Author: mrisaliti
Date: Fri Jan 21 21:12:47 2011 New Revision: 1062032 URL: http://svn.apache.org/viewvc?rev=1062032&view=rev Log: Remove java compilation warnings of some old methods of content components (OFBIZ-4102) Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java?rev=1062032&r1=1062031&r2=1062032&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentPermissionServices.java Fri Jan 21 21:12:47 2011 @@ -27,6 +27,7 @@ import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; @@ -36,10 +37,10 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; -import org.ofbiz.service.ModelService; -import org.ofbiz.service.ServiceUtil; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.service.ModelService; +import org.ofbiz.service.ServiceUtil; /** @@ -96,8 +97,10 @@ public class ContentPermissionServices { Security security = dctx.getSecurity(); Delegator delegator = dctx.getDelegator(); - String statusId = (String) context.get("statusId"); - String privilegeEnumId = (String) context.get("privilegeEnumId"); + //TODO this parameters is still not used but this service need to be replaced by genericContentPermission + // String statusId = (String) context.get("statusId"); + //TODO this parameters is still not used but this service need to be replaced by genericContentPermission + // String privilegeEnumId = (String) context.get("privilegeEnumId"); GenericValue content = (GenericValue) context.get("currentContent"); Boolean bDisplayFailCond = (Boolean)context.get("displayFailCond"); boolean displayFailCond = false; @@ -110,11 +113,8 @@ public class ContentPermissionServices { if (bDisplayPassCond != null && bDisplayPassCond.booleanValue()) { displayPassCond = true; } - Debug.logInfo("displayPassCond(0):" + displayPassCond, ""); - Map results = FastMap.newInstance(); - String contentId = null; - if (content != null) - contentId = content.getString("contentId"); + Debug.logInfo("displayPassCond(0):" + displayPassCond, ""); + Map<String, Object> results = FastMap.newInstance(); GenericValue userLogin = (GenericValue) context.get("userLogin"); String partyId = (String) context.get("partyId"); if (UtilValidate.isEmpty(partyId)) { @@ -140,11 +140,11 @@ public class ContentPermissionServices { // I realized, belatedly, that I wanted to be able to pass parameters in as // strings so this service could be used in an action event directly, // so I had to write this code to handle both list and strings - List passedPurposes = (List) context.get("contentPurposeList"); + List<String> passedPurposes = UtilGenerics.checkList(context.get("contentPurposeList")); String contentPurposeString = (String) context.get("contentPurposeString"); //Debug.logInfo("contentPurposeString(b):" + contentPurposeString, ""); if (UtilValidate.isNotEmpty(contentPurposeString)) { - List purposesFromString = StringUtil.split(contentPurposeString, "|"); + List<String> purposesFromString = StringUtil.split(contentPurposeString, "|"); if (passedPurposes == null) { passedPurposes = FastList.newInstance(); } @@ -156,12 +156,12 @@ public class ContentPermissionServices { // there needs to be a method for setting a purpose list auxGetter.setList(passedPurposes); //Debug.logInfo("passedPurposes(b):" + passedPurposes, ""); - List targetOperations = (List) context.get("targetOperationList"); + List<String> targetOperations = UtilGenerics.checkList(context.get("targetOperationList")); //Debug.logInfo("targetOperations(b):" + targetOperations, ""); String targetOperationString = (String) context.get("targetOperationString"); //Debug.logInfo("targetOperationString(b):" + targetOperationString, ""); if (UtilValidate.isNotEmpty(targetOperationString)) { - List operationsFromString = StringUtil.split(targetOperationString, "|"); + List<String> operationsFromString = StringUtil.split(targetOperationString, "|"); if (targetOperations == null) { targetOperations = FastList.newInstance(); } @@ -173,11 +173,11 @@ public class ContentPermissionServices { EntityPermissionChecker.StdRelatedRoleGetter roleGetter = new EntityPermissionChecker.StdRelatedRoleGetter("Content", "roleTypeId", "contentId", "partyId", "ownerContentId", "ContentRole"); //Debug.logInfo("targetOperations(b):" + targetOperations, ""); - List passedRoles = (List) context.get("roleTypeList"); + List<String> passedRoles = UtilGenerics.checkList(context.get("roleTypeList")); if (passedRoles == null) passedRoles = FastList.newInstance(); String roleTypeString = (String) context.get("roleTypeString"); if (UtilValidate.isNotEmpty(roleTypeString)) { - List rolesFromString = StringUtil.split(roleTypeString, "|"); + List<String> rolesFromString = StringUtil.split(roleTypeString, "|"); passedRoles.addAll(rolesFromString); } roleGetter.setList(passedRoles); @@ -190,7 +190,7 @@ public class ContentPermissionServices { StringBuilder errBuf = new StringBuilder(); String permissionStatus = null; - List entityIds = FastList.newInstance(); + List<Object> entityIds = FastList.newInstance(); if (passed) { results.put("permissionStatus", "granted"); permissionStatus = "granted"; @@ -207,7 +207,7 @@ public class ContentPermissionServices { entityIds.add(content); String quickCheckContentId = (String) context.get("quickCheckContentId"); if (UtilValidate.isNotEmpty(quickCheckContentId)) { - List quickList = StringUtil.split(quickCheckContentId, "|"); + List<String> quickList = StringUtil.split(quickCheckContentId, "|"); if (UtilValidate.isNotEmpty(quickList)) entityIds.addAll(quickList); } try { @@ -259,9 +259,10 @@ public class ContentPermissionServices { return results; } + @SuppressWarnings("null") public static Map<String, Object> checkAssocPermission(DispatchContext dctx, Map<String, ? extends Object> context) { - Map results = FastMap.newInstance(); - Security security = dctx.getSecurity(); + Map<String, Object> results = FastMap.newInstance(); + // Security security = dctx.getSecurity(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Boolean bDisplayFailCond = (Boolean)context.get("displayFailCond"); @@ -271,7 +272,6 @@ public class ContentPermissionServices { String entityAction = (String) context.get("entityOperation"); Locale locale = (Locale) context.get("locale"); if (entityAction == null) entityAction = "_ADMIN"; - List roleIds = null; String permissionStatus = null; GenericValue contentTo = null; @@ -288,20 +288,18 @@ public class ContentPermissionServices { "ContentContentToOrFromIsNull", UtilMisc.toMap("contentTo", contentTo, "contentFrom", contentFrom), locale)); } - Map resultsMap = null; - boolean isMatch = false; - - boolean isMatchTo = false; - boolean isMatchFrom = false; - Map permResults = FastMap.newInstance(); + // boolean isMatch = false; + // boolean isMatchTo = false; + // boolean isMatchFrom = false; + Map<String, Object> permResults = FastMap.newInstance(); String skipPermissionCheck = null; if (UtilValidate.isEmpty(skipPermissionCheck) || (!skipPermissionCheck.equalsIgnoreCase("true") && !skipPermissionCheck.equalsIgnoreCase("granted"))) { // Use the purposes from the from entity for both cases. - List relatedPurposes = EntityPermissionChecker.getRelatedPurposes(contentFrom, null); - List relatedPurposesTo = EntityPermissionChecker.getRelatedPurposes(contentTo, relatedPurposes); - Map serviceInMap = FastMap.newInstance(); + List<String> relatedPurposes = EntityPermissionChecker.getRelatedPurposes(contentFrom, null); + List<String> relatedPurposesTo = EntityPermissionChecker.getRelatedPurposes(contentTo, relatedPurposes); + Map<String, Object> serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", userLogin); serviceInMap.put("targetOperationList", UtilMisc.toList("CONTENT_LINK_TO")); serviceInMap.put("contentPurposeList", relatedPurposesTo); @@ -316,8 +314,8 @@ public class ContentPermissionServices { permissionStatus = (String)permResults.get("permissionStatus"); if (permissionStatus == null || !permissionStatus.equals("granted")) { if (bDisplayFailCond != null && bDisplayFailCond.booleanValue()) { - String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); - results.put(ModelService.ERROR_MESSAGE, errMsg); + String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); + results.put(ModelService.ERROR_MESSAGE, errMsg); } return results; } @@ -334,8 +332,8 @@ public class ContentPermissionServices { results.put("permissionStatus", "granted"); } else { if (bDisplayFailCond != null && bDisplayFailCond.booleanValue()) { - String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); - results.put(ModelService.ERROR_MESSAGE, errMsg); + String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); + results.put(ModelService.ERROR_MESSAGE, errMsg); } } } else { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java?rev=1062032&r1=1062031&r2=1062032&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServices.java Fri Jan 21 21:12:47 2011 @@ -256,10 +256,10 @@ public class ContentServices { public static Map<String, Object> createContentMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); context.put("entityOperation", "_CREATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE"); if (Debug.infoOn()) Debug.logInfo("in createContentMethod, targetOperationList: " + targetOperationList, null); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); @@ -329,14 +329,14 @@ public class ContentServices { public static Map<String, Object> createContentAssoc(DispatchContext dctx, Map<String, ? extends Object> rcontext) { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); context.put("entityOperation", "_CREATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); context.put("skipPermissionCheck", null); - Map result = null; + Map<String, Object> result = null; try { result = createContentAssocMethod(dctx, context); } catch (GenericServiceException e) { @@ -355,15 +355,15 @@ public class ContentServices { */ public static Map<String, Object> createContentAssocMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_CREATE"); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); Locale locale = (Locale) context.get("locale"); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = FastMap.newInstance(); + Map<String, Object> result = FastMap.newInstance(); // This section guesses how contentId should be used (From or To) if // only a contentIdFrom o contentIdTo is passed in @@ -379,8 +379,7 @@ public class ContentServices { contentIdCount++; if (contentIdCount < 2) { Debug.logError("Not 2 out of ContentId/To/From.", "ContentServices"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentCreateContentAssocMethodError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentCreateContentAssocMethodError", locale)); } if (UtilValidate.isNotEmpty(contentIdFrom)) { @@ -468,7 +467,7 @@ public class ContentServices { contentAssoc.put("createdDate", createdDate); contentAssoc.put("lastModifiedDate", lastModifiedDate); - Map serviceInMap = FastMap.newInstance(); + Map<String, Object> serviceInMap = FastMap.newInstance(); String permissionStatus = null; serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); @@ -482,7 +481,7 @@ public class ContentServices { serviceInMap.put("roleTypeList", context.get("roleTypeList")); serviceInMap.put("displayFailCond", context.get("displayFailCond")); - Map permResults = null; + Map<String, Object> permResults = null; permResults = dispatcher.runSync("checkAssocPermission", serviceInMap); permissionStatus = (String) permResults.get("permissionStatus"); @@ -510,14 +509,14 @@ public class ContentServices { public static Map<String, Object> updateContent(DispatchContext dctx, Map<String, ? extends Object> rcontext) { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); context.put("entityOperation", "_UPDATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); context.put("skipPermissionCheck", null); - Map result = updateContentMethod(dctx, context); + Map<String, Object> result = updateContentMethod(dctx, context); return result; } @@ -530,12 +529,12 @@ public class ContentServices { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = FastMap.newInstance(); + Map<String, Object> result = FastMap.newInstance(); context.put("entityOperation", "_UPDATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); @@ -546,12 +545,11 @@ public class ContentServices { content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); } catch (GenericEntityException e) { Debug.logWarning(e, module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentNoContentFound", UtilMisc.toMap("contentId", contentId), locale)); } context.put("currentContent", content); - Map permResults = ContentWorker.callContentPermissionCheckResult(delegator, dispatcher, context); + Map<String, Object> permResults = ContentWorker.callContentPermissionCheckResult(delegator, dispatcher, context); String permissionStatus = (String) permResults.get("permissionStatus"); if (permissionStatus != null && permissionStatus.equalsIgnoreCase("granted")) { GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -561,13 +559,12 @@ public class ContentServices { // update status first to see if allowed if (UtilValidate.isNotEmpty(context.get("statusId"))) { - Map statusInMap = UtilMisc.toMap("contentId", context.get("contentId"), "statusId", context.get("statusId"),"userLogin", userLogin); + Map<String, Object> statusInMap = UtilMisc.<String, Object>toMap("contentId", context.get("contentId"), "statusId", context.get("statusId"), "userLogin", userLogin); try { dispatcher.runSync("setContentStatus", statusInMap); } catch (GenericServiceException e) { Debug.logError(e, "Problem updating content Status", "ContentServices"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentStatusUpdateError", UtilMisc.toMap("errorString", e), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentStatusUpdateError", UtilMisc.toMap("errorString", e), locale)); } } @@ -594,14 +591,14 @@ public class ContentServices { public static Map<String, Object> updateContentAssoc(DispatchContext dctx, Map<String, ? extends Object> rcontext) { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); context.put("entityOperation", "_UPDATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); context.put("skipPermissionCheck", null); - Map result = updateContentAssocMethod(dctx, context); + Map<String, Object> result = updateContentAssocMethod(dctx, context); return result; } @@ -614,12 +611,12 @@ public class ContentServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); - Map result = FastMap.newInstance(); + Map<String, Object> result = FastMap.newInstance(); context.put("entityOperation", "_UPDATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); @@ -636,13 +633,10 @@ public class ContentServices { contentAssoc = delegator.findByPrimaryKey("ContentAssoc", UtilMisc.toMap("contentId", contentId, "contentIdTo", contentIdTo, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate)); } catch (GenericEntityException e) { Debug.logError(e, "Entity Error:" + e.getMessage(), module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentAssocRetrievingError", - UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (contentAssoc == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentAssocUpdateError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocUpdateError", locale)); } contentAssoc.put("contentAssocPredicateId", context.get("contentAssocPredicateId")); @@ -673,7 +667,7 @@ public class ContentServices { contentAssoc.put("lastModifiedDate", lastModifiedDate); String permissionStatus = null; - Map serviceInMap = FastMap.newInstance(); + Map<String, Object> serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); serviceInMap.put("contentPurposeList", contentPurposeList); @@ -681,13 +675,12 @@ public class ContentServices { serviceInMap.put("contentIdTo", contentIdTo); serviceInMap.put("contentIdFrom", contentIdFrom); - Map permResults = null; + Map<String, Object> permResults = null; try { permResults = dispatcher.runSync("checkAssocPermission", serviceInMap); } catch (GenericServiceException e) { Debug.logError(e, "Problem checking permissions", "ContentServices"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentPermissionNotGranted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPermissionNotGranted", locale)); } permissionStatus = (String) permResults.get("permissionStatus"); @@ -712,14 +705,14 @@ public class ContentServices { public static Map<String, Object> deactivateContentAssoc(DispatchContext dctx, Map<String, ? extends Object> rcontext) { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); context.put("entityOperation", "_UPDATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); context.put("skipPermissionCheck", null); - Map result = deactivateContentAssocMethod(dctx, context); + Map<String, Object> result = deactivateContentAssocMethod(dctx, context); return result; } @@ -731,12 +724,12 @@ public class ContentServices { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = FastMap.newInstance(); + Map<String, Object> result = FastMap.newInstance(); Locale locale = (Locale) context.get("locale"); context.put("entityOperation", "_UPDATE"); - List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); + List<String> targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); - List contentPurposeList = ContentWorker.prepContentPurposeList(context); + List<String> contentPurposeList = ContentWorker.prepContentPurposeList(context); context.put("targetOperationList", targetOperationList); context.put("contentPurposeList", contentPurposeList); @@ -755,14 +748,11 @@ public class ContentServices { contentAssoc = delegator.findByPrimaryKey("ContentAssoc", pk); } catch (GenericEntityException e) { Debug.logError(e, "Entity Error:" + e.getMessage(), module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentAssocRetrievingError", - UtilMisc.toMap("errorString", e.getMessage()), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocRetrievingError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } if (contentAssoc == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentAssocDeactivatingError", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocDeactivatingError", locale)); } GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -774,7 +764,7 @@ public class ContentServices { contentAssoc.put("thruDate", UtilDateTime.nowTimestamp()); String permissionStatus = null; - Map serviceInMap = FastMap.newInstance(); + Map<String, Object> serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); serviceInMap.put("contentPurposeList", contentPurposeList); @@ -782,13 +772,12 @@ public class ContentServices { serviceInMap.put("contentIdTo", contentAssoc.get("contentIdTo")); serviceInMap.put("contentIdFrom", contentAssoc.get("contentId")); - Map permResults = null; + Map<String, Object> permResults = null; try { permResults = dispatcher.runSync("checkAssocPermission", serviceInMap); } catch (GenericServiceException e) { Debug.logError(e, "Problem checking permissions", "ContentServices"); - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentPermissionNotGranted", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPermissionNotGranted", locale)); } permissionStatus = (String) permResults.get("permissionStatus"); @@ -820,22 +809,19 @@ public class ContentServices { Locale locale = (Locale) context.get("locale"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); String sequenceNum = null; - Map results = FastMap.newInstance(); + Map<String, Object> results = FastMap.newInstance(); try { GenericValue activeAssoc = null; if (fromDate != null) { activeAssoc = delegator.findByPrimaryKey("ContentAssoc", UtilMisc.toMap("contentId", activeContentId, "contentIdTo", contentIdTo, "fromDate", fromDate, "contentAssocTypeId", contentAssocTypeId)); if (activeAssoc == null) { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "ContentAssocNotFound", - UtilMisc.toMap("activeContentId", activeContentId, "contentIdTo", contentIdTo, - "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentAssocNotFound", UtilMisc.toMap("activeContentId", activeContentId, "contentIdTo", contentIdTo, "contentAssocTypeId", contentAssocTypeId, "fromDate", fromDate), locale)); } sequenceNum = (String) activeAssoc.get("sequenceNum"); } - List exprList = FastList.newInstance(); + List<EntityCondition> exprList = FastList.newInstance(); exprList.add(EntityCondition.makeCondition("mapKey", EntityOperator.EQUALS, mapKey)); if (sequenceNum != null) { exprList.add(EntityCondition.makeCondition("sequenceNum", EntityOperator.EQUALS, sequenceNum)); @@ -852,13 +838,13 @@ public class ContentServices { exprList.add(EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId)); } - EntityConditionList assocExprList = EntityCondition.makeCondition(exprList, EntityOperator.AND); - List relatedAssocs = delegator.findList("ContentAssoc", assocExprList, null, UtilMisc.toList("fromDate"), null, false); + EntityConditionList<EntityCondition> assocExprList = EntityCondition.makeCondition(exprList, EntityOperator.AND); + List<GenericValue> relatedAssocs = delegator.findList("ContentAssoc", assocExprList, null, UtilMisc.toList("fromDate"), null, false); //if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, relatedAssocs:" + relatedAssocs, module); - List filteredAssocs = EntityUtil.filterByDate(relatedAssocs); + List<GenericValue> filteredAssocs = EntityUtil.filterByDate(relatedAssocs); //if (Debug.infoOn()) Debug.logInfo("in deactivateAssocs, filteredAssocs:" + filteredAssocs, module); - Iterator it = filteredAssocs.iterator(); + Iterator<GenericValue> it = filteredAssocs.iterator(); while (it.hasNext()) { GenericValue val = (GenericValue) it.next(); val.set("thruDate", nowTimestamp); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=1062032&r1=1062031&r2=1062032&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Fri Jan 21 21:12:47 2011 @@ -1050,15 +1050,15 @@ public class ContentWorker implements or return permissionStatus; } - public static Map callContentPermissionCheckResult(Delegator delegator, LocalDispatcher dispatcher, Map context) { + public static Map<String, Object> callContentPermissionCheckResult(Delegator delegator, LocalDispatcher dispatcher, Map context) { - Map permResults = FastMap.newInstance(); + Map<String, Object> permResults = FastMap.newInstance(); String skipPermissionCheck = (String) context.get("skipPermissionCheck"); if (UtilValidate.isEmpty(skipPermissionCheck) || (!skipPermissionCheck.equalsIgnoreCase("true") && !skipPermissionCheck.equalsIgnoreCase("granted"))) { GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map serviceInMap = FastMap.newInstance(); + Map<String, Object> serviceInMap = FastMap.newInstance(); serviceInMap.put("userLogin", userLogin); serviceInMap.put("targetOperationList", context.get("targetOperationList")); serviceInMap.put("contentPurposeList", context.get("contentPurposeList")); @@ -1321,9 +1321,8 @@ public class ContentWorker implements or } - public static List prepTargetOperationList(Map context, String md) { - - List targetOperationList = (List)context.get("targetOperationList"); + public static List<String> prepTargetOperationList(Map<String, ? extends Object> context, String md) { + List<String> targetOperationList = (List)context.get("targetOperationList"); String targetOperationString = (String)context.get("targetOperationString"); if (Debug.infoOn()) Debug.logInfo("in prepTargetOperationList, targetOperationString(0):" + targetOperationString, ""); if (UtilValidate.isNotEmpty(targetOperationString)) { @@ -1349,13 +1348,12 @@ public class ContentWorker implements or * @param context * @return */ - public static List prepContentPurposeList(Map context) { - + public static List<String> prepContentPurposeList(Map context) { List contentPurposeList = (List)context.get("contentPurposeList"); String contentPurposeString = (String)context.get("contentPurposeString"); if (Debug.infoOn()) Debug.logInfo("in prepContentPurposeList, contentPurposeString(0):" + contentPurposeString, ""); if (UtilValidate.isNotEmpty(contentPurposeString)) { - List purposesFromString = StringUtil.split(contentPurposeString, "|"); + List<String> purposesFromString = StringUtil.split(contentPurposeString, "|"); if (UtilValidate.isEmpty(contentPurposeList)) { contentPurposeList = FastList.newInstance(); } |
Free forum by Nabble | Edit this page |