Improved: Use Groovy Truth instead of UtilValidate Class in Groovy

(OFBIZ-11064)

As we all know, Groovy is a powerful language with great built-in functions. 
Groovy Truth[1] is one of them, which is not used properly in our code base. 
We have used UtilValidate Class to validate arguments for Empty or NotEmpty, 
which can easily be done in groovy with built-in functionality[1].
 
Current Code: if (UtilValidate.isNotEmpty(locations)) { ... }
Groovy Built-in Code: if (locations) { ... }
 
[1] - http://groovy-lang.org/semantics.html#Groovy-Truth
 
We need to careful for some points while we change this:
Like:
maxRetry = 0
if (!maxRetry)
{  // Not set, use a default  maxRetry = -1 }

Because groovy evaluates zero to be false, it wouldn't be possible to set
maxRetry to zero.  So it's best not to use groovy truth for null-checks on
numbers in some cases. 
 
Thanks: Pawan Verma

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-plugins/trunk@1860051 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2019-05-26 10:36:16 +00:00
parent cfea3ca859
commit f3c3271d12
14 changed files with 68 additions and 68 deletions
@@ -22,7 +22,7 @@ import org.apache.ofbiz.base.util.UtilValidate
reportBy = parameters.reportBy
exportType = parameters.exportType
if (UtilValidate.isEmpty(parameters.fromDate)) {
if (!parameters.fromDate) {
request.setAttribute("_ERROR_MESSAGE_", "Please select From Date.")
return "error"
}
@@ -22,7 +22,7 @@ import org.apache.ofbiz.base.util.UtilValidate
parentCategoryStr = parameters.parentCategoryStr
productCategoryId=parameters.category_id
if(!UtilValidate.isEmpty(parentCategoryStr)) {
if(parentCategoryStr) {
pathList = parentCategoryStr.split('/')
cateList = []
pathTemp = ''
@@ -25,7 +25,7 @@ import org.apache.ofbiz.product.category.*
catalogId = CatalogWorker.getCurrentCatalogId(request)
bestSellerCates = []
if (UtilValidate.isNotEmpty(catalogId)) {
if (catalogId) {
prodCatalogCategoryList = CatalogWorker.getProdCatalogCategories(request, catalogId, "PCCT_BEST_SELL")
if (prodCatalogCategoryList.size() > 0) {
for (int i = 0; i < prodCatalogCategoryList.size(); i++) {
@@ -43,7 +43,7 @@ productKeywords = select("keyword", "keywordTypeId", "statusId")
.distinct(true)
.queryList()
if (UtilValidate.isNotEmpty(productKeywords)) {
if (productKeywords) {
productKeywords.each { productKeyword ->
productTags = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryList()
searchResult = [:]
@@ -54,7 +54,7 @@ if (!userLogin) {
} else {
filteredOrderStatusList = EntityUtil.filterByCondition(orderStatuses, EntityCondition.makeCondition("statusId", EntityOperator.IN, ["ORDER_COMPLETED", "ORDER_APPROVED"]))
}
if (UtilValidate.isNotEmpty(filteredOrderStatusList)) {
if (filteredOrderStatusList) {
if (filteredOrderStatusList.size() < 2) {
statusUserLogin = EntityUtil.getFirst(filteredOrderStatusList).statusUserLogin
userLogin = from("UserLogin").where("userLoginId", statusUserLogin).queryOne()
@@ -1309,7 +1309,7 @@ cursor: default;
.ui-widget-header .ui-icon {background-image: url(jquery/plugins/elrte-1.3/css/smoothness/images/ui-icons_222222_256x240.png); }
.ui-state-default .ui-icon { background-image: url(jquery/plugins/elrte-1.3/css/smoothness/images/ui-icons_888888_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(jquery/plugins/elrte-1.3/css/smoothness/images/ui-icons_454545_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
.ui-state-active .ui-icon {background-image: url(/images/ui-icons_454545_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(jquery/plugins/elrte-1.3/css/smoothness/images/ui-icons_2e83ff_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(jquery/plugins/elrte-1.3/css/smoothness/images/ui-icons_cd0a0a_256x240.png); }
@@ -1506,7 +1506,7 @@ cursor: default;
.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-overlay { background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(jquery/plugins/elrte-1.3/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
* jQuery UI Resizable @VERSION
*
+44 -44
View File
@@ -56,7 +56,7 @@ body {
background: none!important;
}
#ecom-mainarea .card .card-header {
background: #DCDCDC url(images/bg_head_bottom_nav.jpg) no-repeat;
background: #DCDCDC url(/images/bg_head_bottom_nav.jpg) no-repeat;
}
div.popup {
max-width: 1200px;
@@ -71,7 +71,7 @@ div.popup {
clear: both;
width: 900px;
padding-bottom: 30px;
background: transparent url(images/bg_main_withnav.jpg) top left repeat-y;
background: transparent url(/images/bg_main_withnav.jpg) top left repeat-y;
}
.left {
@@ -104,7 +104,7 @@ div.popup {
footer {
clear: both;
padding: 1.0em 0 1.0em 0;
background: rgb(225, 225, 225) url(images/bg_foot.jpg) no-repeat;
background: rgb(225, 225, 225) url(/images/bg_foot.jpg) no-repeat;
background-size: 100% 50px;
font-size: 1.0em;
overflow: visible !important /*Firefox*/;
@@ -129,7 +129,7 @@ footer {
.header-middle {
width: 100%;
height: auto;
background: #E6E6E6 url(images/bg_head_middle.jpg);
background: #E6E6E6 url(/images/bg_head_middle.jpg);
overflow: visible !important /*Firefox*/;
overflow: hidden /*IE6*/;
background-size: cover;
@@ -153,7 +153,7 @@ footer {
.header-bottom {
width: 100%;
height: auto;
background: #FFFFFF url(images/bg_head_breadcrumbs.jpg) repeat-y;
background: #FFFFFF url(/images/bg_head_breadcrumbs.jpg) repeat-y;
margin-bottom: 15px;
}
@@ -162,7 +162,7 @@ footer {
width: 100%;
height: auto;
padding: 1.0em 0 1.0em 0;
background: #FFFFFF url(images/bg_head_breadcrumbs.jpg) repeat-y;
background: #FFFFFF url(/images/bg_head_breadcrumbs.jpg) repeat-y;
}
.sitelogo {
@@ -171,7 +171,7 @@ footer {
position: absolute;
z-index: 1;
margin: 10px 0 0 20px;
background: url(images/ofbizLogo.gif);
background: url(/images/ofbizLogo.gif);
}
@@ -310,7 +310,7 @@ footer {
float: left;
width: 100%;
border: none;
background: #DCDCDC url(images/bg_head_bottom_nav.jpg) no-repeat;
background: #DCDCDC url(/images/bg_head_bottom_nav.jpg) no-repeat;
color: #4B4B4B;
font-size: 130%;
background-size: cover;
@@ -443,7 +443,7 @@ footer {
.center .breadcrumbs ul li {
display: inline;
padding: 0 0 0 10px;
background: transparent url(images/bg_bullet_arrow.gif) no-repeat 0 50%;
background: transparent url(/images/bg_bullet_arrow.gif) no-repeat 0 50%;
font-weight: bold;
color: #7D7D7D;
font-size: 100%;
@@ -520,7 +520,7 @@ footer {
w_idth: 900px;
width: 870px;
padding: 0 1em 0 1em;
background: #FFFFFF url(images/bg_head_breadcrumbs.jpg) repeat-y;
background: #FFFFFF url(/images/bg_head_breadcrumbs.jpg) repeat-y;
}
/******************/
@@ -534,7 +534,7 @@ footer {
position: absolute;
z-index: 100;
margin: 0 0 0 190px;
background: url(images/bg_corner_topright.gif) no-repeat;
background: url(/images/bg_corner_topright.gif) no-repeat;
}
/* MAIN CONTENT */
@@ -654,7 +654,7 @@ footer {
height: 10px;
position: absolute;
z-index: 100;
background: url(images/bg_corner_topleft.gif) no-repeat;
background: url(/images/bg_corner_topleft.gif) no-repeat;
margin-top: -1px;
margin-left: -1px;
}
@@ -664,7 +664,7 @@ footer {
height: 10px;
position: absolute;
z-index: 100;
background: url(images/bg_corner_topright.gif) no-repeat;
background: url(/images/bg_corner_topright.gif) no-repeat;
margin-top: -1px;
margin-left: 174px;
}
@@ -674,7 +674,7 @@ footer {
height: 10px;
position: absolute;
z-index: 100;
background: url(images/bg_corner_topleft.gif) no-repeat;
background: url(/images/bg_corner_topleft.gif) no-repeat;
margin-top: 0px;
margin-left: 0px;
}
@@ -684,7 +684,7 @@ footer {
height: 10px;
position: absolute;
z-index: 100;
background: url(images/bg_corner_topright.gif) no-repeat;
background: url(/images/bg_corner_topright.gif) no-repeat;
margin-top: 0px;
margin-left: 175px;
}
@@ -925,7 +925,7 @@ p:after {
.nav3-bullet dt a:visited {
line-height: 2.0em;
padding: 0 0 0 10px;
background: url(images/bg_bullet_full_1.gif) no-repeat 0px 50%;
background: url(/images/bg_bullet_full_1.gif) no-repeat 0px 50%;
text-decoration: none;
color: rgb(70, 122, 167);
font-weight: bold;
@@ -937,7 +937,7 @@ p:after {
line-height: 1.7em;
margin: 0 0 0 15px;
padding: 0 0 0 10px;
background: url(images/bg_bullet_half_1.gif) no-repeat 0px 50%;
background: url(/images/bg_bullet_half_1.gif) no-repeat 0px 50%;
text-decoration: none;
color: rgb(70, 122, 167);
font-weight: normal;
@@ -945,13 +945,13 @@ p:after {
}
.nav3-bullet dt a:hover {
background: url(images/bg_bullet_full_2.gif) no-repeat 0px 50%;
background: url(/images/bg_bullet_full_2.gif) no-repeat 0px 50%;
text-decoration: underline;
color: rgb(42, 90, 138);
}
.nav3-bullet dd a:hover {
background: url(images/bg_bullet_half_2.gif) no-repeat 0px 50%;
background: url(/images/bg_bullet_half_2.gif) no-repeat 0px 50%;
text-decoration: underline;
color: rgb(42, 90, 138);
}
@@ -1086,7 +1086,7 @@ p:after {
.left ul li {
margin: 5px 0 0.2em 2px;
padding: 0px 0px 0 11px;
background: url(images/bg_bullet_full_1.gif) no-repeat 0 0.4em;
background: url(/images/bg_bullet_full_1.gif) no-repeat 0 0.4em;
line-height: 1.2em;
font-size: 110%;
}
@@ -1290,7 +1290,7 @@ p.caption {
.center ul li {
margin: 0 0 0.2em 2px;
padding: 0 0 0 12px;
background: url(images/bg_bullet_full_1.gif) no-repeat 0 0.5em;
background: url(/images/bg_bullet_full_1.gif) no-repeat 0 0.5em;
line-height: 1.4em;
font-size: 120%;
}
@@ -1473,7 +1473,7 @@ p.caption {
.right ul li {
margin: 5px 0 0.2em 2px;
padding: 0 0 0 11px;
background: url(images/bg_bullet_full_1.gif) no-repeat 0 0.4em;
background: url(/images/bg_bullet_full_1.gif) no-repeat 0 0.4em;
line-height: 1.2em;
font-size: 110%;
}
@@ -1632,7 +1632,7 @@ img {
#ecom-mainarea .rightonly {
width: 670px;
padding: 0 1em 0 1.5em;
background: #FFFFFF url(images/bg_head_breadcrumbs.jpg) repeat-y;
background: #FFFFFF url(/images/bg_head_breadcrumbs.jpg) repeat-y;
}
#ecom-mainarea .leftonly {
@@ -2181,19 +2181,19 @@ a.offlnk:hover {
}
.bl {
background: url(images/bg_corner_topleft.gif) #AAAAAA 0 100% no-repeat;
background: url(/images/bg_corner_topleft.gif) #AAAAAA 0 100% no-repeat;
}
.br {
background: url(images/bg_corner_topleft.gif) 100% 100% no-repeat;
background: url(/images/bg_corner_topleft.gif) 100% 100% no-repeat;
}
.tl {
background: url(images/bg_corner_topleft.gif) 0 0 no-repeat;
background: url(/images/bg_corner_topleft.gif) 0 0 no-repeat;
}
.tr {
background: url(images/bg_corner_topright.gif) 100% 0 no-repeat;
background: url(/images/bg_corner_topright.gif) 100% 0 no-repeat;
padding: 10px;
}
@@ -2361,7 +2361,7 @@ img.cssImgSmall {
.ui-widget-content {
border: 1px solid #aaaaaa;
background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
background: #ffffff url(/images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;
color: #222222;
}
@@ -2371,7 +2371,7 @@ img.cssImgSmall {
.ui-widget-header {
border: 1px solid #aaaaaa;
background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
background: #cccccc url(/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;
color: #222222;
font-weight: bold;
}
@@ -2384,7 +2384,7 @@ img.cssImgSmall {
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
border: 1px solid #d3d3d3;
background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;
background: #e6e6e6 url(/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #555555;
}
@@ -2396,7 +2396,7 @@ img.cssImgSmall {
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
border: 1px solid #999999;
background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;
background: #dadada url(/images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
@@ -2408,7 +2408,7 @@ img.cssImgSmall {
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
border: 1px solid #aaaaaa;
background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
background: #ffffff url(/images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;
font-weight: normal;
color: #212121;
}
@@ -2426,7 +2426,7 @@ img.cssImgSmall {
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {
border: 1px solid #fcefa1;
background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;
background: #fbf9ee url(/images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;
color: #363636;
}
@@ -2436,7 +2436,7 @@ img.cssImgSmall {
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {
border: 1px solid #cd0a0a;
background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
background: #fef1ec url(/images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;
color: #cd0a0a;
}
@@ -2471,35 +2471,35 @@ img.cssImgSmall {
.ui-icon {
width: 16px;
height: 16px;
background-image: url(images/ui-icons_222222_256x240.png);
background-image: url(/images/ui-icons_222222_256x240.png);
}
.ui-widget-content .ui-icon {
background-image: url(images/ui-icons_222222_256x240.png);
background-image: url(/images/ui-icons_222222_256x240.png);
}
.ui-widget-header .ui-icon {
background-image: url(images/ui-icons_222222_256x240.png);
background-image: url(/images/ui-icons_222222_256x240.png);
}
.ui-state-default .ui-icon {
background-image: url(images/ui-icons_888888_256x240.png);
background-image: url(/images/ui-icons_888888_256x240.png);
}
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {
background-image: url(images/ui-icons_454545_256x240.png);
background-image: url(/images/ui-icons_454545_256x240.png);
}
.ui-state-active .ui-icon {
background-image: url(images/ui-icons_454545_256x240.png);
background-image: url(/images/ui-icons_454545_256x240.png);
}
.ui-state-highlight .ui-icon {
background-image: url(images/ui-icons_2e83ff_256x240.png);
background-image: url(/images/ui-icons_2e83ff_256x240.png);
}
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {
background-image: url(images/ui-icons_cd0a0a_256x240.png);
background-image: url(/images/ui-icons_cd0a0a_256x240.png);
}
/* positioning */
@@ -3272,7 +3272,7 @@ img.cssImgSmall {
/* Overlays */
.ui-widget-overlay {
background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
opacity: .30;
filter: Alpha(Opacity=30);
}
@@ -3280,7 +3280,7 @@ img.cssImgSmall {
.ui-widget-shadow {
margin: -8px 0 0 -8px;
padding: 8px;
background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
background: #aaaaaa url(/images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;
opacity: .30;
filter: Alpha(Opacity=30);
-moz-border-radius: 8px;
+1 -1
View File
@@ -119,7 +119,7 @@ if (phases) {
latestTaskIds.add(wf.workEffortId)
}
count = 0
if (UtilValidate.isNotEmpty(latestTaskIds)) {
if (latestTaskIds) {
taskInfo.preDecessor = ""
for (i in latestTaskIds) {
if (count > 0) {
+1 -1
View File
@@ -22,7 +22,7 @@ import org.apache.ofbiz.base.util.UtilValidate
if (parameters.workEffortId) {
workEffortId = parameters.workEffortId
projects = from("ProjectAndPhaseAndTask").where("workEffortId", workEffortId).queryList()
if (UtilValidate.isNotEmpty(projects)) {
if (projects) {
context.put("projectId", projects.get(0).getString("projectId"))
context.put("projectName", projects.get(0).getString("projectName"))
context.put("phaseName", projects.get(0).getString("phaseName"))
@@ -88,7 +88,7 @@ if ("Y".equals(parameters.noConditionFind)) {
conditionsBacklog = EntityCondition.makeCondition(conditionBacklogList, EntityOperator.AND)
if(UtilValidate.isNotEmpty(orConditionsBacklog)){
if(orConditionsBacklog){
mainConditionBacklogList.add(orConditionsBacklog)
}
@@ -40,16 +40,16 @@ if(!security.hasEntityPermission("SCRUM", "_ADMIN", session)){
}
if (userLogin) {
if(UtilValidate.isNotEmpty(partyId)){
if(partyId){
paramCond.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId))
}
if(UtilValidate.isNotEmpty(productId)){
if(productId){
paramCond.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"))
}
if(UtilValidate.isNotEmpty(internalName)){
if(internalName){
paramCond.add(EntityCondition.makeCondition("internalName", EntityOperator.LIKE, "%" + internalName + "%"))
}
if(UtilValidate.isNotEmpty(statusId)){
if(statusId){
if ("PRODUCT_ACTIVE".equals(statusId)) {
paramCond.add(EntityCondition.makeCondition("supportDiscontinuationDate", EntityOperator.EQUALS, null))
} else {
+2 -2
View File
@@ -27,8 +27,8 @@ loginPartyId = userLogin.partyId
communicationEventId = parameters.communicationEventId
now = UtilDateTime.nowTimestamp()
try{
if (UtilValidate.isNotEmpty(loginPartyId)) {
if (UtilValidate.isNotEmpty(productId)) {
if (loginPartyId) {
if (productId) {
context.product = from("Product").where("productId", productId).queryOne()
}
communicationEvent = from("CommunicationEvent").where("communicationEventId", communicationEventId).queryOne()
+2 -2
View File
@@ -32,9 +32,9 @@ if (webPosSession) {
context.isOpen = webPosSession.getCurrentTransaction().isOpen();
context.person = null;
if (UtilValidate.isNotEmpty(shoppingCart)) {
if (shoppingCart) {
placingCustomerParty = from("PartyAndPerson").where("partyId", shoppingCart.getPlacingCustomerPartyId()).queryOne();
if (UtilValidate.isNotEmpty(placingCustomerParty)) {
if (placingCustomerParty) {
context.person = placingCustomerParty.lastName + " " + placingCustomerParty.firstName;
}
}
@@ -23,24 +23,24 @@ webPosSession = WebPosEvents.getWebPosSession(request, null)
if (webPosSession) {
shoppingCart = webPosSession.getCart()
shipToCustomerPartyId = shoppingCart.getShipToCustomerPartyId()
if (UtilValidate.isNotEmpty(shipToCustomerPartyId)) {
if (shipToCustomerPartyId) {
context.personShipTo = from("Person").where("partyId", shipToCustomerPartyId).queryOne()
}
shippingContactMechId = shoppingCart.getContactMech("SHIPPING_LOCATION")
if (UtilValidate.isNotEmpty(shippingContactMechId)) {
if (shippingContactMechId) {
contactMech = from("ContactMech").where("contactMechId", shippingContactMechId).queryOne()
if (UtilValidate.isNotEmpty(contactMech) && "POSTAL_ADDRESS".equals(contactMech.contactMechTypeId)) {
if (contactMech && "POSTAL_ADDRESS".equals(contactMech.contactMechTypeId)) {
context.shippingPostalAddress = contactMech.getRelatedOne("PostalAddress", false)
}
}
billToCustomerPartyId = shoppingCart.getBillToCustomerPartyId()
if (UtilValidate.isNotEmpty(billToCustomerPartyId)) {
if (billToCustomerPartyId) {
context.personBillTo = from("Person").where("partyId", billToCustomerPartyId).queryOne()
}
billingContactMechId = shoppingCart.getContactMech("BILLING_LOCATION")
if (UtilValidate.isNotEmpty(billingContactMechId)) {
if (billingContactMechId) {
contactMech = from("ContactMech").where("contactMechId", billingContactMechId).queryOne()
if (UtilValidate.isNotEmpty(contactMech) && "POSTAL_ADDRESS".equals(contactMech.contactMechTypeId)) {
if (contactMech && "POSTAL_ADDRESS".equals(contactMech.contactMechTypeId)) {
context.billingPostalAddress = contactMech.getRelatedOne("PostalAddress", false)
}
}