Skip to content

Commit 172516e

Browse files
committed
Implemented: Fix all codenarc violation (OFBIZ-13228)
Fix codenarc violation lvl 2 : * AssignmentInConditional * LineLength * PackageName Fix codenarc violation lvl 3 : * BlockStartsWithBlankLine * ConsecutiveBlankLines * FileEndsWithoutNewline * ImportFromSamePackage * JavadocEmptyReturnTag * JavadocMissingParamDescription * SpaceAfterComma * SpaceAfterOpeningBrace * SpaceAroundMapEntryColon * SpaceBeforeClosingBrace * UnnecessaryGString * UnusedImport
1 parent d463e83 commit 172516e

File tree

41 files changed

+178
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+178
-226
lines changed

applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/period/GPeriodServices.groovy

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Map findCustomTimePeriods() {
5252
OR {
5353
EQUALS(organizationPartyId: null)
5454
EQUALS(organizationPartyId: '_NA_')
55-
5655
}
5756
LESS_THAN(fromDate: parameters.findDate)
5857
OR {
@@ -87,4 +86,4 @@ Map getPreviousTimePeriod() {
8786
return success([previousTimePeriod: previousTimePeriod])
8887
}
8988
return success()
90-
}
89+
}

applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchOptions.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.ofbiz.content.content
2020

2121
import java.sql.Timestamp
22-
import org.apache.ofbiz.content.content.ContentSearchSession
2322

2423
searchOperator = parameters.get('SEARCH_OPERATOR')
2524
if ('AND' != searchOperator && 'OR' != searchOperator) {

applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentSearchResults.groovy

+10-11
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@
1818
*/
1919
package org.apache.ofbiz.content.content
2020

21-
import org.apache.ofbiz.content.content.ContentSearchSession
22-
import org.apache.ofbiz.content.content.ContentSearchEvents
23-
2421
// note: this can be run multiple times in the same request without causing problems, will check to see on its own if it has run again
2522
ContentSearchSession.processSearchParameters(parameters, request)
2623
Map result = ContentSearchEvents.getContentSearchResult(request, delegator)
2724

28-
context.put('contentIds', result.get('contentIds'))
29-
context.put('viewIndex', result.get('viewIndex'))
30-
context.put('viewSize', result.get('viewSize'))
31-
context.put('listSize', result.get('listSize'))
32-
context.put('lowIndex', result.get('lowIndex'))
33-
context.put('highIndex', result.get('highIndex'))
34-
context.put('searchConstraintStrings', result.get('searchConstraintStrings'))
35-
context.put('searchSortOrderString', result.get('searchSortOrderString'))
25+
context.with {
26+
contentIds = result.get('contentIds')
27+
viewIndex = result.get('viewIndex')
28+
viewSize = result.get('viewSize')
29+
listSize = result.get('listSize')
30+
lowIndex = result.get('lowIndex')
31+
highIndex = result.get('highIndex')
32+
searchConstraintStrings = result.get('searchConstraintStrings')
33+
searchSortOrderString = result.get('searchSortOrderString')
34+
}

applications/content/src/main/groovy/org/apache/ofbiz/content/content/ContentServicesScript.groovy

+90-94
Large diffs are not rendered by default.

applications/content/src/main/groovy/org/apache/ofbiz/content/survey/EditSurveyResponse.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.content.survey
2020

21-
import org.apache.ofbiz.content.survey.SurveyWrapper
2221
import org.apache.ofbiz.base.util.UtilURL
2322

2423
surveyResponseId = parameters.surveyResponseId

applications/content/src/main/groovy/org/apache/ofbiz/content/survey/ViewSurveyResponses.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.content.survey
2020

21-
import org.apache.ofbiz.content.survey.SurveyWrapper
22-
2321
if (!survey) {
2422
surveyResponseId = parameters.surveyResponseId
2523
if (surveyResponseId) {

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/bom/BomSimulation.groovy

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.manufacturing.bom
2020

21-
import org.apache.ofbiz.manufacturing.bom.BOMNode
22-
2321
tree = request.getAttribute('tree')
2422
currencyUomId = parameters.currencyUomId
2523
facilityId = parameters.facilityId
@@ -36,7 +34,7 @@ if (tree) {
3634
productsData = []
3735
grandTotalCost = 0.0
3836
while (treeQtyIt) {
39-
BOMNode node = (BOMNode)treeQtyIt.next()
37+
BOMNode node = (BOMNode) treeQtyIt.next()
4038
unitCost = null
4139
totalCost = null
4240
qoh = null

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunAllFixedAssets.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.manufacturing.jobshopmgt
2020

21-
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
22-
2321
productionRunId = parameters.productionRunId ?: parameters.workEffortId
2422
if (productionRunId) {
2523
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunDeclaration.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ package org.apache.ofbiz.manufacturing.jobshopmgt
2323

2424
import org.apache.ofbiz.entity.util.EntityUtil
2525
import org.apache.ofbiz.entity.GenericValue
26-
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
2726

2827
productionRunId = parameters.productionRunId ?: parameters.workEffortId
2928
if (productionRunId) {

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServicesScript.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.ofbiz.manufacturing.jobshopmgt
2020

2121
import org.apache.ofbiz.base.util.UtilDateTime
22-
import org.apache.ofbiz.base.util.UtilProperties
2322
import org.apache.ofbiz.entity.GenericValue
2423
import org.apache.ofbiz.service.ServiceUtil
2524

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTaskParties.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.manufacturing.jobshopmgt
2020

21-
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
22-
2321
taskPartyAssocList = []
2422
productionRunId = parameters.productionRunId ?: parameters.workEffortId
2523
if (productionRunId) {

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunTasks.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.manufacturing.jobshopmgt
2020

21-
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
22-
2321
productionRunId = parameters.productionRunId ?: parameters.workEffortId
2422
if (productionRunId) {
2523
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/ViewProductionRun.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ package org.apache.ofbiz.manufacturing.jobshopmgt
2121
// The only required parameter is "productionRunId".
2222
// The "actionForm" parameter triggers actions (see "ProductionRunSimpleEvents.xml").
2323

24-
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
25-
2624
productionRunId = parameters.productionRunId
2725
if (productionRunId) {
2826
ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher)

applications/manufacturing/src/main/groovy/org/apache/ofbiz/manufacturing/jobshopmgt/WorkWithShipmentPlans.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.manufacturing.jobshopmgt
2020

21-
import org.apache.ofbiz.manufacturing.jobshopmgt.ProductionRun
22-
2321
// **************************************
2422
// ShipmentPlan list form
2523
// **************************************

applications/order/src/main/groovy/org/apache/ofbiz/order/customer/CheckoutMapProcs.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ static Map billToAddress(Map parameters) {
100100
return error(label('PartyUiLabels', 'PartyCountryMissing'))
101101
}
102102
return processedMap
103-
}
103+
}

applications/order/src/main/groovy/org/apache/ofbiz/order/entry/BillSettings.groovy

+21-24
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
*/
1919
package org.apache.ofbiz.order.entry
2020

21+
import org.apache.ofbiz.entity.GenericValue
2122
import org.apache.ofbiz.entity.util.EntityUtil
2223
import org.apache.ofbiz.base.util.UtilHttp
2324
import org.apache.ofbiz.accounting.payment.BillingAccountWorker
25+
import org.apache.ofbiz.order.shoppingcart.ShoppingCart
2426

25-
cart = session.getAttribute('shoppingCart')
26-
orderPartyId = cart.getPartyId()
27-
currencyUomId = cart.getCurrency()
27+
ShoppingCart cart = session.getAttribute('shoppingCart')
28+
String orderPartyId = cart.getPartyId()
29+
String currencyUomId = cart.getCurrency()
2830
context.cart = cart
2931
context.paymentMethodType = request.getParameter('paymentMethodType')
3032

@@ -33,59 +35,54 @@ request.removeAttribute('_EVENT_MESSAGE_')
3335

3436
// If there's a paymentMethodId request attribute, the user has just created a new payment method,
3537
// so put the new paymentMethodId in the context for the UI
36-
newPaymentMethodId = request.getAttribute('paymentMethodId')
38+
String newPaymentMethodId = request.getAttribute('paymentMethodId')
3739
if (newPaymentMethodId) {
3840
context.checkOutPaymentId = newPaymentMethodId
3941
}
4042

43+
GenericValue orderParty = null
4144
if (orderPartyId && '_NA_' != orderPartyId) {
42-
orderParty = from('Party').where('partyId', orderPartyId).queryOne()
43-
orderPerson = orderParty.getRelatedOne('Person', false)
45+
orderParty = from('Party').where('partyId', orderPartyId).cache().queryOne()
4446
context.orderParty = orderParty
45-
context.orderPerson = orderPerson
4647
if (orderParty) {
48+
context.orderPerson = orderParty.getRelatedOne('Person', true)
4749
context.paymentMethodList = EntityUtil.filterByDate(orderParty.getRelated('PaymentMethod', null, null, false), true)
4850

49-
billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, orderPartyId, delegator, dispatcher)
51+
List billingAccountList = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, orderPartyId, delegator, dispatcher)
5052
if (billingAccountList) {
5153
context.selectedBillingAccountId = cart.getBillingAccountId()
5254
context.billingAccountList = billingAccountList
5355
}
5456
}
5557
}
5658

57-
if (request.getParameter('useShipAddr') && cart.getShippingContactMechId()) {
58-
shippingContactMech = cart.getShippingContactMechId()
59-
postalAddress = from('PostalAddress').where('contactMechId', shippingContactMech).queryOne()
60-
context.postalFields = postalAddress
61-
} else {
62-
context.postalFields = UtilHttp.getParameterMap(request)
63-
}
59+
context.postalFields = request.getParameter('useShipAddr') && cart.getShippingContactMechId()
60+
? from('PostalAddress').where('contactMechId', cart.getShippingContactMechId()).queryOne()
61+
: UtilHttp.getParameterMap(request)
6462

6563
if (cart) {
6664
if (cart.getPaymentMethodIds()) {
67-
checkOutPaymentId = cart.getPaymentMethodIds().get(0)
65+
String checkOutPaymentId = cart.getPaymentMethodIds().first()
6866
context.checkOutPaymentId = checkOutPaymentId
6967
if (!orderParty) {
70-
paymentMethod = from('PaymentMethod').where('paymentMethodId', checkOutPaymentId).queryOne()
68+
GenericValue account = null
69+
GenericValue paymentMethod = from('PaymentMethod').where(paymentMethodId: checkOutPaymentId).queryOne()
7170
if (paymentMethod?.paymentMethodTypeId == 'CREDIT_CARD') {
72-
paymentMethodType = 'CC'
71+
String paymentMethodType = 'CC'
7372
account = paymentMethod.getRelatedOne('CreditCard', false)
7473
context.creditCard = account
7574
context.paymentMethodType = paymentMethodType
76-
} else if (paymentMethod.paymentMethodTypeId == 'EFT_ACCOUNT') {
77-
paymentMethodType = 'EFT'
75+
} else if (paymentMethod?.paymentMethodTypeId == 'EFT_ACCOUNT') {
76+
String paymentMethodType = 'EFT'
7877
account = paymentMethod.getRelatedOne('EftAccount', false)
7978
context.eftAccount = account
8079
context.paymentMethodType = paymentMethodType
8180
}
8281
if (account) {
83-
address = account.getRelatedOne('PostalAddress', false)
84-
context.postalAddress = address
82+
context.postalAddress = account.getRelatedOne('PostalAddress', false)
8583
}
8684
}
8785
} else if (cart.getPaymentMethodTypeIds()) {
88-
checkOutPaymentId = cart.getPaymentMethodTypeIds().get(0)
89-
context.checkOutPaymentId = checkOutPaymentId
86+
context.checkOutPaymentId = cart.getPaymentMethodTypeIds().first()
9087
}
9188
}

applications/order/src/main/groovy/org/apache/ofbiz/order/order/CompanyHeader.groovy

+11-12
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,19 @@
1818
*/
1919
package org.apache.ofbiz.order.order
2020

21-
// this script is used to get the company's logo header information for orders,
22-
// invoices, and returns. It can either take order, invoice, returnHeader from
23-
// parameters or use orderId, invoiceId, or returnId to look them up.
24-
// if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback
25-
2621
import org.apache.ofbiz.base.util.UtilHttp
2722
import org.apache.ofbiz.content.data.DataResourceWorker
2823
import org.apache.ofbiz.entity.GenericValue
2924
import org.apache.ofbiz.entity.util.EntityUtil
30-
import org.apache.ofbiz.order.order.OrderReadHelper
3125
import org.apache.ofbiz.party.content.PartyContentWrapper
3226

3327
import java.sql.Timestamp
3428

29+
// this script is used to get the company's logo header information for orders,
30+
// invoices, and returns. It can either take order, invoice, returnHeader from
31+
// parameters or use orderId, invoiceId, or returnId to look them up.
32+
// if none of these parameters are available then fromPartyId is used or "ORGANIZATION_PARTY" from general.properties as fallback
33+
3534
orderHeader = parameters.orderHeader
3635
orderId = parameters.orderId
3736
invoice = parameters.invoice
@@ -60,7 +59,7 @@ if (!orderHeader && orderId) {
6059
orderHeader = shipment.getRelatedOne('PrimaryOrderHeader', false)
6160
}
6261

63-
if (!invoice && invoiceId) {
62+
if (!invoice && invoiceId) {
6463
invoice = from('Invoice').where('invoiceId', invoiceId).queryOne()
6564
try {
6665
UtilHttp.setContentDisposition(response, invoiceId + '.pdf')
@@ -98,7 +97,7 @@ if (orderHeader) {
9897
partyId = productStore.payToPartyId
9998
}
10099
}
101-
// purchase orders - use the BILL_TO_CUSTOMER of the order
100+
// purchase orders - use the BILL_TO_CUSTOMER of the order
102101
} else if (orderHeader.orderTypeId == 'PURCHASE_ORDER') {
103102
GenericValue billToParty = orh.getBillToParty()
104103
if (billToParty) {
@@ -188,7 +187,7 @@ address = null
188187
if (addresses) {
189188
address = from('PostalAddress').where('contactMechId', addresses[0].contactMechId).queryOne()
190189
}
191-
if (address) {
190+
if (address) {
192191
// get the country name and state/province abbreviation
193192
country = address.getRelatedOne('CountryGeo', true)
194193
if (country) {
@@ -232,9 +231,9 @@ if (emails) {
232231
.queryList()
233232
if (selContacts) {
234233
i = selContacts.iterator()
235-
while (i.hasNext()) {
234+
while (i.hasNext()) {
236235
email = i.next().getRelatedOne('ContactMech', false)
237-
if (email.contactMechTypeId == 'ELECTRONIC_ADDRESS') {
236+
if (email.contactMechTypeId == 'ELECTRONIC_ADDRESS') {
238237
context.email = email
239238
break
240239
}
@@ -257,7 +256,7 @@ if (websiteUrls) {
257256
.queryList()
258257
if (selContacts) {
259258
Iterator i = selContacts.iterator()
260-
while (i.hasNext()) {
259+
while (i.hasNext()) {
261260
website = i.next().getRelatedOne('ContactMech', false)
262261
if (website.contactMechTypeId == 'WEB_ADDRESS') {
263262
context.website = website

applications/order/src/main/groovy/org/apache/ofbiz/order/order/FilterOrderList.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
*/
1919
package org.apache.ofbiz.order.order
2020

21-
import org.apache.ofbiz.order.order.OrderReadHelper
2221
import org.apache.ofbiz.product.store.ProductStoreWorker
23-
import org.apache.ofbiz.order.order.OrderListState
2422

2523
orderHeaderList = context.orderHeaderList
2624
productStore = ProductStoreWorker.getProductStore(request)

applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderList.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ package org.apache.ofbiz.order.order
2020

2121
import org.apache.ofbiz.entity.condition.EntityCondition
2222
import org.apache.ofbiz.entity.condition.EntityOperator
23-
import org.apache.ofbiz.order.order.OrderListState
2423

2524
partyId = request.getParameter('partyId')
2625
facilityId = request.getParameter('facilityId')

applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderView.groovy

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import org.apache.ofbiz.entity.GenericValue
2626
import org.apache.ofbiz.entity.condition.EntityCondition
2727
import org.apache.ofbiz.entity.condition.EntityOperator
2828
import org.apache.ofbiz.entity.util.EntityUtil
29-
import org.apache.ofbiz.order.order.OrderReadHelper
3029
import org.apache.ofbiz.party.contact.ContactHelper
3130
import org.apache.ofbiz.party.contact.ContactMechWorker
3231
import org.apache.ofbiz.product.catalog.CatalogWorker

applications/order/src/main/groovy/org/apache/ofbiz/order/order/OrderViewWebSecure.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.order.order
2020

21-
import org.apache.ofbiz.order.order.OrderContentWrapper
22-
2321
orderHeader = context.orderHeader
2422

2523
// can anybody view an anonymous order? this is set in the screen widget and should only be turned on by an email confirmation screen

applications/order/src/main/groovy/org/apache/ofbiz/order/order/ViewImage.groovy

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
*/
1919
package org.apache.ofbiz.order.order
2020

21-
import org.apache.ofbiz.order.order.OrderContentWrapper
22-
2321
orderId = request.getParameter('orderId')
2422
orderItemSeqId = request.getParameter('orderItemSeqId')
2523
orderContentTypeId = request.getParameter('orderContentTypeId')

applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/QuickReturn.groovy renamed to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/QuickReturn.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.apache.ofbiz.order.orderReturn
19+
package org.apache.ofbiz.order.orderreturn
2020

2121
import org.apache.ofbiz.order.order.OrderReadHelper
2222
import org.apache.ofbiz.party.contact.ContactHelper

applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHeader.groovy renamed to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHeader.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.apache.ofbiz.order.orderReturn
19+
package org.apache.ofbiz.order.orderreturn
2020

2121
import org.apache.ofbiz.entity.util.EntityUtil
2222
import org.apache.ofbiz.party.contact.ContactHelper

applications/order/src/main/groovy/org/apache/ofbiz/order/orderReturn/ReturnHistory.groovy renamed to applications/order/src/main/groovy/org/apache/ofbiz/order/orderreturn/ReturnHistory.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
package org.apache.ofbiz.order.orderReturn
19+
package org.apache.ofbiz.order.orderreturn
2020

2121
import org.apache.ofbiz.entity.condition.EntityCondition
2222
import org.apache.ofbiz.entity.condition.EntityOperator

0 commit comments

Comments
 (0)