DEPRECATION: framework: GenericValue.getRelated/getRelatedCache variants replaced with a single getRelated variant that takes a boolean useCache parameter.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343509 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adam Heath
2012-05-29 04:17:17 +00:00
parent 21c0cef59e
commit 83d37a796b
11 changed files with 15 additions and 27 deletions
@@ -62,7 +62,7 @@ public class GeoWorker {
List<GenericValue> geoList = FastList.newInstance();
List<GenericValue> thisGeoAssoc = null;
try {
thisGeoAssoc = geo.getRelated("AssocGeoAssoc", UtilMisc.toMap("geoAssocTypeId", "GROUP_MEMBER"), null);
thisGeoAssoc = geo.getRelated("AssocGeoAssoc", UtilMisc.toMap("geoAssocTypeId", "GROUP_MEMBER"), null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get associated Geo GROUP_MEMBER relationship(s)", module);
}
@@ -274,7 +274,7 @@ public class GenericValue extends GenericEntity implements Reusable {
List<GenericValue> col = relatedCache.get(relationName);
if (col == null) {
col = getRelated(relationName);
col = getRelated(relationName, null, null, false);
relatedCache.put(relationName, col);
}
return col;
@@ -86,7 +86,7 @@ public class EntityTypeUtil {
// first get all childrenTypes ...
List<GenericValue> childrenTypes = null;
try {
childrenTypes = typeValue.getRelatedCache("Child" + typeValue.getEntityName());
childrenTypes = typeValue.getRelated("Child" + typeValue.getEntityName(), null, null, true);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
return null;
@@ -344,7 +344,7 @@ public class EntityUtil {
List<GenericValue> result = FastList.newInstance();
for (GenericValue value: values) {
result.addAll(value.getRelated(relationName));
result.addAll(value.getRelated(relationName, null, null, false));
}
return result;
}
@@ -354,7 +354,7 @@ public class EntityUtil {
List<GenericValue> result = FastList.newInstance();
for (GenericValue value: values) {
result.addAll(value.getRelatedCache(relationName));
result.addAll(value.getRelated(relationName, null, null, true));
}
return result;
}
@@ -778,7 +778,7 @@ public class EntityPermissionChecker {
List<GenericValue> purposes = null;
try {
purposes = entity.getRelatedCache(entityName + "Purpose");
purposes = entity.getRelated(entityName + "Purpose", null, null, true);
} catch (GenericEntityException e) {
Debug.logError(e, "No associated purposes found. ", module);
return purposeIds;
@@ -820,7 +820,7 @@ public class EntityPermissionChecker {
String partyId = (String)userLogin.get("partyId");
List<GenericValue> relatedRoles = null;
List<GenericValue> tmpRelatedRoles = entity.getRelatedCache(entityName + "Role");
List<GenericValue> tmpRelatedRoles = entity.getRelated(entityName + "Role", null, null, true);
relatedRoles = EntityUtil.filterByDate(tmpRelatedRoles);
if (relatedRoles != null) {
for (GenericValue contentRole: relatedRoles) {
@@ -847,9 +847,9 @@ public class EntitySyncContext {
/** prepare a list of all entities we want to synchronize: remove all view-entities and all entities that don't match the patterns attached to this EntitySync */
protected List<ModelEntity> makeEntityModelToUseList() throws GenericEntityException {
List<GenericValue> entitySyncIncludes = entitySync.getRelated("EntitySyncInclude");
List<GenericValue> entitySyncIncludes = entitySync.getRelated("EntitySyncInclude", null, null, false);
// get these ones as well, and just add them to the main list, it will have an extra field but that shouldn't hurt anything in the code below
List<GenericValue> entitySyncGroupIncludes = entitySync.getRelated("EntitySyncInclGrpDetailView");
List<GenericValue> entitySyncGroupIncludes = entitySync.getRelated("EntitySyncInclGrpDetailView", null, null, false);
entitySyncIncludes.addAll(entitySyncGroupIncludes);
List<ModelEntity> entityModelToUseList = EntityGroupUtil.getModelEntitiesFromRecords(entitySyncIncludes, delegator, true);
@@ -75,11 +75,7 @@ public class GetRelated extends MethodOperation {
return true;
}
try {
if (useCache) {
listAcsr.put(methodContext, value.getRelatedCache(relationName, constraintMap, orderByNames));
} else {
listAcsr.put(methodContext, value.getRelated(relationName, constraintMap, orderByNames));
}
listAcsr.put(methodContext, value.getRelated(relationName, constraintMap, orderByNames, useCache));
} catch (GenericEntityException e) {
String errMsg = "ERROR: Could not complete the " + simpleMethod.getShortDescription() + " process [problem getting related from entity with name " + value.getEntityName() + " for the relation-name: " + relationName + ": " + e.getMessage() + "]";
Debug.logError(e, errMsg, module);
@@ -76,7 +76,7 @@ public class RecurrenceInfo {
// Get the recurrence rules objects
try {
rRulesList = new ArrayList<RecurrenceRule>();
for (GenericValue value: info.getRelated("RecurrenceRule")) {
for (GenericValue value: info.getRelated("RecurrenceRule", null, null, false)) {
rRulesList.add(new RecurrenceRule(value));
}
} catch (GenericEntityException gee) {
@@ -88,7 +88,7 @@ public class RecurrenceInfo {
// Get the exception rules objects
try {
eRulesList = new ArrayList<RecurrenceRule>();
for (GenericValue value: info.getRelated("ExceptionRecurrenceRule")) {
for (GenericValue value: info.getRelated("ExceptionRecurrenceRule", null, null, false)) {
eRulesList.add(new RecurrenceRule(value));
}
} catch (GenericEntityException gee) {
@@ -325,7 +325,7 @@ for (int relIndex = 0; relIndex < entity.getRelationsSize(); relIndex++) {
if ("one".equals(relation.getType()) || "one-nofk".equals(relation.getType())) {
if (value != null) {
if (hasAllView || security.hasEntityPermission(relatedEntity.getPlainTableName(), "_VIEW", session)) {
Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName()));
Iterator tempIter = UtilMisc.toIterator(value.getRelated(relation.getTitle() + relatedEntity.getEntityName(), null, null, false));
GenericValue valueRelated = null;
if (tempIter != null && tempIter.hasNext()) {
valueRelated = (GenericValue) tempIter.next();
@@ -658,11 +658,7 @@ public abstract class ModelWidgetAction implements Serializable {
constraintMap = mapAcsr.get(context);
}
try {
if (useCache) {
listNameAcsr.put(context, value.getRelatedCache(relationName, constraintMap, orderByNames));
} else {
listNameAcsr.put(context, value.getRelated(relationName, constraintMap, orderByNames));
}
listNameAcsr.put(context, value.getRelated(relationName, constraintMap, orderByNames, useCache));
} catch (GenericEntityException e) {
String errMsg = "Problem getting related from entity with name " + value.getEntityName() + " for the relation-name: " + relationName + ": " + e.getMessage();
Debug.logError(e, errMsg, module);
@@ -657,11 +657,7 @@ public abstract class ModelScreenAction implements Serializable {
constraintMap = mapAcsr.get(context);
}
try {
if (useCache) {
listNameAcsr.put(context, value.getRelatedCache(relationName, constraintMap, orderByNames));
} else {
listNameAcsr.put(context, value.getRelated(relationName, constraintMap, orderByNames));
}
listNameAcsr.put(context, value.getRelated(relationName, constraintMap, orderByNames, useCache));
} catch (GenericEntityException e) {
String errMsg = "Problem getting related from entity with name " + value.getEntityName() + " for the relation-name: " + relationName + ": " + e.getMessage();
Debug.logError(e, errMsg, module);