Fixed a couple of things, fleshed out a little more data gathering for artifact info
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@633364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -60,36 +60,42 @@ public class ArtifactInfoFactory {
|
||||
|
||||
public Map<String, EntityArtifactInfo> allEntityInfos = FastMap.newInstance();
|
||||
public Map<String, ServiceArtifactInfo> allServiceInfos = FastMap.newInstance();
|
||||
public Map<ServiceEcaRule, ServiceEcaArtifactInfo> allServiceEcaInfos = FastMap.newInstance();
|
||||
public Map<String, FormWidgetArtifactInfo> allFormInfos = FastMap.newInstance();
|
||||
public Map<String, ScreenWidgetArtifactInfo> allScreenInfos = FastMap.newInstance();
|
||||
|
||||
// reverse-associative caches for walking backward in the diagram
|
||||
public Map<String, Set<ServiceEcaArtifactInfo>> allServiceEcaInfosReferringToServiceName = FastMap.newInstance();
|
||||
public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceName = FastMap.newInstance();
|
||||
public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToEntityName = FastMap.newInstance();
|
||||
public Map<String, Set<ServiceArtifactInfo>> allFormInfosReferringToServiceName = FastMap.newInstance();
|
||||
public Map<String, Set<ServiceArtifactInfo>> allFormInfosReferringToEntityName = FastMap.newInstance();
|
||||
public Map<String, Set<ServiceArtifactInfo>> allScreenInfosReferringToServiceName = FastMap.newInstance();
|
||||
public Map<String, Set<ServiceArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance();
|
||||
public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToServiceName = FastMap.newInstance();
|
||||
public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToServiceName = FastMap.newInstance();
|
||||
|
||||
public static ArtifactInfoFactory makeArtifactInfoFactory(String delegatorName) throws GenericEntityException {
|
||||
public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToEntityName = FastMap.newInstance();
|
||||
public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToEntityName = FastMap.newInstance();
|
||||
public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance();
|
||||
|
||||
public Map<ServiceEcaRule, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceEcaRule = FastMap.newInstance();
|
||||
|
||||
public static ArtifactInfoFactory makeArtifactInfoFactory(String delegatorName) throws GeneralException {
|
||||
if (UtilValidate.isEmpty(delegatorName)) {
|
||||
delegatorName = "default";
|
||||
}
|
||||
|
||||
ArtifactInfoFactory aic = artifactInfoFactoryCache.get(delegatorName);
|
||||
if (aic == null) {
|
||||
aic = new ArtifactInfoFactory(delegatorName);
|
||||
ArtifactInfoFactory aif = artifactInfoFactoryCache.get(delegatorName);
|
||||
if (aif == null) {
|
||||
aif = new ArtifactInfoFactory(delegatorName);
|
||||
}
|
||||
return aic;
|
||||
return aif;
|
||||
}
|
||||
|
||||
protected ArtifactInfoFactory(String delegatorName) throws GenericEntityException {
|
||||
protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
|
||||
this.delegatorName = delegatorName;
|
||||
this.entityModelReader = ModelReader.getModelReader(delegatorName);
|
||||
this.dispatchContext = new DispatchContext("ArtifactInfoDispCtx", null, this.getClass().getClassLoader(), null);
|
||||
this.entityEcaCache = EntityEcaUtil.getEntityEcaCache(EntityEcaUtil.getEntityEcaReaderName(delegatorName));
|
||||
this.serviceEcaCache = ServiceEcaUtil.ecaCache;
|
||||
|
||||
this.prepareAll();
|
||||
}
|
||||
|
||||
public void prepareAll() throws GeneralException {
|
||||
@@ -103,7 +109,7 @@ public class ArtifactInfoFactory {
|
||||
this.getServiceArtifactInfo(serviceName);
|
||||
}
|
||||
|
||||
// TODO: how to get all Service ECAs to prepare?
|
||||
// how to get all Service ECAs to prepare? don't worry about it, will be populated from service load, ie all ECAs for each service
|
||||
|
||||
// TODO: how to get all forms to prepare?
|
||||
|
||||
@@ -152,6 +158,15 @@ public class ArtifactInfoFactory {
|
||||
return curInfo;
|
||||
}
|
||||
|
||||
public ServiceEcaArtifactInfo getServiceEcaArtifactInfo(ServiceEcaRule ecaRule) throws GeneralException {
|
||||
ServiceEcaArtifactInfo curInfo = this.allServiceEcaInfos.get(ecaRule);
|
||||
if (curInfo == null) {
|
||||
curInfo = new ServiceEcaArtifactInfo(ecaRule, this);
|
||||
this.allServiceEcaInfos.put(ecaRule, curInfo);
|
||||
}
|
||||
return curInfo;
|
||||
}
|
||||
|
||||
public FormWidgetArtifactInfo getFormWidgetArtifactInfo(String formName, String formLocation) throws GeneralException, IOException, SAXException, ParserConfigurationException {
|
||||
FormWidgetArtifactInfo curInfo = this.allFormInfos.get(formName + formLocation);
|
||||
if (curInfo == null) {
|
||||
|
||||
@@ -32,9 +32,10 @@ import org.ofbiz.base.util.GeneralException;
|
||||
import org.ofbiz.base.util.UtilFormatOut;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.minilang.SimpleMethod;
|
||||
import org.ofbiz.service.GenericServiceException;
|
||||
import org.ofbiz.service.ModelParam;
|
||||
import org.ofbiz.service.ModelService;
|
||||
import org.ofbiz.service.eca.ServiceEcaRule;
|
||||
import org.ofbiz.service.eca.ServiceEcaUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -96,9 +97,16 @@ public class ServiceArtifactInfo {
|
||||
}
|
||||
}
|
||||
|
||||
protected void populateTriggeredServiceEcas() {
|
||||
// TODO populate serviceEcasTriggeredByThisService and for each the reverse-associate cache in the aif
|
||||
|
||||
protected void populateTriggeredServiceEcas() throws GeneralException {
|
||||
// populate serviceEcasTriggeredByThisService and for each the reverse-associate cache in the aif
|
||||
Map<String, List<ServiceEcaRule>> serviceEventMap = ServiceEcaUtil.getServiceEventMap(this.modelService.name);
|
||||
for (List<ServiceEcaRule> ecaRuleList: serviceEventMap.values()) {
|
||||
for (ServiceEcaRule ecaRule: ecaRuleList) {
|
||||
this.serviceEcasTriggeredByThisService.add(aif.getServiceEcaArtifactInfo(ecaRule));
|
||||
// the reverse reference
|
||||
UtilMisc.addToSetInMap(this, aif.allServiceInfosReferringToServiceEcaRule, ecaRule);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ModelService getModelService() {
|
||||
|
||||
Reference in New Issue
Block a user