Re: svn commit: r663038 - in /ofbiz/trunk/applications/party/webapp/partymgr: WEB-INF/actions/communication/ WEB-INF/actions/party/ communication/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r663038 - in /ofbiz/trunk/applications/party/webapp/partymgr: WEB-INF/actions/communication/ WEB-INF/actions/party/ communication/

Scott Gray
Hi Asish

Just a couple more tips :-)

You might have misunderstood what I said about the shortcut for the ternary
operator
sortField = parameters.sort ? parameters.sort : "entryDate";
can just be
sortField = parameters.sort ?: "entryDate";
here is the documentation: http://groovy.codehaus.org/Operators (see elvis
operator)

In that document there is also mention of a safe navigation operator (which
I haven't used yet)
if (previousSort && previousSort.equals(sortField)) {
can be replaced with
if (previousSort?.equals(sortField)) {
if previousSort is null the operator will return null instead of an NPE

similar thing here:
if (parameters.communicationEventTypeId) {
   if (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION")) {
can just be
if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) {
which will avoid an NPE

This could have used the ?: operator as well:
       orgEventId = parentEvent.origCommEventId;
        if (!orgEventId) orgEventId = parentCommEventId;
could just be
orgEventId = parentEvent.origCommEventId ?: parentCommEventId;

and here as well:
donePage = parameters.DONE_PAGE;
if (!donePage || donePage.length() <= 0) donePage = "viewprofile?party_id="
+ partyId + "&partyId=" + partyId;
can be
donePage = parameters.DONE_PAGE ?: "viewprofile?party_id=" + partyId +
"&partyId=" + partyId;
remember an empty string resolves to null

and here:
partyId = parameters.partyId;
if (!partyId) {
    partyId = parameters.party_id;
 }
can just be
partyId = parameters.partyId ?: parameters.party_id;
a few other places in this commit as well

This is wrong:
creditCardData = paymentResults.creditCard;
if (!tryEntity.booleanValue()) creditCardData = parameters;
if (!creditCardData) creditCardData = new HashMap();
if (creditCardData) context.creditCardData = creditCardData;

remember that an empty map or list will resolve to false so line 4 will be
false even after new HashMap()
it should be:
creditCardData = paymentResults.creditCard;
if (!tryEntity) creditCardData = parameters;
context.creditCardData = creditCardData ?: new HashMap();

same thing for giftCardData and eftAccountData, also remember instead of new
HashMap() you can do [:] (or FastMap.newInstance())

You do not need to declare variable types like "boolean showOld =" can just
be "showOld =" also auto boxing/unboxing makes this unnecessary:
boolean showOld = "true".equals(parameters.SHOW_OLD);
context.showOld = new Boolean(showOld);
can just be
context.showOld = "true".equals(parameters.SHOW_OLD);

Let me know if you have any questions :-)

Regards
Scott

2008/6/4 <[hidden email]>:

> Author: ashish
> Date: Wed Jun  4 01:55:56 2008
> New Revision: 663038
>
> URL: http://svn.apache.org/viewvc?rev=663038&view=rev
> Log:
> Applied Groovy Features to the party component files.
> Part of JIRA issue # OFBIZ-1801
>
> Modified:
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
>
>  ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> Wed Jun  4 01:55:56 2008
> @@ -24,24 +24,20 @@
>  * expanded to work off other communication event types.
>  */
>
> -import org.ofbiz.base.util.*;
> +import org.ofbiz.base.util.UtilDateTime;
>  import org.ofbiz.entity.util.EntityUtil;
>
> -delegator = request.getAttribute("delegator");
> -userLogin = request.getAttribute("userLogin");
> -partyIdFrom = context.get("partyIdFrom");
> -partyIdTo = context.get("partyIdTo");
> +partyIdFrom = context.partyIdFrom;
> +partyIdTo = context.partyIdTo;
>
> -if (parameters.get("communicationEventTypeId") != null) {
> -   if
> (parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION")) {
> -      userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose",
> UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
>  partyIdFrom));
> +if (parameters.communicationEventTypeId) {
> +   if (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION"))
> {
> +      userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose",
> [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom]);
>       userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses,
> UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
> -      context.put("userEmailAddresses", userEmailAddresses);
> +      context.userEmailAddresses = userEmailAddresses;
>
> -      targetEmailAddresses =
> delegator.findByAnd("PartyContactWithPurpose",
> UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId", partyIdTo));
> +      targetEmailAddresses =
> delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId :
> "EMAIL_ADDRESS", partyId : partyIdTo]);
>       targetEmailAddresses = EntityUtil.filterByDate(targetEmailAddresses,
> UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
> -      context.put("targetEmailAddresses", targetEmailAddresses);
> +      context.targetEmailAddresses = targetEmailAddresses;
>    }
> -}
> -
> -
> +}
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,33 +17,38 @@
>  * under the License.
>  */
>
> -import org.ofbiz.base.util.*;
> -import org.ofbiz.entity.*;
> -import org.ofbiz.entity.condition.*;
> +import org.ofbiz.entity.condition.EntityOperator;
> +import org.ofbiz.entity.condition.EntityCondition;
>
> -partyId = parameters.get("partyId");
> -context.put("partyId", partyId);
> +import javolution.util.FastList;
>
> -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId",
> partyId));
> -context.put("party", party);
> +partyId = parameters.partyId;
> +context.partyId = partyId;
> +
> +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> +context.party = party;
>
>  // get the sort field
> -sortField = request.getParameter("sort");
> -if (sortField == null) sortField = "entryDate";
> -context.put("previousSort", sortField);
> +sortField = parameters.sort ? parameters.sort : "entryDate";
> +context.previousSort = sortField;
>
>  // previous sort field
> -previousSort = request.getParameter("previousSort");
> -if (previousSort != null && previousSort.equals(sortField)) {
> +previousSort = parameters.previousSort;
> +if (previousSort && previousSort.equals(sortField)) {
>     sortField = "-" + sortField;
>  }
>
> -eventExprs = UtilMisc.toList(EntityCondition.makeCondition("partyIdTo",
> EntityOperator.EQUALS, partyId),
> EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS,
> partyId));
> +List eventExprs = FastList.newInstance();
> +expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS,
> partyId);
> +eventExprs.add(expr);
> +expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS,
> "partyId");
> +eventExprs.add(expr);
>  ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR);
> -events = delegator.findList("CommunicationEvent", ecl, null,
> UtilMisc.toList(sortField), null, false);
> -context.put("eventList", events);
> -context.put("eventListSize", events.size());
> -context.put("highIndex", events.size());
> -context.put("viewSize", events.size());
> -context.put("lowIndex", 1);
> -context.put("viewIndex", 1);
> +events = delegator.findList("CommunicationEvent", ecl, null, [sortField],
> null, false);
> +
> +context.eventList = events;
> +context.eventListSize = events.size();
> +context.highIndex = events.size();
> +context.viewSize = events.size();
> +context.lowIndex = 1;
> +context.viewIndex = 1;
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> Wed Jun  4 01:55:56 2008
> @@ -19,29 +19,27 @@
>
>  import org.ofbiz.base.util.*;
>
> -delegator = request.getAttribute("delegator");
> -userLogin = request.getAttribute("userLogin");
> -parentCommEventId = parameters.get("parentCommEventId");
> -
> -if (parentCommEventId != null) {
> -    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> UtilMisc.toMap("communicationEventId", parentCommEventId));
> -    if (parentEvent != null) {
> -        orgEventId = parentEvent.get("origCommEventId");
> -        if (orgEventId == null) orgEventId = parentCommEventId;
> -
> -        parameters.put("communicationEventTypeId",
> parentEvent.get("communicationEventTypeId"));
> -        parameters.put("parentCommEventId", parentCommEventId);
> -        parameters.put("origCommEventId", orgEventId);
> -
> -        parameters.put("contactMechIdTo",
> parentEvent.get("contactMechIdFrom"));
> -        parameters.put("contactMechIdFrom",
> parentEvent.get("contactMechIdTo"));
> -
> -        parameters.put("partyIdFrom", userLogin.get("partyId"));
> -        parameters.put("partyIdTo", parentEvent.get("partyIdFrom"));
> -        parameters.put("toString", parentEvent.get("fromString"));
> -        parameters.put("statusId", "COM_IN_PROGRESS");
> +parentCommEventId = parameters.parentCommEventId;
> +
> +if (parentCommEventId) {
> +    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> [communicationEventId : parentCommEventId]);
> +    if (parentEvent) {
> +        orgEventId = parentEvent.origCommEventId;
> +        if (!orgEventId) orgEventId = parentCommEventId;
> +
> +        parameters.communicationEventTypeId =
> parentEvent.communicationEventTypeId;
> +        parameters.parentCommEventId = parentCommEventId;
> +        parameters.origCommEventId = orgEventId;
> +
> +        parameters.contactMechIdTo = parentEvent.contactMechIdFrom;
> +        parameters.contactMechIdFrom = parentEvent.contactMechIdTo;
> +
> +        parameters.partyIdFrom = userLogin.partyId;
> +        parameters.partyIdTo = parentEvent.partyIdFrom;
> +        parameters.toString =parentEvent.fromString;
> +        parameters.statusId = "COM_IN_PROGRESS";
>
> -        parameters.put("subject", "RE: " + parentEvent.get("subject"));
> -        parameters.put("content", "\n\n\n--------------- In reply to:\n\n"
> + parentEvent.get("content"));
> +        parameters.subject = "RE: " + parentEvent.subject;
> +        parameters.content = "\n\n\n--------------- In reply to:\n\n" +
> parentEvent.content;
>     }
>  }
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,41 +17,30 @@
>  * under the License.
>  */
>
> -import java.util.*;
> -import org.ofbiz.entity.*;
> -import org.ofbiz.base.util.*;
> -import org.ofbiz.securityext.login.*;
> -import org.ofbiz.common.*;
> -import org.ofbiz.party.contact.*;
> -import org.ofbiz.webapp.control.*;
> +import org.ofbiz.party.contact.ContactMechWorker;
>
> -String partyId = parameters.get("partyId");
> -context.put("partyId", partyId);
> +partyId = parameters.partyId;
> +context.partyId = partyId;
>
>  Map mechMap = new HashMap();
>  ContactMechWorker.getContactMechAndRelated(request, partyId, mechMap);
> -context.put("mechMap", mechMap);
> +context.mechMap = mechMap;
>
> -String contactMechId = (String) mechMap.get("contactMechId");
> -context.put("contactMechId", contactMechId);
> -
> -preContactMechTypeId = parameters.get("preContactMechTypeId");
> -context.put("preContactMechTypeId", preContactMechTypeId);
> -
> -paymentMethodId = parameters.get("paymentMethodId");
> -context.put("paymentMethodId", paymentMethodId);
> -
> -cmNewPurposeTypeId = parameters.get("contactMechPurposeTypeId");
> -if (cmNewPurposeTypeId != null) {
> -    contactMechPurposeType =
> delegator.findByPrimaryKey("ContactMechPurposeType",
> UtilMisc.toMap("contactMechPurposeTypeId", cmNewPurposeTypeId));
> -    if (contactMechPurposeType != null) {
> -        context.put("contactMechPurposeType", contactMechPurposeType);
> +context.contactMechId = mechMap.contactMechId;
> +context.preContactMechTypeId = parameters.preContactMechTypeId;
> +context.paymentMethodId = parameters.paymentMethodId;
> +
> +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId;
> +if (cmNewPurposeTypeId) {
> +    contactMechPurposeType =
> delegator.findByPrimaryKey("ContactMechPurposeType",
> [contactMechPurposeTypeId : cmNewPurposeTypeId]);
> +    if (contactMechPurposeType) {
> +        context.contactMechPurposeType = contactMechPurposeType;
>     } else {
>         cmNewPurposeTypeId = null;
>     }
> -    context.put("cmNewPurposeTypeId", cmNewPurposeTypeId);
> +    context.cmNewPurposeTypeId = cmNewPurposeTypeId;
>  }
>
> -String donePage = parameters.get("DONE_PAGE");
> -if (donePage == null || donePage.length() <= 0) donePage =
> "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> -context.put("donePage", donePage);
> +donePage = parameters.DONE_PAGE;
> +if (!donePage || donePage.length() <= 0) donePage =
> "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> +context.donePage = donePage;
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,54 +17,49 @@
>  * under the License.
>  */
>
> -import java.util.HashMap;
> -import org.ofbiz.base.util.UtilHttp;
>  import org.ofbiz.accounting.payment.PaymentWorker;
>  import org.ofbiz.party.contact.ContactMechWorker;
> -import org.ofbiz.securityext.login.*;
> -import org.ofbiz.webapp.control.*;
>
> -partyId = parameters.get("partyId");
> -if (partyId == null) {
> -    partyId = parameters.get("party_id");
> +partyId = parameters.partyId;
> +if (!partyId) {
> +    partyId = parameters.party_id;
>  }
> -context.put("partyId", partyId);
> +context.partyId = partyId;
>
>  // payment info
>  paymentResults = PaymentWorker.getPaymentMethodAndRelated(request,
> partyId);
>  //returns the following: "paymentMethod", "creditCard", "giftCard",
> "eftAccount", "paymentMethodId", "curContactMechId", "donePage", "tryEntity"
>  context.putAll(paymentResults);
>
> -curPostalAddressResults =
> ContactMechWorker.getCurrentPostalAddress(request, partyId,
> paymentResults.get("curContactMechId"));
> +curPostalAddressResults =
> ContactMechWorker.getCurrentPostalAddress(request, partyId,
> paymentResults.curContactMechId);
>  //returns the following: "curPartyContactMech", "curContactMech",
> "curPostalAddress", "curPartyContactMechPurposes"
>  context.putAll(curPostalAddressResults);
>
> -postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request,
> partyId, paymentResults.get("curContactMechId"));
> -context.put("postalAddressInfos", postalAddressInfos);
> +context.postalAddressInfos =
> ContactMechWorker.getPartyPostalAddresses(request, partyId,
> paymentResults.curContactMechId);
>
>  //prepare "Data" maps for filling form input boxes
> -tryEntity = paymentResults.get("tryEntity");
> +tryEntity = paymentResults.tryEntity;
>
> -creditCardData = paymentResults.get("creditCard");
> +creditCardData = paymentResults.creditCard;
>  if (!tryEntity.booleanValue()) creditCardData = parameters;
> -if (creditCardData == null) creditCardData = new HashMap();
> -if (creditCardData != null) context.put("creditCardData", creditCardData);
> +if (!creditCardData) creditCardData = new HashMap();
> +if (creditCardData) context.creditCardData = creditCardData;
>
> -giftCardData = paymentResults.get("giftCard");
> +giftCardData = paymentResults.giftCard;
>  if (!tryEntity.booleanValue()) giftCardData = parameters;
> -if (giftCardData == null) giftCardData = new HashMap();
> -if (giftCardData != null) context.put("giftCardData", giftCardData);
> +if (!giftCardData) giftCardData = new HashMap();
> +if (giftCardData) context.giftCardData = giftCardData;
>
> -eftAccountData = paymentResults.get("eftAccount");
> +eftAccountData = paymentResults.eftAccount;
>  if (!tryEntity.booleanValue()) eftAccountData = parameters;
> -if (eftAccountData == null) eftAccountData = new HashMap();
> -if (eftAccountData != null) context.put("eftAccountData", eftAccountData);
> +if (!eftAccountData) eftAccountData = new HashMap();
> +if (eftAccountData) context.eftAccountData = eftAccountData;
>
> -donePage = parameters.get("DONE_PAGE");
> -if (donePage == null || donePage.length() <= 0) donePage = "viewprofile";
> -context.put("donePage", donePage);
> +donePage = parameters.DONE_PAGE;
> +if (!donePage || donePage.length() <= 0) donePage = "viewprofile";
> +context.donePage = donePage;
>
> -paymentMethodData = paymentResults.get("paymentMethod");
> +paymentMethodData = paymentResults.paymentMethod;
>  if (!tryEntity.booleanValue()) paymentMethodData = parameters;
> -if (paymentMethodData == null) paymentMethodData = new HashMap();
> -if (paymentMethodData != null) context.put("paymentMethodData",
> paymentMethodData);
> +if (!paymentMethodData) paymentMethodData = new HashMap();
> +if (paymentMethodData) context.paymentMethodData = paymentMethodData;
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,13 +17,12 @@
>  * under the License.
>  */
>
> -import org.ofbiz.party.contact.*;
> +import org.ofbiz.party.contact.ContactMechWorker;
>
> -if (partyId == null) {
> -    partyId = parameters.get("partyId");
> +if (!partyId) {
> +    partyId = parameters.partyId;
>  }
> -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> -context.put("showOld", new Boolean(showOld));
> +boolean showOld = "true".equals(parameters.SHOW_OLD);
> +context.showOld = new Boolean(showOld);
>
> -List partyContactMechValueMaps =
> ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, showOld);
> -context.put("contactMeches", partyContactMechValueMaps);
> \ No newline at end of file
> +context.contactMeches =
> ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId, showOld);
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,19 +17,16 @@
>  * under the License.
>  */
>
> -import org.ofbiz.base.util.*;
>  import org.ofbiz.entity.util.EntityUtil;
>
> -if (partyId == null) {
> -    partyId = parameters.get("partyId");
> +if (!partyId) {
> +    partyId = parameters.partyId;
>  }
>
> -savedCartList = EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> UtilMisc.toMap("partyId", partyId,
> -        "shoppingListTypeId", "SLT_SPEC_PURP", "listName", "auto-save")));
> +savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> [partyId : partyId,
> +        shoppingListTypeId : "SLT_SPEC_PURP" , listName : "auto-save"]));
>
> -if (savedCartList != null){
> -      savedCartListId = savedCartList.getString("shoppingListId");
> -      context.put("savedCartListId", savedCartListId);
> -      savedCartItems = savedCartList.getRelated("ShoppingListItem");
> -      context.put("savedCartItems", savedCartItems);
> +if (savedCart){
> +      context.savedCartListId = savedCart.shoppingListId;
> +      context.savedCartItems = savedCart.getRelated("ShoppingListItem");
>  }
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> Wed Jun  4 01:55:56 2008
> @@ -19,13 +19,13 @@
>
>  import org.ofbiz.base.util.*;
>
> -if (partyId == null) {
> -    partyId = parameters.get("partyId");
> +if (!partyId) {
> +    partyId = parameters.partyId;
>  }
>
> -if (partyId != null) {
> +if (partyId) {
>     // get the system user
> -    system = delegator.findByPrimaryKey("UserLogin",
> UtilMisc.toMap("userLoginId", "system"));
> +    system = delegator.findByPrimaryKey("UserLogin", [userLoginId :
> "system"]);
>
>     monthsToInclude = new Integer(12);
>
> @@ -33,7 +33,7 @@
>             "statusId", "ORDER_COMPLETED", "monthsToInclude",
> monthsToInclude, "userLogin", system);
>     Map result = dispatcher.runSync("getOrderedSummaryInformation",
> serviceIn);
>
> -    context.put("monthsToInclude", monthsToInclude);
> -    context.put("totalSubRemainingAmount",
> result.get("totalSubRemainingAmount"));
> -    context.put("totalOrders", result.get("totalOrders"));
> +    context.monthsToInclude = monthsToInclude;
> +    context.totalSubRemainingAmount = result.totalSubRemainingAmount;
> +    context.totalOrders = result.totalOrders;
>  }
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,13 +17,12 @@
>  * under the License.
>  */
>
> -import org.ofbiz.accounting.payment.*;
> +import org.ofbiz.accounting.payment.PaymentWorker;
>
> -if (partyId == null) {
> -    partyId = parameters.get("partyId");
> +if (!partyId) {
> +    partyId = parameters.partyId;
>  }
> -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> -context.put("showOld", new Boolean(showOld));
> +boolean showOld = "true".equals(parameters.SHOW_OLD);
> +context.showOld = new Boolean(showOld);
>
> -List paymentMethodValueMaps =
> PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, showOld);
> -context.put("paymentMethodValueMaps", paymentMethodValueMaps);
> \ No newline at end of file
> +context.paymentMethodValueMaps =
> PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId, showOld);
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,15 +17,12 @@
>  * under the License.
>  */
>
> -import org.ofbiz.base.util.UtilMisc;
> -
>  //figure out the PRIMARY_EMAIL of the logged in user, for setting in the
> send email link
>  //maybe nice to put in some secondary emails later
> -userLogin = request.getAttribute("userLogin");
> -if (userLogin != null) {
> +if (userLogin) {
>   userLoginParty = userLogin.getRelatedOneCache("Party");
> -  userLoginPartyPrimaryEmails =
> userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> UtilMisc.toMap("contactMechPurposeTypeId", "PRIMARY_EMAIL"));
> -  if ((userLoginPartyPrimaryEmails != null) &&
> (userLoginPartyPrimaryEmails.size() > 0)) {
> -      context.put("thisUserPrimaryEmail",
> userLoginPartyPrimaryEmails.get(0));
> +  userLoginPartyPrimaryEmails =
> userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> [contactMechPurposeTypeId : "PRIMARY_EMAIL"]);
> +  if (userLoginPartyPrimaryEmails) {
> +      context.thisUserPrimaryEmail = userLoginPartyPrimaryEmails.get(0);
>   }
>  }
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,21 +17,17 @@
>  * under the License.
>  */
>
> -import java.util.*;
> -import org.ofbiz.entity.*;
> -import org.ofbiz.entity.condition.*;
> -import org.ofbiz.base.util.*;
> -import org.ofbiz.party.party.*;
> +import org.ofbiz.party.party.PartyWorker;
>
> -partyIdFrom = request.getParameter("partyId");
> -partyIdTo = request.getParameter("partyIdTo");
> +partyIdFrom = parameters.partyId;
> +partyIdTo = parameters.partyIdTo;
>
> -if (partyIdFrom != null) {
> +if (partyIdFrom) {
>     otherValues = PartyWorker.getPartyOtherValues(request, partyIdFrom,
> "partyFrom", "personFrom", "groupFrom");
>     context.putAll(otherValues);
>  }
>
> -if (partyIdTo != null) {
> +if (partyIdTo) {
>     otherValues = PartyWorker.getPartyOtherValues(request, partyIdTo,
> "partyTo", "personTo", "groupTo");
>     context.putAll(otherValues);
>  }
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> Wed Jun  4 01:55:56 2008
> @@ -17,36 +17,32 @@
>  * under the License.
>  */
>
> -import java.util.*;
> -import org.ofbiz.entity.*;
> -import org.ofbiz.entity.condition.*;
> -import org.ofbiz.base.util.*;
> -import org.ofbiz.securityext.login.*;
> -import org.ofbiz.common.*;
> -
> -import org.ofbiz.party.contact.*;
> -import org.ofbiz.party.party.*;
> -import org.ofbiz.accounting.payment.*;
> -import org.ofbiz.securityext.login.*;
> -
> -partyId = request.getParameter("party_id");
> -if (partyId == null) partyId = request.getParameter("partyId");
> -if (partyId == null) partyId = (String) request.getAttribute("partyId");
> -context.put("partyId", partyId);
> -
> -EntityConditionList ecl = EntityCondition.makeCondition(UtilMisc.toList(
> -                                EntityCondition.makeCondition("partyId",
> EntityOperator.EQUALS, partyId),
> -
>  EntityCondition.makeCondition("roleTypeId", EntityOperator.NOT_EQUAL,
> "_NA_")),
> -                            EntityOperator.AND);
> -partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> UtilMisc.toList("description"), null, false);
> -context.put("partyRoles", partyRoles);
> -
> -roles = delegator.findList("RoleType", null, null,
> UtilMisc.toList("description", "roleTypeId"), null, false);
> -context.put("roles", roles);
> -
> -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId",
> partyId));
> -context.put("party", party);
> -if (party != null) {
> -    context.put("lookupPerson", party.getRelatedOne("Person"));
> -    context.put("lookupGroup", party.getRelatedOne("PartyGroup"));
> -}
> +import org.ofbiz.entity.condition.EntityCondition;
> +import org.ofbiz.entity.condition.EntityOperator;
> +
> +import javolution.util.FastList;
> +
> +partyId = parameters.party_id;
> +if (!partyId) partyId = parameters.partyId;
> +if (!partyId) partyId = (String) request.getAttribute("partyId");
> +context.partyId = partyId;
> +
> +List roleTypeAndPartyExprs = FastList.newInstance();
> +expr = EntityCondition.makeCondition("partyId", EntityOperator.EQUALS,
> partyId);
> +roleTypeAndPartyExprs.add(expr);
> +expr = EntityCondition.makeCondition("roleTypeId",
> EntityOperator.NOT_EQUAL, "_NA_");
> +roleTypeAndPartyExprs.add(expr);
> +ecl = EntityCondition.makeCondition(roleTypeAndPartyExprs,
> EntityOperator.AND);
> +
> +partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> ["description"], null, false);
> +context.partyRoles = partyRoles;
> +
> +roles = delegator.findList("RoleType", null, null, ["description",
> "roleTypeId"], null, false);
> +context.roles = roles;
> +
> +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> +context.party = party;
> +if (party) {
> +    context.lookupPerson = party.getRelatedOne("Person");
> +    context.lookupGroup = party.getRelatedOne("PartyGroup");
> +}
> \ No newline at end of file
>
> Modified:
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=663038&r1=663037&r2=663038&view=diff
>
> ==============================================================================
> ---
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> (original)
> +++
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> Wed Jun  4 01:55:56 2008
> @@ -47,7 +47,7 @@
>             <entity-one entity-name="StatusItem" value-name="currentStatus"
> auto-field-map="false">
>                 <field-map field-name="statusId"
> env-name="communicationEvent.statusId"/>
>             </entity-one>
> -            <script
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh"/>
> +            <script
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy"/>
>         </actions>
>
>         <alt-target target="createCommunicationEvent"
> use-when="communicationEvent==null"/>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r663038 - in /ofbiz/trunk/applications/party/webapp/partymgr: WEB-INF/actions/communication/ WEB-INF/actions/party/ communication/

Scott Gray
Oops, I meant that an empty string resolves to false

Scott

2008/6/4 Scott Gray <[hidden email]>:

>
> donePage = parameters.DONE_PAGE;
> if (!donePage || donePage.length() <= 0) donePage = "viewprofile?party_id="
> + partyId + "&partyId=" + partyId;
> can be
> donePage = parameters.DONE_PAGE ?: "viewprofile?party_id=" + partyId +
> "&partyId=" + partyId;
> remember an empty string resolves to null
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r663038 - in /ofbiz/trunk/applications/party/webapp/partymgr: WEB-INF/actions/communication/ WEB-INF/actions/party/ communication/

Ashish Vijaywargiya
In reply to this post by Scott Gray
Scott,

Thanks a lot for these useful tips.
I'll dig into it and will patch all the issues from my previous work.

I had read only one document on Groovy i.e
http://www.ibm.com/developerworks/edu/j-dw-java-jgroovy-i.html.
Now I will spend more time in reading online document.
Although I will dig more into the commit that has been done by you in
previous days and will improve my work in the upcoming commits.

Thanks again for all your help.

--
Ashish

On Wed, Jun 4, 2008 at 6:08 AM, Scott Gray <[hidden email]> wrote:

> Hi Asish
>
> Just a couple more tips :-)
>
> You might have misunderstood what I said about the shortcut for the ternary
> operator
> sortField = parameters.sort ? parameters.sort : "entryDate";
> can just be
> sortField = parameters.sort ?: "entryDate";
> here is the documentation: http://groovy.codehaus.org/Operators (see elvis
> operator)
>
> In that document there is also mention of a safe navigation operator (which
> I haven't used yet)
> if (previousSort && previousSort.equals(sortField)) {
> can be replaced with
> if (previousSort?.equals(sortField)) {
> if previousSort is null the operator will return null instead of an NPE
>
> similar thing here:
> if (parameters.communicationEventTypeId) {
>   if (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION")) {
> can just be
> if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) {
> which will avoid an NPE
>
> This could have used the ?: operator as well:
>        orgEventId = parentEvent.origCommEventId;
>        if (!orgEventId) orgEventId = parentCommEventId;
> could just be
> orgEventId = parentEvent.origCommEventId ?: parentCommEventId;
>
> and here as well:
> donePage = parameters.DONE_PAGE;
> if (!donePage || donePage.length() <= 0) donePage = "viewprofile?party_id="
> + partyId + "&partyId=" + partyId;
> can be
> donePage = parameters.DONE_PAGE ?: "viewprofile?party_id=" + partyId +
> "&partyId=" + partyId;
> remember an empty string resolves to null
>
> and here:
> partyId = parameters.partyId;
> if (!partyId) {
>    partyId = parameters.party_id;
>  }
> can just be
> partyId = parameters.partyId ?: parameters.party_id;
> a few other places in this commit as well
>
> This is wrong:
> creditCardData = paymentResults.creditCard;
> if (!tryEntity.booleanValue()) creditCardData = parameters;
> if (!creditCardData) creditCardData = new HashMap();
> if (creditCardData) context.creditCardData = creditCardData;
>
> remember that an empty map or list will resolve to false so line 4 will be
> false even after new HashMap()
> it should be:
> creditCardData = paymentResults.creditCard;
> if (!tryEntity) creditCardData = parameters;
> context.creditCardData = creditCardData ?: new HashMap();
>
> same thing for giftCardData and eftAccountData, also remember instead of
> new
> HashMap() you can do [:] (or FastMap.newInstance())
>
> You do not need to declare variable types like "boolean showOld =" can just
> be "showOld =" also auto boxing/unboxing makes this unnecessary:
> boolean showOld = "true".equals(parameters.SHOW_OLD);
> context.showOld = new Boolean(showOld);
> can just be
> context.showOld = "true".equals(parameters.SHOW_OLD);
>
> Let me know if you have any questions :-)
>
> Regards
> Scott
>
> 2008/6/4 <[hidden email]>:
>
> > Author: ashish
> > Date: Wed Jun  4 01:55:56 2008
> > New Revision: 663038
> >
> > URL: http://svn.apache.org/viewvc?rev=663038&view=rev
> > Log:
> > Applied Groovy Features to the party component files.
> > Part of JIRA issue # OFBIZ-1801
> >
> > Modified:
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -24,24 +24,20 @@
> >  * expanded to work off other communication event types.
> >  */
> >
> > -import org.ofbiz.base.util.*;
> > +import org.ofbiz.base.util.UtilDateTime;
> >  import org.ofbiz.entity.util.EntityUtil;
> >
> > -delegator = request.getAttribute("delegator");
> > -userLogin = request.getAttribute("userLogin");
> > -partyIdFrom = context.get("partyIdFrom");
> > -partyIdTo = context.get("partyIdTo");
> > +partyIdFrom = context.partyIdFrom;
> > +partyIdTo = context.partyIdTo;
> >
> > -if (parameters.get("communicationEventTypeId") != null) {
> > -   if
> >
> (parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION")) {
> > -      userEmailAddresses =
> delegator.findByAnd("PartyContactWithPurpose",
> > UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
> >  partyIdFrom));
> > +if (parameters.communicationEventTypeId) {
> > +   if
> (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION"))
> > {
> > +      userEmailAddresses =
> delegator.findByAnd("PartyContactWithPurpose",
> > [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom]);
> >       userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses,
> > UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
> > -      context.put("userEmailAddresses", userEmailAddresses);
> > +      context.userEmailAddresses = userEmailAddresses;
> >
> > -      targetEmailAddresses =
> > delegator.findByAnd("PartyContactWithPurpose",
> > UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
> partyIdTo));
> > +      targetEmailAddresses =
> > delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId :
> > "EMAIL_ADDRESS", partyId : partyIdTo]);
> >       targetEmailAddresses =
> EntityUtil.filterByDate(targetEmailAddresses,
> > UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
> > -      context.put("targetEmailAddresses", targetEmailAddresses);
> > +      context.targetEmailAddresses = targetEmailAddresses;
> >    }
> > -}
> > -
> > -
> > +}
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,33 +17,38 @@
> >  * under the License.
> >  */
> >
> > -import org.ofbiz.base.util.*;
> > -import org.ofbiz.entity.*;
> > -import org.ofbiz.entity.condition.*;
> > +import org.ofbiz.entity.condition.EntityOperator;
> > +import org.ofbiz.entity.condition.EntityCondition;
> >
> > -partyId = parameters.get("partyId");
> > -context.put("partyId", partyId);
> > +import javolution.util.FastList;
> >
> > -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId",
> > partyId));
> > -context.put("party", party);
> > +partyId = parameters.partyId;
> > +context.partyId = partyId;
> > +
> > +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> > +context.party = party;
> >
> >  // get the sort field
> > -sortField = request.getParameter("sort");
> > -if (sortField == null) sortField = "entryDate";
> > -context.put("previousSort", sortField);
> > +sortField = parameters.sort ? parameters.sort : "entryDate";
> > +context.previousSort = sortField;
> >
> >  // previous sort field
> > -previousSort = request.getParameter("previousSort");
> > -if (previousSort != null && previousSort.equals(sortField)) {
> > +previousSort = parameters.previousSort;
> > +if (previousSort && previousSort.equals(sortField)) {
> >     sortField = "-" + sortField;
> >  }
> >
> > -eventExprs = UtilMisc.toList(EntityCondition.makeCondition("partyIdTo",
> > EntityOperator.EQUALS, partyId),
> > EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS,
> > partyId));
> > +List eventExprs = FastList.newInstance();
> > +expr = EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS,
> > partyId);
> > +eventExprs.add(expr);
> > +expr = EntityCondition.makeCondition("partyIdFrom",
> EntityOperator.EQUALS,
> > "partyId");
> > +eventExprs.add(expr);
> >  ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR);
> > -events = delegator.findList("CommunicationEvent", ecl, null,
> > UtilMisc.toList(sortField), null, false);
> > -context.put("eventList", events);
> > -context.put("eventListSize", events.size());
> > -context.put("highIndex", events.size());
> > -context.put("viewSize", events.size());
> > -context.put("lowIndex", 1);
> > -context.put("viewIndex", 1);
> > +events = delegator.findList("CommunicationEvent", ecl, null,
> [sortField],
> > null, false);
> > +
> > +context.eventList = events;
> > +context.eventListSize = events.size();
> > +context.highIndex = events.size();
> > +context.viewSize = events.size();
> > +context.lowIndex = 1;
> > +context.viewIndex = 1;
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -19,29 +19,27 @@
> >
> >  import org.ofbiz.base.util.*;
> >
> > -delegator = request.getAttribute("delegator");
> > -userLogin = request.getAttribute("userLogin");
> > -parentCommEventId = parameters.get("parentCommEventId");
> > -
> > -if (parentCommEventId != null) {
> > -    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> > UtilMisc.toMap("communicationEventId", parentCommEventId));
> > -    if (parentEvent != null) {
> > -        orgEventId = parentEvent.get("origCommEventId");
> > -        if (orgEventId == null) orgEventId = parentCommEventId;
> > -
> > -        parameters.put("communicationEventTypeId",
> > parentEvent.get("communicationEventTypeId"));
> > -        parameters.put("parentCommEventId", parentCommEventId);
> > -        parameters.put("origCommEventId", orgEventId);
> > -
> > -        parameters.put("contactMechIdTo",
> > parentEvent.get("contactMechIdFrom"));
> > -        parameters.put("contactMechIdFrom",
> > parentEvent.get("contactMechIdTo"));
> > -
> > -        parameters.put("partyIdFrom", userLogin.get("partyId"));
> > -        parameters.put("partyIdTo", parentEvent.get("partyIdFrom"));
> > -        parameters.put("toString", parentEvent.get("fromString"));
> > -        parameters.put("statusId", "COM_IN_PROGRESS");
> > +parentCommEventId = parameters.parentCommEventId;
> > +
> > +if (parentCommEventId) {
> > +    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> > [communicationEventId : parentCommEventId]);
> > +    if (parentEvent) {
> > +        orgEventId = parentEvent.origCommEventId;
> > +        if (!orgEventId) orgEventId = parentCommEventId;
> > +
> > +        parameters.communicationEventTypeId =
> > parentEvent.communicationEventTypeId;
> > +        parameters.parentCommEventId = parentCommEventId;
> > +        parameters.origCommEventId = orgEventId;
> > +
> > +        parameters.contactMechIdTo = parentEvent.contactMechIdFrom;
> > +        parameters.contactMechIdFrom = parentEvent.contactMechIdTo;
> > +
> > +        parameters.partyIdFrom = userLogin.partyId;
> > +        parameters.partyIdTo = parentEvent.partyIdFrom;
> > +        parameters.toString =parentEvent.fromString;
> > +        parameters.statusId = "COM_IN_PROGRESS";
> >
> > -        parameters.put("subject", "RE: " + parentEvent.get("subject"));
> > -        parameters.put("content", "\n\n\n--------------- In reply
> to:\n\n"
> > + parentEvent.get("content"));
> > +        parameters.subject = "RE: " + parentEvent.subject;
> > +        parameters.content = "\n\n\n--------------- In reply to:\n\n" +
> > parentEvent.content;
> >     }
> >  }
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,41 +17,30 @@
> >  * under the License.
> >  */
> >
> > -import java.util.*;
> > -import org.ofbiz.entity.*;
> > -import org.ofbiz.base.util.*;
> > -import org.ofbiz.securityext.login.*;
> > -import org.ofbiz.common.*;
> > -import org.ofbiz.party.contact.*;
> > -import org.ofbiz.webapp.control.*;
> > +import org.ofbiz.party.contact.ContactMechWorker;
> >
> > -String partyId = parameters.get("partyId");
> > -context.put("partyId", partyId);
> > +partyId = parameters.partyId;
> > +context.partyId = partyId;
> >
> >  Map mechMap = new HashMap();
> >  ContactMechWorker.getContactMechAndRelated(request, partyId, mechMap);
> > -context.put("mechMap", mechMap);
> > +context.mechMap = mechMap;
> >
> > -String contactMechId = (String) mechMap.get("contactMechId");
> > -context.put("contactMechId", contactMechId);
> > -
> > -preContactMechTypeId = parameters.get("preContactMechTypeId");
> > -context.put("preContactMechTypeId", preContactMechTypeId);
> > -
> > -paymentMethodId = parameters.get("paymentMethodId");
> > -context.put("paymentMethodId", paymentMethodId);
> > -
> > -cmNewPurposeTypeId = parameters.get("contactMechPurposeTypeId");
> > -if (cmNewPurposeTypeId != null) {
> > -    contactMechPurposeType =
> > delegator.findByPrimaryKey("ContactMechPurposeType",
> > UtilMisc.toMap("contactMechPurposeTypeId", cmNewPurposeTypeId));
> > -    if (contactMechPurposeType != null) {
> > -        context.put("contactMechPurposeType", contactMechPurposeType);
> > +context.contactMechId = mechMap.contactMechId;
> > +context.preContactMechTypeId = parameters.preContactMechTypeId;
> > +context.paymentMethodId = parameters.paymentMethodId;
> > +
> > +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId;
> > +if (cmNewPurposeTypeId) {
> > +    contactMechPurposeType =
> > delegator.findByPrimaryKey("ContactMechPurposeType",
> > [contactMechPurposeTypeId : cmNewPurposeTypeId]);
> > +    if (contactMechPurposeType) {
> > +        context.contactMechPurposeType = contactMechPurposeType;
> >     } else {
> >         cmNewPurposeTypeId = null;
> >     }
> > -    context.put("cmNewPurposeTypeId", cmNewPurposeTypeId);
> > +    context.cmNewPurposeTypeId = cmNewPurposeTypeId;
> >  }
> >
> > -String donePage = parameters.get("DONE_PAGE");
> > -if (donePage == null || donePage.length() <= 0) donePage =
> > "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> > -context.put("donePage", donePage);
> > +donePage = parameters.DONE_PAGE;
> > +if (!donePage || donePage.length() <= 0) donePage =
> > "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> > +context.donePage = donePage;
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,54 +17,49 @@
> >  * under the License.
> >  */
> >
> > -import java.util.HashMap;
> > -import org.ofbiz.base.util.UtilHttp;
> >  import org.ofbiz.accounting.payment.PaymentWorker;
> >  import org.ofbiz.party.contact.ContactMechWorker;
> > -import org.ofbiz.securityext.login.*;
> > -import org.ofbiz.webapp.control.*;
> >
> > -partyId = parameters.get("partyId");
> > -if (partyId == null) {
> > -    partyId = parameters.get("party_id");
> > +partyId = parameters.partyId;
> > +if (!partyId) {
> > +    partyId = parameters.party_id;
> >  }
> > -context.put("partyId", partyId);
> > +context.partyId = partyId;
> >
> >  // payment info
> >  paymentResults = PaymentWorker.getPaymentMethodAndRelated(request,
> > partyId);
> >  //returns the following: "paymentMethod", "creditCard", "giftCard",
> > "eftAccount", "paymentMethodId", "curContactMechId", "donePage",
> "tryEntity"
> >  context.putAll(paymentResults);
> >
> > -curPostalAddressResults =
> > ContactMechWorker.getCurrentPostalAddress(request, partyId,
> > paymentResults.get("curContactMechId"));
> > +curPostalAddressResults =
> > ContactMechWorker.getCurrentPostalAddress(request, partyId,
> > paymentResults.curContactMechId);
> >  //returns the following: "curPartyContactMech", "curContactMech",
> > "curPostalAddress", "curPartyContactMechPurposes"
> >  context.putAll(curPostalAddressResults);
> >
> > -postalAddressInfos = ContactMechWorker.getPartyPostalAddresses(request,
> > partyId, paymentResults.get("curContactMechId"));
> > -context.put("postalAddressInfos", postalAddressInfos);
> > +context.postalAddressInfos =
> > ContactMechWorker.getPartyPostalAddresses(request, partyId,
> > paymentResults.curContactMechId);
> >
> >  //prepare "Data" maps for filling form input boxes
> > -tryEntity = paymentResults.get("tryEntity");
> > +tryEntity = paymentResults.tryEntity;
> >
> > -creditCardData = paymentResults.get("creditCard");
> > +creditCardData = paymentResults.creditCard;
> >  if (!tryEntity.booleanValue()) creditCardData = parameters;
> > -if (creditCardData == null) creditCardData = new HashMap();
> > -if (creditCardData != null) context.put("creditCardData",
> creditCardData);
> > +if (!creditCardData) creditCardData = new HashMap();
> > +if (creditCardData) context.creditCardData = creditCardData;
> >
> > -giftCardData = paymentResults.get("giftCard");
> > +giftCardData = paymentResults.giftCard;
> >  if (!tryEntity.booleanValue()) giftCardData = parameters;
> > -if (giftCardData == null) giftCardData = new HashMap();
> > -if (giftCardData != null) context.put("giftCardData", giftCardData);
> > +if (!giftCardData) giftCardData = new HashMap();
> > +if (giftCardData) context.giftCardData = giftCardData;
> >
> > -eftAccountData = paymentResults.get("eftAccount");
> > +eftAccountData = paymentResults.eftAccount;
> >  if (!tryEntity.booleanValue()) eftAccountData = parameters;
> > -if (eftAccountData == null) eftAccountData = new HashMap();
> > -if (eftAccountData != null) context.put("eftAccountData",
> eftAccountData);
> > +if (!eftAccountData) eftAccountData = new HashMap();
> > +if (eftAccountData) context.eftAccountData = eftAccountData;
> >
> > -donePage = parameters.get("DONE_PAGE");
> > -if (donePage == null || donePage.length() <= 0) donePage =
> "viewprofile";
> > -context.put("donePage", donePage);
> > +donePage = parameters.DONE_PAGE;
> > +if (!donePage || donePage.length() <= 0) donePage = "viewprofile";
> > +context.donePage = donePage;
> >
> > -paymentMethodData = paymentResults.get("paymentMethod");
> > +paymentMethodData = paymentResults.paymentMethod;
> >  if (!tryEntity.booleanValue()) paymentMethodData = parameters;
> > -if (paymentMethodData == null) paymentMethodData = new HashMap();
> > -if (paymentMethodData != null) context.put("paymentMethodData",
> > paymentMethodData);
> > +if (!paymentMethodData) paymentMethodData = new HashMap();
> > +if (paymentMethodData) context.paymentMethodData = paymentMethodData;
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,13 +17,12 @@
> >  * under the License.
> >  */
> >
> > -import org.ofbiz.party.contact.*;
> > +import org.ofbiz.party.contact.ContactMechWorker;
> >
> > -if (partyId == null) {
> > -    partyId = parameters.get("partyId");
> > +if (!partyId) {
> > +    partyId = parameters.partyId;
> >  }
> > -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> > -context.put("showOld", new Boolean(showOld));
> > +boolean showOld = "true".equals(parameters.SHOW_OLD);
> > +context.showOld = new Boolean(showOld);
> >
> > -List partyContactMechValueMaps =
> > ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId,
> showOld);
> > -context.put("contactMeches", partyContactMechValueMaps);
> > \ No newline at end of file
> > +context.contactMeches =
> > ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId,
> showOld);
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,19 +17,16 @@
> >  * under the License.
> >  */
> >
> > -import org.ofbiz.base.util.*;
> >  import org.ofbiz.entity.util.EntityUtil;
> >
> > -if (partyId == null) {
> > -    partyId = parameters.get("partyId");
> > +if (!partyId) {
> > +    partyId = parameters.partyId;
> >  }
> >
> > -savedCartList = EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> > UtilMisc.toMap("partyId", partyId,
> > -        "shoppingListTypeId", "SLT_SPEC_PURP", "listName",
> "auto-save")));
> > +savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> > [partyId : partyId,
> > +        shoppingListTypeId : "SLT_SPEC_PURP" , listName :
> "auto-save"]));
> >
> > -if (savedCartList != null){
> > -      savedCartListId = savedCartList.getString("shoppingListId");
> > -      context.put("savedCartListId", savedCartListId);
> > -      savedCartItems = savedCartList.getRelated("ShoppingListItem");
> > -      context.put("savedCartItems", savedCartItems);
> > +if (savedCart){
> > +      context.savedCartListId = savedCart.shoppingListId;
> > +      context.savedCartItems = savedCart.getRelated("ShoppingListItem");
> >  }
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -19,13 +19,13 @@
> >
> >  import org.ofbiz.base.util.*;
> >
> > -if (partyId == null) {
> > -    partyId = parameters.get("partyId");
> > +if (!partyId) {
> > +    partyId = parameters.partyId;
> >  }
> >
> > -if (partyId != null) {
> > +if (partyId) {
> >     // get the system user
> > -    system = delegator.findByPrimaryKey("UserLogin",
> > UtilMisc.toMap("userLoginId", "system"));
> > +    system = delegator.findByPrimaryKey("UserLogin", [userLoginId :
> > "system"]);
> >
> >     monthsToInclude = new Integer(12);
> >
> > @@ -33,7 +33,7 @@
> >             "statusId", "ORDER_COMPLETED", "monthsToInclude",
> > monthsToInclude, "userLogin", system);
> >     Map result = dispatcher.runSync("getOrderedSummaryInformation",
> > serviceIn);
> >
> > -    context.put("monthsToInclude", monthsToInclude);
> > -    context.put("totalSubRemainingAmount",
> > result.get("totalSubRemainingAmount"));
> > -    context.put("totalOrders", result.get("totalOrders"));
> > +    context.monthsToInclude = monthsToInclude;
> > +    context.totalSubRemainingAmount = result.totalSubRemainingAmount;
> > +    context.totalOrders = result.totalOrders;
> >  }
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,13 +17,12 @@
> >  * under the License.
> >  */
> >
> > -import org.ofbiz.accounting.payment.*;
> > +import org.ofbiz.accounting.payment.PaymentWorker;
> >
> > -if (partyId == null) {
> > -    partyId = parameters.get("partyId");
> > +if (!partyId) {
> > +    partyId = parameters.partyId;
> >  }
> > -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> > -context.put("showOld", new Boolean(showOld));
> > +boolean showOld = "true".equals(parameters.SHOW_OLD);
> > +context.showOld = new Boolean(showOld);
> >
> > -List paymentMethodValueMaps =
> > PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId,
> showOld);
> > -context.put("paymentMethodValueMaps", paymentMethodValueMaps);
> > \ No newline at end of file
> > +context.paymentMethodValueMaps =
> > PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId,
> showOld);
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,15 +17,12 @@
> >  * under the License.
> >  */
> >
> > -import org.ofbiz.base.util.UtilMisc;
> > -
> >  //figure out the PRIMARY_EMAIL of the logged in user, for setting in the
> > send email link
> >  //maybe nice to put in some secondary emails later
> > -userLogin = request.getAttribute("userLogin");
> > -if (userLogin != null) {
> > +if (userLogin) {
> >   userLoginParty = userLogin.getRelatedOneCache("Party");
> > -  userLoginPartyPrimaryEmails =
> > userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> > UtilMisc.toMap("contactMechPurposeTypeId", "PRIMARY_EMAIL"));
> > -  if ((userLoginPartyPrimaryEmails != null) &&
> > (userLoginPartyPrimaryEmails.size() > 0)) {
> > -      context.put("thisUserPrimaryEmail",
> > userLoginPartyPrimaryEmails.get(0));
> > +  userLoginPartyPrimaryEmails =
> > userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> > [contactMechPurposeTypeId : "PRIMARY_EMAIL"]);
> > +  if (userLoginPartyPrimaryEmails) {
> > +      context.thisUserPrimaryEmail = userLoginPartyPrimaryEmails.get(0);
> >   }
> >  }
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,21 +17,17 @@
> >  * under the License.
> >  */
> >
> > -import java.util.*;
> > -import org.ofbiz.entity.*;
> > -import org.ofbiz.entity.condition.*;
> > -import org.ofbiz.base.util.*;
> > -import org.ofbiz.party.party.*;
> > +import org.ofbiz.party.party.PartyWorker;
> >
> > -partyIdFrom = request.getParameter("partyId");
> > -partyIdTo = request.getParameter("partyIdTo");
> > +partyIdFrom = parameters.partyId;
> > +partyIdTo = parameters.partyIdTo;
> >
> > -if (partyIdFrom != null) {
> > +if (partyIdFrom) {
> >     otherValues = PartyWorker.getPartyOtherValues(request, partyIdFrom,
> > "partyFrom", "personFrom", "groupFrom");
> >     context.putAll(otherValues);
> >  }
> >
> > -if (partyIdTo != null) {
> > +if (partyIdTo) {
> >     otherValues = PartyWorker.getPartyOtherValues(request, partyIdTo,
> > "partyTo", "personTo", "groupTo");
> >     context.putAll(otherValues);
> >  }
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > Wed Jun  4 01:55:56 2008
> > @@ -17,36 +17,32 @@
> >  * under the License.
> >  */
> >
> > -import java.util.*;
> > -import org.ofbiz.entity.*;
> > -import org.ofbiz.entity.condition.*;
> > -import org.ofbiz.base.util.*;
> > -import org.ofbiz.securityext.login.*;
> > -import org.ofbiz.common.*;
> > -
> > -import org.ofbiz.party.contact.*;
> > -import org.ofbiz.party.party.*;
> > -import org.ofbiz.accounting.payment.*;
> > -import org.ofbiz.securityext.login.*;
> > -
> > -partyId = request.getParameter("party_id");
> > -if (partyId == null) partyId = request.getParameter("partyId");
> > -if (partyId == null) partyId = (String) request.getAttribute("partyId");
> > -context.put("partyId", partyId);
> > -
> > -EntityConditionList ecl = EntityCondition.makeCondition(UtilMisc.toList(
> > -                                EntityCondition.makeCondition("partyId",
> > EntityOperator.EQUALS, partyId),
> > -
> >  EntityCondition.makeCondition("roleTypeId", EntityOperator.NOT_EQUAL,
> > "_NA_")),
> > -                            EntityOperator.AND);
> > -partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> > UtilMisc.toList("description"), null, false);
> > -context.put("partyRoles", partyRoles);
> > -
> > -roles = delegator.findList("RoleType", null, null,
> > UtilMisc.toList("description", "roleTypeId"), null, false);
> > -context.put("roles", roles);
> > -
> > -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId",
> > partyId));
> > -context.put("party", party);
> > -if (party != null) {
> > -    context.put("lookupPerson", party.getRelatedOne("Person"));
> > -    context.put("lookupGroup", party.getRelatedOne("PartyGroup"));
> > -}
> > +import org.ofbiz.entity.condition.EntityCondition;
> > +import org.ofbiz.entity.condition.EntityOperator;
> > +
> > +import javolution.util.FastList;
> > +
> > +partyId = parameters.party_id;
> > +if (!partyId) partyId = parameters.partyId;
> > +if (!partyId) partyId = (String) request.getAttribute("partyId");
> > +context.partyId = partyId;
> > +
> > +List roleTypeAndPartyExprs = FastList.newInstance();
> > +expr = EntityCondition.makeCondition("partyId", EntityOperator.EQUALS,
> > partyId);
> > +roleTypeAndPartyExprs.add(expr);
> > +expr = EntityCondition.makeCondition("roleTypeId",
> > EntityOperator.NOT_EQUAL, "_NA_");
> > +roleTypeAndPartyExprs.add(expr);
> > +ecl = EntityCondition.makeCondition(roleTypeAndPartyExprs,
> > EntityOperator.AND);
> > +
> > +partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> > ["description"], null, false);
> > +context.partyRoles = partyRoles;
> > +
> > +roles = delegator.findList("RoleType", null, null, ["description",
> > "roleTypeId"], null, false);
> > +context.roles = roles;
> > +
> > +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> > +context.party = party;
> > +if (party) {
> > +    context.lookupPerson = party.getRelatedOne("Person");
> > +    context.lookupGroup = party.getRelatedOne("PartyGroup");
> > +}
> > \ No newline at end of file
> >
> > Modified:
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > URL:
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=663038&r1=663037&r2=663038&view=diff
> >
> >
> ==============================================================================
> > ---
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > (original)
> > +++
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > Wed Jun  4 01:55:56 2008
> > @@ -47,7 +47,7 @@
> >             <entity-one entity-name="StatusItem"
> value-name="currentStatus"
> > auto-field-map="false">
> >                 <field-map field-name="statusId"
> > env-name="communicationEvent.statusId"/>
> >             </entity-one>
> > -            <script
> >
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh"/>
> > +            <script
> >
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy"/>
> >         </actions>
> >
> >         <alt-target target="createCommunicationEvent"
> > use-when="communicationEvent==null"/>
> >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r663038 - in /ofbiz/trunk/applications/party/webapp/partymgr: WEB-INF/actions/communication/ WEB-INF/actions/party/ communication/

Scott Gray
No problem at all.  The docs are very helpful with good examples, these ones
in particular:
http://groovy.codehaus.org/Collections
http://groovy.codehaus.org/Control+Structures
http://groovy.codehaus.org/Groovy+Truth
http://groovy.codehaus.org/Operators

Regards
Scott

2008/6/4 Ashish Vijaywargiya <[hidden email]>:

> Scott,
>
> Thanks a lot for these useful tips.
> I'll dig into it and will patch all the issues from my previous work.
>
> I had read only one document on Groovy i.e
> http://www.ibm.com/developerworks/edu/j-dw-java-jgroovy-i.html.
> Now I will spend more time in reading online document.
> Although I will dig more into the commit that has been done by you in
> previous days and will improve my work in the upcoming commits.
>
> Thanks again for all your help.
>
> --
> Ashish
>
> On Wed, Jun 4, 2008 at 6:08 AM, Scott Gray <[hidden email]> wrote:
>
> > Hi Asish
> >
> > Just a couple more tips :-)
> >
> > You might have misunderstood what I said about the shortcut for the
> ternary
> > operator
> > sortField = parameters.sort ? parameters.sort : "entryDate";
> > can just be
> > sortField = parameters.sort ?: "entryDate";
> > here is the documentation: http://groovy.codehaus.org/Operators (see
> elvis
> > operator)
> >
> > In that document there is also mention of a safe navigation operator
> (which
> > I haven't used yet)
> > if (previousSort && previousSort.equals(sortField)) {
> > can be replaced with
> > if (previousSort?.equals(sortField)) {
> > if previousSort is null the operator will return null instead of an NPE
> >
> > similar thing here:
> > if (parameters.communicationEventTypeId) {
> >   if (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION"))
> {
> > can just be
> > if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) {
> > which will avoid an NPE
> >
> > This could have used the ?: operator as well:
> >        orgEventId = parentEvent.origCommEventId;
> >        if (!orgEventId) orgEventId = parentCommEventId;
> > could just be
> > orgEventId = parentEvent.origCommEventId ?: parentCommEventId;
> >
> > and here as well:
> > donePage = parameters.DONE_PAGE;
> > if (!donePage || donePage.length() <= 0) donePage =
> "viewprofile?party_id="
> > + partyId + "&partyId=" + partyId;
> > can be
> > donePage = parameters.DONE_PAGE ?: "viewprofile?party_id=" + partyId +
> > "&partyId=" + partyId;
> > remember an empty string resolves to null
> >
> > and here:
> > partyId = parameters.partyId;
> > if (!partyId) {
> >    partyId = parameters.party_id;
> >  }
> > can just be
> > partyId = parameters.partyId ?: parameters.party_id;
> > a few other places in this commit as well
> >
> > This is wrong:
> > creditCardData = paymentResults.creditCard;
> > if (!tryEntity.booleanValue()) creditCardData = parameters;
> > if (!creditCardData) creditCardData = new HashMap();
> > if (creditCardData) context.creditCardData = creditCardData;
> >
> > remember that an empty map or list will resolve to false so line 4 will
> be
> > false even after new HashMap()
> > it should be:
> > creditCardData = paymentResults.creditCard;
> > if (!tryEntity) creditCardData = parameters;
> > context.creditCardData = creditCardData ?: new HashMap();
> >
> > same thing for giftCardData and eftAccountData, also remember instead of
> > new
> > HashMap() you can do [:] (or FastMap.newInstance())
> >
> > You do not need to declare variable types like "boolean showOld =" can
> just
> > be "showOld =" also auto boxing/unboxing makes this unnecessary:
> > boolean showOld = "true".equals(parameters.SHOW_OLD);
> > context.showOld = new Boolean(showOld);
> > can just be
> > context.showOld = "true".equals(parameters.SHOW_OLD);
> >
> > Let me know if you have any questions :-)
> >
> > Regards
> > Scott
> >
> > 2008/6/4 <[hidden email]>:
> >
> > > Author: ashish
> > > Date: Wed Jun  4 01:55:56 2008
> > > New Revision: 663038
> > >
> > > URL: http://svn.apache.org/viewvc?rev=663038&view=rev
> > > Log:
> > > Applied Groovy Features to the party component files.
> > > Part of JIRA issue # OFBIZ-1801
> > >
> > > Modified:
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -24,24 +24,20 @@
> > >  * expanded to work off other communication event types.
> > >  */
> > >
> > > -import org.ofbiz.base.util.*;
> > > +import org.ofbiz.base.util.UtilDateTime;
> > >  import org.ofbiz.entity.util.EntityUtil;
> > >
> > > -delegator = request.getAttribute("delegator");
> > > -userLogin = request.getAttribute("userLogin");
> > > -partyIdFrom = context.get("partyIdFrom");
> > > -partyIdTo = context.get("partyIdTo");
> > > +partyIdFrom = context.partyIdFrom;
> > > +partyIdTo = context.partyIdTo;
> > >
> > > -if (parameters.get("communicationEventTypeId") != null) {
> > > -   if
> > >
> >
> (parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION")) {
> > > -      userEmailAddresses =
> > delegator.findByAnd("PartyContactWithPurpose",
> > > UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
> > >  partyIdFrom));
> > > +if (parameters.communicationEventTypeId) {
> > > +   if
> > (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION"))
> > > {
> > > +      userEmailAddresses =
> > delegator.findByAnd("PartyContactWithPurpose",
> > > [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom]);
> > >       userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses,
> > > UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate",
> true);
> > > -      context.put("userEmailAddresses", userEmailAddresses);
> > > +      context.userEmailAddresses = userEmailAddresses;
> > >
> > > -      targetEmailAddresses =
> > > delegator.findByAnd("PartyContactWithPurpose",
> > > UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
> > partyIdTo));
> > > +      targetEmailAddresses =
> > > delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId :
> > > "EMAIL_ADDRESS", partyId : partyIdTo]);
> > >       targetEmailAddresses =
> > EntityUtil.filterByDate(targetEmailAddresses,
> > > UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate",
> true);
> > > -      context.put("targetEmailAddresses", targetEmailAddresses);
> > > +      context.targetEmailAddresses = targetEmailAddresses;
> > >    }
> > > -}
> > > -
> > > -
> > > +}
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,33 +17,38 @@
> > >  * under the License.
> > >  */
> > >
> > > -import org.ofbiz.base.util.*;
> > > -import org.ofbiz.entity.*;
> > > -import org.ofbiz.entity.condition.*;
> > > +import org.ofbiz.entity.condition.EntityOperator;
> > > +import org.ofbiz.entity.condition.EntityCondition;
> > >
> > > -partyId = parameters.get("partyId");
> > > -context.put("partyId", partyId);
> > > +import javolution.util.FastList;
> > >
> > > -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId",
> > > partyId));
> > > -context.put("party", party);
> > > +partyId = parameters.partyId;
> > > +context.partyId = partyId;
> > > +
> > > +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> > > +context.party = party;
> > >
> > >  // get the sort field
> > > -sortField = request.getParameter("sort");
> > > -if (sortField == null) sortField = "entryDate";
> > > -context.put("previousSort", sortField);
> > > +sortField = parameters.sort ? parameters.sort : "entryDate";
> > > +context.previousSort = sortField;
> > >
> > >  // previous sort field
> > > -previousSort = request.getParameter("previousSort");
> > > -if (previousSort != null && previousSort.equals(sortField)) {
> > > +previousSort = parameters.previousSort;
> > > +if (previousSort && previousSort.equals(sortField)) {
> > >     sortField = "-" + sortField;
> > >  }
> > >
> > > -eventExprs =
> UtilMisc.toList(EntityCondition.makeCondition("partyIdTo",
> > > EntityOperator.EQUALS, partyId),
> > > EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS,
> > > partyId));
> > > +List eventExprs = FastList.newInstance();
> > > +expr = EntityCondition.makeCondition("partyIdTo",
> EntityOperator.EQUALS,
> > > partyId);
> > > +eventExprs.add(expr);
> > > +expr = EntityCondition.makeCondition("partyIdFrom",
> > EntityOperator.EQUALS,
> > > "partyId");
> > > +eventExprs.add(expr);
> > >  ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR);
> > > -events = delegator.findList("CommunicationEvent", ecl, null,
> > > UtilMisc.toList(sortField), null, false);
> > > -context.put("eventList", events);
> > > -context.put("eventListSize", events.size());
> > > -context.put("highIndex", events.size());
> > > -context.put("viewSize", events.size());
> > > -context.put("lowIndex", 1);
> > > -context.put("viewIndex", 1);
> > > +events = delegator.findList("CommunicationEvent", ecl, null,
> > [sortField],
> > > null, false);
> > > +
> > > +context.eventList = events;
> > > +context.eventListSize = events.size();
> > > +context.highIndex = events.size();
> > > +context.viewSize = events.size();
> > > +context.lowIndex = 1;
> > > +context.viewIndex = 1;
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -19,29 +19,27 @@
> > >
> > >  import org.ofbiz.base.util.*;
> > >
> > > -delegator = request.getAttribute("delegator");
> > > -userLogin = request.getAttribute("userLogin");
> > > -parentCommEventId = parameters.get("parentCommEventId");
> > > -
> > > -if (parentCommEventId != null) {
> > > -    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> > > UtilMisc.toMap("communicationEventId", parentCommEventId));
> > > -    if (parentEvent != null) {
> > > -        orgEventId = parentEvent.get("origCommEventId");
> > > -        if (orgEventId == null) orgEventId = parentCommEventId;
> > > -
> > > -        parameters.put("communicationEventTypeId",
> > > parentEvent.get("communicationEventTypeId"));
> > > -        parameters.put("parentCommEventId", parentCommEventId);
> > > -        parameters.put("origCommEventId", orgEventId);
> > > -
> > > -        parameters.put("contactMechIdTo",
> > > parentEvent.get("contactMechIdFrom"));
> > > -        parameters.put("contactMechIdFrom",
> > > parentEvent.get("contactMechIdTo"));
> > > -
> > > -        parameters.put("partyIdFrom", userLogin.get("partyId"));
> > > -        parameters.put("partyIdTo", parentEvent.get("partyIdFrom"));
> > > -        parameters.put("toString", parentEvent.get("fromString"));
> > > -        parameters.put("statusId", "COM_IN_PROGRESS");
> > > +parentCommEventId = parameters.parentCommEventId;
> > > +
> > > +if (parentCommEventId) {
> > > +    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> > > [communicationEventId : parentCommEventId]);
> > > +    if (parentEvent) {
> > > +        orgEventId = parentEvent.origCommEventId;
> > > +        if (!orgEventId) orgEventId = parentCommEventId;
> > > +
> > > +        parameters.communicationEventTypeId =
> > > parentEvent.communicationEventTypeId;
> > > +        parameters.parentCommEventId = parentCommEventId;
> > > +        parameters.origCommEventId = orgEventId;
> > > +
> > > +        parameters.contactMechIdTo = parentEvent.contactMechIdFrom;
> > > +        parameters.contactMechIdFrom = parentEvent.contactMechIdTo;
> > > +
> > > +        parameters.partyIdFrom = userLogin.partyId;
> > > +        parameters.partyIdTo = parentEvent.partyIdFrom;
> > > +        parameters.toString =parentEvent.fromString;
> > > +        parameters.statusId = "COM_IN_PROGRESS";
> > >
> > > -        parameters.put("subject", "RE: " +
> parentEvent.get("subject"));
> > > -        parameters.put("content", "\n\n\n--------------- In reply
> > to:\n\n"
> > > + parentEvent.get("content"));
> > > +        parameters.subject = "RE: " + parentEvent.subject;
> > > +        parameters.content = "\n\n\n--------------- In reply to:\n\n"
> +
> > > parentEvent.content;
> > >     }
> > >  }
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,41 +17,30 @@
> > >  * under the License.
> > >  */
> > >
> > > -import java.util.*;
> > > -import org.ofbiz.entity.*;
> > > -import org.ofbiz.base.util.*;
> > > -import org.ofbiz.securityext.login.*;
> > > -import org.ofbiz.common.*;
> > > -import org.ofbiz.party.contact.*;
> > > -import org.ofbiz.webapp.control.*;
> > > +import org.ofbiz.party.contact.ContactMechWorker;
> > >
> > > -String partyId = parameters.get("partyId");
> > > -context.put("partyId", partyId);
> > > +partyId = parameters.partyId;
> > > +context.partyId = partyId;
> > >
> > >  Map mechMap = new HashMap();
> > >  ContactMechWorker.getContactMechAndRelated(request, partyId, mechMap);
> > > -context.put("mechMap", mechMap);
> > > +context.mechMap = mechMap;
> > >
> > > -String contactMechId = (String) mechMap.get("contactMechId");
> > > -context.put("contactMechId", contactMechId);
> > > -
> > > -preContactMechTypeId = parameters.get("preContactMechTypeId");
> > > -context.put("preContactMechTypeId", preContactMechTypeId);
> > > -
> > > -paymentMethodId = parameters.get("paymentMethodId");
> > > -context.put("paymentMethodId", paymentMethodId);
> > > -
> > > -cmNewPurposeTypeId = parameters.get("contactMechPurposeTypeId");
> > > -if (cmNewPurposeTypeId != null) {
> > > -    contactMechPurposeType =
> > > delegator.findByPrimaryKey("ContactMechPurposeType",
> > > UtilMisc.toMap("contactMechPurposeTypeId", cmNewPurposeTypeId));
> > > -    if (contactMechPurposeType != null) {
> > > -        context.put("contactMechPurposeType", contactMechPurposeType);
> > > +context.contactMechId = mechMap.contactMechId;
> > > +context.preContactMechTypeId = parameters.preContactMechTypeId;
> > > +context.paymentMethodId = parameters.paymentMethodId;
> > > +
> > > +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId;
> > > +if (cmNewPurposeTypeId) {
> > > +    contactMechPurposeType =
> > > delegator.findByPrimaryKey("ContactMechPurposeType",
> > > [contactMechPurposeTypeId : cmNewPurposeTypeId]);
> > > +    if (contactMechPurposeType) {
> > > +        context.contactMechPurposeType = contactMechPurposeType;
> > >     } else {
> > >         cmNewPurposeTypeId = null;
> > >     }
> > > -    context.put("cmNewPurposeTypeId", cmNewPurposeTypeId);
> > > +    context.cmNewPurposeTypeId = cmNewPurposeTypeId;
> > >  }
> > >
> > > -String donePage = parameters.get("DONE_PAGE");
> > > -if (donePage == null || donePage.length() <= 0) donePage =
> > > "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> > > -context.put("donePage", donePage);
> > > +donePage = parameters.DONE_PAGE;
> > > +if (!donePage || donePage.length() <= 0) donePage =
> > > "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> > > +context.donePage = donePage;
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,54 +17,49 @@
> > >  * under the License.
> > >  */
> > >
> > > -import java.util.HashMap;
> > > -import org.ofbiz.base.util.UtilHttp;
> > >  import org.ofbiz.accounting.payment.PaymentWorker;
> > >  import org.ofbiz.party.contact.ContactMechWorker;
> > > -import org.ofbiz.securityext.login.*;
> > > -import org.ofbiz.webapp.control.*;
> > >
> > > -partyId = parameters.get("partyId");
> > > -if (partyId == null) {
> > > -    partyId = parameters.get("party_id");
> > > +partyId = parameters.partyId;
> > > +if (!partyId) {
> > > +    partyId = parameters.party_id;
> > >  }
> > > -context.put("partyId", partyId);
> > > +context.partyId = partyId;
> > >
> > >  // payment info
> > >  paymentResults = PaymentWorker.getPaymentMethodAndRelated(request,
> > > partyId);
> > >  //returns the following: "paymentMethod", "creditCard", "giftCard",
> > > "eftAccount", "paymentMethodId", "curContactMechId", "donePage",
> > "tryEntity"
> > >  context.putAll(paymentResults);
> > >
> > > -curPostalAddressResults =
> > > ContactMechWorker.getCurrentPostalAddress(request, partyId,
> > > paymentResults.get("curContactMechId"));
> > > +curPostalAddressResults =
> > > ContactMechWorker.getCurrentPostalAddress(request, partyId,
> > > paymentResults.curContactMechId);
> > >  //returns the following: "curPartyContactMech", "curContactMech",
> > > "curPostalAddress", "curPartyContactMechPurposes"
> > >  context.putAll(curPostalAddressResults);
> > >
> > > -postalAddressInfos =
> ContactMechWorker.getPartyPostalAddresses(request,
> > > partyId, paymentResults.get("curContactMechId"));
> > > -context.put("postalAddressInfos", postalAddressInfos);
> > > +context.postalAddressInfos =
> > > ContactMechWorker.getPartyPostalAddresses(request, partyId,
> > > paymentResults.curContactMechId);
> > >
> > >  //prepare "Data" maps for filling form input boxes
> > > -tryEntity = paymentResults.get("tryEntity");
> > > +tryEntity = paymentResults.tryEntity;
> > >
> > > -creditCardData = paymentResults.get("creditCard");
> > > +creditCardData = paymentResults.creditCard;
> > >  if (!tryEntity.booleanValue()) creditCardData = parameters;
> > > -if (creditCardData == null) creditCardData = new HashMap();
> > > -if (creditCardData != null) context.put("creditCardData",
> > creditCardData);
> > > +if (!creditCardData) creditCardData = new HashMap();
> > > +if (creditCardData) context.creditCardData = creditCardData;
> > >
> > > -giftCardData = paymentResults.get("giftCard");
> > > +giftCardData = paymentResults.giftCard;
> > >  if (!tryEntity.booleanValue()) giftCardData = parameters;
> > > -if (giftCardData == null) giftCardData = new HashMap();
> > > -if (giftCardData != null) context.put("giftCardData", giftCardData);
> > > +if (!giftCardData) giftCardData = new HashMap();
> > > +if (giftCardData) context.giftCardData = giftCardData;
> > >
> > > -eftAccountData = paymentResults.get("eftAccount");
> > > +eftAccountData = paymentResults.eftAccount;
> > >  if (!tryEntity.booleanValue()) eftAccountData = parameters;
> > > -if (eftAccountData == null) eftAccountData = new HashMap();
> > > -if (eftAccountData != null) context.put("eftAccountData",
> > eftAccountData);
> > > +if (!eftAccountData) eftAccountData = new HashMap();
> > > +if (eftAccountData) context.eftAccountData = eftAccountData;
> > >
> > > -donePage = parameters.get("DONE_PAGE");
> > > -if (donePage == null || donePage.length() <= 0) donePage =
> > "viewprofile";
> > > -context.put("donePage", donePage);
> > > +donePage = parameters.DONE_PAGE;
> > > +if (!donePage || donePage.length() <= 0) donePage = "viewprofile";
> > > +context.donePage = donePage;
> > >
> > > -paymentMethodData = paymentResults.get("paymentMethod");
> > > +paymentMethodData = paymentResults.paymentMethod;
> > >  if (!tryEntity.booleanValue()) paymentMethodData = parameters;
> > > -if (paymentMethodData == null) paymentMethodData = new HashMap();
> > > -if (paymentMethodData != null) context.put("paymentMethodData",
> > > paymentMethodData);
> > > +if (!paymentMethodData) paymentMethodData = new HashMap();
> > > +if (paymentMethodData) context.paymentMethodData = paymentMethodData;
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,13 +17,12 @@
> > >  * under the License.
> > >  */
> > >
> > > -import org.ofbiz.party.contact.*;
> > > +import org.ofbiz.party.contact.ContactMechWorker;
> > >
> > > -if (partyId == null) {
> > > -    partyId = parameters.get("partyId");
> > > +if (!partyId) {
> > > +    partyId = parameters.partyId;
> > >  }
> > > -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> > > -context.put("showOld", new Boolean(showOld));
> > > +boolean showOld = "true".equals(parameters.SHOW_OLD);
> > > +context.showOld = new Boolean(showOld);
> > >
> > > -List partyContactMechValueMaps =
> > > ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId,
> > showOld);
> > > -context.put("contactMeches", partyContactMechValueMaps);
> > > \ No newline at end of file
> > > +context.contactMeches =
> > > ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId,
> > showOld);
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,19 +17,16 @@
> > >  * under the License.
> > >  */
> > >
> > > -import org.ofbiz.base.util.*;
> > >  import org.ofbiz.entity.util.EntityUtil;
> > >
> > > -if (partyId == null) {
> > > -    partyId = parameters.get("partyId");
> > > +if (!partyId) {
> > > +    partyId = parameters.partyId;
> > >  }
> > >
> > > -savedCartList =
> EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> > > UtilMisc.toMap("partyId", partyId,
> > > -        "shoppingListTypeId", "SLT_SPEC_PURP", "listName",
> > "auto-save")));
> > > +savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> > > [partyId : partyId,
> > > +        shoppingListTypeId : "SLT_SPEC_PURP" , listName :
> > "auto-save"]));
> > >
> > > -if (savedCartList != null){
> > > -      savedCartListId = savedCartList.getString("shoppingListId");
> > > -      context.put("savedCartListId", savedCartListId);
> > > -      savedCartItems = savedCartList.getRelated("ShoppingListItem");
> > > -      context.put("savedCartItems", savedCartItems);
> > > +if (savedCart){
> > > +      context.savedCartListId = savedCart.shoppingListId;
> > > +      context.savedCartItems =
> savedCart.getRelated("ShoppingListItem");
> > >  }
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -19,13 +19,13 @@
> > >
> > >  import org.ofbiz.base.util.*;
> > >
> > > -if (partyId == null) {
> > > -    partyId = parameters.get("partyId");
> > > +if (!partyId) {
> > > +    partyId = parameters.partyId;
> > >  }
> > >
> > > -if (partyId != null) {
> > > +if (partyId) {
> > >     // get the system user
> > > -    system = delegator.findByPrimaryKey("UserLogin",
> > > UtilMisc.toMap("userLoginId", "system"));
> > > +    system = delegator.findByPrimaryKey("UserLogin", [userLoginId :
> > > "system"]);
> > >
> > >     monthsToInclude = new Integer(12);
> > >
> > > @@ -33,7 +33,7 @@
> > >             "statusId", "ORDER_COMPLETED", "monthsToInclude",
> > > monthsToInclude, "userLogin", system);
> > >     Map result = dispatcher.runSync("getOrderedSummaryInformation",
> > > serviceIn);
> > >
> > > -    context.put("monthsToInclude", monthsToInclude);
> > > -    context.put("totalSubRemainingAmount",
> > > result.get("totalSubRemainingAmount"));
> > > -    context.put("totalOrders", result.get("totalOrders"));
> > > +    context.monthsToInclude = monthsToInclude;
> > > +    context.totalSubRemainingAmount = result.totalSubRemainingAmount;
> > > +    context.totalOrders = result.totalOrders;
> > >  }
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,13 +17,12 @@
> > >  * under the License.
> > >  */
> > >
> > > -import org.ofbiz.accounting.payment.*;
> > > +import org.ofbiz.accounting.payment.PaymentWorker;
> > >
> > > -if (partyId == null) {
> > > -    partyId = parameters.get("partyId");
> > > +if (!partyId) {
> > > +    partyId = parameters.partyId;
> > >  }
> > > -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> > > -context.put("showOld", new Boolean(showOld));
> > > +boolean showOld = "true".equals(parameters.SHOW_OLD);
> > > +context.showOld = new Boolean(showOld);
> > >
> > > -List paymentMethodValueMaps =
> > > PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId,
> > showOld);
> > > -context.put("paymentMethodValueMaps", paymentMethodValueMaps);
> > > \ No newline at end of file
> > > +context.paymentMethodValueMaps =
> > > PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId,
> > showOld);
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,15 +17,12 @@
> > >  * under the License.
> > >  */
> > >
> > > -import org.ofbiz.base.util.UtilMisc;
> > > -
> > >  //figure out the PRIMARY_EMAIL of the logged in user, for setting in
> the
> > > send email link
> > >  //maybe nice to put in some secondary emails later
> > > -userLogin = request.getAttribute("userLogin");
> > > -if (userLogin != null) {
> > > +if (userLogin) {
> > >   userLoginParty = userLogin.getRelatedOneCache("Party");
> > > -  userLoginPartyPrimaryEmails =
> > > userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> > > UtilMisc.toMap("contactMechPurposeTypeId", "PRIMARY_EMAIL"));
> > > -  if ((userLoginPartyPrimaryEmails != null) &&
> > > (userLoginPartyPrimaryEmails.size() > 0)) {
> > > -      context.put("thisUserPrimaryEmail",
> > > userLoginPartyPrimaryEmails.get(0));
> > > +  userLoginPartyPrimaryEmails =
> > > userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> > > [contactMechPurposeTypeId : "PRIMARY_EMAIL"]);
> > > +  if (userLoginPartyPrimaryEmails) {
> > > +      context.thisUserPrimaryEmail =
> userLoginPartyPrimaryEmails.get(0);
> > >   }
> > >  }
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,21 +17,17 @@
> > >  * under the License.
> > >  */
> > >
> > > -import java.util.*;
> > > -import org.ofbiz.entity.*;
> > > -import org.ofbiz.entity.condition.*;
> > > -import org.ofbiz.base.util.*;
> > > -import org.ofbiz.party.party.*;
> > > +import org.ofbiz.party.party.PartyWorker;
> > >
> > > -partyIdFrom = request.getParameter("partyId");
> > > -partyIdTo = request.getParameter("partyIdTo");
> > > +partyIdFrom = parameters.partyId;
> > > +partyIdTo = parameters.partyIdTo;
> > >
> > > -if (partyIdFrom != null) {
> > > +if (partyIdFrom) {
> > >     otherValues = PartyWorker.getPartyOtherValues(request, partyIdFrom,
> > > "partyFrom", "personFrom", "groupFrom");
> > >     context.putAll(otherValues);
> > >  }
> > >
> > > -if (partyIdTo != null) {
> > > +if (partyIdTo) {
> > >     otherValues = PartyWorker.getPartyOtherValues(request, partyIdTo,
> > > "partyTo", "personTo", "groupTo");
> > >     context.putAll(otherValues);
> > >  }
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > Wed Jun  4 01:55:56 2008
> > > @@ -17,36 +17,32 @@
> > >  * under the License.
> > >  */
> > >
> > > -import java.util.*;
> > > -import org.ofbiz.entity.*;
> > > -import org.ofbiz.entity.condition.*;
> > > -import org.ofbiz.base.util.*;
> > > -import org.ofbiz.securityext.login.*;
> > > -import org.ofbiz.common.*;
> > > -
> > > -import org.ofbiz.party.contact.*;
> > > -import org.ofbiz.party.party.*;
> > > -import org.ofbiz.accounting.payment.*;
> > > -import org.ofbiz.securityext.login.*;
> > > -
> > > -partyId = request.getParameter("party_id");
> > > -if (partyId == null) partyId = request.getParameter("partyId");
> > > -if (partyId == null) partyId = (String)
> request.getAttribute("partyId");
> > > -context.put("partyId", partyId);
> > > -
> > > -EntityConditionList ecl =
> EntityCondition.makeCondition(UtilMisc.toList(
> > > -
>  EntityCondition.makeCondition("partyId",
> > > EntityOperator.EQUALS, partyId),
> > > -
> > >  EntityCondition.makeCondition("roleTypeId", EntityOperator.NOT_EQUAL,
> > > "_NA_")),
> > > -                            EntityOperator.AND);
> > > -partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> > > UtilMisc.toList("description"), null, false);
> > > -context.put("partyRoles", partyRoles);
> > > -
> > > -roles = delegator.findList("RoleType", null, null,
> > > UtilMisc.toList("description", "roleTypeId"), null, false);
> > > -context.put("roles", roles);
> > > -
> > > -party = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId",
> > > partyId));
> > > -context.put("party", party);
> > > -if (party != null) {
> > > -    context.put("lookupPerson", party.getRelatedOne("Person"));
> > > -    context.put("lookupGroup", party.getRelatedOne("PartyGroup"));
> > > -}
> > > +import org.ofbiz.entity.condition.EntityCondition;
> > > +import org.ofbiz.entity.condition.EntityOperator;
> > > +
> > > +import javolution.util.FastList;
> > > +
> > > +partyId = parameters.party_id;
> > > +if (!partyId) partyId = parameters.partyId;
> > > +if (!partyId) partyId = (String) request.getAttribute("partyId");
> > > +context.partyId = partyId;
> > > +
> > > +List roleTypeAndPartyExprs = FastList.newInstance();
> > > +expr = EntityCondition.makeCondition("partyId", EntityOperator.EQUALS,
> > > partyId);
> > > +roleTypeAndPartyExprs.add(expr);
> > > +expr = EntityCondition.makeCondition("roleTypeId",
> > > EntityOperator.NOT_EQUAL, "_NA_");
> > > +roleTypeAndPartyExprs.add(expr);
> > > +ecl = EntityCondition.makeCondition(roleTypeAndPartyExprs,
> > > EntityOperator.AND);
> > > +
> > > +partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> > > ["description"], null, false);
> > > +context.partyRoles = partyRoles;
> > > +
> > > +roles = delegator.findList("RoleType", null, null, ["description",
> > > "roleTypeId"], null, false);
> > > +context.roles = roles;
> > > +
> > > +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> > > +context.party = party;
> > > +if (party) {
> > > +    context.lookupPerson = party.getRelatedOne("Person");
> > > +    context.lookupGroup = party.getRelatedOne("PartyGroup");
> > > +}
> > > \ No newline at end of file
> > >
> > > Modified:
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=663038&r1=663037&r2=663038&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > (original)
> > > +++
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > Wed Jun  4 01:55:56 2008
> > > @@ -47,7 +47,7 @@
> > >             <entity-one entity-name="StatusItem"
> > value-name="currentStatus"
> > > auto-field-map="false">
> > >                 <field-map field-name="statusId"
> > > env-name="communicationEvent.statusId"/>
> > >             </entity-one>
> > > -            <script
> > >
> >
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh"/>
> > > +            <script
> > >
> >
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy"/>
> > >         </actions>
> > >
> > >         <alt-target target="createCommunicationEvent"
> > > use-when="communicationEvent==null"/>
> > >
> > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r663038 - in /ofbiz/trunk/applications/party/webapp/partymgr: WEB-INF/actions/communication/ WEB-INF/actions/party/ communication/

Ashish Vijaywargiya
Thanks Scott for the link of Documents.

--
Ashish

On Wed, Jun 4, 2008 at 7:17 AM, Scott Gray <[hidden email]> wrote:

> No problem at all.  The docs are very helpful with good examples, these
> ones
> in particular:
> http://groovy.codehaus.org/Collections
> http://groovy.codehaus.org/Control+Structures
> http://groovy.codehaus.org/Groovy+Truth
> http://groovy.codehaus.org/Operators
>
> Regards
> Scott
>
> 2008/6/4 Ashish Vijaywargiya <[hidden email]>:
>
> > Scott,
> >
> > Thanks a lot for these useful tips.
> > I'll dig into it and will patch all the issues from my previous work.
> >
> > I had read only one document on Groovy i.e
> > http://www.ibm.com/developerworks/edu/j-dw-java-jgroovy-i.html.
> > Now I will spend more time in reading online document.
> > Although I will dig more into the commit that has been done by you in
> > previous days and will improve my work in the upcoming commits.
> >
> > Thanks again for all your help.
> >
> > --
> > Ashish
> >
> > On Wed, Jun 4, 2008 at 6:08 AM, Scott Gray <[hidden email]> wrote:
> >
> > > Hi Asish
> > >
> > > Just a couple more tips :-)
> > >
> > > You might have misunderstood what I said about the shortcut for the
> > ternary
> > > operator
> > > sortField = parameters.sort ? parameters.sort : "entryDate";
> > > can just be
> > > sortField = parameters.sort ?: "entryDate";
> > > here is the documentation: http://groovy.codehaus.org/Operators (see
> > elvis
> > > operator)
> > >
> > > In that document there is also mention of a safe navigation operator
> > (which
> > > I haven't used yet)
> > > if (previousSort && previousSort.equals(sortField)) {
> > > can be replaced with
> > > if (previousSort?.equals(sortField)) {
> > > if previousSort is null the operator will return null instead of an NPE
> > >
> > > similar thing here:
> > > if (parameters.communicationEventTypeId) {
> > >   if
> (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION"))
> > {
> > > can just be
> > > if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId))
> {
> > > which will avoid an NPE
> > >
> > > This could have used the ?: operator as well:
> > >        orgEventId = parentEvent.origCommEventId;
> > >        if (!orgEventId) orgEventId = parentCommEventId;
> > > could just be
> > > orgEventId = parentEvent.origCommEventId ?: parentCommEventId;
> > >
> > > and here as well:
> > > donePage = parameters.DONE_PAGE;
> > > if (!donePage || donePage.length() <= 0) donePage =
> > "viewprofile?party_id="
> > > + partyId + "&partyId=" + partyId;
> > > can be
> > > donePage = parameters.DONE_PAGE ?: "viewprofile?party_id=" + partyId +
> > > "&partyId=" + partyId;
> > > remember an empty string resolves to null
> > >
> > > and here:
> > > partyId = parameters.partyId;
> > > if (!partyId) {
> > >    partyId = parameters.party_id;
> > >  }
> > > can just be
> > > partyId = parameters.partyId ?: parameters.party_id;
> > > a few other places in this commit as well
> > >
> > > This is wrong:
> > > creditCardData = paymentResults.creditCard;
> > > if (!tryEntity.booleanValue()) creditCardData = parameters;
> > > if (!creditCardData) creditCardData = new HashMap();
> > > if (creditCardData) context.creditCardData = creditCardData;
> > >
> > > remember that an empty map or list will resolve to false so line 4 will
> > be
> > > false even after new HashMap()
> > > it should be:
> > > creditCardData = paymentResults.creditCard;
> > > if (!tryEntity) creditCardData = parameters;
> > > context.creditCardData = creditCardData ?: new HashMap();
> > >
> > > same thing for giftCardData and eftAccountData, also remember instead
> of
> > > new
> > > HashMap() you can do [:] (or FastMap.newInstance())
> > >
> > > You do not need to declare variable types like "boolean showOld =" can
> > just
> > > be "showOld =" also auto boxing/unboxing makes this unnecessary:
> > > boolean showOld = "true".equals(parameters.SHOW_OLD);
> > > context.showOld = new Boolean(showOld);
> > > can just be
> > > context.showOld = "true".equals(parameters.SHOW_OLD);
> > >
> > > Let me know if you have any questions :-)
> > >
> > > Regards
> > > Scott
> > >
> > > 2008/6/4 <[hidden email]>:
> > >
> > > > Author: ashish
> > > > Date: Wed Jun  4 01:55:56 2008
> > > > New Revision: 663038
> > > >
> > > > URL: http://svn.apache.org/viewvc?rev=663038&view=rev
> > > > Log:
> > > > Applied Groovy Features to the party component files.
> > > > Part of JIRA issue # OFBIZ-1801
> > > >
> > > > Modified:
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > >
> > > >
> > >
> >
>  ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -24,24 +24,20 @@
> > > >  * expanded to work off other communication event types.
> > > >  */
> > > >
> > > > -import org.ofbiz.base.util.*;
> > > > +import org.ofbiz.base.util.UtilDateTime;
> > > >  import org.ofbiz.entity.util.EntityUtil;
> > > >
> > > > -delegator = request.getAttribute("delegator");
> > > > -userLogin = request.getAttribute("userLogin");
> > > > -partyIdFrom = context.get("partyIdFrom");
> > > > -partyIdTo = context.get("partyIdTo");
> > > > +partyIdFrom = context.partyIdFrom;
> > > > +partyIdTo = context.partyIdTo;
> > > >
> > > > -if (parameters.get("communicationEventTypeId") != null) {
> > > > -   if
> > > >
> > >
> >
> (parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION")) {
> > > > -      userEmailAddresses =
> > > delegator.findByAnd("PartyContactWithPurpose",
> > > > UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
> > > >  partyIdFrom));
> > > > +if (parameters.communicationEventTypeId) {
> > > > +   if
> > > (parameters.communicationEventTypeId.equals("EMAIL_COMMUNICATION"))
> > > > {
> > > > +      userEmailAddresses =
> > > delegator.findByAnd("PartyContactWithPurpose",
> > > > [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom]);
> > > >       userEmailAddresses =
> EntityUtil.filterByDate(userEmailAddresses,
> > > > UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate",
> > true);
> > > > -      context.put("userEmailAddresses", userEmailAddresses);
> > > > +      context.userEmailAddresses = userEmailAddresses;
> > > >
> > > > -      targetEmailAddresses =
> > > > delegator.findByAnd("PartyContactWithPurpose",
> > > > UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId",
> > > partyIdTo));
> > > > +      targetEmailAddresses =
> > > > delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId :
> > > > "EMAIL_ADDRESS", partyId : partyIdTo]);
> > > >       targetEmailAddresses =
> > > EntityUtil.filterByDate(targetEmailAddresses,
> > > > UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate",
> > true);
> > > > -      context.put("targetEmailAddresses", targetEmailAddresses);
> > > > +      context.targetEmailAddresses = targetEmailAddresses;
> > > >    }
> > > > -}
> > > > -
> > > > -
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/listCommunications.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,33 +17,38 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import org.ofbiz.base.util.*;
> > > > -import org.ofbiz.entity.*;
> > > > -import org.ofbiz.entity.condition.*;
> > > > +import org.ofbiz.entity.condition.EntityOperator;
> > > > +import org.ofbiz.entity.condition.EntityCondition;
> > > >
> > > > -partyId = parameters.get("partyId");
> > > > -context.put("partyId", partyId);
> > > > +import javolution.util.FastList;
> > > >
> > > > -party = delegator.findByPrimaryKey("Party",
> UtilMisc.toMap("partyId",
> > > > partyId));
> > > > -context.put("party", party);
> > > > +partyId = parameters.partyId;
> > > > +context.partyId = partyId;
> > > > +
> > > > +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> > > > +context.party = party;
> > > >
> > > >  // get the sort field
> > > > -sortField = request.getParameter("sort");
> > > > -if (sortField == null) sortField = "entryDate";
> > > > -context.put("previousSort", sortField);
> > > > +sortField = parameters.sort ? parameters.sort : "entryDate";
> > > > +context.previousSort = sortField;
> > > >
> > > >  // previous sort field
> > > > -previousSort = request.getParameter("previousSort");
> > > > -if (previousSort != null && previousSort.equals(sortField)) {
> > > > +previousSort = parameters.previousSort;
> > > > +if (previousSort && previousSort.equals(sortField)) {
> > > >     sortField = "-" + sortField;
> > > >  }
> > > >
> > > > -eventExprs =
> > UtilMisc.toList(EntityCondition.makeCondition("partyIdTo",
> > > > EntityOperator.EQUALS, partyId),
> > > > EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS,
> > > > partyId));
> > > > +List eventExprs = FastList.newInstance();
> > > > +expr = EntityCondition.makeCondition("partyIdTo",
> > EntityOperator.EQUALS,
> > > > partyId);
> > > > +eventExprs.add(expr);
> > > > +expr = EntityCondition.makeCondition("partyIdFrom",
> > > EntityOperator.EQUALS,
> > > > "partyId");
> > > > +eventExprs.add(expr);
> > > >  ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR);
> > > > -events = delegator.findList("CommunicationEvent", ecl, null,
> > > > UtilMisc.toList(sortField), null, false);
> > > > -context.put("eventList", events);
> > > > -context.put("eventListSize", events.size());
> > > > -context.put("highIndex", events.size());
> > > > -context.put("viewSize", events.size());
> > > > -context.put("lowIndex", 1);
> > > > -context.put("viewIndex", 1);
> > > > +events = delegator.findList("CommunicationEvent", ecl, null,
> > > [sortField],
> > > > null, false);
> > > > +
> > > > +context.eventList = events;
> > > > +context.eventListSize = events.size();
> > > > +context.highIndex = events.size();
> > > > +context.viewSize = events.size();
> > > > +context.lowIndex = 1;
> > > > +context.viewIndex = 1;
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -19,29 +19,27 @@
> > > >
> > > >  import org.ofbiz.base.util.*;
> > > >
> > > > -delegator = request.getAttribute("delegator");
> > > > -userLogin = request.getAttribute("userLogin");
> > > > -parentCommEventId = parameters.get("parentCommEventId");
> > > > -
> > > > -if (parentCommEventId != null) {
> > > > -    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> > > > UtilMisc.toMap("communicationEventId", parentCommEventId));
> > > > -    if (parentEvent != null) {
> > > > -        orgEventId = parentEvent.get("origCommEventId");
> > > > -        if (orgEventId == null) orgEventId = parentCommEventId;
> > > > -
> > > > -        parameters.put("communicationEventTypeId",
> > > > parentEvent.get("communicationEventTypeId"));
> > > > -        parameters.put("parentCommEventId", parentCommEventId);
> > > > -        parameters.put("origCommEventId", orgEventId);
> > > > -
> > > > -        parameters.put("contactMechIdTo",
> > > > parentEvent.get("contactMechIdFrom"));
> > > > -        parameters.put("contactMechIdFrom",
> > > > parentEvent.get("contactMechIdTo"));
> > > > -
> > > > -        parameters.put("partyIdFrom", userLogin.get("partyId"));
> > > > -        parameters.put("partyIdTo", parentEvent.get("partyIdFrom"));
> > > > -        parameters.put("toString", parentEvent.get("fromString"));
> > > > -        parameters.put("statusId", "COM_IN_PROGRESS");
> > > > +parentCommEventId = parameters.parentCommEventId;
> > > > +
> > > > +if (parentCommEventId) {
> > > > +    parentEvent = delegator.findByPrimaryKey("CommunicationEvent",
> > > > [communicationEventId : parentCommEventId]);
> > > > +    if (parentEvent) {
> > > > +        orgEventId = parentEvent.origCommEventId;
> > > > +        if (!orgEventId) orgEventId = parentCommEventId;
> > > > +
> > > > +        parameters.communicationEventTypeId =
> > > > parentEvent.communicationEventTypeId;
> > > > +        parameters.parentCommEventId = parentCommEventId;
> > > > +        parameters.origCommEventId = orgEventId;
> > > > +
> > > > +        parameters.contactMechIdTo = parentEvent.contactMechIdFrom;
> > > > +        parameters.contactMechIdFrom = parentEvent.contactMechIdTo;
> > > > +
> > > > +        parameters.partyIdFrom = userLogin.partyId;
> > > > +        parameters.partyIdTo = parentEvent.partyIdFrom;
> > > > +        parameters.toString =parentEvent.fromString;
> > > > +        parameters.statusId = "COM_IN_PROGRESS";
> > > >
> > > > -        parameters.put("subject", "RE: " +
> > parentEvent.get("subject"));
> > > > -        parameters.put("content", "\n\n\n--------------- In reply
> > > to:\n\n"
> > > > + parentEvent.get("content"));
> > > > +        parameters.subject = "RE: " + parentEvent.subject;
> > > > +        parameters.content = "\n\n\n--------------- In reply
> to:\n\n"
> > +
> > > > parentEvent.content;
> > > >     }
> > > >  }
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editcontactmech.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,41 +17,30 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import java.util.*;
> > > > -import org.ofbiz.entity.*;
> > > > -import org.ofbiz.base.util.*;
> > > > -import org.ofbiz.securityext.login.*;
> > > > -import org.ofbiz.common.*;
> > > > -import org.ofbiz.party.contact.*;
> > > > -import org.ofbiz.webapp.control.*;
> > > > +import org.ofbiz.party.contact.ContactMechWorker;
> > > >
> > > > -String partyId = parameters.get("partyId");
> > > > -context.put("partyId", partyId);
> > > > +partyId = parameters.partyId;
> > > > +context.partyId = partyId;
> > > >
> > > >  Map mechMap = new HashMap();
> > > >  ContactMechWorker.getContactMechAndRelated(request, partyId,
> mechMap);
> > > > -context.put("mechMap", mechMap);
> > > > +context.mechMap = mechMap;
> > > >
> > > > -String contactMechId = (String) mechMap.get("contactMechId");
> > > > -context.put("contactMechId", contactMechId);
> > > > -
> > > > -preContactMechTypeId = parameters.get("preContactMechTypeId");
> > > > -context.put("preContactMechTypeId", preContactMechTypeId);
> > > > -
> > > > -paymentMethodId = parameters.get("paymentMethodId");
> > > > -context.put("paymentMethodId", paymentMethodId);
> > > > -
> > > > -cmNewPurposeTypeId = parameters.get("contactMechPurposeTypeId");
> > > > -if (cmNewPurposeTypeId != null) {
> > > > -    contactMechPurposeType =
> > > > delegator.findByPrimaryKey("ContactMechPurposeType",
> > > > UtilMisc.toMap("contactMechPurposeTypeId", cmNewPurposeTypeId));
> > > > -    if (contactMechPurposeType != null) {
> > > > -        context.put("contactMechPurposeType",
> contactMechPurposeType);
> > > > +context.contactMechId = mechMap.contactMechId;
> > > > +context.preContactMechTypeId = parameters.preContactMechTypeId;
> > > > +context.paymentMethodId = parameters.paymentMethodId;
> > > > +
> > > > +cmNewPurposeTypeId = parameters.contactMechPurposeTypeId;
> > > > +if (cmNewPurposeTypeId) {
> > > > +    contactMechPurposeType =
> > > > delegator.findByPrimaryKey("ContactMechPurposeType",
> > > > [contactMechPurposeTypeId : cmNewPurposeTypeId]);
> > > > +    if (contactMechPurposeType) {
> > > > +        context.contactMechPurposeType = contactMechPurposeType;
> > > >     } else {
> > > >         cmNewPurposeTypeId = null;
> > > >     }
> > > > -    context.put("cmNewPurposeTypeId", cmNewPurposeTypeId);
> > > > +    context.cmNewPurposeTypeId = cmNewPurposeTypeId;
> > > >  }
> > > >
> > > > -String donePage = parameters.get("DONE_PAGE");
> > > > -if (donePage == null || donePage.length() <= 0) donePage =
> > > > "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> > > > -context.put("donePage", donePage);
> > > > +donePage = parameters.DONE_PAGE;
> > > > +if (!donePage || donePage.length() <= 0) donePage =
> > > > "viewprofile?party_id=" + partyId + "&partyId=" + partyId;
> > > > +context.donePage = donePage;
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/editpaymentmethod.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,54 +17,49 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import java.util.HashMap;
> > > > -import org.ofbiz.base.util.UtilHttp;
> > > >  import org.ofbiz.accounting.payment.PaymentWorker;
> > > >  import org.ofbiz.party.contact.ContactMechWorker;
> > > > -import org.ofbiz.securityext.login.*;
> > > > -import org.ofbiz.webapp.control.*;
> > > >
> > > > -partyId = parameters.get("partyId");
> > > > -if (partyId == null) {
> > > > -    partyId = parameters.get("party_id");
> > > > +partyId = parameters.partyId;
> > > > +if (!partyId) {
> > > > +    partyId = parameters.party_id;
> > > >  }
> > > > -context.put("partyId", partyId);
> > > > +context.partyId = partyId;
> > > >
> > > >  // payment info
> > > >  paymentResults = PaymentWorker.getPaymentMethodAndRelated(request,
> > > > partyId);
> > > >  //returns the following: "paymentMethod", "creditCard", "giftCard",
> > > > "eftAccount", "paymentMethodId", "curContactMechId", "donePage",
> > > "tryEntity"
> > > >  context.putAll(paymentResults);
> > > >
> > > > -curPostalAddressResults =
> > > > ContactMechWorker.getCurrentPostalAddress(request, partyId,
> > > > paymentResults.get("curContactMechId"));
> > > > +curPostalAddressResults =
> > > > ContactMechWorker.getCurrentPostalAddress(request, partyId,
> > > > paymentResults.curContactMechId);
> > > >  //returns the following: "curPartyContactMech", "curContactMech",
> > > > "curPostalAddress", "curPartyContactMechPurposes"
> > > >  context.putAll(curPostalAddressResults);
> > > >
> > > > -postalAddressInfos =
> > ContactMechWorker.getPartyPostalAddresses(request,
> > > > partyId, paymentResults.get("curContactMechId"));
> > > > -context.put("postalAddressInfos", postalAddressInfos);
> > > > +context.postalAddressInfos =
> > > > ContactMechWorker.getPartyPostalAddresses(request, partyId,
> > > > paymentResults.curContactMechId);
> > > >
> > > >  //prepare "Data" maps for filling form input boxes
> > > > -tryEntity = paymentResults.get("tryEntity");
> > > > +tryEntity = paymentResults.tryEntity;
> > > >
> > > > -creditCardData = paymentResults.get("creditCard");
> > > > +creditCardData = paymentResults.creditCard;
> > > >  if (!tryEntity.booleanValue()) creditCardData = parameters;
> > > > -if (creditCardData == null) creditCardData = new HashMap();
> > > > -if (creditCardData != null) context.put("creditCardData",
> > > creditCardData);
> > > > +if (!creditCardData) creditCardData = new HashMap();
> > > > +if (creditCardData) context.creditCardData = creditCardData;
> > > >
> > > > -giftCardData = paymentResults.get("giftCard");
> > > > +giftCardData = paymentResults.giftCard;
> > > >  if (!tryEntity.booleanValue()) giftCardData = parameters;
> > > > -if (giftCardData == null) giftCardData = new HashMap();
> > > > -if (giftCardData != null) context.put("giftCardData", giftCardData);
> > > > +if (!giftCardData) giftCardData = new HashMap();
> > > > +if (giftCardData) context.giftCardData = giftCardData;
> > > >
> > > > -eftAccountData = paymentResults.get("eftAccount");
> > > > +eftAccountData = paymentResults.eftAccount;
> > > >  if (!tryEntity.booleanValue()) eftAccountData = parameters;
> > > > -if (eftAccountData == null) eftAccountData = new HashMap();
> > > > -if (eftAccountData != null) context.put("eftAccountData",
> > > eftAccountData);
> > > > +if (!eftAccountData) eftAccountData = new HashMap();
> > > > +if (eftAccountData) context.eftAccountData = eftAccountData;
> > > >
> > > > -donePage = parameters.get("DONE_PAGE");
> > > > -if (donePage == null || donePage.length() <= 0) donePage =
> > > "viewprofile";
> > > > -context.put("donePage", donePage);
> > > > +donePage = parameters.DONE_PAGE;
> > > > +if (!donePage || donePage.length() <= 0) donePage = "viewprofile";
> > > > +context.donePage = donePage;
> > > >
> > > > -paymentMethodData = paymentResults.get("paymentMethod");
> > > > +paymentMethodData = paymentResults.paymentMethod;
> > > >  if (!tryEntity.booleanValue()) paymentMethodData = parameters;
> > > > -if (paymentMethodData == null) paymentMethodData = new HashMap();
> > > > -if (paymentMethodData != null) context.put("paymentMethodData",
> > > > paymentMethodData);
> > > > +if (!paymentMethodData) paymentMethodData = new HashMap();
> > > > +if (paymentMethodData) context.paymentMethodData =
> paymentMethodData;
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getContactMechs.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,13 +17,12 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import org.ofbiz.party.contact.*;
> > > > +import org.ofbiz.party.contact.ContactMechWorker;
> > > >
> > > > -if (partyId == null) {
> > > > -    partyId = parameters.get("partyId");
> > > > +if (!partyId) {
> > > > +    partyId = parameters.partyId;
> > > >  }
> > > > -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> > > > -context.put("showOld", new Boolean(showOld));
> > > > +boolean showOld = "true".equals(parameters.SHOW_OLD);
> > > > +context.showOld = new Boolean(showOld);
> > > >
> > > > -List partyContactMechValueMaps =
> > > > ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId,
> > > showOld);
> > > > -context.put("contactMeches", partyContactMechValueMaps);
> > > > \ No newline at end of file
> > > > +context.contactMeches =
> > > > ContactMechWorker.getPartyContactMechValueMaps(delegator, partyId,
> > > showOld);
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getCurrentCart.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,19 +17,16 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import org.ofbiz.base.util.*;
> > > >  import org.ofbiz.entity.util.EntityUtil;
> > > >
> > > > -if (partyId == null) {
> > > > -    partyId = parameters.get("partyId");
> > > > +if (!partyId) {
> > > > +    partyId = parameters.partyId;
> > > >  }
> > > >
> > > > -savedCartList =
> > EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> > > > UtilMisc.toMap("partyId", partyId,
> > > > -        "shoppingListTypeId", "SLT_SPEC_PURP", "listName",
> > > "auto-save")));
> > > > +savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList",
> > > > [partyId : partyId,
> > > > +        shoppingListTypeId : "SLT_SPEC_PURP" , listName :
> > > "auto-save"]));
> > > >
> > > > -if (savedCartList != null){
> > > > -      savedCartListId = savedCartList.getString("shoppingListId");
> > > > -      context.put("savedCartListId", savedCartListId);
> > > > -      savedCartItems = savedCartList.getRelated("ShoppingListItem");
> > > > -      context.put("savedCartItems", savedCartItems);
> > > > +if (savedCart){
> > > > +      context.savedCartListId = savedCart.shoppingListId;
> > > > +      context.savedCartItems =
> > savedCart.getRelated("ShoppingListItem");
> > > >  }
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getLoyaltyPoints.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -19,13 +19,13 @@
> > > >
> > > >  import org.ofbiz.base.util.*;
> > > >
> > > > -if (partyId == null) {
> > > > -    partyId = parameters.get("partyId");
> > > > +if (!partyId) {
> > > > +    partyId = parameters.partyId;
> > > >  }
> > > >
> > > > -if (partyId != null) {
> > > > +if (partyId) {
> > > >     // get the system user
> > > > -    system = delegator.findByPrimaryKey("UserLogin",
> > > > UtilMisc.toMap("userLoginId", "system"));
> > > > +    system = delegator.findByPrimaryKey("UserLogin", [userLoginId :
> > > > "system"]);
> > > >
> > > >     monthsToInclude = new Integer(12);
> > > >
> > > > @@ -33,7 +33,7 @@
> > > >             "statusId", "ORDER_COMPLETED", "monthsToInclude",
> > > > monthsToInclude, "userLogin", system);
> > > >     Map result = dispatcher.runSync("getOrderedSummaryInformation",
> > > > serviceIn);
> > > >
> > > > -    context.put("monthsToInclude", monthsToInclude);
> > > > -    context.put("totalSubRemainingAmount",
> > > > result.get("totalSubRemainingAmount"));
> > > > -    context.put("totalOrders", result.get("totalOrders"));
> > > > +    context.monthsToInclude = monthsToInclude;
> > > > +    context.totalSubRemainingAmount =
> result.totalSubRemainingAmount;
> > > > +    context.totalOrders = result.totalOrders;
> > > >  }
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getPaymentMethods.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,13 +17,12 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import org.ofbiz.accounting.payment.*;
> > > > +import org.ofbiz.accounting.payment.PaymentWorker;
> > > >
> > > > -if (partyId == null) {
> > > > -    partyId = parameters.get("partyId");
> > > > +if (!partyId) {
> > > > +    partyId = parameters.partyId;
> > > >  }
> > > > -boolean showOld = "true".equals(parameters.get("SHOW_OLD"));
> > > > -context.put("showOld", new Boolean(showOld));
> > > > +boolean showOld = "true".equals(parameters.SHOW_OLD);
> > > > +context.showOld = new Boolean(showOld);
> > > >
> > > > -List paymentMethodValueMaps =
> > > > PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId,
> > > showOld);
> > > > -context.put("paymentMethodValueMaps", paymentMethodValueMaps);
> > > > \ No newline at end of file
> > > > +context.paymentMethodValueMaps =
> > > > PaymentWorker.getPartyPaymentMethodValueMaps(delegator, partyId,
> > > showOld);
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,15 +17,12 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import org.ofbiz.base.util.UtilMisc;
> > > > -
> > > >  //figure out the PRIMARY_EMAIL of the logged in user, for setting in
> > the
> > > > send email link
> > > >  //maybe nice to put in some secondary emails later
> > > > -userLogin = request.getAttribute("userLogin");
> > > > -if (userLogin != null) {
> > > > +if (userLogin) {
> > > >   userLoginParty = userLogin.getRelatedOneCache("Party");
> > > > -  userLoginPartyPrimaryEmails =
> > > > userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> > > > UtilMisc.toMap("contactMechPurposeTypeId", "PRIMARY_EMAIL"));
> > > > -  if ((userLoginPartyPrimaryEmails != null) &&
> > > > (userLoginPartyPrimaryEmails.size() > 0)) {
> > > > -      context.put("thisUserPrimaryEmail",
> > > > userLoginPartyPrimaryEmails.get(0));
> > > > +  userLoginPartyPrimaryEmails =
> > > > userLoginParty.getRelatedByAnd("PartyContactMechPurpose",
> > > > [contactMechPurposeTypeId : "PRIMARY_EMAIL"]);
> > > > +  if (userLoginPartyPrimaryEmails) {
> > > > +      context.thisUserPrimaryEmail =
> > userLoginPartyPrimaryEmails.get(0);
> > > >   }
> > > >  }
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/linkparty.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,21 +17,17 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import java.util.*;
> > > > -import org.ofbiz.entity.*;
> > > > -import org.ofbiz.entity.condition.*;
> > > > -import org.ofbiz.base.util.*;
> > > > -import org.ofbiz.party.party.*;
> > > > +import org.ofbiz.party.party.PartyWorker;
> > > >
> > > > -partyIdFrom = request.getParameter("partyId");
> > > > -partyIdTo = request.getParameter("partyIdTo");
> > > > +partyIdFrom = parameters.partyId;
> > > > +partyIdTo = parameters.partyIdTo;
> > > >
> > > > -if (partyIdFrom != null) {
> > > > +if (partyIdFrom) {
> > > >     otherValues = PartyWorker.getPartyOtherValues(request,
> partyIdFrom,
> > > > "partyFrom", "personFrom", "groupFrom");
> > > >     context.putAll(otherValues);
> > > >  }
> > > >
> > > > -if (partyIdTo != null) {
> > > > +if (partyIdTo) {
> > > >     otherValues = PartyWorker.getPartyOtherValues(request, partyIdTo,
> > > > "partyTo", "personTo", "groupTo");
> > > >     context.putAll(otherValues);
> > > >  }
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/viewroles.groovy
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -17,36 +17,32 @@
> > > >  * under the License.
> > > >  */
> > > >
> > > > -import java.util.*;
> > > > -import org.ofbiz.entity.*;
> > > > -import org.ofbiz.entity.condition.*;
> > > > -import org.ofbiz.base.util.*;
> > > > -import org.ofbiz.securityext.login.*;
> > > > -import org.ofbiz.common.*;
> > > > -
> > > > -import org.ofbiz.party.contact.*;
> > > > -import org.ofbiz.party.party.*;
> > > > -import org.ofbiz.accounting.payment.*;
> > > > -import org.ofbiz.securityext.login.*;
> > > > -
> > > > -partyId = request.getParameter("party_id");
> > > > -if (partyId == null) partyId = request.getParameter("partyId");
> > > > -if (partyId == null) partyId = (String)
> > request.getAttribute("partyId");
> > > > -context.put("partyId", partyId);
> > > > -
> > > > -EntityConditionList ecl =
> > EntityCondition.makeCondition(UtilMisc.toList(
> > > > -
> >  EntityCondition.makeCondition("partyId",
> > > > EntityOperator.EQUALS, partyId),
> > > > -
> > > >  EntityCondition.makeCondition("roleTypeId",
> EntityOperator.NOT_EQUAL,
> > > > "_NA_")),
> > > > -                            EntityOperator.AND);
> > > > -partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> > > > UtilMisc.toList("description"), null, false);
> > > > -context.put("partyRoles", partyRoles);
> > > > -
> > > > -roles = delegator.findList("RoleType", null, null,
> > > > UtilMisc.toList("description", "roleTypeId"), null, false);
> > > > -context.put("roles", roles);
> > > > -
> > > > -party = delegator.findByPrimaryKey("Party",
> UtilMisc.toMap("partyId",
> > > > partyId));
> > > > -context.put("party", party);
> > > > -if (party != null) {
> > > > -    context.put("lookupPerson", party.getRelatedOne("Person"));
> > > > -    context.put("lookupGroup", party.getRelatedOne("PartyGroup"));
> > > > -}
> > > > +import org.ofbiz.entity.condition.EntityCondition;
> > > > +import org.ofbiz.entity.condition.EntityOperator;
> > > > +
> > > > +import javolution.util.FastList;
> > > > +
> > > > +partyId = parameters.party_id;
> > > > +if (!partyId) partyId = parameters.partyId;
> > > > +if (!partyId) partyId = (String) request.getAttribute("partyId");
> > > > +context.partyId = partyId;
> > > > +
> > > > +List roleTypeAndPartyExprs = FastList.newInstance();
> > > > +expr = EntityCondition.makeCondition("partyId",
> EntityOperator.EQUALS,
> > > > partyId);
> > > > +roleTypeAndPartyExprs.add(expr);
> > > > +expr = EntityCondition.makeCondition("roleTypeId",
> > > > EntityOperator.NOT_EQUAL, "_NA_");
> > > > +roleTypeAndPartyExprs.add(expr);
> > > > +ecl = EntityCondition.makeCondition(roleTypeAndPartyExprs,
> > > > EntityOperator.AND);
> > > > +
> > > > +partyRoles = delegator.findList("RoleTypeAndParty", ecl, null,
> > > > ["description"], null, false);
> > > > +context.partyRoles = partyRoles;
> > > > +
> > > > +roles = delegator.findList("RoleType", null, null, ["description",
> > > > "roleTypeId"], null, false);
> > > > +context.roles = roles;
> > > > +
> > > > +party = delegator.findByPrimaryKey("Party", [partyId : partyId]);
> > > > +context.party = party;
> > > > +if (party) {
> > > > +    context.lookupPerson = party.getRelatedOne("Person");
> > > > +    context.lookupGroup = party.getRelatedOne("PartyGroup");
> > > > +}
> > > > \ No newline at end of file
> > > >
> > > > Modified:
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > > URL:
> > > >
> > >
> >
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=663038&r1=663037&r2=663038&view=diff
> > > >
> > > >
> > >
> >
> ==============================================================================
> > > > ---
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > > (original)
> > > > +++
> > > >
> > >
> >
> ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
> > > > Wed Jun  4 01:55:56 2008
> > > > @@ -47,7 +47,7 @@
> > > >             <entity-one entity-name="StatusItem"
> > > value-name="currentStatus"
> > > > auto-field-map="false">
> > > >                 <field-map field-name="statusId"
> > > > env-name="communicationEvent.statusId"/>
> > > >             </entity-one>
> > > > -            <script
> > > >
> > >
> >
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh"/>
> > > > +            <script
> > > >
> > >
> >
> location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.groovy"/>
> > > >         </actions>
> > > >
> > > >         <alt-target target="createCommunicationEvent"
> > > > use-when="communicationEvent==null"/>
> > > >
> > > >
> > > >
> > >
> >
>