IDEMPIERE-5012 org.idempiere.ui.zk.annotation.Form annotation (#954)

change naming convention to follow other annotation based factory
This commit is contained in:
hengsin 2021-10-28 17:16:30 +08:00 committed by GitHub
parent 4e867f161e
commit c4c5fed0fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.adempiere.webui.factory.DefaultScanBasedFormFactory">
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.adempiere.webui.factory.DefaultAnnotationBasedFormFactory">
<property name="service.ranking" type="Integer" value="0"/>
<service>
<provide interface="org.adempiere.webui.factory.IFormFactory"/>
</service>
<implementation class="org.adempiere.webui.factory.DefaultScanBasedFormFactory"/>
<implementation class="org.adempiere.webui.factory.DefaultAnnotationBasedFormFactory"/>
</scr:component>

View File

@ -50,7 +50,7 @@ import io.github.classgraph.ScanResult;
* @author hengsin
*
*/
public abstract class ScanBasedFormFactory implements IFormFactory {
public abstract class AnnotationBasedFormFactory implements IFormFactory {
private final Map<String, String> classCache = new HashMap<>();
@ -58,9 +58,9 @@ public abstract class ScanBasedFormFactory implements IFormFactory {
private BundleContext bundleContext = null;
private static final CLogger s_log = CLogger.getCLogger(ScanBasedFormFactory.class);
private static final CLogger s_log = CLogger.getCLogger(AnnotationBasedFormFactory.class);
public ScanBasedFormFactory() {
public AnnotationBasedFormFactory() {
}
@Override

View File

@ -32,9 +32,9 @@ import org.osgi.service.component.annotations.Component;
*
*/
@Component(immediate = true, service = IFormFactory.class, property = {"service.ranking:Integer=0"})
public final class DefaultScanBasedFormFactory extends ScanBasedFormFactory {
public final class DefaultAnnotationBasedFormFactory extends AnnotationBasedFormFactory {
public DefaultScanBasedFormFactory() {
public DefaultAnnotationBasedFormFactory() {
}
@Override

View File

@ -31,7 +31,7 @@ import java.util.List;
import org.adempiere.base.IServiceReferenceHolder;
import org.adempiere.base.Service;
import org.adempiere.webui.factory.DefaultScanBasedFormFactory;
import org.adempiere.webui.factory.DefaultAnnotationBasedFormFactory;
import org.adempiere.webui.factory.IFormFactory;
import org.compiere.model.MForm;
import org.compiere.model.Query;
@ -51,19 +51,19 @@ public class FormTest extends AbstractTestCase {
@Test
public void testCoreFormMapping() {
DefaultScanBasedFormFactory formFactory = null;
DefaultAnnotationBasedFormFactory formFactory = null;
List<IServiceReferenceHolder<IFormFactory>> factories = Service.locator().list(IFormFactory.class).getServiceReferences();
if (factories != null) {
for(IServiceReferenceHolder<IFormFactory> factory : factories) {
IFormFactory service = factory.getService();
if (service != null && service instanceof DefaultScanBasedFormFactory) {
formFactory = (DefaultScanBasedFormFactory) service;
if (service != null && service instanceof DefaultAnnotationBasedFormFactory) {
formFactory = (DefaultAnnotationBasedFormFactory) service;
break;
}
}
}
assertNotNull(formFactory, "Failed to locate DefaultScanBasedFormFactory");
assertNotNull(formFactory, "Failed to locate DefaultAnnotationBasedFormFactory");
Query query = new Query(Env.getCtx(), MForm.Table_Name, "AD_Form_ID < 1000000 AND ClassName IS NOT NULL "
+ " AND EXISTS (select 1 from ad_menu where isactive='Y' and ad_form_id=ad_form.ad_form_id)", getTrxName());