You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2018/12/09 13:04:23 UTC
svn commit: r1848514 - in /ofbiz/ofbiz-framework/trunk:
applications/content/src/main/java/org/apache/ofbiz/content/cms/
applications/order/src/main/java/org/apache/ofbiz/order/order/
framework/catalina/src/main/java/org/apache/ofbiz/catalina/container...
Author: jleroux
Date: Sun Dec 9 13:04:23 2018
New Revision: 1848514
URL: http://svn.apache.org/viewvc?rev=1848514&view=rev
Log:
Improved: Replace Callable objects with lambda expressions
(OFBIZ-10488)
Since Java 8 it is possible to instantiate functional interfaces
(interfaces with one non-static method) with lambda expressions instead
of anonymous classes.
This replaces the creation of callable objects with lambda expressions.
Thanks: Mathieu Lirzin
Modified:
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java
ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/DispatchContext.java
ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java
ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java Sun Dec 9 13:04:23 2018
@@ -101,25 +101,25 @@ public class ContentJsonEvents {
final Timestamp fromDate = Timestamp.valueOf(request.getParameter("fromDate"));
final Timestamp now = UtilDateTime.nowTimestamp();
- GenericValue assoc = TransactionUtil.inTransaction(new Callable<GenericValue>() {
- @Override
- public GenericValue call() throws Exception {
- GenericValue oldAssoc = EntityQuery.use(delegator).from("ContentAssoc").where("contentIdTo", contentIdTo, "contentId", contentIdFrom, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate).queryOne();
- if (oldAssoc == null) {
- throw new GenericEntityNotFoundException("Could not find ContentAssoc by primary key [contentIdTo: $contentIdTo, contentId: $contentIdFrom, contentAssocTypeId: $contentAssocTypeId, fromDate: $fromDate]");
- }
- GenericValue newAssoc = (GenericValue) oldAssoc.clone();
+ GenericValue assoc = TransactionUtil.inTransaction(() -> {
+ GenericValue oldAssoc = EntityQuery.use(delegator).from("ContentAssoc")
+ .where("contentIdTo", contentIdTo, "contentId", contentIdFrom, "contentAssocTypeId",
+ contentAssocTypeId, "fromDate", fromDate)
+ .queryOne();
+ if (oldAssoc == null) {
+ throw new GenericEntityNotFoundException("Could not find ContentAssoc by primary key [contentIdTo: $contentIdTo, contentId: $contentIdFrom, contentAssocTypeId: $contentAssocTypeId, fromDate: $fromDate]");
+ }
+ GenericValue newAssoc = (GenericValue) oldAssoc.clone();
- oldAssoc.set("thruDate", now);
- oldAssoc.store();
+ oldAssoc.set("thruDate", now);
+ oldAssoc.store();
- newAssoc.set("contentId", contentIdFromNew);
- newAssoc.set("fromDate", now);
- newAssoc.set("thruDate", null);
- delegator.clearCacheLine(delegator.create(newAssoc));
+ newAssoc.set("contentId", contentIdFromNew);
+ newAssoc.set("fromDate", now);
+ newAssoc.set("thruDate", null);
+ delegator.clearCacheLine(delegator.create(newAssoc));
- return newAssoc;
- }
+ return newAssoc;
}, String.format("move content [%s] from [%s] to [%s]", contentIdTo, contentIdFrom, contentIdFromNew), 0, true).call();
IOUtils.write(JSON.from(getTreeNode(assoc)).toString(), response.getOutputStream());
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Sun Dec 9 13:04:23 2018
@@ -6253,25 +6253,22 @@ public class OrderServices {
final EntityCondition cond = EntityCondition.makeCondition(orderCondList);
List<String> orderIds;
try {
- orderIds = TransactionUtil.doNewTransaction(new Callable<List<String>>() {
- @Override
- public List<String> call() throws Exception {
- List<String> orderIds = new LinkedList<>();
+ orderIds = TransactionUtil.doNewTransaction(() -> {
+ List<String> oids = new LinkedList<>();
- EntityQuery eq = EntityQuery.use(delegator)
- .select("orderId")
- .from("OrderHeader")
- .where(cond)
- .orderBy("entryDate ASC");
+ EntityQuery eq = EntityQuery.use(delegator)
+ .select("orderId")
+ .from("OrderHeader")
+ .where(cond)
+ .orderBy("entryDate ASC");
- try (EntityListIterator eli = eq.queryIterator()) {
- GenericValue orderHeader;
- while ((orderHeader = eli.next()) != null) {
- orderIds.add(orderHeader.getString("orderId"));
- }
+ try (EntityListIterator eli = eq.queryIterator()) {
+ GenericValue orderHeader;
+ while ((orderHeader = eli.next()) != null) {
+ oids.add(orderHeader.getString("orderId"));
}
- return orderIds;
}
+ return oids;
}, "getSalesOrderIds", 0, true);
} catch (GenericEntityException e) {
Debug.logError(e, module);
Modified: ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java Sun Dec 9 13:04:23 2018
@@ -482,12 +482,10 @@ public class CatalinaContainer implement
Debug.logInfo("Creating context [" + appInfo.name + "]", module);
Host host = prepareHost(tomcat, appInfo.getVirtualHosts());
- return new Callable<Context>() {
- public Context call() throws ContainerException, LifecycleException {
- StandardContext context = prepareContext(host, configuration, appInfo, clusterProp);
- host.addChild(context);
- return context;
- }
+ return () -> {
+ StandardContext context = prepareContext(host, configuration, appInfo, clusterProp);
+ host.addChild(context);
+ return context;
};
}
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericDelegator.java Sun Dec 9 13:04:23 2018
@@ -281,12 +281,9 @@ public class GenericDelegator implements
}
protected Callable<Void> createHelperCallable(final String groupName) {
- return new Callable<Void>() {
- @Override
- public Void call() {
- initializeOneGenericHelper(groupName);
- return null;
- }
+ return () -> {
+ initializeOneGenericHelper(groupName);
+ return null;
};
}
@@ -312,11 +309,7 @@ public class GenericDelegator implements
return;
}
- Callable<EntityEcaHandler<?>> creator = new Callable<EntityEcaHandler<?>>() {
- public EntityEcaHandler<?> call() {
- return createEntityEcaHandler();
- }
- };
+ Callable<EntityEcaHandler<?>> creator = () -> createEntityEcaHandler();
FutureTask<EntityEcaHandler<?>> futureTask = new FutureTask<>(creator);
if (this.entityEcaHandler.compareAndSet(null, futureTask)) {
// This needs to use BATCH, as the service engine might add it's own items into a thread pool.
@@ -2617,11 +2610,7 @@ public class GenericDelegator implements
return;
}
- Callable<DistributedCacheClear> creator = new Callable<DistributedCacheClear>() {
- public DistributedCacheClear call() {
- return createDistributedCacheClear();
- }
- };
+ Callable<DistributedCacheClear> creator = () -> createDistributedCacheClear();
FutureTask<DistributedCacheClear> futureTask = new FutureTask<>(creator);
if (distributedCacheClear.compareAndSet(null, futureTask)) {
ExecutionPool.GLOBAL_BATCH.submit(futureTask);
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/test/EntityTestSuite.java Sun Dec 9 13:04:23 2018
@@ -1198,26 +1198,22 @@ public class EntityTestSuite extends Ent
final AtomicBoolean nullSeqIdReturned = new AtomicBoolean(false);
List<Future<Void>> futures = new ArrayList<>();
- Callable<Void> getSeqIdTask = new Callable<Void>() {
- public Void call() throws Exception {
- Long seqId = sequencer.getNextSeqId(sequenceName, 1, null);
- if (seqId == null) {
- nullSeqIdReturned.set(true);
- return null;
- }
- Long existingValue = seqIds.putIfAbsent(seqId, seqId);
- if (existingValue != null) {
- duplicateFound.set(true);
- }
- return null;
- }
- };
- Callable<Void> refreshTask = new Callable<Void>() {
- public Void call() throws Exception {
- sequencer.forceBankRefresh(sequenceName, 1);
- return null;
- }
- };
+ Callable<Void> getSeqIdTask = () -> {
+ Long seqId = sequencer.getNextSeqId(sequenceName, 1, null);
+ if (seqId == null) {
+ nullSeqIdReturned.set(true);
+ return null;
+ }
+ Long existingValue = seqIds.putIfAbsent(seqId, seqId);
+ if (existingValue != null) {
+ duplicateFound.set(true);
+ }
+ return null;
+ };
+ Callable<Void> refreshTask = () -> {
+ sequencer.forceBankRefresh(sequenceName, 1);
+ return null;
+ };
double probabilityOfRefresh = 0.1;
for (int i = 1; i <= 1000; i++) {
Callable<Void> randomTask = Math.random() < probabilityOfRefresh ? refreshTask : getSeqIdTask;
Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java Sun Dec 9 13:04:23 2018
@@ -206,11 +206,9 @@ public final class EntityCrypto {
newValue.set("keyName", hashedKeyName);
try {
- TransactionUtil.doNewTransaction(new Callable<Void>() {
- public Void call() throws Exception {
- delegator.create(newValue);
- return null;
- }
+ TransactionUtil.doNewTransaction(() -> {
+ delegator.create(newValue);
+ return null;
}, "storing encrypted key", 0, true);
} catch (GenericEntityException e) {
throw new EntityCryptoException(e);
Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java Sun Dec 9 13:04:23 2018
@@ -57,10 +57,8 @@ public class DelegatorEcaHandler impleme
this.delegatorName = delegator.getDelegatorName();
this.entityEcaReaderName = EntityEcaUtil.getEntityEcaReaderName(delegator.getDelegatorBaseName());
- Callable<DispatchContext> creator = new Callable<DispatchContext>() {
- public DispatchContext call() {
- return EntityServiceFactory.getDispatchContext(DelegatorEcaHandler.this.delegator);
- }
+ Callable<DispatchContext> creator = () -> {
+ return EntityServiceFactory.getDispatchContext(DelegatorEcaHandler.this.delegator);
};
FutureTask<DispatchContext> futureTask = new FutureTask<DispatchContext>(creator);
if (this.dctx.compareAndSet(null, futureTask)) {
Modified: ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java Sun Dec 9 13:04:23 2018
@@ -152,11 +152,7 @@ public final class EntityEcaUtil {
}
private static Callable<List<EntityEcaRule>> createEcaLoaderCallable(final ResourceHandler handler) {
- return new Callable<List<EntityEcaRule>>() {
- public List<EntityEcaRule> call() throws Exception {
- return getEcaDefinitions(handler);
- }
- };
+ return () -> getEcaDefinitions(handler);
}
public static Collection<EntityEcaRule> getEntityEcaRules(Delegator delegator, String entityName, String event) {
Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/DispatchContext.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/DispatchContext.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/DispatchContext.java Sun Dec 9 13:04:23 2018
@@ -231,11 +231,7 @@ public class DispatchContext implements
}
private Callable<Map<String, ModelService>> createServiceReaderCallable(final ResourceHandler handler) {
- return new Callable<Map<String, ModelService>>() {
- public Map<String, ModelService> call() throws Exception {
- return ModelServiceReader.getModelServiceMap(handler, DispatchContext.this.getDelegator());
- }
- };
+ return () -> ModelServiceReader.getModelServiceMap(handler, DispatchContext.this.getDelegator());
}
private Map<String, ModelService> getGlobalServiceMap() {
Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java Sun Dec 9 13:04:23 2018
@@ -91,11 +91,7 @@ public final class ServiceEcaUtil {
}
private static Callable<List<ServiceEcaRule>> createEcaLoaderCallable(final ResourceHandler handler) {
- return new Callable<List<ServiceEcaRule>>() {
- public List<ServiceEcaRule> call() throws Exception {
- return getEcaDefinitions(handler);
- }
- };
+ return () -> getEcaDefinitions(handler);
}
public static void addEcaDefinitions(ResourceHandler handler) {
Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=1848514&r1=1848513&r2=1848514&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Sun Dec 9 13:04:23 2018
@@ -382,103 +382,97 @@ public class ArtifactInfoFactory {
// private methods
private Callable<Void> prepareTaskForServiceAnalysis(final String serviceName) {
- return new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- try {
- getServiceArtifactInfo(serviceName);
- } catch(Exception exc) {
- Debug.logWarning(exc, "Error processing service: " + serviceName, module);
- }
- return null;
+ return () -> {
+ try {
+ getServiceArtifactInfo(serviceName);
+ } catch(Exception exc) {
+ Debug.logWarning(exc, "Error processing service: " + serviceName, module);
}
+ return null;
};
}
private Callable<Void> prepareTaskForComponentAnalysis(final ComponentConfig componentConfig) {
- return new Callable<Void>() {
- @Override
- public Void call() throws Exception {
- String componentName = componentConfig.getGlobalName();
- String rootComponentPath = componentConfig.getRootLocation();
- List<File> screenFiles = new ArrayList<File>();
- List<File> formFiles = new ArrayList<File>();
- List<File> controllerFiles = new ArrayList<File>();
+ return () -> {
+ String componentName = componentConfig.getGlobalName();
+ String rootComponentPath = componentConfig.getRootLocation();
+ List<File> screenFiles = new ArrayList<File>();
+ List<File> formFiles = new ArrayList<File>();
+ List<File> controllerFiles = new ArrayList<File>();
+ try {
+ screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd");
+ } catch (IOException ioe) {
+ Debug.logWarning(ioe.getMessage(), module);
+ }
+ try {
+ formFiles = FileUtil.findXmlFiles(rootComponentPath, null, "forms", "widget-form.xsd");
+ } catch (IOException ioe) {
+ Debug.logWarning(ioe.getMessage(), module);
+ }
+ try {
+ controllerFiles = FileUtil.findXmlFiles(rootComponentPath, null, "site-conf", "site-conf.xsd");
+ } catch (IOException ioe) {
+ Debug.logWarning(ioe.getMessage(), module);
+ }
+ for (File screenFile: screenFiles) {
+ String screenFilePath = screenFile.getAbsolutePath();
+ screenFilePath = screenFilePath.replace('\\', '/');
+ String screenFileRelativePath = screenFilePath.substring(rootComponentPath.length());
+ String screenLocation = "component://" + componentName + "/" + screenFileRelativePath;
+ Map<String, ModelScreen> modelScreenMap = null;
try {
- screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd");
- } catch (IOException ioe) {
- Debug.logWarning(ioe.getMessage(), module);
+ modelScreenMap = ScreenFactory.getScreensFromLocation(screenLocation);
+ } catch (Exception exc) {
+ Debug.logWarning(exc.getMessage(), module);
}
- try {
- formFiles = FileUtil.findXmlFiles(rootComponentPath, null, "forms", "widget-form.xsd");
- } catch (IOException ioe) {
- Debug.logWarning(ioe.getMessage(), module);
+ for (String screenName : modelScreenMap.keySet()) {
+ getScreenWidgetArtifactInfo(screenName, screenLocation);
}
+ }
+ for (File formFile: formFiles) {
+ String formFilePath = formFile.getAbsolutePath();
+ formFilePath = formFilePath.replace('\\', '/');
+ String formFileRelativePath = formFilePath.substring(rootComponentPath.length());
+ String formLocation = "component://" + componentName + "/" + formFileRelativePath;
+ Map<String, ModelForm> modelFormMap = null;
try {
- controllerFiles = FileUtil.findXmlFiles(rootComponentPath, null, "site-conf", "site-conf.xsd");
- } catch (IOException ioe) {
- Debug.logWarning(ioe.getMessage(), module);
- }
- for (File screenFile: screenFiles) {
- String screenFilePath = screenFile.getAbsolutePath();
- screenFilePath = screenFilePath.replace('\\', '/');
- String screenFileRelativePath = screenFilePath.substring(rootComponentPath.length());
- String screenLocation = "component://" + componentName + "/" + screenFileRelativePath;
- Map<String, ModelScreen> modelScreenMap = null;
+ modelFormMap = FormFactory.getFormsFromLocation(formLocation, getEntityModelReader(), getDispatchContext());
+ } catch (Exception exc) {
+ Debug.logWarning(exc.getMessage(), module);
+ }
+ for (String formName : modelFormMap.keySet()) {
try {
- modelScreenMap = ScreenFactory.getScreensFromLocation(screenLocation);
- } catch (Exception exc) {
- Debug.logWarning(exc.getMessage(), module);
- }
- for (String screenName : modelScreenMap.keySet()) {
- getScreenWidgetArtifactInfo(screenName, screenLocation);
+ getFormWidgetArtifactInfo(formName, formLocation);
+ } catch (GeneralException ge) {
+ Debug.logWarning(ge.getMessage(), module);
}
}
- for (File formFile: formFiles) {
- String formFilePath = formFile.getAbsolutePath();
- formFilePath = formFilePath.replace('\\', '/');
- String formFileRelativePath = formFilePath.substring(rootComponentPath.length());
- String formLocation = "component://" + componentName + "/" + formFileRelativePath;
- Map<String, ModelForm> modelFormMap = null;
+ }
+ for (File controllerFile: controllerFiles) {
+ URL controllerUrl = null;
+ try {
+ controllerUrl = controllerFile.toURI().toURL();
+ } catch (MalformedURLException mue) {
+ Debug.logWarning(mue.getMessage(), module);
+ }
+ if (controllerUrl == null) continue;
+ ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
+ for (String requestUri: cc.getRequestMapMap().keySet()) {
try {
- modelFormMap = FormFactory.getFormsFromLocation(formLocation, getEntityModelReader(), getDispatchContext());
- } catch (Exception exc) {
- Debug.logWarning(exc.getMessage(), module);
- }
- for (String formName : modelFormMap.keySet()) {
- try {
- getFormWidgetArtifactInfo(formName, formLocation);
- } catch (GeneralException ge) {
- Debug.logWarning(ge.getMessage(), module);
- }
+ getControllerRequestArtifactInfo(controllerUrl, requestUri);
+ } catch (GeneralException e) {
+ Debug.logWarning(e.getMessage(), module);
}
}
- for (File controllerFile: controllerFiles) {
- URL controllerUrl = null;
+ for (String viewUri: cc.getViewMapMap().keySet()) {
try {
- controllerUrl = controllerFile.toURI().toURL();
- } catch (MalformedURLException mue) {
- Debug.logWarning(mue.getMessage(), module);
- }
- if (controllerUrl == null) continue;
- ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
- for (String requestUri: cc.getRequestMapMap().keySet()) {
- try {
- getControllerRequestArtifactInfo(controllerUrl, requestUri);
- } catch (GeneralException e) {
- Debug.logWarning(e.getMessage(), module);
- }
- }
- for (String viewUri: cc.getViewMapMap().keySet()) {
- try {
- getControllerViewArtifactInfo(controllerUrl, viewUri);
- } catch (GeneralException e) {
- Debug.logWarning(e.getMessage(), module);
- }
+ getControllerViewArtifactInfo(controllerUrl, viewUri);
+ } catch (GeneralException e) {
+ Debug.logWarning(e.getMessage(), module);
}
}
- return null;
}
+ return null;
};
}