danwatford commented on a change in pull request #252:
URL: https://github.com/apache/ofbiz-framework/pull/252#discussion_r560210028



##########
File path: applications/order/groovyScripts/order/CompanyHeader.groovy
##########
@@ -135,12 +136,22 @@ if (!partyId) {
 }
 
 // the logo
-partyGroup = from("PartyGroup").where("partyId", partyId).queryOne()
+GenericValue partyGroup = from("PartyGroup").where("partyId", 
partyId).queryOne()
 if (partyGroup) {
-    partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, 
locale, EntityUtilProperties.getPropertyValue("content", "defaultMimeType", 
"text/html; charset=utf-8", delegator))
-    partyContent = 
partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, 
"LGOIMGURL", delegator)
+    GenericValue partyContent = 
PartyContentWrapper.getFirstPartyContentByType(partyId, partyGroup, 
"LGOIMGURL", delegator)

Review comment:
       Hi @dixitdeepak , I still just get a string version of the content ID.
   
   After adding a new logo and assigning to the Company party as the logo image 
I end up with the following GenericEntities:
   
   (I appreciate the following is difficult to read so please let me know of 
any preferred way to get and present this sort of information.)
   
   dataResource.asImmutable().toString():
   ```
   {dataResourceName=TestLogo.png, lastUpdatedStamp=2021-01-19 13:57:11.498, 
surveyId=null,
   dataTemplateTypeId=NONE, lastModifiedDate=2021-01-19 13:57:10.159, 
createdTxStamp=2021-01-19 13:57:09.983,
   createdStamp=2021-01-19 13:57:11.176, mimeTypeId=image/png, 
lastUpdatedTxStamp=2021-01-19 13:57:09.983, 
   dataCategoryId=PERSONAL, surveyResponseId=null, characterSetId=null, 
dataSourceId=null,
   lastModifiedByUserLogin=admin, createdDate=2021-01-19 13:57:10.159, 
statusId=CTNT_PUBLISHED,
   localeString=null, relatedDetailId=null, dataResourceId=10030, isPublic=N, 
   
objectInfo=C:/dev/floss/ofbiz/ofbiz-framework/runtime/uploads/1610721557185/10030.png,
   dataResourceTypeId=LOCAL_FILE, createdByUserLogin=admin}
   ```
   
   content.asImmutable().toString():
   ```
   {ownerContentId=null, createdStamp=2021-01-19 13:57:12.593, contentId=10030, 
contentTypeId=DOCUMENT, 
   description=null, mimeTypeId=image/png, childLeafCount=null, 
privilegeEnumId=null, dataSourceId=null, 
   lastModifiedByUserLogin=admin, dataResourceId=10030, 
createdByUserLogin=admin, 
   lastUpdatedStamp=2021-01-19 13:57:12.593, templateDataResourceId=null, 
lastModifiedDate=2021-01-19 13:57:12.593,
    instanceOfContentId=null, createdTxStamp=2021-01-19 13:57:09.983, 
lastUpdatedTxStamp=2021-01-19 13:57:09.983,
    serviceName=null, customMethodId=null, characterSetId=null, 
contentName=TestLogo.png, 
   createdDate=2021-01-19 13:57:12.593, statusId=CTNT_PUBLISHED, 
localeString=null, 
   decoratorContentId=null, childBranchCount=null}
   ```
   
   partyContent.asImmutable().toString()
   ```
   {fromDate=2021-01-19 13:57:13.014, lastUpdatedStamp=2021-01-19 13:57:13.014, 
partyContentTypeId=LGOIMGURL, 
   createdTxStamp=2021-01-19 13:57:09.983, createdStamp=2021-01-19 
13:57:13.014, contentId=10030, 
   lastUpdatedTxStamp=2021-01-19 13:57:09.983, partyId=Company, thruDate=null}
   ```
   
   I tried the following methods at calling 
PartyContentWrapper.getPartyContentAsText from CompanyHeader.groovy:
   
   PartyContentWrapper.getPartyContentAsText(partyGroup, 
content.getString("contentId"), context.request, "html")
   `"10030"`
   
   PartyContentWrapper.getPartyContentAsText(partyGroup, 
content.getString("contentId"), context.request, "url")
   `"10030"`
   
   PartyContentWrapper.getPartyContentAsText(partyGroup, 
content.getString("contentId"), context.request, null)
   `"10030"`
   
   I'm not sure how else I should be using getPartyContentAsText as part of 
retrieving the binary content in order to convert to a data-uri.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to