Author: doogie
Date: Fri Mar 27 17:00:22 2009 New Revision: 759248 URL: http://svn.apache.org/viewvc?rev=759248&view=rev Log: Fix lines that *only* have whitespace. Modified: ofbiz/trunk/applications/content/src/ControlApplet.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java 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/ContentServicesComplex.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWrapper.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/PermissionRecorder.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayInputStream.java ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/report/JREntityListIteratorDataSource.java ofbiz/trunk/applications/content/src/org/ofbiz/content/search/SearchEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/SurveyWrapper.java ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/CheckPermissionTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/LoopSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentAsText.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java Modified: ofbiz/trunk/applications/content/src/ControlApplet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/ControlApplet.java?rev=759248&r1=759247&r2=759248&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/ControlApplet.java (original) +++ ofbiz/trunk/applications/content/src/ControlApplet.java Fri Mar 27 17:00:22 2009 @@ -36,27 +36,27 @@ * Control Applet - Client applet for page pushing and (future) chat */ public class ControlApplet extends Applet implements Runnable { - + private static String pushUrl = "/commonapp/control/pushapplet"; private static String pullUrl = "/commonapp/control/pullapplet"; - + protected AppletContext ctx = null; - + protected String sessionId = null; protected String visitId = null; protected String serverUrl = null; protected String timeoutUrl = null; protected String currentPage = null; protected String debug = null; - + protected int waitTime = 1500; protected int timeout = 300000; - + protected boolean isRunning = false; protected boolean stopped = true; - + protected Thread thread = null; - + public void init() { ctx = this.getAppletContext(); this.sessionId = this.getParameter("sessionId"); @@ -65,7 +65,7 @@ this.timeoutUrl = this.getParameter("timeoutUrl"); this.currentPage = this.getParameter("currentPage"); this.debug = this.getParameter("debug"); - + // see if we override the integer values try { int waitInt = Integer.parseInt(this.getParameter("waitTime")); @@ -79,24 +79,24 @@ timeout = outInt; } catch (NumberFormatException e) { } - + if (serverUrl != null) { boolean sessionOkay = false; boolean visitOkay = false; boolean pageOkay = false; - + if (sessionId != null && sessionId.length() > 0) sessionOkay = true; if (visitId != null && visitId.length() > 0) visitOkay = true; if (currentPage != null && currentPage.length() > 0) pageOkay = true; - + if (sessionOkay && visitOkay && pageOkay) { // tell the host about our current page (mainly for followers) this.push(); } - + // start the polling thread this.isRunning = true; this.stopped = false; @@ -105,11 +105,11 @@ thread.start(); } } - + public void destroy() { this.stopped = true; } - + // poll the servlet for page request public void run() { while (isRunning && !stopped) { @@ -124,26 +124,26 @@ if (debug != null && debug.equalsIgnoreCase("true")) System.out.println("Polling finished."); } - + protected void pull() { Map params = new HashMap(); params.put("sessionId", this.sessionId.trim()); params.put("visitId", this.visitId.trim()); - + String pullResp = null; URL callPullUrl = null; try { callPullUrl = new URL(serverUrl + pullUrl); } catch (MalformedURLException e) { } - + if (callPullUrl != null) { try { pullResp = callServer(callPullUrl, params); } catch (IOException e) { } } - + if (pullResp != null && pullResp.length() > 0) { URL docUrl = null; try { @@ -154,20 +154,20 @@ ctx.showDocument(docUrl, "appletWindow"); } } - + protected void push() { Map params = new HashMap(); params.put("sessionId", this.sessionId.trim()); params.put("visitId", this.visitId.trim()); params.put("currentPage", this.currentPage.trim()); - + String pushResp = null; URL callPushUrl = null; try { callPushUrl = new URL(serverUrl + pushUrl); } catch (MalformedURLException e) { } - + if (callPushUrl != null) { try { pushResp = callServer(callPushUrl, params); @@ -175,7 +175,7 @@ } } } - + private String callServer(URL serverUrl, Map parms) throws IOException { // send the request String parameters = this.encodeArgs(parms); @@ -187,7 +187,7 @@ PrintWriter pw = new PrintWriter(uc.getOutputStream()); pw.println(parameters); pw.close(); - + // read the response BufferedReader in = new BufferedReader(new InputStreamReader(uc.getInputStream())); String responseStr = in.readLine(); @@ -198,7 +198,7 @@ System.out.println("Receive response: " + responseStr); return responseStr; } - + public String encodeArgs(Map args) { StringBuffer buf = new StringBuffer(); if (args != null) { @@ -214,7 +214,7 @@ } else { valueStr = value.toString(); } - + if (valueStr != null && valueStr.length() > 0) { if (buf.length() > 0) buf.append('&'); try { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=759248&r1=759247&r2=759248&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java Fri Mar 27 17:00:22 2009 @@ -165,14 +165,14 @@ GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); - + Debug.logInfo("=========== type:" + (String)context.get("dataresourceTypeId") , module); // Knowing why a request fails permission check is one of the more difficult // aspects of content management. Setting "displayFailCond" to true will // put an html table in result.errorMessage that will show what tests were performed Boolean bDisplayFailCond = (Boolean)context.get("displayFailCond"); String mapKey = (String) context.get("mapKey"); - + // If "deactivateExisting" is set, other Contents that are tied to the same // contentIdTo will be deactivated (thruDate set to now) String deactivateString = (String) context.get("deactivateExisting"); @@ -195,7 +195,7 @@ } if (Debug.infoOn()) Debug.logInfo("in persist... contentPurposeList(0):" + contentPurposeList, null); if (Debug.infoOn()) Debug.logInfo("in persist... textData(0):" + context.get("textData"), null); - + GenericValue content = delegator.makeValue("Content"); content.setPKFields(context); @@ -228,7 +228,7 @@ GenericValue electronicText = delegator.makeValue("ElectronicText"); electronicText.setPKFields(context); electronicText.setNonPKFields(context); - + // save expected primary keys on result now in case there is no operation that uses them Map results = ServiceUtil.returnSuccess(); results.put("contentId", content.get("contentId")); @@ -239,7 +239,7 @@ results.put("caContentId", contentAssoc.get("contentId")); results.put("caFromDate", contentAssoc.get("fromDate")); results.put("caContentAssocTypeId", contentAssoc.get("contentAssocTypeId")); - + // get user info for multiple use GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -247,7 +247,7 @@ //String textData = (String)electronicText.get("textData"); //String userLoginId = (String)userLogin.get("userLoginId"); - + //String createdByUserLogin = userLoginId; //String lastModifiedByUserLogin = userLoginId; //Timestamp createdDate = UtilDateTime.nowTimestamp(); @@ -476,7 +476,7 @@ } catch (GenericEntityException e) { return ServiceUtil.returnError( e.toString()); } - + Iterator siteRoleIter = siteRoles.iterator(); while (siteRoleIter.hasNext()) { Map serviceContext = FastMap.newInstance(); @@ -551,7 +551,7 @@ } return results; } - + public static Map<String, Object> persistDataResourceAndData(DispatchContext dctx, Map<String, ? extends Object> context) { //GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -585,7 +585,7 @@ } return result; } - + public static Map<String, Object> persistDataResourceAndDataMethod(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException, GenericEntityException, Exception { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -597,13 +597,13 @@ dataResource.setNonPKFields(context); dataResource.setAllFields(context, false, "dr", null); context.putAll(dataResource); - + GenericValue electronicText = delegator.makeValue("ElectronicText"); electronicText.setPKFields(context); electronicText.setNonPKFields(context); String textData = (String)electronicText.get("textData"); - + String dataResourceId = (String)dataResource.get("dataResourceId"); String dataResourceTypeId = (String)dataResource.get("dataResourceTypeId"); if (Debug.infoOn()) Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, null); @@ -637,7 +637,7 @@ } newDrContext.put("mimeTypeId", mimeTypeId); } - + if (!dataResourceExists) { Map thisResult = dispatcher.runSync("createDataResource", newDrContext); String errorMsg = ServiceUtil.getErrorMessage(thisResult); @@ -755,13 +755,13 @@ } } } - + result.put("dataResourceId", dataResourceId); result.put("drDataResourceId", dataResourceId); context.put("dataResourceId", dataResourceId); return result; } - + public static void addRoleToUser(GenericDelegator delegator, LocalDispatcher dispatcher, Map serviceContext) throws GenericServiceException, GenericEntityException { String partyId = (String)serviceContext.get("partyId"); Map findMap = UtilMisc.toMap("partyId", partyId); @@ -887,14 +887,14 @@ if (Debug.infoOn()) Debug.logInfo("in updateOrRemove, entityValueExisting: REMOVED", module); } } - + } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.toString()); } return results; } - + public static Map<String, Object> resequence(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); @@ -964,11 +964,11 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.toString()); } - - + + return result; } - + public static Map<String, Object> changeLeafToNode(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); @@ -1000,7 +1000,7 @@ content.set("lastModifiedDate", UtilDateTime.nowTimestamp()); content.set("lastModifiedByUserLogin", userLoginId); content.store(); - + if (UtilValidate.isNotEmpty(dataResourceId)) { // add previous DataResource as part of new subcontent GenericValue contentClone = (GenericValue)content.clone(); @@ -1009,7 +1009,7 @@ content.set("lastModifiedByUserLogin", userLoginId); content.set("createdDate", UtilDateTime.nowTimestamp()); content.set("createdByUserLogin", userLoginId); - + contentClone.set("contentId", null); ModelService modelService = dctx.getModelService("persistContentAndAssoc"); Map serviceIn = modelService.makeValid(contentClone, "IN"); @@ -1022,20 +1022,20 @@ } catch (ServiceAuthException e) { return ServiceUtil.returnError(e.toString()); } - + List typeList = UtilMisc.toList("SUB_CONTENT"); int leafCount = ContentManagementWorker.updateStatsTopDown(delegator, contentId, typeList); } - + } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.toString()); } - - + + return result; } - + public static Map<String, Object> updateLeafCount(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); @@ -1053,7 +1053,7 @@ } return result; } - + /* public static Map<String, Object> updateLeafChange(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ @@ -1063,12 +1063,12 @@ if (typeList == null) typeList = UtilMisc.toList("PUBLISH_LINK", "SUB_CONTENT"); String contentId = (String)context.get("contentId"); - + try { GenericValue thisContent = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); if (thisContent == null) throw new RuntimeException("No entity found for id=" + contentId); - + String thisContentId = thisContent.getString("contentId"); Long leafCount = (Long)thisContent.get("nodeLeafCount"); int subLeafCount = (leafCount == null) ? 1 : leafCount.intValue(); @@ -1079,7 +1079,7 @@ // TODO: ??? what is this supposed to do: //subLeafCount = subLeafCount; } - + EntityCondition conditionType = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList); EntityCondition conditionMain = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, thisContentId), conditionType), EntityOperator.AND); List listAll = delegator.findByConditionCache("ContentAssoc", conditionMain, null, null); @@ -1097,12 +1097,12 @@ branchCount += 1; // For the level just above only, update the branch count contentTo.put("childBranchCount", Integer.valueOf(branchCount)); - + // Start the updating of leaf counts above ContentManagementWorker.updateStatsBottomUp(delegator, subContentId, typeList, subLeafCount); } - - + + } catch (GenericEntityException e) { Debug.logError(e, module); return ServiceUtil.returnError(e.toString()); @@ -1110,7 +1110,7 @@ return result; } */ - + /** * This service changes the contentTypeId of the current content and its children depending on the pageMode. * if pageMode == "outline" then if the contentTypeId of children is not "OUTLINE_NODE" or "PAGE_NODE" @@ -1119,7 +1119,7 @@ * (it could be DOCUMENT or OUTLINE_NODE) then it will get changed to SUBPAGE_NODE.` */ public static Map<String, Object> updatePageType(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException{ - + GenericDelegator delegator = dctx.getDelegator(); Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); Map results = FastMap.newInstance(); @@ -1155,12 +1155,12 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.toString()); } - + return results; } - + public static Map<String, Object> resetToOutlineMode(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException{ - + GenericDelegator delegator = dctx.getDelegator(); Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); Map results = FastMap.newInstance(); @@ -1202,10 +1202,10 @@ Debug.logError(e, module); return ServiceUtil.returnError(e.toString()); } - + return results; } - + public static Map<String, Object> clearContentAssocViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map results = FastMap.newInstance(); @@ -1214,7 +1214,7 @@ if (utilCache != null) { utilCache.clear(); } - + utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewTo"); if (utilCache != null) { utilCache.clear(); @@ -1222,16 +1222,16 @@ return results; } - + public static Map<String, Object> clearContentAssocDataResourceViewCache(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ - + Map results = FastMap.newInstance(); UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom"); if (utilCache != null) { utilCache.clear(); } - + utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceTo"); if (utilCache != null) { utilCache.clear(); @@ -1239,9 +1239,9 @@ return results; } - + public static void updatePageNodeChildren(GenericValue content, Map context) throws GenericEntityException { - + String contentId = content.getString("contentId"); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { @@ -1262,10 +1262,10 @@ // } else if (contentTypeId.equals("OUTLINE_NODE")) { // newContentTypeId = "PAGE_NODE"; // } - + content.put("contentTypeId", newContentTypeId); content.store(); - + //if (contentTypeId == null || contentTypeId.equals("OUTLINE_DOCUMENT") || contentTypeId.equals("DOCUMENT")) { List kids = ContentWorker.getAssociatedContent(content, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); Iterator iter = kids.iterator(); @@ -1277,7 +1277,7 @@ } public static void updateOutlineNodeChildren(GenericValue content, boolean forceOutline, Map context) throws GenericEntityException { - + String contentId = content.getString("contentId"); Set visitedSet = (Set)context.get("visitedSet"); if (visitedSet == null) { @@ -1305,10 +1305,10 @@ } else if (contentTypeId.equals("SUBPAGE_NODE")) { newContentTypeId = "PAGE_NODE"; } - + content.put("contentTypeId", newContentTypeId); content.store(); - + if (contentTypeId == null || contentTypeId.equals("DOCUMENT") || contentTypeId.equals("OUTLINE_NODE")) { //if (contentTypeId == null || contentTypeId.equals("DOCUMENT")) { List kids = ContentWorker.getAssociatedContent(content, "from", UtilMisc.toList("SUB_CONTENT"), null, null, null); @@ -1341,7 +1341,7 @@ } return results; } - + public static String updateTypeAndFile(GenericValue dataResource, Map context) { String retVal = null; String mimeTypeId = (String) context.get("_imageData_contentType"); @@ -1360,7 +1360,7 @@ public static Map<String, Object> initContentChildCounts(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); - + GenericValue content = (GenericValue)context.get("content"); if (content == null) { return ServiceUtil.returnError("No Content found."); @@ -1373,7 +1373,7 @@ if (branchCount == null) { content.set("childBranchCount", Long.valueOf(0)); } - + //content.store(); return result; @@ -1382,10 +1382,10 @@ public static Map<String, Object> incrementContentChildStats(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); - + String contentId = (String)context.get("contentId"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); - + try { GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); if (content == null) { @@ -1397,21 +1397,21 @@ } int changeLeafCount = leafCount.intValue() + 1; int changeBranchCount = 1; - + ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount, changeLeafCount); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.toString()); } return result; } - + public static Map<String, Object> decrementContentChildStats(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); - + String contentId = (String)context.get("contentId"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); - + try { GenericValue content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", contentId)); if (content == null) { @@ -1423,7 +1423,7 @@ } int changeLeafCount = -1 * leafCount.intValue() - 1; int changeBranchCount = -1; - + ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount, changeLeafCount); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.toString()); @@ -1434,7 +1434,7 @@ public static Map<String, Object> updateContentChildStats(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); - + String contentId = (String)context.get("contentId"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); List typeList = FastList.newInstance(); @@ -1443,7 +1443,7 @@ } else { typeList = UtilMisc.toList("PUBLISH_LINK", "SUB_CONTENT"); } - + try { ContentManagementWorker.updateStatsTopDown(delegator, contentId, typeList); } catch (GenericEntityException e) { @@ -1451,13 +1451,13 @@ } return result; } - + public static Map<String, Object> updateContentSubscription(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - + String partyId = (String) context.get("partyId"); String webPubPt = (String) context.get("contentId"); String roleTypeId = (String) context.get("useRoleTypeId"); @@ -1477,7 +1477,7 @@ } catch (GenericEntityException e) { return ServiceUtil.returnError(e.toString()); } - + if (contentRole == null) { contentRole = delegator.makeValue("ContentRole"); contentRole.set("contentId", webPubPt); @@ -1485,7 +1485,7 @@ contentRole.set("roleTypeId", roleTypeId); contentRole.set("fromDate", nowTimestamp); } - + Timestamp thruDate = (Timestamp) contentRole.get("thruDate"); if (thruDate == null) { // no thruDate? start with NOW @@ -1530,7 +1530,7 @@ } return result; } - + public static Map<String, Object> updateContentSubscriptionByProduct(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException{ Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); Map result = FastMap.newInstance(); @@ -1541,7 +1541,7 @@ if (qty == null) { qty = Integer.valueOf(1); } - + Timestamp orderCreatedDate = (Timestamp) context.get("orderCreatedDate"); if (orderCreatedDate == null) { orderCreatedDate = UtilDateTime.nowTimestamp(); @@ -1577,16 +1577,16 @@ result = dispatcher.runSync("updateContentSubscription", ctx); return result; } - + public static Map<String, Object> updateContentSubscriptionByOrder(DispatchContext dctx, Map<String, ? extends Object> rcontext) throws GenericServiceException{ Map<String, Object> context = UtilMisc.makeMapWritable(rcontext); Map result = FastMap.newInstance(); GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String orderId = (String) context.get("orderId"); - + Debug.logInfo("In updateContentSubscriptionByOrder service with orderId: " + orderId, module); - + GenericValue orderHeader = null; try { List orderRoleList = delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "END_USER_CUSTOMER")); @@ -1597,7 +1597,7 @@ } else { String msg = "No OrderRole found for orderId:" + orderId; return ServiceUtil.returnFailure(msg); - + } orderHeader = delegator.findByPrimaryKeyCache("OrderHeader", UtilMisc.toMap("orderId", orderId)); if (orderHeader == null) { @@ -1630,7 +1630,7 @@ } public static Map<String, Object> followNodeChildren(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException{ - + Map result = null; GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -1653,7 +1653,7 @@ ctx.put("userLogin", userLogin); ctx.put("contentAssocTypeIdList", contentAssocTypeIdList); try { - + GenericValue content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); result = followNodeChildrenMethod(content, dispatcher, serviceName, ctx); } catch (GenericEntityException e) { @@ -1664,7 +1664,7 @@ } public static Map followNodeChildrenMethod(GenericValue content, LocalDispatcher dispatcher, String serviceName, Map context) throws GenericEntityException, GenericServiceException { - + Map result = null; String contentId = content.getString("contentId"); List contentAssocTypeIdList = (List)context.get("contentAssocTypeIdList" ); @@ -1683,7 +1683,7 @@ GenericValue userLogin = (GenericValue)context.get("userLogin"); result = dispatcher.runSync(serviceName, UtilMisc.toMap("content", content, "userLogin", userLogin)); - + List kids = ContentWorker.getAssociatedContent(content, "from", contentAssocTypeIdList, null, null, null); Iterator iter = kids.iterator(); while (iter.hasNext()) { @@ -1713,7 +1713,7 @@ return ServiceUtil.returnError(e.toString()); } } - + try { ModelService persistContentAndAssocModel = dispatcher.getDispatchContext().getModelService("persistContentAndAssoc"); Map ctx = persistContentAndAssocModel.makeValid(context, "IN"); @@ -1738,7 +1738,7 @@ } else { parentList.add(masterRevisionContentId); } - + // Update ContentRevision and ContentRevisonItem Map contentRevisionMap = FastMap.newInstance(); contentRevisionMap.put("itemContentId", contentId); @@ -1754,7 +1754,7 @@ return ServiceUtil.returnError(errorMsg); } } - + } catch (GenericServiceException e) { Debug.logError(e.toString(), module); return ServiceUtil.returnError(e.toString()); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java?rev=759248&r1=759247&r2=759248&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementWorker.java Fri Mar 27 17:00:22 2009 @@ -104,7 +104,7 @@ lkupCache = new LifoSet(); lookupCaches.put(cacheEntityName, lkupCache); } - + lkupCache.add(pk.getPrimaryKey()); if (Debug.infoOn()) Debug.logInfo("in mruAddByEntityName, entityName:" + entityName + " lifoSet.size()" + lkupCache.size(), module); } @@ -117,7 +117,7 @@ lkupCache = new LifoSet(); lookupCaches.put(cacheEntityName, lkupCache); } - + Iterator mrvIterator = lkupCache.iterator(); return mrvIterator; } @@ -153,7 +153,7 @@ public static void setCurrentEntityMap(HttpServletRequest request, GenericEntity ent) { - + String entityName = ent.getEntityName(); setCurrentEntityMap(request, entityName, ent); } @@ -317,7 +317,7 @@ public static List getPermittedPublishPoints(GenericDelegator delegator, List allPublishPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { List permittedPublishPointList = FastList.newInstance(); - + // Check that user has permission to admin sites Iterator it = allPublishPoints.iterator(); while (it.hasNext()) { @@ -515,7 +515,7 @@ public static String getParentWebSitePublishPointId(GenericDelegator delegator, String contentId) throws GenericEntityException { - + String contentIdTo = null; List contentAssocList = delegator.findByAndCache("ContentAssoc", UtilMisc.toMap("contentId", contentId, "contentAssocTypeId", "SUBSITE")); List filteredContentAssocList = EntityUtil.filterByDate(contentAssocList); @@ -637,7 +637,7 @@ } public static GenericValue getAuthorContent(GenericDelegator delegator, String contentId) { - + GenericValue authorContent = null; try { List assocTypes = UtilMisc.toList("AUTHOR"); @@ -663,7 +663,7 @@ public static List getPermittedDepartmentPoints(GenericDelegator delegator, List allDepartmentPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { List permittedDepartmentPointList = FastList.newInstance(); - + // Check that user has permission to admin sites Iterator it = allDepartmentPoints.iterator(); while (it.hasNext()) { @@ -740,7 +740,7 @@ GenericValue thisContent = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); if (thisContent == null) throw new RuntimeException("No entity found for id=" + contentId); - + EntityCondition conditionMain = null; if (typeList.size() > 0 ) { EntityCondition conditionType = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList); @@ -756,22 +756,22 @@ String subContentId = contentAssoc.getString("contentId"); subLeafCount += updateStatsTopDown(delegator, subContentId, typeList); } - + // If no children, count this as a leaf if (subLeafCount == 0) subLeafCount = 1; thisContent.put("childBranchCount", Long.valueOf(listFiltered.size())); thisContent.put("childLeafCount", Long.valueOf(subLeafCount)); thisContent.store(); - + return subLeafCount; } - + public static void updateStatsBottomUp(GenericDelegator delegator, String contentId, List typeList, int branchChangeAmount, int leafChangeAmount) throws GenericEntityException { GenericValue thisContent = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); if (thisContent == null) throw new RuntimeException("No entity found for id=" + contentId); - + EntityCondition conditionType = EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList); EntityCondition conditionMain = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId), conditionType), EntityOperator.AND); List listAll = delegator.findList("ContentAssoc", conditionMain, null, null, null, true); @@ -787,7 +787,7 @@ intLeafCount = leafCount.intValue(); } contentTo.set("childLeafCount", Long.valueOf(intLeafCount + leafChangeAmount)); - + if (branchChangeAmount != 0) { int intBranchCount = 0; Long branchCount = (Long)contentTo.get("childBranchCount"); @@ -799,8 +799,8 @@ contentTo.store(); updateStatsBottomUp(delegator, contentIdTo, typeList, 0, leafChangeAmount); } - - + + } - + } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java?rev=759248&r1=759247&r2=759248&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ConvertTree.java Fri Mar 27 17:00:22 2009 @@ -93,7 +93,7 @@ Entity.set("createdStamp",UtilDateTime.nowTimestamp()); Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); delegator.create(Entity); - + Entity = null; Entity = delegator.makeValue("Content"); Entity.set("contentId", "HOME_DUCUMENT"); @@ -132,7 +132,7 @@ //Debug.log("======Data======"+data); size = data.length(); List<GenericValue> contents = null; - + for(int index = 0; index< size; index++) {//start character in line boolean contentNameMatch = false; int contentAssocSize=0; @@ -168,11 +168,11 @@ } else { rootContent = "HOME_DUCUMENT"; contentAssocs= delegator.findByAnd("ContentAssoc", UtilMisc.toMap("contentId",contentId, "contentIdTo", rootContent)); - + } contentAssocSize=contentAssocs.size(); } - + if ( contentAssocSize == 0 && contentNameMatch==false) {//New Root Content Entity = null; contentId = delegator.getNextSeqId("Content"); @@ -253,7 +253,7 @@ return ServiceUtil.returnError(errMsg); } } - + public static Map<String,Object> createSubContent(int index,String line,String rootContent, Map context, DispatchContext dctx) { GenericDelegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -317,7 +317,7 @@ Entity.set("createdStamp",UtilDateTime.nowTimestamp()); Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); delegator.create(Entity); - + //Relation Content Map<String,Object> contentAssoc = FastMap.newInstance(); contentAssoc.put("contentId", contentId); @@ -329,7 +329,7 @@ contentName =""; contentNameInprogress=""; } - + if ((subContents.charAt(index))!= check.charAt(0)) { contentNameInprogress = contentNameInprogress.concat(Character.toString(subContents.charAt(index))); if (contentNameInprogress.length() > 99) { @@ -377,7 +377,7 @@ Entity.set("createdStamp",UtilDateTime.nowTimestamp()); Entity.set("createdTxStamp",UtilDateTime.nowTimestamp()); delegator.create(Entity); - + //create ContentAssoc Map<String,Object> contentAssoc = FastMap.newInstance(); contentAssoc.put("contentId", contentId); @@ -387,7 +387,7 @@ dispatcher.runSync("createContentAssoc", contentAssoc); } } - + } return ServiceUtil.returnSuccess(sucMsg); } catch (GenericEntityException e) { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java?rev=759248&r1=759247&r2=759248&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/cms/CmsEvents.java Fri Mar 27 17:00:22 2009 @@ -65,7 +65,7 @@ LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); ServletContext servletContext = request.getSession().getServletContext(); HttpSession session = request.getSession(); - + String webSiteId = (String) session.getAttribute("webSiteId"); if (webSiteId == null) { webSiteId = WebSiteWorker.getWebSiteId(request); @@ -132,7 +132,7 @@ pathInfo = pathInfo.substring(0, pathInfo.length() - 1); } Debug.log("Path INFO for Alias: " + pathInfo, module); - + GenericValue pathAlias = null; try { pathAlias = delegator.findByPrimaryKeyCache("WebSitePathAlias", UtilMisc.toMap("webSiteId", webSiteId, "pathAlias", pathInfo)); @@ -198,12 +198,12 @@ MapStack<String> templateMap = MapStack.create(); ScreenRenderer.populateContextForRequest(templateMap, null, request, response, servletContext); templateMap.put("formStringRenderer", new HtmlFormRenderer(request, response)); - + // make the link prefix ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); templateMap.put("_REQUEST_HANDLER_", rh); - + // NOTE DEJ20080817: this is done in the ContentMapFacade class now to avoid problems with the jsessionid being in the middle of the URL and such //String contextLinkPrefix = rh.makeLink(request, response, "", true, false, true); //templateMap.put("_CONTEXT_LINK_PREFIX_", contextLinkPrefix); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java?rev=759248&r1=759247&r2=759248&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java Fri Mar 27 17:00:22 2009 @@ -56,7 +56,7 @@ */ public class CompDocEvents { public static final String module = CompDocEvents.class.getName(); - + /** * * @param request @@ -78,7 +78,7 @@ GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); String contentId = (String)paramMap.get("contentId"); //String instanceContentId = null; - + boolean contentExists = true; if (UtilValidate.isEmpty(contentId)) { contentExists = false; @@ -93,7 +93,7 @@ return "error"; } } - + ModelService modelService = null; try { modelService = dispatcher.getDispatchContext().getModelService("persistContentAndAssoc"); @@ -136,7 +136,7 @@ request.setAttribute("_ERROR_MESSAGE_", "<li>" + errMsg + "</li>"); return "error"; } - + } catch (GenericServiceException e) { String errMsg = "Error running serviceName, 'persistContentAndAssoc'. " + e.toString(); Debug.logError(errMsg, module); @@ -145,7 +145,7 @@ } return "success"; } - + public static String padNumberWithLeadingZeros(Long num, Integer padLen) { String s = UtilFormatOut.formatPaddedNumber(num.longValue(), padLen.intValue()); return s; @@ -164,7 +164,7 @@ String rootDir = null; String webSiteId = null; String https = null; - + if (UtilValidate.isEmpty(rootDir)) { rootDir = servletContext.getRealPath("/"); } @@ -174,7 +174,7 @@ if (UtilValidate.isEmpty(https)) { https = (String) servletContext.getAttribute("https"); } - + Map mapIn = FastMap.newInstance(); mapIn.put("contentId", contentId); mapIn.put("locale", locale); @@ -182,7 +182,7 @@ mapIn.put("webSiteId", webSiteId); mapIn.put("https", https); mapIn.put("userLogin", userLogin); - + Map results = null; try { results = dispatcher.runSync("renderCompDocPdf", mapIn); @@ -196,19 +196,19 @@ request.setAttribute("_ERROR_MESSAGE_", e.toString()); return "error"; } - + if (ServiceUtil.isError(results)) { request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(results)); return "error"; } - + ByteBuffer outByteBuffer = (ByteBuffer) results.get("outByteBuffer"); // setup content type String contentType = "application/pdf; charset=ISO-8859-1"; ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array()); - + /* try { FileOutputStream fos = new FileOutputStream(FileUtil.getFile("/home/byersa/pdftest.pdf")); @@ -238,7 +238,7 @@ String rootDir = null; String webSiteId = null; String https = null; - + if (UtilValidate.isEmpty(rootDir)) { rootDir = servletContext.getRealPath("/"); } @@ -248,7 +248,7 @@ if (UtilValidate.isEmpty(https)) { https = (String) servletContext.getAttribute("https"); } - + Map mapIn = FastMap.newInstance(); mapIn.put("contentId", contentId); mapIn.put("locale", locale); @@ -256,7 +256,7 @@ mapIn.put("webSiteId", webSiteId); mapIn.put("https", https); mapIn.put("userLogin", userLogin); - + Map results = null; try { results = dispatcher.runSync("renderContentPdf", mapIn); @@ -270,19 +270,19 @@ request.setAttribute("_ERROR_MESSAGE_", e.toString()); return "error"; } - + if (ServiceUtil.isError(results)) { request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(results)); return "error"; } - + ByteBuffer outByteBuffer = (ByteBuffer) results.get("outByteBuffer"); // setup content type String contentType = "application/pdf; charset=ISO-8859-1"; ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array()); - + /* try { FileOutputStream fos = new FileOutputStream(FileUtil.getFile("/home/byersa/pdftest.pdf")); 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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -63,7 +63,7 @@ public class CompDocServices { public static final String module = CompDocServices.class.getName(); - + /** * * @param request @@ -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,20 +142,20 @@ 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 { Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); List exprList = FastList.newInstance(); @@ -173,12 +173,12 @@ 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); @@ -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,20 +301,20 @@ 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 { //Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); //ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -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, "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/ContentMapFacade.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentMapFacade.java?rev=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 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; } @@ -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 { 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=759248&r1=759247&r2=759248&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 Mar 27 17:00:22 2009 @@ -91,7 +91,7 @@ */ 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"); @@ -132,7 +132,7 @@ partyId = userLogin.getString("partyId"); } - + // Do entity permission check. This will pass users with administrative permissions. boolean passed = false; // I realized, belatedly, that I wanted to be able to pass parameters in as @@ -148,7 +148,7 @@ } passedPurposes.addAll(purposesFromString); } - + EntityPermissionChecker.StdAuxiliaryValueGetter auxGetter = new EntityPermissionChecker.StdAuxiliaryValueGetter("ContentPurpose", "contentPurposeTypeId", "contentId"); // Sometimes permissions need to be checked before an entity is created, so // there needs to be a method for setting a purpose list @@ -168,7 +168,7 @@ //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"); @@ -179,13 +179,13 @@ 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(); @@ -195,7 +195,7 @@ if (displayPassCond) { errBuf.append("\n hasEntityPermission(" + entityAction + "): PASSED" ); } - + } else { if (displayFailCond) { errBuf.append("\n hasEntityPermission(" + entityAction + "): FAILED" ); @@ -222,7 +222,7 @@ 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(); @@ -271,7 +271,7 @@ 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) { @@ -339,5 +339,5 @@ } 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=759248&r1=759247&r2=759248&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 Mar 27 17:00:22 2009 @@ -150,7 +150,7 @@ } return results; } - + private static void walkParentTree(Map nodeMap, List parentList) { List kids = (List)nodeMap.get("kids"); if (UtilValidate.isEmpty(kids)) { @@ -558,7 +558,7 @@ return ServiceUtil.returnError("Problem updating content Status: " + e); } } - + content.setNonPKFields(context); content.put("lastModifiedByUserLogin", lastModifiedByUserLogin); content.put("lastModifiedDate", lastModifiedDate); @@ -1037,13 +1037,13 @@ 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"); - + try { content.put("statusId", "CTNT_PUBLISHED"); content.store(); @@ -1053,9 +1053,9 @@ } 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,7 +1076,7 @@ } 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(); @@ -1088,7 +1088,7 @@ 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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -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=759248&r1=759247&r2=759248&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 Mar 27 17:00:22 2009 @@ -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; @@ -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; @@ -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); @@ -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; @@ -894,7 +894,7 @@ 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 { @@ -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,7 +976,7 @@ 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) { @@ -1002,7 +1002,7 @@ } public static Map callContentPermissionCheckResult(GenericDelegator delegator, LocalDispatcher dispatcher, Map context) { - + Map permResults = FastMap.newInstance(); String skipPermissionCheck = (String) context.get("skipPermissionCheck"); @@ -1271,7 +1271,7 @@ } return bool; } - + public static List prepTargetOperationList(Map context, String md) { @@ -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; @@ -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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -255,7 +255,7 @@ //if (Debug.infoOn()) Debug.logInfo("renderCCMapHtml, (1):" + rMap, module); sb.append(renderResultRowHtml(rMap, cMap)); } - + return sb.toString(); } 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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -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); 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; @@ -191,7 +191,7 @@ 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; @@ -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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -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,7 +253,7 @@ 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", @@ -265,7 +265,7 @@ return "error"; } } - + String mimeType = DataResourceWorker.getMimeType(dataResource); //if (Debug.infoOn()) Debug.logInfo("in serveImage, imageType:" + imageType, module); @@ -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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -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"); @@ -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; @@ -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 { @@ -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=759248&r1=759247&r2=759248&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 Fri Mar 27 17:00:22 2009 @@ -126,7 +126,7 @@ return ServiceUtil.returnError(e.getMessage()); } } - + try { dataResource.create(); } catch (GenericEntityException e) { @@ -160,7 +160,7 @@ return ServiceUtil.returnError(e.getMessage()); } } - + return result; } @@ -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 { |
Free forum by Nabble | Edit this page |