You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2016/07/16 14:10:10 UTC
svn commit: r1752965 [2/3] - in
/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content:
./ cms/ compdoc/ content/ data/ layout/ openoffice/ survey/ webapp/ftl/
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java Sat Jul 16 14:10:10 2016
@@ -161,27 +161,19 @@ public class PermissionRecorder {
permCheckResults.add(currentContentMap);
String s = null;
if (targetOperations != null) {
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, targetOperations:" + targetOperations, module);
s = targetOperations.toString();
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, targetOperations(string):" + s, module);
currentContentMap.put("contentOperationId", s);
}
if (purposes != null) {
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, purposes:" + purposes, module);
s = purposes.toString();
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, purposes(string):" + s, module);
currentContentMap.put("contentPurposeTypeId", s);
}
if (roles != null) {
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, roles:" + roles, module);
s = roles.toString();
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, roles(string):" + s, module);
currentContentMap.put("roleTypeId", s);
}
if (targStatusList != null) {
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, targStatusList:" + targStatusList, module);
s = targStatusList.toString();
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, targStatusList(string):" + s, module);
currentContentMap.put("statusId", s);
}
List<Map<String, Object>> checkResultList = new LinkedList<Map<String,Object>>();
@@ -190,7 +182,6 @@ public class PermissionRecorder {
currentContentMap.put("checkResultList", checkResultList);
currentContentMap.put("matches", null);
currentContentId = contentId;
- //if (Debug.infoOn()) Debug.logInfo("startMatchGroup, currentContentMap:" + currentContentMap, module);
}
public void record(GenericValue purposeOp, boolean targetOpCond, boolean purposeCond, boolean statusCond, boolean privilegeCond, boolean roleCond) {
@@ -203,7 +194,6 @@ public class PermissionRecorder {
map.put("contentId", currentContentId);
List<Map<String, Object>> checkResultList = UtilGenerics.checkList(currentContentMap.get("checkResultList"));
checkResultList.add(map);
- //if (Debug.infoOn()) Debug.logInfo("record, map:" + map, module);
}
public String toHtml() {
@@ -215,7 +205,6 @@ public class PermissionRecorder {
sb.append(".headr {background-color:white; font-weight:bold; font-family:Verdana,Arial,sans-serif; font-size:12px; }");
sb.append("</style>");
- //if (Debug.infoOn()) Debug.logInfo("toHtml, style:" + sb.toString(), module);
sb.append("<table border=\"1\" >");
// Do header row
sb.append("<tr>");
@@ -224,7 +213,6 @@ public class PermissionRecorder {
sb.append("Content Id");
sb.append("</td>");
- //if (Debug.infoOn()) Debug.logInfo("renderResultRowHtml, (1):" + sb.toString(), module);
for (int i=0; i < fieldTitles.length; i++) {
String opField = fieldTitles[i];
sb.append("<td class=\"headr\">");
@@ -245,14 +233,12 @@ public class PermissionRecorder {
StringBuilder sb = new StringBuilder();
List<Map<String, Object>> resultList = UtilGenerics.checkList(cMap.get("checkResultList"));
for (Map<String, Object> rMap : resultList) {
- //if (Debug.infoOn()) Debug.logInfo("renderCCMapHtml, (1):" + rMap, module);
sb.append(renderResultRowHtml(rMap, cMap));
}
return sb.toString();
}
- //public static final String [] opFields = { "contentPurposeTypeId", "contentOperationId", "roleTypeId", "statusId", "privilegeEnumId"};
public String renderResultRowHtml(Map<String, Object> rMap, Map<String, Object> currentContentResultMap) {
StringBuilder sb = new StringBuilder();
@@ -281,7 +267,6 @@ public class PermissionRecorder {
sb.append("<td class=\"target\" > </td>");
sb.append("</tr>");
- //if (Debug.infoOn()) Debug.logInfo("renderResultRowHtml, (2):" + sb.toString(), module);
// Do UUT row
sb.append("<tr>");
@@ -297,16 +282,13 @@ public class PermissionRecorder {
if (!bool.booleanValue())
isPass = false;
sb.append("<td class=\"" + cls + "\">");
- //if (Debug.infoOn()) Debug.logInfo("renderResultRowHtml, (2b):" + sb.toString(), module);
s = (String)rMap.get(opField);
- //if (Debug.infoOn()) Debug.logInfo("renderResultRowHtml, (s):" + s, module);
sb.append(s);
sb.append("</td>");
}
String passFailCls = (isPass) ? "pass" : "fail";
sb.append("<td class=\"" + passFailCls +"\">" + passFailCls.toUpperCase() + "</td>");
sb.append("</tr>");
- //if (Debug.infoOn()) Debug.logInfo("renderResultRowHtml, (3):" + sb.toString(), module);
return sb.toString();
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java Sat Jul 16 14:10:10 2016
@@ -85,7 +85,6 @@ public class UploadContentAndImage {
Debug.logError("[UploadContentAndImage.uploadContentAndImage] " + e4.getMessage(), module);
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);
@@ -100,7 +99,6 @@ public class UploadContentAndImage {
byte[] imageBytes = {};
for (int i = 0; i < lst.size(); i++) {
fi = lst.get(i);
- //String fn = fi.getName();
String fieldName = fi.getFieldName();
if (fi.isFormField()) {
String fieldStr = fi.getString();
@@ -138,7 +136,6 @@ public class UploadContentAndImage {
ftlContext.put("description", passedParams.get("description"));
ftlContext.put("privilegeEnumId", passedParams.get("privilegeEnumId"));
String drid = (String)passedParams.get("dataResourceId");
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]drid:" + drid, module);
ftlContext.put("dataResourceId", drid);
ftlContext.put("dataResourceTypeId", null); // inhibits persistence of DataResource, because it already exists
String contentIdTo = (String)passedParams.get("contentIdTo");
@@ -194,7 +191,6 @@ public class UploadContentAndImage {
String ftlDataResourceId = drid;
if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]ftlContentId:" + ftlContentId, module);
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]ftlDataResourceId:" + ftlDataResourceId, module);
// Create or update summary text subContent
if (passedParams.containsKey("summaryData")) {
Map<String, Object> sumContext = new HashMap<String, Object>();
@@ -204,7 +200,6 @@ public class UploadContentAndImage {
sumContext.put("contentTypeId", "DOCUMENT");
sumContext.put("statusId", passedParams.get("statusId"));
sumContext.put("contentPurposeList", UtilMisc.toList("SUMMARY"));
- //sumContext.put("contentPurposeList", contentPurposeList);
sumContext.put("targetOperationList",targetOperationList);
sumContext.put("contentName", passedParams.get("contentName"));
sumContext.put("description", passedParams.get("description"));
@@ -233,7 +228,6 @@ public class UploadContentAndImage {
txtContext.put("ownerContentId", ftlContentId);
txtContext.put("contentTypeId", "DOCUMENT");
txtContext.put("statusId", passedParams.get("statusId"));
- //txtContext.put("contentPurposeList", contentPurposeList);
txtContext.put("contentPurposeList", UtilMisc.toList("MAIN_ARTICLE"));
txtContext.put("targetOperationList",targetOperationList);
txtContext.put("contentName", passedParams.get("contentName"));
@@ -269,9 +263,6 @@ public class UploadContentAndImage {
imgContext.put("privilegeEnumId", passedParams.get("privilegeEnumId"));
imgContext.put("targetOperationList",targetOperationList);
imgContext.put("dataResourceId", passedParams.get("imgDataResourceId"));
- //String dataResourceTypeId = (String)passedParams.get("dataResourceTypeId");
- //if (UtilValidate.isEmpty(dataResourceTypeId))
- //dataResourceTypeId = "IMAGE_OBJECT";
String dataResourceTypeId = "IMAGE_OBJECT";
imgContext.put("dataResourceTypeId", dataResourceTypeId);
imgContext.put("contentIdTo", ftlContentId);
@@ -279,7 +270,6 @@ public class UploadContentAndImage {
imgContext.put("imageData", imageBytes);
imgContext.put("mapKey", "IMAGE");
imgContext.put("dataTemplateTypeId", "NONE");
- // String rootDir = request.getSession().getServletContext().getRealPath("/");
imgContext.put("rootDir", "rootDir");
if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]imgContext " + imgContext, module);
Map<String, Object> imgResults = dispatcher.runSync("persistContentAndAssoc", imgContext);
@@ -298,7 +288,6 @@ public class UploadContentAndImage {
long currentAuthorAssocCount = EntityQuery.use(delegator).from("ContentAssoc")
.where("contentId", ftlContentId, "contentIdTo", userLoginId, "contentAssocTypeId", "AUTHOR")
.filterByDate().queryCount();
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]currentAuthorAssocList " + currentAuthorAssocList, module);
if (currentAuthorAssocCount == 0) {
// Don't want to bother with permission checking on this association
GenericValue authorAssoc = delegator.makeValue("ContentAssoc");
@@ -322,7 +311,6 @@ public class UploadContentAndImage {
String newTrail = passedParams.get("nodeTrailCsv") + "," + ftlContentId;
request.setAttribute("nodeTrailCsv", newTrail);
request.setAttribute("passedParams", passedParams);
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]newTrail: " + newTrail, module);
TransactionUtil.commit();
} catch (Exception e) {
Debug.logError(e, "[UploadContentAndImage] " , module);
@@ -344,7 +332,6 @@ public class UploadContentAndImage {
GenericValue userLogin = (GenericValue)session.getAttribute("userLogin");
ServletFileUpload dfu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]DiskFileUpload " + dfu, module);
List<FileItem> lst = null;
try {
lst = UtilGenerics.checkList(dfu.parseRequest(request));
@@ -353,7 +340,6 @@ public class UploadContentAndImage {
Debug.logError("[UploadContentAndImage.uploadContentAndImage] " + e4.getMessage(), module);
return "error";
}
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]lst " + lst, module);
if (lst.size() == 0) {
request.setAttribute("_ERROR_MESSAGE_", "No files uploaded");
@@ -368,7 +354,6 @@ public class UploadContentAndImage {
passedParams.put("userLogin", userLogin);
for (int i = 0; i < lst.size(); i++) {
fi = lst.get(i);
- //String fn = fi.getName();
String fieldName = fi.getFieldName();
if (fi.isFormField()) {
String fieldStr = fi.getString();
@@ -491,9 +476,6 @@ public class UploadContentAndImage {
ftlContext.put("textData", passedParams.get("textData" + suffix));
byte[] bytes = (byte[])passedParams.get("imageData" + suffix);
ftlContext.put("imageData", bytes);
- //if (Debug.infoOn()) Debug.logInfo("[UploadContentStuff]byteBuffer:" + bytes, module);
- //contentAssocDataResourceViewFrom.setAllFields(ftlContext2, true, null, null);
- //ftlContext.putAll(ftlContext2);
if (Debug.infoOn()) {
Debug.logInfo("[UploadContentStuff]ftlContext:" + ftlContext, module);
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java Sat Jul 16 14:10:10 2016
@@ -186,9 +186,6 @@ public class DataResourceWorker impleme
*/
// TODO: This method is not used and should be removed. amb
public static String uploadAndStoreImage(HttpServletRequest request, String idField, String uploadField) {
- //Delegator delegator = (Delegator) request.getAttribute("delegator");
-
- //String idFieldValue = null;
ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
List<FileItem> lst = null;
Locale locale = UtilHttp.getLocale(request);
@@ -218,7 +215,6 @@ public class DataResourceWorker impleme
byte[] imageBytes = null;
for (int i = 0; i < lst.size(); i++) {
fi = lst.get(i);
- //String fn = fi.getName();
String fieldName = fi.getFieldName();
if (fi.isFormField()) {
String fieldStr = fi.getString();
@@ -342,7 +338,6 @@ public class DataResourceWorker impleme
String dataResourceId = dataResource.getString("dataResourceId");
GenericValue imageDataResource = EntityQuery.use(delegator).from("ImageDataResource").where("dataResourceId", dataResourceId).queryOne();
if (imageDataResource != null) {
- //b = (byte[]) imageDataResource.get("imageData");
b = imageDataResource.getBytes("imageData");
}
return b;
@@ -454,10 +449,8 @@ public class DataResourceWorker impleme
String mimeType = null;
if (view != null)
mimeType = view.getString("drMimeTypeId");
- //if (Debug.infoOn()) Debug.logInfo("getDataResourceMimeType, mimeType(2):" + mimeType, "");
if (UtilValidate.isEmpty(mimeType) && UtilValidate.isNotEmpty(dataResourceId)) {
GenericValue dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).cache().queryOne();
- //if (Debug.infoOn()) Debug.logInfo("getDataResourceMimeType, dataResource(2):" + dataResource, "");
mimeType = dataResource.getString("mimeTypeId");
}
@@ -953,7 +946,6 @@ public class DataResourceWorker impleme
Debug.logError(" in renderDataResourceAsHtml(CONTEXT_FILE), got exception:" + e.getMessage(), module);
}
UtilIO.copy(in, true, out);
- //out.flush();
}
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java Sat Jul 16 14:10:10 2016
@@ -293,7 +293,6 @@ public class DataServices {
* A service wrapper for the updateDataResourceMethod method. Forces permissions to be checked.
*/
public static Map<String, Object> updateDataResource(DispatchContext dctx, Map<String, ? extends Object> context) {
- //context.put("skipPermissionCheck", null);
Map<String, Object> result = updateDataResourceMethod(dctx, context);
return result;
}
@@ -398,9 +397,7 @@ public class DataServices {
public static Map<String, Object> updateFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException {
Map<String, Object> result = new HashMap<String, Object>();
- //GenericValue fileText = null;
Locale locale = (Locale) context.get("locale");
- //String dataResourceId = (String) dataResource.get("dataResourceId");
String dataResourceTypeId = (String) context.get("dataResourceTypeId");
String objectInfo = (String) context.get("objectInfo");
String textData = (String) context.get("textData");
@@ -490,7 +487,6 @@ public class DataServices {
templateContext = new HashMap<String, Object>();
}
- // GenericValue view = (GenericValue) context.get("subContentDataResourceView");
Writer outWriter = new StringWriter();
DataResourceWorker.renderDataResourceAsText(delegator, dataResourceId, outWriter, templateContext, locale, mimeTypeId, true);
try {
@@ -555,7 +551,6 @@ public class DataServices {
byte[] imageBytes = byteBuffer.array();
try {
GenericValue imageDataResource = delegator.makeValue("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
- //imageDataResource.set("imageData", imageBytes);
imageDataResource.setBytes("imageData", imageBytes);
if (Debug.infoOn()) {
Debug.logInfo("imageDataResource(C):" + imageDataResource, module);
@@ -585,7 +580,6 @@ public class DataServices {
public static Map<String, Object> createBinaryFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException {
Map<String, Object> result = new HashMap<String, Object>();
GenericValue dataResource = (GenericValue) context.get("dataResource");
- //String dataResourceId = (String) dataResource.get("dataResourceId");
String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId");
String objectInfo = (String) dataResource.get("objectInfo");
byte [] imageData = (byte []) context.get("imageData");
@@ -642,7 +636,6 @@ public class DataServices {
public static Map<String, Object> updateBinaryFileMethod(DispatchContext dctx, Map<String, ? extends Object> context) throws GenericServiceException {
Map<String, Object> result = new HashMap<String, Object>();
GenericValue dataResource = (GenericValue) context.get("dataResource");
- //String dataResourceId = (String) dataResource.get("dataResourceId");
String dataResourceTypeId = (String) dataResource.get("dataResourceTypeId");
String objectInfo = (String) dataResource.get("objectInfo");
byte [] imageData = (byte []) context.get("imageData");
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java Sat Jul 16 14:10:10 2016
@@ -66,7 +66,6 @@ public class LayoutEvents {
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
HttpSession session = request.getSession();
Map<String, Object> uploadResults = LayoutWorker.uploadImageAndParameters(request, "imageData");
- //Debug.logVerbose("in createLayoutImage(java), uploadResults:" + uploadResults, "");
Map<String, Object> formInput = UtilGenerics.checkMap(uploadResults.get("formInput"));
Map<String, Object> context = new HashMap<String, Object>();
ByteBuffer byteWrap = (ByteBuffer) uploadResults.get("imageData");
@@ -75,9 +74,7 @@ public class LayoutEvents {
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
- //Debug.logVerbose("in createLayoutImage, byteWrap(0):" + byteWrap, module);
String imageFileName = (String) uploadResults.get("imageFileName");
- //Debug.logVerbose("in createLayoutImage(java), context:" + context, "");
String imageFileNameExt = null;
if (UtilValidate.isNotEmpty(imageFileName)) {
int pos = imageFileName.lastIndexOf(".");
@@ -114,14 +111,12 @@ public class LayoutEvents {
}
Map<String, Object> 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)) {
Map<String, Object> context2 = new HashMap<String, Object>();
context2.put("activeContentId", activeContentId);
- //context2.put("dataResourceId", dataResourceId);
context2.put("contentAssocTypeId", result.get("contentAssocTypeId"));
context2.put("fromDate", result.get("fromDate"));
@@ -132,12 +127,10 @@ public class LayoutEvents {
context2.put("contentIdTo", formInput.get("contentIdTo"));
context2.put("mapKey", formInput.get("mapKey"));
- //Debug.logVerbose("in createLayoutImage, context2:" + context2, module);
dispatcher.runSync("deactivateAssocs", context2);
}
GenericValue dataResource = EntityQuery.use(delegator).from("DataResource").where("dataResourceId", dataResourceId).queryOne();
- //Debug.logVerbose("in createLayoutImage, dataResource:" + dataResource, module);
// Use objectInfo field to store the name of the file, since there is no
// place in ImageDataResource for it.
if (dataResource != null) {
@@ -148,7 +141,6 @@ public class LayoutEvents {
// See if this needs to be a create or an update procedure
GenericValue imageDataResource = EntityQuery.use(delegator).from("ImageDataResource").where("dataResourceId", dataResourceId).queryOne();
- //Debug.logVerbose("in createLayoutImage, imageDataResource(0):" + imageDataResource, module);
if (imageDataResource == null) {
imageDataResource = delegator.makeValue("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId));
imageDataResource.set("imageData", byteWrap.array());
@@ -201,7 +193,6 @@ public class LayoutEvents {
// place in ImageDataResource for it.
Debug.logVerbose("in createLayoutImage(java), imageFileName:" + imageFileName, "");
if (dataResource != null) {
- //dataResource.set("objectInfo", imageFileName);
dataResource.setNonPKFields(context);
dataResource.store();
}
@@ -248,24 +239,6 @@ public class LayoutEvents {
String contentId = (String) paramMap.get("contentId");
context.put("userLogin", session.getAttribute("userLogin"));
-/*
- // If contentId is missing
- if (UtilValidate.isEmpty(contentId)) {
- // Look for an existing associated Content
- try {
- GenericValue dataResourceContentView = EntityQuery.use(delegator).from("DataResourceContentView")
- .where("dataResourceId", dataResourceId)
- .queryFirst();
- if (dataResourceContentView != null) {
- contentId = dataResourceContentView.getString("coContentId");
- }
- } catch (GenericEntityException e) {
- request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
- return "error";
- }
- // Else, create and associate a Content
- }
-*/
if (UtilValidate.isNotEmpty(contentId)) {
context.put("contentId", contentId);
context.put("contentIdTo", contentIdTo);
@@ -274,11 +247,9 @@ public class LayoutEvents {
try {
Map<String, Object> result = dispatcher.runSync("persistContentAndAssoc", context);
- //Debug.logVerbose("in replaceSubContent, result:" + result, module);
request.setAttribute("contentId", contentIdTo);
Map<String, Object> context2 = new HashMap<String, Object>();
context2.put("activeContentId", contentId);
- //context2.put("dataResourceId", dataResourceId);
context2.put("contentAssocTypeId", "SUB_CONTENT");
context2.put("fromDate", result.get("fromDate"));
@@ -288,7 +259,6 @@ public class LayoutEvents {
context2.put("contentIdTo", contentIdTo);
context2.put("mapKey", mapKey);
- //Debug.logVerbose("in replaceSubContent, context2:" + context2, module);
dispatcher.runSync("deactivateAssocs", context2);
} catch (GenericServiceException e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
@@ -498,14 +468,12 @@ public class LayoutEvents {
request.setAttribute("currentEntityName", "SubContentDataResourceId");
Map<String, Object> context2 = new HashMap<String, Object>();
context2.put("activeContentId", contentId);
- //context2.put("dataResourceId", dataResourceId);
context2.put("contentAssocTypeId", "SUB_CONTENT");
context2.put("fromDate", result.get("fromDate"));
context2.put("contentIdTo", contentIdTo);
context2.put("mapKey", mapKey);
context2.put("userLogin", userLogin);
- //Debug.logVerbose("in replaceSubContent, context2:" + context2, module);
dispatcher.runSync("deactivateAssocs", context2);
} catch (GenericServiceException e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
@@ -519,8 +487,6 @@ public class LayoutEvents {
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
HttpSession session = request.getSession();
Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
- // String contentIdTo = (String) paramMap.get("contentIdTo");
- // String mapKey = (String) paramMap.get("mapKey");
Map<String, Object> context = new HashMap<String, Object>();
List<Object> errorMessages = null;
Locale loc = (Locale) request.getSession().getServletContext().getAttribute("locale");
@@ -561,18 +527,6 @@ public class LayoutEvents {
request.setAttribute("contentId", contentId);
request.setAttribute("drDataResourceId", dataResourceId);
request.setAttribute("currentEntityName", "SubContentDataResourceId");
- /*
- Map context2 = new HashMap<String, Object>();
- context2.put("activeContentId", contentId);
- //context2.put("dataResourceId", dataResourceId);
- context2.put("contentAssocTypeId", "SUB_CONTENT");
- 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) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
return "error";
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java Sat Jul 16 14:10:10 2016
@@ -53,8 +53,6 @@ public final class LayoutWorker {
* and the binary data to be in a field id'd by uploadField.
*/
public static Map<String, Object> uploadImageAndParameters(HttpServletRequest request, String uploadField) {
-
- //Debug.logVerbose("in uploadAndStoreImage", "");
Locale locale = UtilHttp.getLocale(request);
Map<String, Object> results = new HashMap<String, Object>();
@@ -72,7 +70,6 @@ public final class LayoutWorker {
String errMsg = UtilProperties.getMessage(err_resource,
"layoutEvents.no_files_uploaded", locale);
request.setAttribute("_ERROR_MESSAGE_", errMsg);
- //Debug.logWarning("[DataEvents.uploadImage] No files uploaded", module);
return ServiceUtil.returnError(UtilProperties.getMessage(err_resource,
"layoutEvents.no_files_uploaded", locale));
}
@@ -88,7 +85,6 @@ public final class LayoutWorker {
if (fi.isFormField()) {
formInput.put(fieldName, fieldStr);
request.setAttribute(fieldName, fieldStr);
- //Debug.logVerbose("in uploadAndStoreImage, fieldName:" + fieldName + " fieldStr:" + fieldStr, "");
}
if (fieldName.equals(uploadField)) {
imageFi = fi;
@@ -101,7 +97,6 @@ public final class LayoutWorker {
String errMsg = UtilProperties.getMessage(err_resource,
"layoutEvents.image_null", UtilMisc.toMap("imageFi", imageFi), locale);
request.setAttribute("_ERROR_MESSAGE_", errMsg);
- //Debug.logWarning("[DataEvents.uploadImage] imageFi(" + imageFi + ") is null", module);
return null;
}
@@ -109,8 +104,6 @@ public final class LayoutWorker {
ByteBuffer byteWrap = ByteBuffer.wrap(imageBytes);
results.put("imageData", byteWrap);
results.put("imageFileName", imageFi.getName());
-
- //Debug.logVerbose("in uploadAndStoreImage, results:" + results, "");
return results;
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeByteArrayOutputStream.java Sat Jul 16 14:10:10 2016
@@ -36,12 +36,10 @@ public class OpenOfficeByteArrayOutputSt
public OpenOfficeByteArrayOutputStream() {
super();
- // TODO Auto-generated constructor stub
}
public OpenOfficeByteArrayOutputStream(int arg0) {
super(arg0);
- // TODO Auto-generated constructor stub
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeServices.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeServices.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeServices.java Sat Jul 16 14:10:10 2016
@@ -71,7 +71,6 @@ public class OpenOfficeServices {
Map results = ServiceUtil.returnSuccess();
Delegator delegator = dctx.getDelegator();
XMultiComponentFactory xmulticomponentfactory = null;
- //String uniqueSeqNum = delegator.getNextSeqId("OOTempDir");
Timestamp ts = UtilDateTime.nowTimestamp();
Random random = new Random(ts.getTime());
String uniqueSeqNum = Integer.toString(Math.abs(random.nextInt()));
@@ -95,11 +94,6 @@ public class OpenOfficeServices {
byte[] inByteArray = inByteBuffer.array();
// The following line work in linux, but not Windows or Mac environment. It is preferred because it does not use temporary files
- //OpenOfficeByteArrayInputStream oobais = new OpenOfficeByteArrayInputStream(inByteArray);
- //Debug.logInfo("Doing convertDocumentByteBuffer, inBytes size is [" + inByteArray.length + "]", module);
- //OpenOfficeByteArrayOutputStream baos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, outputMimeType);
-
-
String tempDir = EntityUtilProperties.getPropertyValue("content", "content.temp.dir", delegator);
fileIn = new File(tempDir + fileInName);
FileOutputStream fos = new FileOutputStream(fileIn);
@@ -312,11 +306,6 @@ public class OpenOfficeServices {
propertyvalue[ 0 ] = new PropertyValue();
propertyvalue[ 0 ].Name = "Hidden";
propertyvalue[ 0 ].Value = Boolean.valueOf(true);
- //TODO: Hardcoding opening word documents -- this will need to change.
- //propertyvalue[ 1 ] = new PropertyValue();
- //propertyvalue[ 1 ].Name = "FilterName";
- //propertyvalue[ 1 ].Value = "HTML (StarWriter)";
-
// Loading the wanted document
Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(stringUrl, "_blank", 0, propertyvalue);
@@ -329,12 +318,7 @@ public class OpenOfficeServices {
propertyvalue[ 0 ] = new PropertyValue();
propertyvalue[ 0 ].Name = "URL";
propertyvalue[ 0 ].Value = stringOriginalFile;
- // Setting the filter name
- //propertyvalue[ 1 ] = new PropertyValue();
- //propertyvalue[ 1 ].Name = "FilterName";
- //propertyvalue[ 1 ].Value = context.get("convertFilterName");
XFrame frame = desktop.getCurrentFrame();
- //XFrame frame = (XFrame) UnoRuntime.queryInterface(XFrame.class, desktop);
Object dispatchHelperObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.DispatchHelper", xcomponentcontext);
XDispatchHelper dispatchHelper = (XDispatchHelper) UnoRuntime.queryInterface(XDispatchHelper.class, dispatchHelperObj);
XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, frame);
@@ -346,11 +330,6 @@ public class OpenOfficeServices {
propertyvalue[ 0 ] = new PropertyValue();
propertyvalue[ 0 ].Name = "Overwrite";
propertyvalue[ 0 ].Value = Boolean.valueOf(true);
- // Setting the filter name
- //propertyvalue[ 1 ] = new PropertyValue();
- //propertyvalue[ 1 ].Name = "FilterName";
- //propertyvalue[ 1 ].Value = context.get("convertFilterName");
-
Debug.logInfo("stringOutFile: "+stringOutFile, module);
// Storing and converting the document
xstorable.storeToURL(stringOutFile, propertyvalue);
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeWorker.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeWorker.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/openoffice/OpenOfficeWorker.java Sat Jul 16 14:10:10 2016
@@ -97,19 +97,6 @@ public final class OpenOfficeWorker{
// Create a service manager from the initial object
xmulticomponentfactory = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, objectInitial);
} catch (Exception e) {
- // TODO: None of this works. Need a programmable start solution.
- //String ooxvfb = UtilProperties.getPropertyValue("openoffice-uno", "oo.start.xvfb");
- //String ooexport = UtilProperties.getPropertyValue("openoffice-uno", "oo.start.export");
- // String oosoffice = UtilProperties.getPropertyValue("openoffice-uno", "oo.start.soffice");
- //Process procXvfb = Runtime.getRuntime().exec(ooxvfb);
- //Process procExport = Runtime.getRuntime().exec(ooexport);
- /*
- Process procSoffice = Runtime.getRuntime().exec(oosoffice);
- Thread.sleep(3000);
- objectInitial = xurlresolver.resolve("uno:socket,host=" + host + ",port=" + port + ";urp;StarOffice.ServiceManager");
- xmulticomponentfactory = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, objectInitial);
- Debug.logInfo("soffice started. " + procSoffice, module);
- */
String errMsg = "Error connecting to OpenOffice with host [" + host + "] and port [" + port + "]: " + e.toString();
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
@@ -145,18 +132,9 @@ public final class OpenOfficeWorker{
XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(XNameAccess.class, filterFactory);
String [] filterNames = xNameAccess.getElementNames();
- //String [] serviceNames = filterFactory.getAvailableServiceNames();
for (int i=0; i < filterNames.length; i++) {
String s = filterNames[i];
Debug.logInfo(s, module);
- /*
- if (s.toLowerCase().indexOf("filter") >= 0) {
- Debug.logInfo("FILTER: " + s, module);
- }
- if (s.toLowerCase().indexOf("desktop") >= 0) {
- Debug.logInfo("DESKTOP: " + s, module);
- }
- */
}
List filterNameList = UtilMisc.toListArray(filterNames);
@@ -180,7 +158,6 @@ public final class OpenOfficeWorker{
frames. */
Object desktopObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop", xcomponentcontext);
- //XDesktop desktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktopObj);
XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktopObj);
@@ -222,8 +199,6 @@ public final class OpenOfficeWorker{
propertyvalue[2].Value = "1";
// Storing and converting the document
- //File newFile = new File(stringConvertedFile);
- //newFile.createNewFile();
String stringConvertedFile = convertToUrl(fileOutPath, xcomponentcontext);
Debug.logInfo("stringConvertedFile: "+stringConvertedFile, module);
@@ -255,7 +230,6 @@ public final class OpenOfficeWorker{
frames. */
Object desktopObj = xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop", xcomponentcontext);
- //XDesktop desktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktopObj);
XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, desktopObj);
// Preparing properties for loading the document
@@ -303,7 +277,6 @@ public final class OpenOfficeWorker{
propertyvalue[2].Value = "1";
xstorable.storeToURL("private:stream", propertyvalue);
- //xstorable.storeToURL("file:///home/byersa/testdoc1_file.pdf", propertyvalue);
// Getting the method dispose() for closing the document
XComponent xcomponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xstorable);
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java Sat Jul 16 14:10:10 2016
@@ -127,9 +127,6 @@ public class PdfSurveyServices {
} else if (type == AcroFields.FIELD_TYPE_LIST || type == AcroFields.FIELD_TYPE_COMBO) {
surveyQuestion.set("surveyQuestionTypeId", "OPTION");
// TODO: handle these specially with the acroFields.getListOptionDisplay (and getListOptionExport?)
- /*String[] listOptionDisplayArray = acroFields.getListOptionDisplay(fieldName);
- String[] listOptionExportArray = acroFields.getListOptionExport(fieldName);
- Debug.logInfo("listOptionDisplayArray: " + listOptionDisplayArray + "; listOptionExportArray: " + listOptionExportArray, module);*/
} else {
surveyQuestion.set("surveyQuestionTypeId", "TEXT_SHORT");
Debug.logWarning("Building Survey from PDF, fieldName=[" + fieldName + "]: don't know how to handle field type: " + type + "; defaulting to short text", module);
@@ -166,14 +163,6 @@ public class PdfSurveyServices {
// if the "/Type" value is "/Annot", then get the value of "/TU" for the annotation
- /* Interesting... this doesn't work, I guess we have to iterate to find the stuff...
- PdfObject typeValue = dict.get(new PdfName("/Type"));
- if (typeValue != null && "/Annot".equals(typeValue.toString())) {
- PdfObject tuValue = dict.get(new PdfName("/TU"));
- annotation = tuValue.toString();
- }
- */
-
PdfObject typeValue = null;
PdfObject tuValue = null;
@@ -186,7 +175,6 @@ public class PdfSurveyServices {
} else if ("/TU".equals(dictKeyName.toString())) {
tuValue = dictObject;
}
- //Debug.logInfo("AcroForm widget fieldName[" + fieldName + "] dictKey[" + dictKeyName.toString() + "] dictValue[" + dictObject.toString() + "]", module);
}
if (tuValue != null && typeValue != null && "/Annot".equals(typeValue.toString())) {
annotation = tuValue.toString();
@@ -243,7 +231,6 @@ public class PdfSurveyServices {
Delegator delegator = dctx.getDelegator();
String partyId = (String)context.get("partyId");
String surveyId = (String)context.get("surveyId");
- //String contentId = (String)context.get("contentId");
surveyResponseId = (String)context.get("surveyResponseId");
if (UtilValidate.isNotEmpty(surveyResponseId)) {
GenericValue surveyResponse = EntityQuery.use(delegator).from("SurveyResponse").where("surveyResponseId", surveyResponseId).queryOne();
@@ -267,7 +254,6 @@ public class PdfSurveyServices {
s.setFormFlattening(true);
for (String fieldName : hm.keySet()) {
//AcroFields.Item item = fs.getFieldItem(fieldName);
- //int type = fs.getFieldType(fieldName);
String value = fs.getField(fieldName);
GenericValue surveyQuestionAndAppl = EntityQuery.use(delegator).from("SurveyQuestionAndAppl")
.where("surveyId", surveyId,
@@ -318,11 +304,6 @@ public class PdfSurveyServices {
Map<String, Object> map = UtilGenerics.checkMap(fs.getFields());
s.setFormFlattening(true);
- // Debug code to get the values for setting TDP
- // String[] sa = fs.getAppearanceStates("TDP");
- // for (int i=0;i<sa.length;i++)
- // Debug.logInfo("Appearance="+sa[i]);
-
for (String fieldName : map.keySet()) {
String parmValue = fs.getField(fieldName);
acroFieldMap.put(fieldName, parmValue);
@@ -359,11 +340,6 @@ public class PdfSurveyServices {
Map<String, Object> map = UtilGenerics.checkMap(fs.getFields());
s.setFormFlattening(true);
- // Debug code to get the values for setting TDP
- // String[] sa = fs.getAppearanceStates("TDP");
- // for (int i=0;i<sa.length;i++)
- // Debug.logInfo("Appearance="+sa[i]);
-
for (String fieldName : map.keySet()) {
String fieldValue = fs.getField(fieldName);
Object obj = acroFieldMap.get(fieldName);
@@ -414,7 +390,6 @@ public class PdfSurveyServices {
public static Map<String, Object> buildPdfFromSurveyResponse(DispatchContext dctx, Map<String, ? extends Object> rcontext) {
Map<String, Object> context = UtilMisc.makeMapWritable(rcontext);
Delegator delegator = dctx.getDelegator();
- //LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> results = ServiceUtil.returnSuccess();
String surveyResponseId = (String)context.get("surveyResponseId");
String contentId = (String)context.get("contentId");
@@ -484,7 +459,6 @@ public class PdfSurveyServices {
*/
public static Map<String, Object> buildSurveyQuestionsAndAnswers(DispatchContext dctx, Map<String, ? extends Object> context) {
Delegator delegator = dctx.getDelegator();
- //LocalDispatcher dispatcher = dctx.getDispatcher();
Map<String, Object> results = ServiceUtil.returnSuccess();
String surveyResponseId = (String)context.get("surveyResponseId");
List<Object> qAndA = new LinkedList<Object>();
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/SurveyWrapper.java Sat Jul 16 14:10:10 2016
@@ -424,7 +424,6 @@ public class SurveyWrapper {
TransactionUtil.commit(beganTransaction);
} catch (GenericEntityException e) {
throw new SurveyWrapperException(e);
- //Debug.logError(e, "Could not commit transaction: " + e.toString(), module);
}
}
return resp;
@@ -571,7 +570,6 @@ public class SurveyWrapper {
TransactionUtil.commit(beganTransaction);
} catch (GenericEntityException e) {
throw new SurveyWrapperException(e);
- //Debug.logError(e, "Could not commit transaction: " + e.toString(), module);
}
}
}
@@ -631,7 +629,6 @@ public class SurveyWrapper {
TransactionUtil.commit(beganTransaction);
} catch (GenericEntityException e) {
throw new SurveyWrapperException(e);
- //Debug.logError(e, "Could not commit transaction: " + e.toString(), module);
}
}
@@ -711,7 +708,6 @@ public class SurveyWrapper {
TransactionUtil.commit(beganTransaction);
} catch (GenericEntityException e) {
throw new SurveyWrapperException(e);
- //Debug.logError(e, "Could not commit transaction: " + e.toString(), module);
}
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/CheckPermissionTransform.java Sat Jul 16 14:10:10 2016
@@ -96,8 +96,6 @@ public class CheckPermissionTransform im
final String mode = (String)templateCtx.get("mode");
final String quickCheckContentId = (String)templateCtx.get("quickCheckContentId");
final Map<String, Object> savedValues = new HashMap<String, Object>();
- //Debug.logInfo("in CheckPermission, contentId(1):" + templateCtx.get("contentId"),"");
- //Debug.logInfo("in CheckPermission, subContentId(1):" + templateCtx.get("subContentId"),"");
return new LoopWriter(out) {
@@ -114,11 +112,6 @@ public class CheckPermissionTransform im
@Override
public int onStart() throws TemplateModelException, IOException {
List<Map<String, ? extends Object>> trail = UtilGenerics.checkList(templateCtx.get("globalNodeTrail"));
- //String trailCsv = ContentWorker.nodeTrailToCsv(trail);
- //Debug.logInfo("in CheckPermission, trailCsv(2):" + trailCsv,"");
- //Debug.logInfo("in CheckPermission, contentId(2):" + templateCtx.get("contentId"),"");
- //Debug.logInfo("in CheckPermission, subContentId(2):" + templateCtx.get("subContentId"),"");
-
GenericValue currentContent = null;
String contentAssocPredicateId = (String)templateCtx.get("contentAssocPredicateId");
String strNullThruDatesOnly = (String)templateCtx.get("nullThruDatesOnly");
@@ -129,17 +122,12 @@ public class CheckPermissionTransform im
} catch (GeneralException e) {
throw new RuntimeException("Error getting current content. " + e.toString());
}
- // final GenericValue view = val;
currentContent = val;
- if (currentContent != null) {
- //Debug.logInfo("in CheckPermission, currentContent(0):" + currentContent.get("contentId"),"");
- }
if (currentContent == null) {
currentContent = delegator.makeValue("Content");
currentContent.put("ownerContentId", templateCtx.get("ownerContentId"));
}
- //Debug.logInfo("in CheckPermission, currentContent(1):" + currentContent.get("contentId"),"");
Security security = null;
if (request != null) {
@@ -166,8 +154,6 @@ public class CheckPermissionTransform im
}
List<String> targetOperationList = StringUtil.split(targetOperation, "|");
if (targetOperationList.size() == 0) {
- //Debug.logInfo("in CheckPermission, entityOperation:" + entityOperation,"");
- //Debug.logInfo("in CheckPermission, templateCtx:" + templateCtx,"");
throw new IOException("targetOperationList has zero size.");
}
List<String> roleList = new LinkedList<String>();
@@ -185,10 +171,8 @@ public class CheckPermissionTransform im
if (UtilValidate.isEmpty(permissionStatus) || !permissionStatus.equals("granted")) {
String errorMessage = "Permission to add response is denied (2)";
PermissionRecorder recorder = (PermissionRecorder)results.get("permissionRecorder");
- //Debug.logInfo("recorder(0):" + recorder, "");
if (recorder != null) {
String permissionMessage = recorder.toHtml();
- //Debug.logInfo("permissionMessage(0):" + permissionMessage, "");
errorMessage += " \n " + permissionMessage;
}
templateCtx.put("permissionErrorMsg", errorMessage);
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentCacheTransform.java Sat Jul 16 14:10:10 2016
@@ -41,7 +41,6 @@ import org.apache.ofbiz.service.LocalDis
import freemarker.core.Environment;
import freemarker.template.TemplateTransformModel;
-//import com.clarkware.profiler.Profiler;
/**
* EditRenderSubContentCacheTransform - Freemarker Transform for URLs (links)
*
@@ -145,13 +144,9 @@ public class EditRenderSubContentCacheTr
public void close() throws IOException {
FreeMarkerWorker.reloadValues(templateCtx, savedValues, env);
String wrappedContent = buf.toString();
- // String editTemplate = (String)templateCtx.get("editTemplate");
- // if (editTemplate != null && editTemplate.equalsIgnoreCase("true")) {
String wrapTemplateId = (String)templateCtx.get("wrapTemplateId");
if (UtilValidate.isNotEmpty(wrapTemplateId)) {
templateCtx.put("wrappedContent", wrappedContent);
-
- //Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
Map<String, Object> templateRoot = null;
Map<String, Object> templateRootTemplate = UtilGenerics.checkMap(templateCtx.get("templateRootTemplate"));
if (templateRootTemplate == null) {
@@ -173,9 +168,7 @@ public class EditRenderSubContentCacheTr
String mimeTypeId = (String)templateCtx.get("mimeTypeId");
Locale locale = null;
try {
- //if (Debug.infoOn()) Debug.logInfo("in Edit(0), before calling renderContentAsTextCache, wrapTemplateId: ." + wrapTemplateId , module);
ContentWorker.renderContentAsText(dispatcher, delegator, wrapTemplateId, out, templateRoot, locale, mimeTypeId, null, null, true);
- //if (Debug.infoOn()) Debug.logInfo("in Edit(0), after calling renderContentAsTextCache, wrapTemplateId: ." + wrapTemplateId , module);
} catch (IOException e) {
Debug.logError(e, "Error rendering content" + e.getMessage(), module);
throw new IOException("Error rendering content" + e.toString());
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/EditRenderSubContentTransform.java Sat Jul 16 14:10:10 2016
@@ -96,7 +96,6 @@ public class EditRenderSubContentTransfo
final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
GenericValue subContentDataResourceViewTemp = FreeMarkerWorker.getWrappedObject("subContentDataResourceView", env);
- //final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
ctx.put("mapKey", mapKey);
ctx.put("subDataResourceTypeIdTemp", subDataResourceTypeIdTemp);
@@ -110,7 +109,6 @@ public class EditRenderSubContentTransfo
// is gotten here and made available to underlying transforms to save overall
// processing time.
GenericValue parentContent = null;
- //ctx.put("userLogin", userLogin);
List<String> assocTypes = UtilMisc.toList("SUB_CONTENT");
Timestamp fromDate = UtilDateTime.nowTimestamp();
if (subContentDataResourceViewTemp == null) {
@@ -149,19 +147,15 @@ public class EditRenderSubContentTransfo
ctx.put("drDataResourceId", dataResourceIdTemp);
ctx.put("subContentDataResourceView", subContentDataResourceView);
ctx.put("mimeTypeId", mimeTypeIdTemp);
- //request.setAttribute("drDataResourceId", subContentDataResourceView.get("drDataResourceId"));
} else {
ctx.put("subContentId", null);
ctx.put("drDataResourceId", null);
ctx.put("subContentDataResourceView", null);
ctx.put("mimeTypeId", null);
- //request.setAttribute("drDataResourceId", null);
}
final String dataResourceId = dataResourceIdTemp;
final String subContentIdSub = subContentIdSubTemp;
- //final GenericValue finalSubContentView = subContentDataResourceView;
- //final GenericValue content = parentContent;
final Map<String, Object> templateContext = ctx;
final String mimeTypeId = mimeTypeIdTemp;
final String subDataResourceTypeId = subDataResourceTypeIdTemp;
@@ -184,8 +178,6 @@ public class EditRenderSubContentTransfo
if (editTemplate != null && editTemplate.equalsIgnoreCase("true")) {
if (UtilValidate.isNotEmpty(wrapTemplateId)) {
templateContext.put("wrappedFTL", wrappedFTL);
- //ServletContext servletContext = (ServletContext)request.getSession().getServletContext();
- //String rootDir = servletContext.getRealPath("/");
templateContext.put("webSiteId", webSiteId);
templateContext.put("https", https);
templateContext.put("rootDir", rootDir);
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/InjectNodeTrailCsvTransform.java Sat Jul 16 14:10:10 2016
@@ -79,10 +79,8 @@ public class InjectNodeTrailCsvTransform
final StringBuilder buf = new StringBuilder();
final Environment env = Environment.getCurrentEnvironment();
final Map<String, Object> templateCtx = FreeMarkerWorker.getWrappedObject("context", env);
- //FreeMarkerWorker.convertContext(templateCtx);
final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
- //final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
FreeMarkerWorker.getSiteParameters(request, templateCtx);
FreeMarkerWorker.overrideWithArgs(templateCtx, args);
@@ -109,11 +107,9 @@ public class InjectNodeTrailCsvTransform
if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), trail:"+trail,module);
// This will build a nodeTrail if none exists
// Maybe only contentId or subContentId are passed in
- //GenericValue currentValue = getCurrentContent(delegator, trail, userLogin, templateCtx, nullThruDatesOnly, contentAssocPredicateId);
String redo = (String)templateCtx.get("redo");
if (UtilValidate.isEmpty(trail) || (redo != null && redo.equalsIgnoreCase("true"))) {
- // String thisContentId = null;
String subContentId = (String)templateCtx.get("subContentId");
if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), subContentId:"+subContentId,module);
String contentId = (String)templateCtx.get("contentId");
@@ -138,8 +134,6 @@ public class InjectNodeTrailCsvTransform
if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv(0), csvTrail:"+csvTrail,module);
} else {
// Build nodeTrail if one does not exist
- //if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv, trail:"+trail,module);
- //if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv, passedCsv:"+passedCsv,module);
if (UtilValidate.isNotEmpty(passedCsv)) {
csvTrail = passedCsv;
int lastComma = passedCsv.lastIndexOf(",");
@@ -167,7 +161,6 @@ public class InjectNodeTrailCsvTransform
csvTrail = ContentWorker.nodeTrailToCsv(trail);
}
}
- //if (Debug.infoOn()) Debug.logInfo("in InjectNodeTrailCsv, csvTrail:"+csvTrail,module);
templateCtx.put("nodeTrailCsv", csvTrail);
return TransformControl.EVALUATE_BODY;
}
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LimitedSubContentCacheTransform.java Sat Jul 16 14:10:10 2016
@@ -86,7 +86,6 @@ public class LimitedSubContentCacheTrans
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
- //Profiler.begin("Limited");
final StringBuilder buf = new StringBuilder();
final Environment env = Environment.getCurrentEnvironment();
final Map<String, Object> templateRoot = FreeMarkerWorker.createEnvironmentMap(env);
@@ -134,12 +133,6 @@ public class LimitedSubContentCacheTrans
String limitSize = (String) templateRoot.get("limitSize");
final int returnLimit = Integer.parseInt(limitSize);
- // limitMode will be "random" to begin with
- // String limitMode = (String) templateRoot.get("limitMode");
- // final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
- // List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail"));
- // String strNullThruDatesOnly = (String) templateRoot.get("nullThruDatesOnly");
- // Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && strNullThruDatesOnly.equalsIgnoreCase("true")) ? Boolean.TRUE : Boolean.FALSE;
String orderBy = (String) templateRoot.get("orderBy");
// NOTE this was looking for subContentId, but that doesn't make ANY sense, so changed to contentId
@@ -148,10 +141,7 @@ public class LimitedSubContentCacheTrans
templateRoot.put("contentId", null);
templateRoot.put("subContentId", null);
- // final String contentIdTo = contentId;
-
Map<String, Object> results = null;
- //if (Debug.infoOn()) Debug.logInfo("in LimitedSubContentCache(0), assocTypes ." + assocTypes, module);
String contentAssocPredicateId = (String) templateRoot.get("contentAssocPredicateId");
try {
results = ContentServicesComplex.getAssocAndContentAndDataResourceCacheMethod(delegator, contentId, null, "From", fromDate, null, assocTypes, null, Boolean.TRUE, contentAssocPredicateId, orderBy);
@@ -162,15 +152,12 @@ public class LimitedSubContentCacheTrans
}
List<GenericValue> longList = UtilGenerics.checkList(results.get("entityList"));
templateRoot.put("entityList", longList);
- //if (Debug.infoOn()) Debug.logInfo("in limited, longList:" + longList , "");
return new LoopWriter(out) {
@Override
public void write(char cbuf[], int off, int len) {
buf.append(cbuf, off, len);
- //StringBuilder ctxBuf = (StringBuilder) templateRoot.get("buf");
- //ctxBuf.append(cbuf, off, len);
}
@Override
@@ -180,11 +167,7 @@ public class LimitedSubContentCacheTrans
@Override
public int onStart() throws TemplateModelException, IOException {
- // List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail"));
- // String trailCsv = ContentWorker.nodeTrailToCsv(globalNodeTrail);
boolean inProgress = false;
- //if (Debug.infoOn()) Debug.logInfo("in limited, returnLimit:" + returnLimit , "");
- //if (Debug.infoOn()) Debug.logInfo("in limited, pickedEntityIds:" + pickedEntityIds , "");
if (pickedEntityIds.size() < returnLimit) {
inProgress = getNextMatchingEntity(templateRoot, delegator, env);
}
@@ -204,9 +187,6 @@ public class LimitedSubContentCacheTrans
templateRoot.put("globalNodeTrail", subList);
env.setVariable("globalNodeTrail", FreeMarkerWorker.autoWrap(subList, env));
- //if (Debug.infoOn()) Debug.logInfo("highIndex(2):" + highIndexInteger , "");
- //if (Debug.infoOn()) Debug.logInfo("in limited, returnLimit(2):" + returnLimit , "");
- //if (Debug.verboseOn()) Debug.logVerbose("in limited, pickedEntityIds(2):" + pickedEntityIds , "");
boolean inProgress = false;
if (pickedEntityIds.size() < returnLimit) {
inProgress = getNextMatchingEntity(templateRoot, delegator, env);
@@ -225,18 +205,9 @@ public class LimitedSubContentCacheTrans
FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env);
String wrappedContent = buf.toString();
out.write(wrappedContent);
- //try {
- //Profiler.end("Limited");
- //FileOutputStream fw = new FileOutputStream(FileUtil.getFile("/usr/local/agi/ofbiz/hot-deploy/sfmp/misc/profile.data"));
- //Profiler.print(fw);
- //fw.close();
- //} catch (IOException e) {
- //Debug.logError("[PROFILER] " + e.getMessage(),"");
- //}
}
public boolean prepCtx(Delegator delegator, Map<String, Object> ctx, Environment env, GenericValue view) throws GeneralException {
- // String dataResourceId = (String) view.get("drDataResourceId");
String subContentIdSub = (String) view.get("contentId");
// This order is taken so that the dataResourceType can be overridden in the transform arguments.
String subDataResourceTypeId = (String) ctx.get("subDataResourceTypeId");
@@ -257,10 +228,8 @@ public class LimitedSubContentCacheTrans
GenericValue assocContent = null;
ContentWorker.checkConditions(delegator, trailNode, assocContent, whenMap);
Boolean isReturnBeforeObj = (Boolean) trailNode.get("isReturnBefore");
- // Boolean isReturnAfterObj = (Boolean) trailNode.get("isReturnAfter");
Boolean isPickObj = (Boolean) trailNode.get("isPick");
Boolean isFollowObj = (Boolean) trailNode.get("isFollow");
- //if (Debug.infoOn()) Debug.logInfo("in LimitedSubContentCache, isReturnBeforeObj" + isReturnBeforeObj + " isPickObj:" + isPickObj + " isFollowObj:" + isFollowObj + " isReturnAfterObj:" + isReturnAfterObj, module);
if ((isReturnBeforeObj == null || !isReturnBeforeObj.booleanValue()) && ((isPickObj != null &&
isPickObj.booleanValue()) || (isFollowObj != null && isFollowObj.booleanValue()))) {
List<Map<String, ? extends Object>> globalNodeTrail = UtilGenerics.checkList(ctx.get("globalNodeTrail"));
@@ -271,7 +240,6 @@ public class LimitedSubContentCacheTrans
ctx.put("globalNodeTrail", globalNodeTrail);
String csvTrail = ContentWorker.nodeTrailToCsv(globalNodeTrail);
ctx.put("nodeTrailCsv", csvTrail);
- //if (Debug.infoOn()) Debug.logInfo("prepCtx, csvTrail(2):" + csvTrail, "");
int indentSz = globalNodeTrail.size();
ctx.put("indent", Integer.valueOf(indentSz));
@@ -300,9 +268,7 @@ public class LimitedSubContentCacheTrans
while (pickEntity == null && lst.size() > 0) {
double randomValue = Math.random();
- //if (Debug.infoOn()) Debug.logInfo("in limited, randomValue:" + randomValue , "");
int idx = (int) (lst.size() * randomValue);
- //if (Debug.infoOn()) Debug.logInfo("in limited, idx:" + idx , "");
pickEntity = lst.get(idx);
String pickEntityId = pickEntity.getString("contentId");
if (pickedEntityIds.get(pickEntityId) == null) {
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/LoopSubContentTransform.java Sat Jul 16 14:10:10 2016
@@ -181,10 +181,7 @@ public class LoopSubContentTransform imp
String thisContentId = (String) templateCtx.get("contentId");
//DEJ20080730 Should always use contentId, not subContentId since we're searching for that and it is confusing
- //if (UtilValidate.isEmpty(thisContentId)) thisContentId = (String)templateCtx.get("subContentId");
-
String thisMapKey = (String)templateCtx.get("mapKey");
- //GenericValue subContentDataResourceView = null;
Map<String, Object> results = ContentServicesComplex.getAssocAndContentAndDataResourceMethod(delegator, thisContentId, thisMapKey, null, fromDate, null, null, null, assocTypes, null);
List<GenericValue> entityList = UtilGenerics.checkList(results.get("entityList"));
templateCtx.put("entityList", entityList);
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java Sat Jul 16 14:10:10 2016
@@ -46,8 +46,6 @@ import freemarker.template.TemplateTrans
public class RenderContentAndSubContent implements TemplateTransformModel {
public static final String module = RenderContentAndSubContent.class.getName();
-// public static final String [] upSaveKeyNames = {"globalNodeTrail"};
-// public static final String [] saveKeyNames = {"contentId", "subContentId", "subDataResourceTypeId", "mimeTypeId", "whenMap", "locale", "wrapTemplateId", "encloseWrapText", "nullThruDatesOnly", "globalNodeTrail"};
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
@@ -55,18 +53,13 @@ public class RenderContentAndSubContent
final LocalDispatcher dispatcher = FreeMarkerWorker.getWrappedObject("dispatcher", env);
final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
- // final HttpServletResponse response = FreeMarkerWorker.getWrappedObject("response", env);
final Map<String, Object> envMap = FreeMarkerWorker.createEnvironmentMap(env);
final MapStack<String> templateRoot = MapStack.create();
((MapStack)templateRoot).push(envMap);
if (Debug.verboseOn()) Debug.logVerbose("in RenderContentAndSubContent, contentId(0):" + templateRoot.get("contentId"), module);
FreeMarkerWorker.getSiteParameters(request, templateRoot);
- // final Map savedValuesUp = new HashMap<String, Object>();
- // FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp);
FreeMarkerWorker.overrideWithArgs(templateRoot, args);
- // final Map<String, Object> savedValues = new HashMap<String, Object>();
-
return new Writer(out) {
@Override
@@ -81,7 +74,6 @@ public class RenderContentAndSubContent
@Override
public void close() throws IOException {
renderSubContent();
- //if (Debug.verboseOn()) Debug.logVerbose("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module);
}
public void renderSubContent() throws IOException {
@@ -96,38 +88,16 @@ public class RenderContentAndSubContent
if (Debug.verboseOn()) Debug.logVerbose("in RenderContentAndSubContent, contentId(2):" + templateRoot.get("contentId"), module);
if (Debug.verboseOn()) Debug.logVerbose("in RenderContentAndSubContent, subContentId(2):" + templateRoot.get("subContentId"), module);
- //if (thisView != null) {
try {
String contentId = (String)templateRoot.get("contentId");
String mapKey = (String)templateRoot.get("mapKey");
String contentAssocTypeId = (String)templateRoot.get("contentAssocTypeId");
if (UtilValidate.isNotEmpty(mapKey) || UtilValidate.isNotEmpty(contentAssocTypeId)) {
String txt = ContentWorker.renderSubContentAsText(dispatcher, delegator, contentId, mapKey, templateRoot, locale, mimeTypeId, true);
- //String txt = ContentWorker.renderSubContentAsTextCache(delegator, thisContentId, thisMapKey, null, templateRoot, locale, mimeTypeId, null, fromDate);
-// if ("true".equals(xmlEscape)) {
-// txt = UtilFormatOut.encodeXmlValue(txt);
-// }
-
out.write(txt);
-
-// if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, after renderContentAsTextCache:", module);
-// List assocList = null;
-// if (UtilValidate.isNotEmpty(contentAssocTypeId)) {
-// assocList = UtilMisc.toList(contentAssocTypeId);
-// }
-// GenericValue content = ContentWorker.getSubContent(delegator, contentId, mapKey, null, null, assocList, null);
-// if (content != null) {
-// contentId = content.getString("contentId");
-// } else {
-// contentId = null;
-// }
} else if (contentId != null) {
ContentWorker.renderContentAsText(dispatcher, delegator, contentId, out, templateRoot, locale, mimeTypeId, null, null, true);
-// ((MapStack)templateRoot).pop();
}
- //FreeMarkerWorker.reloadValues(templateRoot, savedValues, env);
- //FreeMarkerWorker.reloadValues(templateRoot, savedValuesUp, env);
-
} catch (GeneralException e) {
String errMsg = "Error rendering thisContentId:" + (String)templateRoot.get("contentId") + " msg:" + e.toString();
Debug.logError(e, errMsg, module);
Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java?rev=1752965&r1=1752964&r2=1752965&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java (original)
+++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderContentAsText.java Sat Jul 16 14:10:10 2016
@@ -59,8 +59,6 @@ public class RenderContentAsText impleme
@SuppressWarnings("unchecked")
public Writer getWriter(final Writer out, Map args) {
final Environment env = Environment.getCurrentEnvironment();
- //final Map templateCtx = FreeMarkerWorker.getWrappedObject("context", env);
- //final Map templateCtx = new HashMap<String, Object>();
final LocalDispatcher dispatcher = FreeMarkerWorker.getWrappedObject("dispatcher", env);
final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env);
final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env);
@@ -76,58 +74,12 @@ public class RenderContentAsText impleme
if (Debug.verboseOn()) {
Debug.logVerbose("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), module);
}
- // not used yet: final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env);
- // not used yet: List trail = (List)templateRoot.get("globalNodeTrail");
- //if (Debug.infoOn()) Debug.logInfo("in Render(0), globalNodeTrail ." + trail , module);
- // not used yet: String contentAssocPredicateId = (String)templateRoot.get("contentAssocPredicateId");
- // not used yet: String strNullThruDatesOnly = (String)templateRoot.get("nullThruDatesOnly");
- // not used yet: Boolean nullThruDatesOnly = (strNullThruDatesOnly != null && strNullThruDatesOnly.equalsIgnoreCase("true")) ? Boolean.TRUE :Boolean.FALSE;
final String thisContentId = (String)templateRoot.get("contentId");
final String xmlEscape = (String)templateRoot.get("xmlEscape");
final boolean directAssocMode = UtilValidate.isNotEmpty(thisContentId) ? true : false;
if (Debug.verboseOn()) {
Debug.logVerbose("in Render(0), directAssocMode ." + directAssocMode , module);
}
- /*
- if (Debug.infoOn()) Debug.logInfo("in Render(0), thisSubContentId ." + thisSubContentId , module);
- String thisSubContentId = (String)templateRoot.get("subContentId");
- GenericValue val = null;
- try {
- val = FreeMarkerWorker.getCurrentContent(delegator, trail, userLogin, templateRoot, nullThruDatesOnly, contentAssocPredicateId);
- } catch (GeneralException e) {
- throw new RuntimeException("Error getting current content. " + e.toString());
- }
- final GenericValue view = val;
-
- String dataResourceId = null;
- String subContentIdSub = null;
- if (view != null) {
- try {
- dataResourceId = (String) view.get("drDataResourceId");
- } catch (Exception e) {
- dataResourceId = (String) view.get("dataResourceId");
- }
- subContentIdSub = (String) view.get("contentId");
- }
- // This order is taken so that the dataResourceType can be overridden in the transform arguments.
- String subDataResourceTypeId = (String)templateRoot.get("subDataResourceTypeId");
- if (UtilValidate.isEmpty(subDataResourceTypeId)) {
- try {
- subDataResourceTypeId = (String) view.get("drDataResourceTypeId");
- } catch (Exception e) {
- // view may be "Content"
- }
- // TODO: If this value is still empty then it is probably necessary to get a value from
- // the parent context. But it will already have one and it is the same context that is
- // being passed.
- }
- String mimeTypeId = FreeMarkerWorker.getMimeTypeId(delegator, view, templateRoot);
- templateRoot.put("drDataResourceId", dataResourceId);
- templateRoot.put("mimeTypeId", mimeTypeId);
- templateRoot.put("dataResourceId", dataResourceId);
- templateRoot.put("subContentId", subContentIdSub);
- templateRoot.put("subDataResourceTypeId", subDataResourceTypeId);
- */
final Map<String, Object> savedValues = new HashMap<String, Object>();
@@ -149,7 +101,6 @@ public class RenderContentAsText impleme
Debug.logVerbose("Render close, globalNodeTrail(2a):" + ContentWorker.nodeTrailToCsv(globalNodeTrail), "");
}
renderSubContent();
- //if (Debug.verboseOn()) Debug.logVerbose("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module);
}
public void renderSubContent() throws IOException {
@@ -162,26 +113,10 @@ public class RenderContentAsText impleme
locale = UtilMisc.ensureLocale(localeObject);
}
- //TemplateHashModel dataRoot = env.getDataModel();
- // Timestamp fromDate = UtilDateTime.nowTimestamp();
- // List passedGlobalNodeTrail = (List)templateRoot.get("globalNodeTrail");
String editRequestName = (String)templateRoot.get("editRequestName");
if (Debug.verboseOn()) {
Debug.logVerbose("in Render(3), editRequestName ." + editRequestName , module);
}
- /*
- GenericValue thisView = null;
- if (view != null) {
- thisView = view;
- } else if (passedGlobalNodeTrail.size() > 0) {
- Map map = (Map)passedGlobalNodeTrail.get(passedGlobalNodeTrail.size() - 1);
- if (Debug.infoOn()) Debug.logInfo("in Render(3), map ." + map , module);
- if (map != null)
- thisView = (GenericValue)map.get("value");
- }
- if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, subContentId:" + templateRoot.get("subContentId"), module);
- if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, contentId:" + templateRoot.get("contentId"), module);
- */
if (UtilValidate.isNotEmpty(editRequestName)) {
String editStyle = getEditStyle();
@@ -193,7 +128,6 @@ public class RenderContentAsText impleme
Debug.logVerbose("in RenderSubContent, subContentId(2):" + templateRoot.get("subContentId"), module);
}
FreeMarkerWorker.saveContextValues(templateRoot, saveKeyNames, savedValues);
- //if (thisView != null) {
try {
String txt = ContentWorker.renderContentAsText(dispatcher, delegator, thisContentId, templateRoot, locale, mimeTypeId, true);
if ("true".equals(xmlEscape)) {
@@ -202,7 +136,6 @@ public class RenderContentAsText impleme
out.write(txt);
- // if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, after renderContentAsTextCache:", module);
} catch (GeneralException e) {
String errMsg = "Error rendering thisContentId:" + thisContentId + " msg:" + e.toString();
Debug.logError(e, errMsg, module);
@@ -215,7 +148,6 @@ public class RenderContentAsText impleme
closeEditWrap(out, editRequestName);
}
- //if (Debug.infoOn()) Debug.logInfo("in Render(4), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module);
}
public void openEditWrap(Writer out, String editStyle) throws IOException {