Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -63,13 +63,13 @@ public class CompDocServices { public static final String module = CompDocServices.class.getName(); - - /** - * + + /** + * * @param request * @param response * @return - * + * * Creates the topmost Content entity of a Composite Document tree. * Also creates an "empty" Composite Document Instance Content entity. * Creates ContentRevision/Item records for each, as well. @@ -83,7 +83,7 @@ GenericValue userLogin = (GenericValue)context.get("userLogin"); String contentId = (String)context.get("contentId"); //String instanceContentId = null; - + boolean contentExists = true; if (UtilValidate.isEmpty(contentId)) { contentExists = false; @@ -97,7 +97,7 @@ return ServiceUtil.returnError(errMsg); } } - + ModelService modelService = null; try { modelService = dispatcher.getDispatchContext().getModelService("persistContentAndAssoc"); @@ -142,21 +142,21 @@ public static Map<String, Object> renderCompDocPdf(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); - + Locale locale = (Locale) context.get("locale"); String rootDir = (String) context.get("rootDir"); String webSiteId = (String) context.get("webSiteId"); String https = (String) context.get("https"); - + GenericDelegator delegator = dctx.getDelegator(); - + String contentId = (String) context.get("contentId"); String contentRevisionSeqId = (String) context.get("contentRevisionSeqId"); String oooHost = (String) context.get("oooHost"); String oooPort = (String) context.get("oooPort"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - - try { + + try { Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); List exprList = FastList.newInstance(); exprList.add(EntityCondition.makeCondition("contentIdTo", EntityOperator.EQUALS, contentId)); @@ -173,15 +173,15 @@ exprList.add(EntityCondition.makeCondition(thruList, EntityOperator.OR)); EntityConditionList conditionList = EntityCondition.makeCondition(exprList, EntityOperator.AND); - + String [] fields = {"rootRevisionContentId", "itemContentId", "maxRevisionSeqId", "contentId", "dataResourceId", "contentIdTo", "contentAssocTypeId", "fromDate", "sequenceNum"}; Set selectFields = UtilMisc.toSetArray(fields); List orderByFields = UtilMisc.toList("sequenceNum"); List compDocParts = delegator.findList("ContentAssocRevisionItemView", conditionList, selectFields, orderByFields, null, false); - + ByteArrayOutputStream baos = new ByteArrayOutputStream(); Document document = new Document(); - document.setPageSize(PageSize.LETTER); + document.setPageSize(PageSize.LETTER); //Rectangle rect = document.getPageSize(); //PdfWriter writer = PdfWriter.getInstance(document, baos); PdfCopy writer = new PdfCopy(document, baos); @@ -261,7 +261,7 @@ if (UtilValidate.isNotEmpty(oooPort)) convertInMap.put("oooPort", oooPort); Map convertResult = dispatcher.runSync("convertDocumentByteBuffer", convertInMap); - + if (ServiceUtil.isError(convertResult)) { return ServiceUtil.returnError("Error in Open", null, null, convertResult); } @@ -301,25 +301,25 @@ LocalDispatcher dispatcher = dctx.getDispatcher(); Map results = ServiceUtil.returnSuccess(); String dataResourceId = null; - + Locale locale = (Locale) context.get("locale"); String rootDir = (String) context.get("rootDir"); String webSiteId = (String) context.get("webSiteId"); String https = (String) context.get("https"); - + GenericDelegator delegator = dctx.getDelegator(); - + String contentId = (String) context.get("contentId"); String contentRevisionSeqId = (String) context.get("contentRevisionSeqId"); String oooHost = (String) context.get("oooHost"); String oooPort = (String) context.get("oooPort"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - - try { + + try { //Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); //ByteArrayOutputStream baos = new ByteArrayOutputStream(); Document document = new Document(); - document.setPageSize(PageSize.LETTER); + document.setPageSize(PageSize.LETTER); //Rectangle rect = document.getPageSize(); //PdfCopy writer = new PdfCopy(document, baos); document.open(); @@ -376,7 +376,7 @@ } } } - + if (surveyResponse != null) { if (UtilValidate.isEmpty(acroFormContentId)) { // Create AcroForm PDF @@ -400,14 +400,14 @@ } } else { ByteBuffer inByteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https, webSiteId, locale, rootDir); - - Map convertInMap = UtilMisc.toMap("userLogin", userLogin, "inByteBuffer", inByteBuffer, + + Map convertInMap = UtilMisc.toMap("userLogin", userLogin, "inByteBuffer", inByteBuffer, "inputMimeType", inputMimeType, "outputMimeType", "application/pdf"); if (UtilValidate.isNotEmpty(oooHost)) convertInMap.put("oooHost", oooHost); if (UtilValidate.isNotEmpty(oooPort)) convertInMap.put("oooPort", oooPort); Map convertResult = dispatcher.runSync("convertDocumentByteBuffer", convertInMap); - + if (ServiceUtil.isError(convertResult)) { return ServiceUtil.returnError("Error in Open", null, null, convertResult); } @@ -415,7 +415,7 @@ ByteBuffer outByteBuffer = (ByteBuffer) convertResult.get("outByteBuffer"); inputByteArray = outByteBuffer.array(); } - + ByteBuffer outByteBuffer = ByteBuffer.wrap(inputByteArray); results.put("outByteBuffer", outByteBuffer); } catch (GenericEntityException e) { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentEvents.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentEvents.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java Sat Mar 21 23:43:51 2009 @@ -47,7 +47,7 @@ public class ContentMapFacade implements Map { public static final String module = ContentMapFacade.class.getName(); - + protected static final Set<String> mapKeySet = FastSet.newInstance(); static { mapKeySet.add("fields"); @@ -123,7 +123,7 @@ public void setRenderFlag(boolean render) { this.allowRender = render; } - + public void setIsDecorated(boolean isDecorated) { this.isDecorated = isDecorated; } @@ -219,7 +219,7 @@ } } else if ("data".equalsIgnoreCase(name) || "dataresource".equalsIgnoreCase(name)) { // data (resource) object - return dataResource; + return dataResource; } else if ("subcontent_all".equalsIgnoreCase(name)) { // subcontent list of ordered subcontent List<ContentMapFacade> subContent = FastList.newInstance(); @@ -257,7 +257,7 @@ return null; } - + protected String renderThis() { if (!this.allowRender && !this.isDecorated) { String errorMsg = "WARNING: Cannot render content being rendered! (Infinite Recursion NOT allowed!)"; @@ -267,11 +267,11 @@ // TODO: change to use the MapStack instead of a cloned Map Map renderCtx = FastMap.newInstance(); renderCtx.putAll(context); - + if (this.isDecorated) { renderCtx.put("_IS_DECORATED_", Boolean.TRUE); } - + try { return ContentWorker.renderContentAsText(dispatcher, delegator, contentId, renderCtx, locale, mimeType, cache); } catch (GeneralException e) { @@ -351,7 +351,7 @@ if (name.toLowerCase().startsWith("id_")) { name = name.substring(3); } - + // look up the content ID (of name) GenericValue content = null; try { @@ -377,7 +377,7 @@ Debug.logWarning("Key parameters must be a string", module); return null; } - String name = (String) key; + String name = (String) key; if (name.toLowerCase().startsWith("id_")) { name = name.substring(3); } 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=757086&r1=757085&r2=757086&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 Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -42,7 +42,7 @@ /** * ContentPermissionServices Class - * + * * Services for granting operation permissions on Content entities in a data-driven manner. */ public class ContentPermissionServices { @@ -62,26 +62,26 @@ * This service goes thru a series of test to determine if the user has * authority to performed anyone of the passed in target operations. * - * It expects a Content entity in "currentContent" + * It expects a Content entity in "currentContent" * It expects a list of contentOperationIds in "targetOperationList" rather * than a scalar because it is thought that sometimes more than one operation * would fit the situation. * Similarly, it expects a list of contentPurposeTypeIds in "contentPurposeList". - * Again, normally there will just be one, but it is possible that a Content + * Again, normally there will just be one, but it is possible that a Content * entity could have multiple purposes associated with it. * The userLogin GenericValue is also required. * A list of roleTypeIds is also possible. * * The basic sequence of testing events is: - * First the ContentPurposeOperation table is checked to see if there are any + * First the ContentPurposeOperation table is checked to see if there are any * entries with matching purposes (and operations) with no roleTypeId (ie. _NA_). * This is done because it would be the most common scenario and is quick to check. * * Secondly, the CONTENTMGR permission is checked. * - * Thirdly, the ContentPurposeOperation table is rechecked to see if there are + * Thirdly, the ContentPurposeOperation table is rechecked to see if there are * any conditions with roleTypeIds that match associated ContentRoles tied to the - * user. + * user. * If a Party of "PARTY_GROUP" type is found, the PartyRelationship table is checked * to see if the current user is linked to that group. * @@ -91,29 +91,29 @@ */ public static Map<String, Object> checkContentPermission(DispatchContext dctx, Map<String, ? extends Object> context) { Debug.logWarning(new Exception(), "This service has been depricated in favor of [genericContentPermission]", module); - + Security security = dctx.getSecurity(); GenericDelegator delegator = dctx.getDelegator(); String statusId = (String) context.get("statusId"); String privilegeEnumId = (String) context.get("privilegeEnumId"); - GenericValue content = (GenericValue) context.get("currentContent"); + GenericValue content = (GenericValue) context.get("currentContent"); Boolean bDisplayFailCond = (Boolean)context.get("displayFailCond"); boolean displayFailCond = false; if (bDisplayFailCond != null && bDisplayFailCond.booleanValue()) { - displayFailCond = true; + displayFailCond = true; } Debug.logInfo("displayFailCond(0):" + displayFailCond, ""); Boolean bDisplayPassCond = (Boolean)context.get("displayPassCond"); boolean displayPassCond = false; if (bDisplayPassCond != null && bDisplayPassCond.booleanValue()) { - displayPassCond = true; + displayPassCond = true; } Debug.logInfo("displayPassCond(0):" + displayPassCond, ""); Map results = FastMap.newInstance(); String contentId = null; if (content != null) contentId = content.getString("contentId"); - GenericValue userLogin = (GenericValue) context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String partyId = (String) context.get("partyId"); if (UtilValidate.isEmpty(partyId)) { String passedUserLoginId = (String)context.get("userLoginId"); @@ -121,7 +121,7 @@ try { userLogin = delegator.findByPrimaryKeyCache("UserLogin", UtilMisc.toMap("userLoginId", passedUserLoginId)); if (userLogin != null) { - partyId = userLogin.getString("partyId"); + partyId = userLogin.getString("partyId"); } } catch (GenericEntityException e) { ServiceUtil.returnError(e.getMessage()); @@ -138,8 +138,8 @@ // 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"); - String contentPurposeString = (String) context.get("contentPurposeString"); + List passedPurposes = (List) context.get("contentPurposeList"); + String contentPurposeString = (String) context.get("contentPurposeString"); //Debug.logInfo("contentPurposeString(b):" + contentPurposeString, ""); if (UtilValidate.isNotEmpty(contentPurposeString)) { List purposesFromString = StringUtil.split(contentPurposeString, "|"); @@ -148,15 +148,15 @@ } passedPurposes.addAll(purposesFromString); } - + EntityPermissionChecker.StdAuxiliaryValueGetter auxGetter = new EntityPermissionChecker.StdAuxiliaryValueGetter("ContentPurpose", "contentPurposeTypeId", "contentId"); - // Sometimes permissions need to be checked before an entity is created, so + // Sometimes permissions need to be checked before an entity is created, so // 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 targetOperations = (List) context.get("targetOperationList"); //Debug.logInfo("targetOperations(b):" + targetOperations, ""); - String targetOperationString = (String) context.get("targetOperationString"); + String targetOperationString = (String) context.get("targetOperationString"); //Debug.logInfo("targetOperationString(b):" + targetOperationString, ""); if (UtilValidate.isNotEmpty(targetOperationString)) { List operationsFromString = StringUtil.split(targetOperationString, "|"); @@ -168,44 +168,44 @@ //Debug.logInfo("targetOperations(c):" + targetOperations, ""); EntityPermissionChecker.StdPermissionConditionGetter permCondGetter = new EntityPermissionChecker.StdPermissionConditionGetter("ContentPurposeOperation", "contentOperationId", "roleTypeId", "statusId", "contentPurposeTypeId", "privilegeEnumId"); permCondGetter.setOperationList(targetOperations); - + EntityPermissionChecker.StdRelatedRoleGetter roleGetter = new EntityPermissionChecker.StdRelatedRoleGetter("Content", "roleTypeId", "contentId", "partyId", "ownerContentId", "ContentRole"); //Debug.logInfo("targetOperations(b):" + targetOperations, ""); - List passedRoles = (List) context.get("roleTypeList"); + List passedRoles = (List) context.get("roleTypeList"); if (passedRoles == null) passedRoles = FastList.newInstance(); - String roleTypeString = (String) context.get("roleTypeString"); + String roleTypeString = (String) context.get("roleTypeString"); if (UtilValidate.isNotEmpty(roleTypeString)) { List rolesFromString = StringUtil.split(roleTypeString, "|"); passedRoles.addAll(rolesFromString); } roleGetter.setList(passedRoles); - + String entityAction = (String) context.get("entityOperation"); if (entityAction == null) entityAction = "_ADMIN"; if (userLogin != null && entityAction != null) { passed = security.hasEntityPermission("CONTENTMGR", entityAction, userLogin); } - + StringBuilder errBuf = new StringBuilder(); String permissionStatus = null; List entityIds = FastList.newInstance(); if (passed) { - results.put("permissionStatus", "granted"); + results.put("permissionStatus", "granted"); permissionStatus = "granted"; if (displayPassCond) { errBuf.append("\n hasEntityPermission(" + entityAction + "): PASSED" ); - } - + } + } else { if (displayFailCond) { errBuf.append("\n hasEntityPermission(" + entityAction + "): FAILED" ); - } + } if (content != null) entityIds.add(content); String quickCheckContentId = (String) context.get("quickCheckContentId"); if (UtilValidate.isNotEmpty(quickCheckContentId)) { - List quickList = StringUtil.split(quickCheckContentId, "|"); + List quickList = StringUtil.split(quickCheckContentId, "|"); if (UtilValidate.isNotEmpty(quickList)) entityIds.addAll(quickList); } try { @@ -216,13 +216,13 @@ results.put("permissionStatus", "rejected"); } } catch (GenericEntityException e) { - ServiceUtil.returnError(e.getMessage()); + ServiceUtil.returnError(e.getMessage()); } permissionStatus = (String)results.get("permissionStatus"); errBuf.append("\n permissionStatus:" ); errBuf.append(permissionStatus); } - + if ((permissionStatus.equals("granted") && displayPassCond) || (permissionStatus.equals("rejected") && displayFailCond)) { // Don't show this if passed on 'hasEntityPermission' @@ -238,27 +238,27 @@ errBuf.append(partyId); errBuf.append("\n entityIds:" ); errBuf.append(entityIds); - + if (auxGetter != null) { errBuf.append("\n auxList:" ); errBuf.append(auxGetter.getList()); } - + if (roleGetter != null) { errBuf.append("\n roleList:" ); errBuf.append(roleGetter.getList()); } } - + } } Debug.logInfo("displayPass/FailCond(0), errBuf:" + errBuf.toString(), ""); results.put(ModelService.ERROR_MESSAGE, errBuf.toString()); return results; } - + public static Map<String, Object> checkAssocPermission(DispatchContext dctx, Map<String, ? extends Object> context) { - + Map results = FastMap.newInstance(); Security security = dctx.getSecurity(); GenericDelegator delegator = dctx.getDelegator(); @@ -266,12 +266,12 @@ Boolean bDisplayFailCond = (Boolean)context.get("displayFailCond"); String contentIdFrom = (String) context.get("contentIdFrom"); String contentIdTo = (String) context.get("contentIdTo"); - GenericValue userLogin = (GenericValue) context.get("userLogin"); + GenericValue userLogin = (GenericValue) context.get("userLogin"); String entityAction = (String) context.get("entityOperation"); if (entityAction == null) entityAction = "_ADMIN"; List roleIds = null; String permissionStatus = null; - + GenericValue contentTo = null; GenericValue contentFrom = null; try { @@ -285,12 +285,12 @@ } Map resultsMap = null; boolean isMatch = false; - + boolean isMatchTo = false; boolean isMatchFrom = false; Map permResults = FastMap.newInstance(); String skipPermissionCheck = null; - + if (skipPermissionCheck == null || skipPermissionCheck.length() == 0 || (!skipPermissionCheck.equalsIgnoreCase("true") && !skipPermissionCheck.equalsIgnoreCase("granted"))) { @@ -303,7 +303,7 @@ serviceInMap.put("contentPurposeList", relatedPurposesTo); serviceInMap.put("currentContent", contentTo); serviceInMap.put("displayFailCond", bDisplayFailCond); - + try { permResults = dispatcher.runSync("checkContentPermission", serviceInMap); } catch (GenericServiceException e) { @@ -327,7 +327,7 @@ } permissionStatus = (String)permResults.get("permissionStatus"); if (permissionStatus != null && permissionStatus.equals("granted") ) { - results.put("permissionStatus", "granted"); + results.put("permissionStatus", "granted"); } else { if (bDisplayFailCond != null && bDisplayFailCond.booleanValue()) { String errMsg = (String)permResults.get(ModelService.ERROR_MESSAGE); @@ -335,9 +335,9 @@ } } } else { - results.put("permissionStatus", "granted"); + results.put("permissionStatus", "granted"); } return results; } - + } 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=757086&r1=757085&r2=757086&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 Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -150,7 +150,7 @@ } return results; } - + private static void walkParentTree(Map nodeMap, List parentList) { List kids = (List)nodeMap.get("kids"); if (UtilValidate.isEmpty(kids)) { @@ -272,12 +272,12 @@ GenericValue userLogin = (GenericValue) context.get("userLogin"); String userLoginId = (String) userLogin.get("userLoginId"); - // get first statusId for content out of the statusItem table if not provided + // get first statusId for content out of the statusItem table if not provided if (UtilValidate.isEmpty(context.get("statusId"))) { try { List statusItems = delegator.findByAnd("StatusItem",UtilMisc.toMap("statusTypeId", "CONTENT_STATUS"), UtilMisc.toList("sequenceId")); if (!UtilValidate.isEmpty(statusItems)) { - content.put("statusId", ((GenericValue) statusItems.get(0)).getString("statusId")); + content.put("statusId", ((GenericValue) statusItems.get(0)).getString("statusId")); } } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); @@ -558,7 +558,7 @@ return ServiceUtil.returnError("Problem updating content Status: " + e); } } - + content.setNonPKFields(context); content.put("lastModifiedByUserLogin", lastModifiedByUserLogin); content.put("lastModifiedDate", lastModifiedDate); @@ -1037,25 +1037,25 @@ return results; } - + public static Map<String, Object> publishContent(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ - + Map result = FastMap.newInstance(); GenericValue content = (GenericValue)context.get("content"); - GenericValue userLogin = (GenericValue)context.get("userLogin"); - + GenericValue userLogin = (GenericValue)context.get("userLogin"); + try { content.put("statusId", "CTNT_PUBLISHED"); - content.store(); + content.store(); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); return ServiceUtil.returnError(e.getMessage()); } return result; } - + public static Map<String, Object> getPrefixedMembers(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ - + Map result = FastMap.newInstance(); Map mapIn = (Map)context.get("mapIn"); String prefix = (String)context.get("prefix"); @@ -1076,19 +1076,19 @@ } return result; } - + public static Map<String, Object> splitString(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); List outputList = FastList.newInstance(); String delimiter = UtilFormatOut.checkEmpty((String)context.get("delimiter"), "|"); String inputString = (String)context.get("inputString"); if (UtilValidate.isNotEmpty(inputString)) { - outputList = StringUtil.split(inputString, delimiter); + outputList = StringUtil.split(inputString, delimiter); } result.put("outputList", outputList); return result; } - + public static Map<String, Object> joinString(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); String outputString = null; @@ -1100,9 +1100,9 @@ result.put("outputString", outputString); return result; } - + public static Map<String, Object> urlEncodeArgs(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ - + Map result = FastMap.newInstance(); Map mapFiltered = FastMap.newInstance(); Map mapIn = (Map)context.get("mapIn"); @@ -1126,5 +1126,5 @@ } return result; } - + } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentServicesComplex.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -65,7 +65,7 @@ public static Map<String, Object> getAssocAndContentAndDataResource(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); - List assocTypes = (List) context.get("assocTypes"); + List assocTypes = (List) context.get("assocTypes"); List contentTypes = (List)context.get("contentTypes"); Timestamp fromDate = (Timestamp)context.get("fromDate"); Timestamp thruDate = (Timestamp)context.get("thruDate"); @@ -140,7 +140,7 @@ EntityConditionList assocExprList = EntityCondition.makeCondition(exprList, EntityOperator.AND); List relatedAssocs = null; try { - //relatedAssocs = delegator.findByCondition(viewName, joinExpr, + //relatedAssocs = delegator.findByCondition(viewName, joinExpr, relatedAssocs = delegator.findList(viewName, assocExprList, null,UtilMisc.toList("caFromDate"), null, false); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); @@ -171,12 +171,12 @@ public static Map<String, Object> getAssocAndContentAndDataResourceCache(DispatchContext dctx, Map<String, ? extends Object> context) { GenericDelegator delegator = dctx.getDelegator(); - List assocTypes = (List) context.get("assocTypes"); + List assocTypes = (List) context.get("assocTypes"); String assocTypesString = (String)context.get("assocTypesString"); if (UtilValidate.isNotEmpty(assocTypesString)) { List lst = StringUtil.split(assocTypesString, "|"); if (assocTypes == null) { - assocTypes = FastList.newInstance(); + assocTypes = FastList.newInstance(); } assocTypes.addAll(lst); } @@ -185,7 +185,7 @@ if (UtilValidate.isNotEmpty(contentTypesString)) { List lst = StringUtil.split(contentTypesString, "|"); if (contentTypes == null) { - contentTypes = FastList.newInstance(); + contentTypes = FastList.newInstance(); } contentTypes.addAll(lst); } @@ -199,7 +199,7 @@ Map results = null; try { results = getAssocAndContentAndDataResourceCacheMethod(delegator, - contentId, mapKey, direction, fromDate, + contentId, mapKey, direction, fromDate, fromDateStr, assocTypes, contentTypes, nullThruDatesOnly, contentAssocPredicateId); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); @@ -210,15 +210,15 @@ } - public static Map getAssocAndContentAndDataResourceCacheMethod(GenericDelegator delegator, String contentId, String mapKey, String direction, + public static Map getAssocAndContentAndDataResourceCacheMethod(GenericDelegator delegator, String contentId, String mapKey, String direction, Timestamp fromDate, String fromDateStr, List assocTypes, List contentTypes, Boolean nullThruDatesOnly, String contentAssocPredicateId) throws GenericEntityException, MiniLangException { Map results = getAssocAndContentAndDataResourceCacheMethod(delegator, - contentId, mapKey, direction, fromDate, fromDateStr, assocTypes, + contentId, mapKey, direction, fromDate, fromDateStr, assocTypes, contentTypes, nullThruDatesOnly, contentAssocPredicateId, null); return results; } - public static Map getAssocAndContentAndDataResourceCacheMethod(GenericDelegator delegator, String contentId, String mapKey, String direction, + public static Map getAssocAndContentAndDataResourceCacheMethod(GenericDelegator delegator, String contentId, String mapKey, String direction, Timestamp fromDate, String fromDateStr, List assocTypes, List contentTypes, Boolean nullThruDatesOnly, String contentAssocPredicateId, String orderBy) throws GenericEntityException, MiniLangException { //List exprList = FastList.newInstance(); @@ -258,7 +258,7 @@ fieldMap.putAll(UtilMisc.toMap("thruDate", null)); } List contentAssocsUnfiltered = null; - + //if (Debug.infoOn()) Debug.logInfo("in getAssocAndContent...Cache, fieldMap:" + fieldMap, module); contentAssocsUnfiltered = delegator.findByAndCache("ContentAssoc", fieldMap, UtilMisc.toList("-fromDate")); 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=757086&r1=757085&r2=757086&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 Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -318,7 +318,7 @@ if (locale == null) { return contentAssocDataResourceViewFrom; } - + String localeStr = locale.toString(); boolean isTwoLetterLocale = localeStr.length() == 2; @@ -329,7 +329,7 @@ Debug.logError(e, "Error finding alternate locale content: " + e.toString(), module); return contentAssocDataResourceViewFrom; } - + alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); Iterator alternateViewIter = alternateViews.iterator(); while (alternateViewIter.hasNext()) { @@ -338,9 +338,9 @@ if (UtilValidate.isEmpty(currentLocaleString)) { continue; } - + int currentLocaleLength = currentLocaleString.length(); - + // could be a 2 letter or 5 letter code if (isTwoLetterLocale) { if (currentLocaleLength == 2) { @@ -370,12 +370,12 @@ } } } - + return contentAssocDataResourceViewFrom; } public static void traverse(GenericDelegator delegator, GenericValue content, Timestamp fromDate, Timestamp thruDate, Map whenMap, int depthIdx, Map masterNode, String contentAssocTypeId, List pickList, String direction) { - + //String startContentAssocTypeId = null; String contentTypeId = null; String contentId = null; @@ -477,7 +477,7 @@ List nodeTrail = (List)ctx.get("nodeTrail"); ContentWorker.traceNodeTrail("11",nodeTrail); int sz = nodeTrail.size(); - if (sz == 0) { + if (sz == 0) { return false; } @@ -494,7 +494,7 @@ currentNode = (Map)kids.get(idx); ContentWorker.traceNodeTrail("12",nodeTrail); Boolean isPick = (Boolean)currentNode.get("isPick"); - + if (isPick != null && isPick.booleanValue()) { nodeTrail.add(currentNode); inProgress = true; @@ -514,7 +514,7 @@ } idx++; } - } + } if (!inProgress) { // look for next sibling @@ -608,7 +608,7 @@ } public static void selectKids(Map currentNode, Map ctx) { - + GenericDelegator delegator = (GenericDelegator) ctx.get("delegator"); GenericValue parentContent = (GenericValue) currentNode.get("value"); String contentAssocTypeId = (String) ctx.get("contentAssocTypeId"); @@ -624,7 +624,7 @@ direction = "From"; Timestamp fromDate = (Timestamp) ctx.get("fromDate"); Timestamp thruDate = (Timestamp) ctx.get("thruDate"); - + List assocTypeList = StringUtil.split(contentAssocTypeId, " "); List contentTypeList = StringUtil.split(contentTypeId, " "); String contentAssocPredicateId = null; @@ -662,7 +662,7 @@ } public static boolean checkWhen(Map context, String whenStr) { - + boolean isWhen = true; //opposite default from checkReturnWhen if (whenStr != null && whenStr.length() > 0) { FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr); @@ -703,7 +703,7 @@ GenericDelegator delegator = currentContent.getDelegator(); List assocList = getAssociations(currentContent, linkDir, assocTypes, fromDate, thruDate); - if (UtilValidate.isEmpty(assocList)) { + if (UtilValidate.isEmpty(assocList)) { return assocList; } if (Debug.infoOn()) Debug.logInfo("assocList:" + assocList.size() + " contentId:" + currentContent.getString("contentId"), ""); @@ -870,7 +870,7 @@ contentIdField = "contentIdTo"; contentIdOtherField = "contentId"; } - + if (Debug.infoOn()) Debug.logInfo("getContentAncestry, contentId:" + contentId, ""); if (Debug.infoOn()) Debug.logInfo("getContentAncestry, contentAssocTypeId:" + contentAssocTypeId, ""); Map andMap = null; @@ -890,11 +890,11 @@ contentAncestorList.add(contentAssoc.getString(contentIdOtherField)); } } catch (GenericEntityException e) { - Debug.logError(e,module); + Debug.logError(e,module); return; } } - + public static void getContentAncestryAll(GenericDelegator delegator, String contentId, String passedContentTypeId, String direction, List contentAncestorList) { String contentIdField = null; String contentIdOtherField = null; @@ -905,7 +905,7 @@ contentIdField = "contentIdTo"; contentIdOtherField = "contentId"; } - + if (Debug.infoOn()) Debug.logInfo("getContentAncestry, contentId:" + contentId, ""); Map andMap = UtilMisc.toMap(contentIdField, contentId); try { @@ -928,7 +928,7 @@ } } } catch (GenericEntityException e) { - Debug.logError(e,module); + Debug.logError(e,module); return; } } @@ -938,7 +938,7 @@ List contentAncestorList = FastList.newInstance(); List nodeTrail = FastList.newInstance(); getContentAncestry(delegator, contentId, contentAssocTypeId, direction, contentAncestorList); - Iterator contentAncestorListIter = contentAncestorList.iterator(); + Iterator contentAncestorListIter = contentAncestorList.iterator(); while (contentAncestorListIter.hasNext()) { GenericValue value = (GenericValue) contentAncestorListIter.next(); Map thisNode = ContentWorker.makeNode(value); @@ -965,7 +965,7 @@ contentIdField = "contentIdTo"; contentIdOtherField = "contentId"; } - + //if (Debug.infoOn()) Debug.logInfo("getContentAncestry, contentId:" + contentId, ""); try { List lst = delegator.findByAndCache("ContentAssoc", UtilMisc.toMap(contentIdField, contentId, "contentAssocTypeId", contentAssocTypeId)); @@ -976,11 +976,11 @@ GenericValue contentAssoc = (GenericValue)lst2.get(0); getContentAncestryValues(delegator, contentAssoc.getString(contentIdOtherField), contentAssocTypeId, direction, contentAncestorList); GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentAssoc.getString(contentIdOtherField))); - + contentAncestorList.add(content); } } catch (GenericEntityException e) { - Debug.logError(e,module); + Debug.logError(e,module); return; } } @@ -1002,7 +1002,7 @@ } public static Map callContentPermissionCheckResult(GenericDelegator delegator, LocalDispatcher dispatcher, Map context) { - + Map permResults = FastMap.newInstance(); String skipPermissionCheck = (String) context.get("skipPermissionCheck"); @@ -1026,7 +1026,7 @@ Debug.logError(e, "Problem checking permissions", "ContentServices"); } } else { - permResults.put("permissionStatus", "granted"); + permResults.put("permissionStatus", "granted"); } return permResults; } @@ -1117,7 +1117,7 @@ List passedGlobalNodeTrail = null; GenericValue currentContent = null; String viewContentId = null; - if (UtilValidate.isNotEmpty(trail)) { + if (UtilValidate.isNotEmpty(trail)) { passedGlobalNodeTrail = UtilMisc.makeListWritable(trail); } else { passedGlobalNodeTrail = FastList.newInstance(); @@ -1128,7 +1128,7 @@ Map nd = (Map)passedGlobalNodeTrail.get(sz - 1); if (nd != null) currentContent = (GenericValue)nd.get("value"); - if (currentContent != null) + if (currentContent != null) viewContentId = (String)currentContent.get("contentId"); } @@ -1271,7 +1271,7 @@ } return bool; } - + public static List prepTargetOperationList(Map context, String md) { @@ -1296,7 +1296,7 @@ } /** - * Checks to see if there is a purpose string (delimited by pipes) and + * Checks to see if there is a purpose string (delimited by pipes) and * turns it into a list and concants to any existing purpose list. * @param context * @return @@ -1323,7 +1323,7 @@ public static String prepPermissionErrorMsg(Map permResults) { String permissionStatus = (String)permResults.get("permissionStatus"); - String errorMessage = "Permission is denied." + permissionStatus; + String errorMessage = "Permission is denied." + permissionStatus; errorMessage += ServiceUtil.getErrorMessage(permResults); PermissionRecorder recorder = (PermissionRecorder)permResults.get("permissionRecorder"); Debug.logInfo("recorder(0):" + recorder, ""); @@ -1383,7 +1383,7 @@ public static Map makeNode(GenericValue thisContent) { Map thisNode = null; - if (thisContent == null) + if (thisContent == null) return thisNode; thisNode = FastMap.newInstance(); @@ -1408,7 +1408,7 @@ public static String nodeTrailToCsv(List nodeTrail) { - + if (nodeTrail == null) return ""; StringBuilder csv = new StringBuilder(); @@ -1427,7 +1427,7 @@ } public static List csvToList(String csv, GenericDelegator delegator) { - + List outList = FastList.newInstance(); List contentIdList = StringUtil.split(csv, ","); GenericValue content = null; @@ -1447,7 +1447,7 @@ values = FastList.newInstance(); values.add(contentId); values.add(contentName); - outList.add(values); + outList.add(values); } return outList; } @@ -1519,7 +1519,7 @@ /* * Tries to find the mime type of the associated content and parent content. * - * @param delegator + * @param delegator * @param view SubContentDataResourceView * @param parentContent Content entity * @param contentId part of primary key of view. To be used if view is null. @@ -1577,7 +1577,7 @@ public static String logMap(String lbl, Map map, int indentLevel) { StringBuilder indent = new StringBuilder(); - for (int i=0; i<indentLevel; i++) { + for (int i=0; i<indentLevel; i++) { indent.append(' '); } StringBuilder sb = new StringBuilder(); @@ -1623,7 +1623,7 @@ public static String logList(String lbl, List lst, int indentLevel) { StringBuilder indent = new StringBuilder(); - for (int i=0; i<indentLevel; i++) { + for (int i=0; i<indentLevel; i++) { indent.append(' '); } StringBuilder sb = new StringBuilder(); @@ -1631,7 +1631,7 @@ } public static StringBuilder logList(StringBuilder s, String lbl, List lst, StringBuilder indent) { - + String sep = ":"; String eol = "\n"; String spc = ""; @@ -1666,7 +1666,7 @@ } return s.append(eol).append(eol); } - + public static void traceNodeTrail(String lbl, List nodeTrail) { /* if (!Debug.verboseOn()) { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWrapper.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWrapper.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWrapper.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -27,5 +27,5 @@ public interface ContentWrapper { public StringUtil.StringWrapper get(String contentTypeId); - + } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -31,7 +31,7 @@ /** * PermissionRecorder Class - * + * * Services for granting operation permissions on Content entities in a data-driven manner. */ public class PermissionRecorder { @@ -129,8 +129,8 @@ if (!currentContentId.equals(id)) { currentContentMap = FastMap.newInstance(); permCheckResults.add(currentContentMap); - currentContentMap.put("contentId", id); - currentContentMap.put("checkResults", FastList.newInstance()); + currentContentMap.put("contentId", id); + currentContentMap.put("checkResults", FastList.newInstance()); } currentContentId = id; } @@ -141,7 +141,7 @@ public void setRoles(List roles) { if (currentContentMap != null) { - if (roles != null) + if (roles != null) currentContentMap.put("roles", roles.toArray()); else currentContentMap.put("roles", null); @@ -150,7 +150,7 @@ public void setPurposes(List purposes) { if (currentContentMap != null) { - if (purposes != null) + if (purposes != null) currentContentMap.put("purposes", purposes.toArray()); else currentContentMap.put("purposes", null); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -73,7 +73,7 @@ public static String uploadContentAndImage(HttpServletRequest request, HttpServletResponse response) { - + try { Locale locale = UtilHttp.getLocale(request); LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); @@ -91,14 +91,14 @@ return "error"; } //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]lst " + lst, module); - + if (lst.size() == 0) { - String errMsg = UtilProperties.getMessage(UploadContentAndImage.err_resource, "uploadContentAndImage.no_files_uploaded", locale); + String errMsg = UtilProperties.getMessage(UploadContentAndImage.err_resource, "uploadContentAndImage.no_files_uploaded", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); Debug.logWarning("[DataEvents.uploadImage] No files uploaded", module); return "error"; } - + Map passedParams = FastMap.newInstance(); FileItem fi = null; FileItem imageFi = null; @@ -187,11 +187,11 @@ return "error"; } } - } + } - if (UtilValidate.isEmpty(ftlContentId)) + if (UtilValidate.isEmpty(ftlContentId)) ftlContentId = passedContentId; - + String ftlDataResourceId = drid; if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]ftlContentId:" + ftlContentId, module); @@ -291,7 +291,7 @@ return "error"; } } - + // Check for existing AUTHOR link String userLoginId = userLogin.getString("userLoginId"); GenericValue authorContent = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", userLoginId)); @@ -340,7 +340,7 @@ public static String uploadContentStuff(HttpServletRequest request, HttpServletResponse response) { - + try { HttpSession session = request.getSession(); GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); @@ -356,13 +356,13 @@ return "error"; } //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]lst " + lst, module); - + if (lst.size() == 0) { request.setAttribute("_ERROR_MESSAGE_", "No files uploaded"); Debug.logWarning("[DataEvents.uploadImage] No files uploaded", module); return "error"; } - + Map passedParams = FastMap.newInstance(); FileItem fi = null; FileItem imageFi = null; @@ -493,7 +493,7 @@ ftlContext.put("imageData", bytes); //if (Debug.infoOn()) Debug.logInfo("[UploadContentStuff]byteBuffer:" + bytes, module); //contentAssocDataResourceViewFrom.setAllFields(ftlContext2, true, null, null); - //ftlContext.putAll(ftlContext2); + //ftlContext.putAll(ftlContext2); if (Debug.infoOn()) Debug.logInfo("[UploadContentStuff]ftlContext:" + ftlContext, module); Map ftlResults = null; try { @@ -531,7 +531,7 @@ request.setAttribute("caFromDate" + suffix, ftlResults.get("fromDate")); request.setAttribute("drDataResourceId" + suffix, ftlResults.get("dataResourceId")); request.setAttribute("caContentId" + suffix, ftlResults.get("contentId")); - + String caContentIdTo = (String)passedParams.get("caContentIdTo"); if (UtilValidate.isNotEmpty(caContentIdTo)) { Map resequenceContext = FastMap.newInstance(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataEvents.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataEvents.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -203,7 +203,7 @@ length = (Long) resourceData.get("length"); } Debug.log("Got resource data stream: " + length + " bytes", module); - + // stream the content to the browser if (stream != null && length != null) { try { @@ -231,7 +231,7 @@ GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); Map parameters = UtilHttp.getParameterMap(request); - + Debug.log("Img UserAgent - " + request.getHeader("User-Agent"), module); String dataResourceId = (String) parameters.get("imgId"); @@ -253,10 +253,10 @@ request.setAttribute("_ERROR_MESSAGE_", errorMsg); return "error"; } - + // make sure the logged in user can download this content; otherwise is a pretty big security hole for DataResource records... // TODO: should we restrict the roleTypeId? - List contentAndRoleList = delegator.findByAnd("ContentAndRole", + List contentAndRoleList = delegator.findByAnd("ContentAndRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "dataResourceId", dataResourceId)); if (contentAndRoleList.size() == 0) { String errorMsg = "You do not have permission to download the Data Resource with ID [" + dataResourceId + "], ie you are not associated with it."; @@ -265,7 +265,7 @@ return "error"; } } - + String mimeType = DataResourceWorker.getMimeType(dataResource); //if (Debug.infoOn()) Debug.logInfo("in serveImage, imageType:" + imageType, module); @@ -303,8 +303,8 @@ } - /** Dual create and edit event. - * Needed to make permission criteria available to services. + /** Dual create and edit event. + * Needed to make permission criteria available to services. */ public static String persistDataResource(HttpServletRequest request, HttpServletResponse response) { Map result = null; @@ -316,7 +316,7 @@ GenericValue dataResource = delegator.makeValue("DataResource"); dataResource.setPKFields(paramMap); dataResource.setNonPKFields(paramMap); - Map serviceInMap = UtilMisc.makeMapWritable(dataResource); + Map serviceInMap = UtilMisc.makeMapWritable(dataResource); serviceInMap.put("userLogin", userLogin); String mode = (String)paramMap.get("mode"); Locale locale = UtilHttp.getLocale(request); @@ -336,7 +336,7 @@ try { result = dispatcher.runSync("createDataResource", serviceInMap); } catch (GenericServiceException e) { - String errMsg = UtilProperties.getMessage(DataEvents.err_resource, "dataEvents.error_call_create_service", locale); + String errMsg = UtilProperties.getMessage(DataEvents.err_resource, "dataEvents.error_call_create_service", locale); String errorMsg = "Error calling the createDataResource service." + e.toString(); Debug.logError(e, errorMsg, module); request.setAttribute("_ERROR_MESSAGE_", errMsg + e.toString()); @@ -345,8 +345,8 @@ dataResourceId = (String)result.get("dataResourceId"); dataResource.set("dataResourceId", dataResourceId); } - - + + // Save the primary key so that it can be used in a "quick pick" list later GenericPK pk = dataResource.getPrimaryKey(); HttpSession session = request.getSession(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -414,7 +414,7 @@ public static String buildRequestPrefix(GenericDelegator delegator, Locale locale, String webSiteId, String https) { Map prefixValues = FastMap.newInstance(); String prefix; - + NotificationServices.setBaseUrl(delegator, webSiteId, prefixValues); if (https != null && https.equalsIgnoreCase("true")) { prefix = (String) prefixValues.get("baseSecureUrl"); @@ -687,7 +687,7 @@ ModelScreen modelScreen = null; ScreenStringRenderer renderer = screens.getScreenStringRenderer(); String combinedName = dataResource.getString("objectInfo"); - if ("URL_RESOURCE".equals(dataResource.getString("dataResourceTypeId")) && UtilValidate.isNotEmpty(combinedName) && combinedName.startsWith("component://")) { + if ("URL_RESOURCE".equals(dataResource.getString("dataResourceTypeId")) && UtilValidate.isNotEmpty(combinedName) && combinedName.startsWith("component://")) { modelScreen = ScreenFactory.getScreenFromLocation(combinedName); } else { // stored in a single file, long or short text Document screenXml = UtilXml.readXmlDocument(getDataResourceText(dataResource, targetMimeTypeId, locale, templateContext, delegator, cache), true); @@ -766,7 +766,7 @@ if (context != null) https = (String) context.get("https"); } - + String rootDir = (String) templateContext.get("rootDir"); if (UtilValidate.isEmpty(rootDir)) { if (context != null) @@ -804,7 +804,7 @@ } else if (dataResourceTypeId.equals("URL_RESOURCE")) { String text = null; URL url = FlexibleLocation.resolveLocation(dataResource.getString("objectInfo")); - + if (url.getHost() != null) { // is absolute InputStream in = url.openStream(); int c; @@ -852,7 +852,7 @@ /** @deprecated */ public static void writeDataResourceTextCache(GenericValue dataResource, String mimeTypeId, Locale locale, Map context, GenericDelegator delegator, Appendable outWriter) throws IOException, GeneralException { - writeDataResourceText(dataResource, mimeTypeId, locale, context, delegator, outWriter, true); + writeDataResourceText(dataResource, mimeTypeId, locale, context, delegator, outWriter, true); } /** @deprecated */ @@ -896,7 +896,7 @@ mimeContext.putAll(context); mimeContext.put("dataResource", dataResource); mimeContext.put("textData", textData); - + String mimeString = DataResourceWorker.renderMimeTypeTemplate(mimeTypeTemplate, mimeContext); out.append(mimeString); } else { @@ -1070,7 +1070,7 @@ String objectInfo = dataResource.getString("objectInfo"); if (UtilValidate.isNotEmpty(objectInfo)) { File file = DataResourceWorker.getContentFile(dataResourceTypeId, objectInfo, contextRoot); - return UtilMisc.toMap("stream", new FileInputStream(file), "length", Long.valueOf(file.length())); + return UtilMisc.toMap("stream", new FileInputStream(file), "length", Long.valueOf(file.length())); } else { throw new GeneralException("No objectInfo found for FILE type [" + dataResourceTypeId + "]; cannot stream"); } @@ -1090,7 +1090,7 @@ } URLConnection con = url.openConnection(); - return UtilMisc.toMap("stream", con.getInputStream(), "length", Long.valueOf(con.getContentLength())); + return UtilMisc.toMap("stream", con.getInputStream(), "length", Long.valueOf(con.getContentLength())); } else { throw new GeneralException("No objectInfo found for URL_RESOURCE type; cannot stream"); } @@ -1115,7 +1115,7 @@ if (UtilValidate.isEmpty(mimeTypeId)) { mimeTypeId = "text/html"; } - + if (dataResourceTypeId.equals("SHORT_TEXT")) { String text = dataResource.getString("objectInfo"); os.write(text.getBytes()); @@ -1164,19 +1164,19 @@ throw new GeneralException("Error in streamDataResource", e); } } - + public static ByteBuffer getContentAsByteBuffer(GenericDelegator delegator, String dataResourceId, String https, String webSiteId, Locale locale, String rootDir) throws IOException, GeneralException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); streamDataResource(baos, delegator, dataResourceId, https, webSiteId, locale, rootDir); ByteBuffer byteBuffer = ByteBuffer.wrap(baos.toByteArray()); return byteBuffer; } - + public String renderDataResourceAsTextExt(GenericDelegator delegator, String dataResourceId, Map templateContext, Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException { return renderDataResourceAsText(delegator, dataResourceId, templateContext, locale, targetMimeTypeId, cache); } - + public void renderDataResourceAsTextExt(GenericDelegator delegator, String dataResourceId, Appendable out, Map templateContext, Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException { renderDataResourceAsText(delegator, dataResourceId, out, templateContext, locale, targetMimeTypeId, cache); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -115,18 +115,18 @@ dataResource.put("lastModifiedByUserLogin", lastModifiedByUserLogin); dataResource.put("createdDate", createdDate); dataResource.put("lastModifiedDate", lastModifiedDate); - // get first statusId for content out of the statusItem table if not provided + // get first statusId for content out of the statusItem table if not provided if (UtilValidate.isEmpty(dataResource.get("statusId"))) { try { List statusItems = delegator.findByAnd("StatusItem",UtilMisc.toMap("statusTypeId", "CONTENT_STATUS"), UtilMisc.toList("sequenceId")); if (!UtilValidate.isEmpty(statusItems)) { - dataResource.put("statusId", ((GenericValue) statusItems.get(0)).getString("statusId")); + dataResource.put("statusId", ((GenericValue) statusItems.get(0)).getString("statusId")); } } catch (GenericEntityException e) { return ServiceUtil.returnError(e.getMessage()); } } - + try { dataResource.create(); } catch (GenericEntityException e) { @@ -160,7 +160,7 @@ return ServiceUtil.returnError(e.getMessage()); } } - + return result; } @@ -175,7 +175,7 @@ public static Map<String, Object> createFileNoPerm(DispatchContext dctx, Map<String, ? extends Object> rcontext) { Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); - context.put("skipPermissionCheck", "true"); + context.put("skipPermissionCheck", "true"); return createFileMethod(dctx, context); } @@ -311,7 +311,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.getMessage()); } - + result.put("dataResource", dataResource); return result; } @@ -344,7 +344,7 @@ String errMsg = "dataResourceId is null."; Debug.logError(errMsg, module); return ServiceUtil.returnError(errMsg); - + } String textData = (String) context.get("textData"); if (Debug.verboseOn()) Debug.logVerbose("in updateElectronicText, textData:" + textData, module); @@ -419,7 +419,7 @@ if (file == null) { throw new IOException("File: " + file + " is null"); } - + // write the data to the file if (UtilValidate.isNotEmpty(textData)) { try { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -70,7 +70,7 @@ Map context = FastMap.newInstance(); ByteBuffer byteWrap = (ByteBuffer) uploadResults.get("imageData"); if (byteWrap == null) { - String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.image_data_null", locale); + String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.image_data_null", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } @@ -80,7 +80,7 @@ String imageFileNameExt = null; if (UtilValidate.isNotEmpty(imageFileName)) { int pos = imageFileName.lastIndexOf("."); - if (pos >= 0) + if (pos >= 0) imageFileNameExt = imageFileName.substring(pos + 1); } String mimeTypeId = "image/" + imageFileNameExt; @@ -115,10 +115,10 @@ if (UtilValidate.isNotEmpty(contentPurposeTypeId)) { context.put("contentPurposeList", UtilMisc.toList(contentPurposeTypeId)); } - + Map result = dispatcher.runSync("persistContentAndAssoc", context); //Debug.logVerbose("in createLayoutImage, result:" + result, module); - + String dataResourceId = (String)result.get("dataResourceId"); String activeContentId = (String)result.get("contentId"); if (UtilValidate.isNotEmpty(activeContentId)) { @@ -127,14 +127,14 @@ //context2.put("dataResourceId", dataResourceId); context2.put("contentAssocTypeId", result.get("contentAssocTypeId")); context2.put("fromDate", result.get("fromDate")); - + request.setAttribute("contentId", result.get("contentId")); request.setAttribute("drDataResourceId", dataResourceId); request.setAttribute("currentEntityName", "SubContentDataResourceId"); - + context2.put("contentIdTo", formInput.get("contentIdTo")); context2.put("mapKey", formInput.get("mapKey")); - + //Debug.logVerbose("in createLayoutImage, context2:" + context2, module); Map result2 = dispatcher.runSync("deactivateAssocs", context2); } @@ -196,7 +196,7 @@ context.put("objectInfo", context.get("drobjectInfo")); context.put("drObjectInfo", null); context.put("drDataResourceTypeId", null); - + String dataResourceId = (String)context.get("drDataResourceId"); Debug.logVerbose("in createLayoutImage(java), dataResourceId:" + dataResourceId, ""); @@ -263,8 +263,8 @@ // Look for an existing associated Content try { List lst = delegator.findByAnd( - "DataResourceContentView ", - UtilMisc.toMap("dataResourceId", dataResourceId)); + "DataResourceContentView ", + UtilMisc.toMap("dataResourceId", dataResourceId)); if (lst.size() > 0) { GenericValue dataResourceContentView = (GenericValue)lst.get(0); contentId = (String)dataResourceContentView.get("coContentId"); @@ -274,14 +274,14 @@ return "error"; } // Else, create and associate a Content - } + } */ if (UtilValidate.isNotEmpty(contentId)) { context.put("contentId", contentId); context.put("contentIdTo", contentIdTo); context.put("mapKey", mapKey); context.put("contentAssocTypeId", "SUB_CONTENT"); - + try { Map result = dispatcher.runSync("persistContentAndAssoc", context); //Debug.logVerbose("in replaceSubContent, result:" + result, module); @@ -291,13 +291,13 @@ //context2.put("dataResourceId", dataResourceId); context2.put("contentAssocTypeId", "SUB_CONTENT"); context2.put("fromDate", result.get("fromDate")); - + request.setAttribute("drDataResourceId", null); request.setAttribute("currentEntityName", "ContentDataResourceView"); - + context2.put("contentIdTo", contentIdTo); context2.put("mapKey", mapKey); - + //Debug.logVerbose("in replaceSubContent, context2:" + context2, module); Map result2 = dispatcher.runSync("deactivateAssocs", context2); } catch ( GenericServiceException e) { @@ -320,7 +320,7 @@ Debug.logVerbose("in cloneLayout, contentId:" + contentId, ""); if (UtilValidate.isEmpty(contentId)) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.content_id_empty", locale); - request.setAttribute("_ERROR_MESSAGE_", errMsg); + request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } String contentIdTo = (String)paramMap.get("contentIdTo"); @@ -333,7 +333,7 @@ String newId = null; String newDataResourceId = null; try { - content = delegator.findByPrimaryKey("Content", + content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); Debug.logVerbose("in cloneLayout, content:" + content, ""); if (content == null) { @@ -347,7 +347,7 @@ newId = delegator.getNextSeqId("Content"); newContent.set("contentId", newId); String dataResourceId = (String)content.get("dataResourceId"); - GenericValue dataResource = delegator.findByPrimaryKey("DataResource", + GenericValue dataResource = delegator.findByPrimaryKey("DataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); if (dataResource != null) { GenericValue newDataResource = delegator.makeValue("DataResource", dataResource); @@ -400,7 +400,7 @@ request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; } - + serviceIn = FastMap.newInstance(); serviceIn.put("userLogin", session.getAttribute("userLogin")); @@ -447,7 +447,7 @@ view.set("contentId", newId); view.set("drDataResourceId", newDataResourceId); Debug.logVerbose("in cloneLayout, view:" + view, ""); - ContentManagementWorker.setCurrentEntityMap(request, view); + ContentManagementWorker.setCurrentEntityMap(request, view); request.setAttribute("contentId", view.get("contentId")); request.setAttribute("drDataResourceId", view.get("drDataResourceId")); return "success"; @@ -460,7 +460,7 @@ Map paramMap = UtilHttp.getParameterMap(request); String contentIdTo = (String)paramMap.get("contentIdTo"); String mapKey = (String)paramMap.get("mapKey"); - if (Debug.verboseOn()) { + if (Debug.verboseOn()) { Debug.logVerbose("in createSubContent, contentIdTo:" + contentIdTo, module); Debug.logVerbose("in createSubContent, mapKey:" + mapKey, module); } @@ -473,7 +473,7 @@ GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); context.put("userLogin", userLogin); - String rootDir = request.getSession().getServletContext().getRealPath("/"); + String rootDir = request.getSession().getServletContext().getRealPath("/"); context.put("rootDir", rootDir); try { SimpleMapProcessor.runSimpleMapProcessor( @@ -519,7 +519,7 @@ context2.put("fromDate", result.get("fromDate")); context2.put("contentIdTo", contentIdTo); context2.put("mapKey", mapKey); - + //Debug.logVerbose("in replaceSubContent, context2:" + context2, module); Map result2 = dispatcher.runSync("deactivateAssocs", context2); } catch ( GenericServiceException e) { @@ -540,13 +540,13 @@ Map context = FastMap.newInstance(); List errorMessages = null; Locale loc = (Locale)request.getSession().getServletContext().getAttribute("locale"); - if (loc == null) + if (loc == null) loc = Locale.getDefault(); context.put("locale", loc); GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); context.put("userLogin", userLogin); - String rootDir = request.getSession().getServletContext().getRealPath("/"); + String rootDir = request.getSession().getServletContext().getRealPath("/"); context.put("rootDir", rootDir); try { SimpleMapProcessor.runSimpleMapProcessor( @@ -590,7 +590,7 @@ context2.put("fromDate", result.get("fromDate")); context2.put("contentIdTo", contentIdTo); context2.put("mapKey", mapKey); - + //Debug.logVerbose("in replaceSubContent, context2:" + context2, module); Map result2 = dispatcher.runSync("deactivateAssocs", context2); */ @@ -606,12 +606,12 @@ Map paramMap = UtilHttp.getParameterMap(request); String entityName = (String)paramMap.get("entityName"); Locale locale = UtilHttp.getLocale(request); - + if (UtilValidate.isEmpty(entityName) ) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.entityname_empty", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; - } + } GenericValue v = delegator.makeValue(entityName); GenericPK passedPK = v.getPrimaryKey(); Collection keyColl = passedPK.getAllKeys(); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutServices.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutServices.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java?rev=757086&r1=757085&r2=757086&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java Sat Mar 21 23:43:51 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -45,7 +45,7 @@ public static final String err_resource = "ContentErrorUiLabels"; /** - * Uploads image data from a form and stores it in ImageDataResource. + * Uploads image data from a form and stores it in ImageDataResource. * Expects key data in a field identitified by the "idField" value * and the binary data to be in a field id'd by uploadField. */ @@ -53,7 +53,7 @@ //Debug.logVerbose("in uploadAndStoreImage", ""); Locale locale = UtilHttp.getLocale(request); - + Map results = FastMap.newInstance(); Map formInput = FastMap.newInstance(); results.put("formInput", formInput); @@ -66,7 +66,7 @@ } if (lst.size() == 0) { - String errMsg = UtilProperties.getMessage(LayoutWorker.err_resource, "layoutEvents.no_files_uploaded", locale); + String errMsg = UtilProperties.getMessage(LayoutWorker.err_resource, "layoutEvents.no_files_uploaded", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); //Debug.logWarning("[DataEvents.uploadImage] No files uploaded", module); return ServiceUtil.returnError("No files uploaded."); @@ -93,7 +93,7 @@ } if (imageFi == null ) { - Map messageMap = UtilMisc.toMap("imageFi", imageFi); + Map messageMap = UtilMisc.toMap("imageFi", imageFi); String errMsg = UtilProperties.getMessage(LayoutWorker.err_resource, "layoutEvents.image_null", messageMap, locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); //Debug.logWarning("[DataEvents.uploadImage] imageFi(" + imageFi + ") is null", module); @@ -104,13 +104,13 @@ ByteBuffer byteWrap = ByteBuffer.wrap(imageBytes); results.put("imageData", byteWrap); results.put("imageFileName", imageFi.getName()); - + //Debug.logVerbose("in uploadAndStoreImage, results:" + results, ""); return results; } - public static ByteBuffer returnByteBuffer(Map map) { + public static ByteBuffer returnByteBuffer(Map map) { ByteBuffer byteBuff = (ByteBuffer)map.get("imageData"); return byteBuff; - } + } } |
Free forum by Nabble | Edit this page |