[OFBiz] SVN: r7689 - in trunk/applications/content/src/org/ofbiz/content: . content
hansbak@svn.ofbiz.org
hansbak at svn.ofbiz.org
Mon May 29 02:31:45 CDT 2006
Author: hansbak
Date: 2006-05-29 02:31:32 -0500 (Mon, 29 May 2006)
New Revision: 7689
Modified:
trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java
trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
Log:
error when using persistContentAndAssoc and providing no contenIdTo fixed, now possble to connect a contentid in different languages to a publishpoint
Modified: trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java
===================================================================
--- trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java 2006-05-28 20:36:10 UTC (rev 7688)
+++ trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java 2006-05-29 07:31:32 UTC (rev 7689)
@@ -374,7 +374,8 @@
contentAssocTypeId = (String)context.get("caContentAssocTypeId");
if (Debug.infoOn()) Debug.logInfo("CREATING contentASSOC contentAssocTypeId:" + contentAssocTypeId, null);
- if (contentAssocTypeId != null && contentAssocTypeId.length() > 0 ) {
+ // create content assoc if the key values are present....
+ if (contentAssocTypeId != null && contentAssocTypeId.length() > 0 && contentAssoc.get("contentId") != null && contentAssoc.get("contentIdTo") != null ) {
if (Debug.infoOn()) Debug.logInfo("in persistContentAndAssoc, deactivateExisting:" + deactivateExisting, null);
Map contentAssocContext = new HashMap();
contentAssocContext.put("userLogin", userLogin);
Modified: trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
===================================================================
--- trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java 2006-05-28 20:36:10 UTC (rev 7688)
+++ trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java 2006-05-29 07:31:32 UTC (rev 7689)
@@ -1205,6 +1205,20 @@
results.put("view", view);
results.put("content", content);
+ // if the contentId is a publishpoint and the resource ID is not defined get the related contentId
+ if (view.get("contentTypeId").equals("WEB_SITE_PUB_PT") && view.get("dataResourceId") == null) {
+ List relContentIds = delegator.findByAnd("ContentAssocDataResourceViewFrom",
+ UtilMisc.toMap("contentIdStart", view.get("contentId"),"statusId","CTNT_PUBLISHED", "caContentAssocTypeId", "PUBLISH_LINK"),
+ UtilMisc.toList("caFromDate"));
+ relContentIds = EntityUtil.filterByDate(relContentIds, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true);
+ if (relContentIds != null && relContentIds.size() > 0) {
+ view = (GenericValue) relContentIds.get(0);
+ }
+ else {
+ throw new GeneralException("No related content found for publish point contentId=" + contentId);
+ }
+ }
+
if (locale != null) {
String targetLocaleString = locale.toString();
String thisLocaleString = (String) view.get("localeString");
@@ -1236,6 +1250,7 @@
// TODO: what should we REALLY do here? looks like there is no decision between Java and Service style error handling...
if (UtilValidate.isEmpty(templateDataResourceId)) {
+ // Debug.logInfo("=====rendering contentId" + contentId + " dataResourceId:" + dataResourceId + " view:" + view,module);
if (UtilValidate.isNotEmpty(dataResourceId) || view != null)
DataResourceWorker.renderDataResourceAsTextCache(delegator, dataResourceId, out, templateContext, view, locale, mimeTypeId);
More information about the Svn
mailing list