From 990c8a3aab36bcb7ae003dc6b378461b97e0a416 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Sun, 21 Apr 2019 12:49:52 +0000 Subject: [PATCH] Improved: Remove redundant specification of type arguments (OFBIZ-10937) Since Java 1.7, when defining generic types it is unnecessary to redefine those types in the constructor when it is done in the declared type. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857906 13f79535-47bb-0310-9956-ffa450edef68 --- .../agreement/AgreementServices.java | 2 +- .../accounting/test/FinAccountTests.java | 2 +- .../authorizedotnet/AIMPaymentServices.java | 20 +-- .../authorizedotnet/AIMRespPositions.java | 2 +- .../authorizedotnet/CPRespPositions.java | 2 +- .../sagepay/SagePayPaymentServices.java | 2 +- .../thirdparty/sagepay/SagePayServices.java | 22 +-- .../thirdparty/sagepay/SagePayUtil.java | 14 +- .../valuelink/ValueLinkServices.java | 24 ++-- .../ofbiz/accounting/util/UtilAccounting.java | 2 +- .../content/ContentManagementEvents.java | 8 +- .../content/ContentManagementServices.java | 102 +++++++------- .../content/ContentManagementWorker.java | 46 +++--- .../org/apache/ofbiz/content/ConvertTree.java | 16 +-- .../ofbiz/content/blog/BlogRssServices.java | 4 +- .../ofbiz/content/cms/ContentJsonEvents.java | 2 +- .../ofbiz/content/compdoc/CompDocEvents.java | 6 +- .../content/compdoc/CompDocServices.java | 6 +- .../content/content/ContentKeywordIndex.java | 6 +- .../content/content/ContentMapFacade.java | 10 +- .../content/ContentPermissionServices.java | 16 +-- .../ofbiz/content/content/ContentSearch.java | 32 ++--- .../content/content/ContentSearchEvents.java | 2 +- .../content/content/ContentSearchSession.java | 6 +- .../content/content/ContentServices.java | 58 ++++---- .../content/ContentServicesComplex.java | 22 +-- .../ofbiz/content/content/ContentWorker.java | 84 +++++------ .../content/content/PermissionRecorder.java | 8 +- .../content/UploadContentAndImage.java | 36 ++--- .../ofbiz/content/layout/LayoutEvents.java | 30 ++-- .../ofbiz/content/layout/LayoutWorker.java | 4 +- .../webapp/ftl/RenderSubContentAsText.java | 4 +- .../ftl/RenderSubContentCacheTransform.java | 2 +- .../webapp/ftl/RenderSubContentTransform.java | 2 +- .../ftl/TraverseSubContentCacheTransform.java | 12 +- .../ftl/TraverseSubContentTransform.java | 10 +- .../ftl/WrapSubContentCacheTransform.java | 4 +- .../apache/ofbiz/humanres/HumanResEvents.java | 32 ++--- .../ofbiz/manufacturing/bom/BOMNode.java | 20 +-- .../ofbiz/manufacturing/bom/BOMServices.java | 56 ++++---- .../ofbiz/manufacturing/bom/BOMTree.java | 8 +- .../jobshopmgt/ProductionRun.java | 2 +- .../jobshopmgt/ProductionRunEvents.java | 2 +- .../jobshopmgt/ProductionRunHelper.java | 2 +- .../jobshopmgt/ProductionRunServices.java | 132 +++++++++--------- .../ofbiz/manufacturing/mrp/MrpServices.java | 10 +- .../manufacturing/mrp/ProposedOrder.java | 6 +- .../routing/RoutingServices.java | 2 +- .../techdata/TechDataServices.java | 20 +-- .../ofbiz/marketing/report/ReportHelper.java | 4 +- .../tracking/TrackingCodeEvents.java | 2 +- .../org/apache/ofbiz/sfa/vcard/VCard.java | 6 +- .../ofbiz/order/OrderManagerEvents.java | 4 +- .../order/order/OrderReturnServices.java | 2 +- .../ofbiz/order/order/OrderServices.java | 4 +- .../ofbiz/order/quote/QuoteServices.java | 6 +- .../requirement/RequirementServices.java | 14 +- .../shipping/ShippingEstimateWrapper.java | 2 +- .../shoppingcart/shipping/ShippingEvents.java | 4 +- .../shoppinglist/ShoppingListEvents.java | 2 +- .../shoppinglist/ShoppingListServices.java | 2 +- .../ofbiz/order/test/OrderTestServices.java | 2 +- .../thirdparty/zipsales/ZipSalesServices.java | 6 +- .../party/content/PartyContentWrapper.java | 6 +- .../ofbiz/product/catalog/CatalogWorker.java | 8 +- .../product/category/CatalogUrlFilter.java | 18 +-- .../product/category/CatalogUrlServlet.java | 2 +- .../category/CategoryContentWrapper.java | 2 +- .../product/category/CategoryServices.java | 16 +-- .../product/category/CategoryWorker.java | 12 +- .../category/SeoCatalogUrlServlet.java | 2 +- .../ofbiz/product/category/SeoConfigUtil.java | 16 +-- .../product/category/SeoContextFilter.java | 2 +- .../product/feature/ParametricSearch.java | 20 +-- .../feature/ProductFeatureServices.java | 30 ++-- .../ofbiz/product/price/PriceServices.java | 32 ++--- .../product/store/ProductStoreWorker.java | 6 +- .../shipment/packing/PackingSession.java | 50 +++---- .../shipment/packing/PackingSessionLine.java | 6 +- .../shipment/picklist/PickListServices.java | 4 +- .../shipment/shipment/ShipmentServices.java | 26 ++-- .../shipment/shipment/ShipmentWorker.java | 8 +- .../shipment/thirdparty/dhl/DhlServices.java | 14 +- .../thirdparty/fedex/FedexServices.java | 18 +-- .../shipment/thirdparty/ups/UpsServices.java | 34 ++--- .../thirdparty/usps/UspsServices.java | 4 +- .../thirdparty/usps/UspsServicesTests.java | 2 +- .../shipment/verify/VerifyPickServices.java | 2 +- .../shipment/verify/VerifyPickSession.java | 22 +-- .../shipment/verify/VerifyPickSessionRow.java | 4 +- .../weightPackage/WeightPackageServices.java | 4 +- .../weightPackage/WeightPackageSession.java | 16 +-- .../WeightPackageSessionLine.java | 2 +- .../content/WorkEffortContentWrapper.java | 6 +- .../ofbiz/base/conversion/test/MiscTests.java | 4 +- .../conversion/test/TestJSONConverters.java | 8 +- .../ofbiz/base/location/FlexibleLocation.java | 2 +- .../org/apache/ofbiz/base/util/UtilHttp.java | 4 +- .../test/FlexibleMapAccessorTests.java | 8 +- .../util/collections/test/GenericMapTest.java | 14 +- .../util/string/FlexibleStringExpander.java | 4 +- .../base/util/string/NodeELResolver.java | 2 +- .../ofbiz/base/util/test/AssertTests.java | 4 +- .../ofbiz/base/util/test/ObjectTypeTests.java | 6 +- .../base/util/test/ReferenceCleanerTests.java | 4 +- .../ofbiz/base/util/test/StringUtilTests.java | 2 +- .../ofbiz/base/util/UtilCodecTests.java | 2 +- .../ofbiz/common/JsLanguageFilesMapping.java | 10 +- .../ofbiz/common/email/EmailServices.java | 2 +- .../apache/ofbiz/common/geo/GeoWorker.java | 8 +- .../ofbiz/common/scripting/ContextHelper.java | 8 +- .../common/scripting/ScriptHelperImpl.java | 8 +- .../ofbiz/common/status/StatusServices.java | 4 +- .../ofbiz/common/status/StatusWorker.java | 2 +- .../ofbiz/common/telecom/TelecomServices.java | 6 +- .../ofbiz/common/test/PerformFindTests.java | 4 +- .../ofbiz/common/GetLocaleListTests.java | 2 +- .../apache/ofbiz/datafile/RecordIterator.java | 2 +- .../ofbiz/entity/config/model/Datasource.java | 4 +- .../entity/config/model/DelegatorElement.java | 4 +- .../entity/config/model/EntityConfig.java | 32 ++--- .../entity/config/model/EntityDataReader.java | 2 +- .../entity/config/model/EntityEcaReader.java | 2 +- .../config/model/EntityGroupReader.java | 2 +- .../config/model/EntityModelReader.java | 2 +- .../connection/DBCPConnectionFactory.java | 4 +- .../connection/DebugManagedDataSource.java | 2 +- .../ofbiz/entity/datasource/GenericDAO.java | 56 ++++---- .../entity/datasource/GenericHelperDAO.java | 2 +- .../datasource/GenericHelperFactory.java | 2 +- .../entity/datasource/ReadOnlyHelperDAO.java | 2 +- .../ofbiz/entity/jdbc/DatabaseUtil.java | 52 +++---- .../ofbiz/entity/jdbc/JdbcValueHandler.java | 4 +- .../ofbiz/entity/jdbc/SQLProcessor.java | 2 +- .../apache/ofbiz/entity/jdbc/SqlJdbcUtil.java | 10 +- .../ofbiz/entity/model/DynamicViewEntity.java | 10 +- .../apache/ofbiz/entity/model/ModelField.java | 2 +- .../entity/model/ModelFieldTypeReader.java | 2 +- .../ofbiz/entity/model/ModelRelation.java | 4 +- .../ofbiz/entity/model/ModelViewEntity.java | 2 +- .../apache/ofbiz/entity/util/Converters.java | 6 +- .../ofbiz/entity/util/EntityCrypto.java | 2 +- .../ofbiz/entity/util/EntityDataLoader.java | 12 +- .../apache/ofbiz/entity/util/EntityQuery.java | 8 +- .../ofbiz/entity/util/EntitySaxReader.java | 4 +- .../ofbiz/entity/util/EntityTypeUtil.java | 2 +- .../apache/ofbiz/entity/util/EntityUtil.java | 28 ++-- .../ofbiz/entity/util/SequenceUtil.java | 2 +- .../ofbiz/entityext/EntityGroupUtil.java | 4 +- .../data/EntityDataLoadContainer.java | 30 ++-- .../entityext/data/EntityDataServices.java | 6 +- .../entityext/eca/DelegatorEcaHandler.java | 6 +- .../entityext/eca/EntityEcaCondition.java | 4 +- .../ofbiz/entityext/eca/EntityEcaRule.java | 10 +- .../ofbiz/entityext/eca/EntityEcaUtil.java | 12 +- .../permission/EntityPermissionChecker.java | 44 +++--- .../synchronization/EntitySyncContext.java | 18 +-- .../synchronization/EntitySyncServices.java | 2 +- .../apache/ofbiz/minilang/MiniLangUtil.java | 2 +- .../ofbiz/minilang/MiniLangValidate.java | 8 +- .../ofbiz/minilang/SimpleMapProcessor.java | 2 +- .../apache/ofbiz/minilang/SimpleMethod.java | 12 +- .../artifact/ArtifactInfoContext.java | 6 +- .../ofbiz/minilang/method/MethodContext.java | 4 +- .../method/callops/CallClassMethod.java | 4 +- .../method/callops/CallObjectMethod.java | 4 +- .../minilang/method/callops/CallService.java | 16 +-- .../method/callops/CallServiceAsynch.java | 2 +- .../callops/CallSimpleMapProcessor.java | 6 +- .../method/callops/CallSimpleMethod.java | 4 +- .../method/callops/SetServiceFields.java | 4 +- .../method/conditional/CombinedCondition.java | 2 +- .../minilang/method/conditional/Compare.java | 2 +- .../conditional/ConditionalFactory.java | 2 +- .../minilang/method/conditional/MasterIf.java | 2 +- .../minilang/method/entityops/EntityData.java | 2 +- .../minilang/method/envops/AddError.java | 2 +- .../ofbiz/minilang/method/envops/Assert.java | 4 +- .../ofbiz/minilang/method/envops/CheckId.java | 2 +- .../minilang/method/envops/CreateObject.java | 4 +- .../minilang/method/envops/FieldToList.java | 2 +- .../minilang/method/envops/ListToList.java | 2 +- .../minilang/method/envops/MapToMap.java | 2 +- .../minilang/method/envops/OrderMapList.java | 2 +- .../minilang/method/envops/SetOperation.java | 2 +- .../minilang/method/envops/StringToList.java | 2 +- .../eventops/RequestParametersToList.java | 2 +- .../method/ifops/CheckPermission.java | 4 +- .../minilang/operation/MakeInString.java | 2 +- .../minilang/operation/MapProcessor.java | 4 +- .../minilang/operation/SimpleMapProcess.java | 2 +- .../service/config/ServiceConfigUtil.java | 2 +- .../ofbiz/service/config/model/Engine.java | 4 +- .../service/config/model/JmsService.java | 2 +- .../config/model/NotificationGroup.java | 2 +- .../service/config/model/ServiceConfig.java | 2 +- .../service/config/model/ServiceEngine.java | 20 +-- .../service/config/model/ThreadPool.java | 2 +- .../ofbiz/service/eca/ServiceEcaAction.java | 4 +- .../service/eca/ServiceEcaCondition.java | 2 +- .../ofbiz/service/eca/ServiceEcaRule.java | 8 +- .../ofbiz/service/eca/ServiceEcaSetField.java | 2 +- .../ofbiz/service/eca/ServiceEcaUtil.java | 16 +-- .../ofbiz/service/jms/JmsListenerFactory.java | 6 +- .../ofbiz/service/jms/JmsServiceEngine.java | 4 +- .../service/rmi/ExampleRemoteClient.java | 2 +- .../ofbiz/testtools/EntityXmlAssertTest.java | 2 +- .../ofbiz/testtools/JunitSuiteWrapper.java | 4 +- .../ofbiz/testtools/TestRunContainer.java | 2 +- .../ofbiz/webapp/control/ConfigXMLReader.java | 30 ++-- .../ofbiz/webapp/control/JWTManager.java | 2 +- .../ofbiz/webapp/control/LoginWorker.java | 8 +- .../webapp/control/ProtectViewWorker.java | 4 +- .../ofbiz/webapp/control/RequestHandler.java | 2 +- .../apache/ofbiz/webapp/event/CoreEvents.java | 10 +- .../ofbiz/webapp/event/EventFactory.java | 2 +- .../webapp/event/GroovyEventHandler.java | 4 +- .../event/RequestBodyMapHandlerFactory.java | 2 +- .../webapp/event/ScriptEventHandler.java | 4 +- .../webapp/event/ServiceEventHandler.java | 4 +- .../event/ServiceMultiEventHandler.java | 6 +- .../webapp/event/XmlRpcEventHandler.java | 4 +- .../ofbiz/webapp/stats/ServerHitBin.java | 22 +-- .../apache/ofbiz/webapp/view/ViewFactory.java | 2 +- .../ofbiz/webapp/webdav/PropFindHelper.java | 2 +- .../ofbiz/webapp/webdav/WebDavUtil.java | 2 +- .../ofbiz/webtools/WebToolsServices.java | 70 +++++----- .../artifactinfo/ArtifactInfoFactory.java | 64 ++++----- .../ControllerRequestArtifactInfo.java | 4 +- .../artifactinfo/EntityArtifactInfo.java | 8 +- .../artifactinfo/FormWidgetArtifactInfo.java | 8 +- .../webtools/artifactinfo/RunTestEvents.java | 2 +- .../ScreenWidgetArtifactInfo.java | 10 +- .../artifactinfo/ServiceArtifactInfo.java | 52 +++---- .../artifactinfo/ServiceEcaArtifactInfo.java | 16 +-- .../webtools/labelmanager/LabelInfo.java | 2 +- .../labelmanager/LabelManagerFactory.java | 12 +- .../labelmanager/LabelReferences.java | 12 +- .../widget/artifact/ArtifactInfoContext.java | 12 +- .../ofbiz/widget/portal/PortalPageWorker.java | 2 +- 240 files changed, 1246 insertions(+), 1246 deletions(-) diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java index bc6596f28b..5c4a87075b 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java @@ -72,7 +72,7 @@ public class AgreementServices { Delegator delegator = ctx.getDelegator(); Locale locale = (Locale) context.get("locale"); String errMsg = null; - List> commissions = new LinkedList>(); + List> commissions = new LinkedList<>(); try { BigDecimal amount = ((BigDecimal)context.get("amount")); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/test/FinAccountTests.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/test/FinAccountTests.java index ecd1a87e05..15b3cd4d6d 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/test/FinAccountTests.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/test/FinAccountTests.java @@ -39,7 +39,7 @@ public class FinAccountTests extends OFBizTestCase { public void testFinAccountOperations() throws Exception { GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").queryOne(); - Map ctx = new HashMap(); + Map ctx = new HashMap<>(); ctx.put("finAccountId", "TESTACCOUNT1"); ctx.put("finAccountName", "Test Financial Account"); ctx.put("finAccountTypeId", "BANK_ACCOUNT"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java index 5b91db8909..8bcbfd06ce 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java @@ -81,7 +81,7 @@ public class AIMPaymentServices { Delegator delegator = ctx.getDelegator(); Locale locale = (Locale) context.get("locale"); Map results = ServiceUtil.returnSuccess(); - Map request = new HashMap(); + Map request = new HashMap<>(); Properties props = buildAIMProperties(context, delegator); buildMerchantInfo(context, props, request); buildGatewayResponeConfig(context, props, request); @@ -122,7 +122,7 @@ public class AIMPaymentServices { context.put("creditCard", creditCard); context.put("authTransaction", authTransaction); Map results = ServiceUtil.returnSuccess(); - Map request = new HashMap(); + Map request = new HashMap<>(); Properties props = buildAIMProperties(context, delegator); buildMerchantInfo(context, props, request); buildGatewayResponeConfig(context, props, request); @@ -169,7 +169,7 @@ public class AIMPaymentServices { context.put("creditCard",creditCard); context.put("authTransaction",authTransaction); Map results = ServiceUtil.returnSuccess(); - Map request = new HashMap(); + Map request = new HashMap<>(); Properties props = buildAIMProperties(context, delegator); buildMerchantInfo(context, props, request); buildGatewayResponeConfig(context, props, request); @@ -260,7 +260,7 @@ public class AIMPaymentServices { Locale locale = (Locale) context.get("locale"); context.put("authTransaction", authTransaction); Map results = ServiceUtil.returnSuccess(); - Map request = new HashMap(); + Map request = new HashMap<>(); Properties props = buildAIMProperties(context, delegator); buildMerchantInfo(context, props, request); buildGatewayResponeConfig(context, props, request); @@ -278,7 +278,7 @@ public class AIMPaymentServices { public static Map ccCredit(DispatchContext ctx, Map context) { Locale locale = (Locale) context.get("locale"); - Map results = new HashMap(); + Map results = new HashMap<>(); results.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR); results.put(ModelService.ERROR_MESSAGE, UtilProperties.getMessage(resource, "AccountingAuthorizeNetccCreditUnsupported", locale)); return results; @@ -288,7 +288,7 @@ public class AIMPaymentServices { Delegator delegator = ctx.getDelegator(); Locale locale = (Locale) context.get("locale"); Map results = ServiceUtil.returnSuccess(); - Map request = new HashMap(); + Map request = new HashMap<>(); Properties props = buildAIMProperties(context, delegator); buildMerchantInfo(context, props, request); buildGatewayResponeConfig(context, props, request); @@ -314,7 +314,7 @@ public class AIMPaymentServices { } private static Map processCard(Map request, Properties props, Locale locale) { - Map result = new HashMap(); + Map result = new HashMap<>(); String url = props.getProperty("url"); if (UtilValidate.isEmpty(url)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, @@ -642,7 +642,7 @@ public class AIMPaymentServices { } private static Map validateRequest(Map params, Properties props, Map AIMRequest) { - Map result = new HashMap(); + Map result = new HashMap<>(); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); return result; } @@ -704,7 +704,7 @@ public class AIMPaymentServices { } private static Map processRefundTransResult(Map request, Map reply) { - Map results = new HashMap(); + Map results = new HashMap<>(); AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse"); try { Boolean captureResult = (Boolean) reply.get("authResult"); @@ -731,7 +731,7 @@ public class AIMPaymentServices { } private static Map processReleaseTransResult(Map request, Map reply) { - Map results = new HashMap(); + Map results = new HashMap<>(); AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse"); try { Boolean captureResult = (Boolean) reply.get("authResult"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java index f83e14ad07..48300335bb 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java @@ -25,7 +25,7 @@ import java.util.Map; public class AIMRespPositions extends AuthorizeResponse.RespPositions { // AIM v3.1 response positions - private static Map positions = new LinkedHashMap(); + private static Map positions = new LinkedHashMap<>(); static { positions.put(AuthorizeResponse.RESPONSE_CODE, 1); positions.put(AuthorizeResponse.REASON_CODE, 3); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java index 3b02940a66..acea6f24ed 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java @@ -25,7 +25,7 @@ import java.util.Map; public class CPRespPositions extends AuthorizeResponse.RespPositions { // Card-Present v1.0 response positions - private static Map positions = new LinkedHashMap(); + private static Map positions = new LinkedHashMap<>(); static { positions.put(AuthorizeResponse.RESPONSE_CODE, 2); positions.put(AuthorizeResponse.REASON_CODE, 3); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java index ad472f303b..21b7cb8f06 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayPaymentServices.java @@ -51,7 +51,7 @@ public class SagePayPaymentServices { Debug.logInfo("SagePay - Entered buildCustomerBillingInfo", module); Debug.logInfo("SagePay buildCustomerBillingInfo context : " + context, module); - Map billingInfo = new HashMap(); + Map billingInfo = new HashMap<>(); String orderId = null; BigDecimal processAmount = null; diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java index fdd6fe06f9..448d03193b 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayServices.java @@ -49,7 +49,7 @@ public class SagePayServices private static Map buildSagePayProperties(Map context, Delegator delegator) { - Map sagePayConfig = new HashMap(); + Map sagePayConfig = new HashMap<>(); String paymentGatewayConfigId = (String) context.get("paymentGatewayConfigId"); @@ -79,7 +79,7 @@ public class SagePayServices Debug.logInfo("SagePay paymentAuthentication context : " + context, module); Delegator delegator = ctx.getDelegator(); - Map resultMap = new HashMap(); + Map resultMap = new HashMap<>(); Map props = buildSagePayProperties(context, delegator); @@ -124,7 +124,7 @@ public class SagePayServices HttpHost host = SagePayUtil.getHost(props); //start - authentication parameters - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); @@ -299,7 +299,7 @@ public class SagePayServices Debug.logInfo("SagePay paymentAuthorisation context : " + context, module); Delegator delegator = ctx.getDelegator(); - Map resultMap = new HashMap(); + Map resultMap = new HashMap<>(); Map props = buildSagePayProperties(context, delegator); @@ -313,7 +313,7 @@ public class SagePayServices HttpHost host = SagePayUtil.getHost(props); //start - authorization parameters - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); @@ -391,7 +391,7 @@ public class SagePayServices Debug.logInfo("SagePay paymentRelease context : " + context, module); Delegator delegator = ctx.getDelegator(); - Map resultMap = new HashMap(); + Map resultMap = new HashMap<>(); Map props = buildSagePayProperties(context, delegator); @@ -404,7 +404,7 @@ public class SagePayServices HttpHost host = SagePayUtil.getHost(props); //start - release parameters - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); @@ -480,7 +480,7 @@ public class SagePayServices Debug.logInfo("SagePay paymentVoid context : " + context, module); Delegator delegator = ctx.getDelegator(); - Map resultMap = new HashMap(); + Map resultMap = new HashMap<>(); Map props = buildSagePayProperties(context, delegator); @@ -493,7 +493,7 @@ public class SagePayServices HttpHost host = SagePayUtil.getHost(props); //start - void parameters - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); @@ -567,7 +567,7 @@ public class SagePayServices Debug.logInfo("SagePay paymentRefund context : " + context, module); Delegator delegator = ctx.getDelegator(); - Map resultMap = new HashMap(); + Map resultMap = new HashMap<>(); Map props = buildSagePayProperties(context, delegator); @@ -585,7 +585,7 @@ public class SagePayServices HttpHost host = SagePayUtil.getHost(props); //start - refund parameters - Map parameters = new HashMap(); + Map parameters = new HashMap<>(); String vpsProtocol = props.get("protocolVersion"); String vendor = props.get("vendor"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java index 7a31428f24..40dc9fe49d 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/sagepay/SagePayUtil.java @@ -51,7 +51,7 @@ public final class SagePayUtil { public static Map buildCardAuthorisationPaymentResponse (Boolean authResult, String authCode, String authFlag, BigDecimal processAmount, String authRefNum, String authAltRefNum, String authMessage) { - Map result = new HashMap(); + Map result = new HashMap<>(); if(authResult != null) { result.put("authResult", authResult); } if(authCode != null) { result.put("authCode", authCode); } if(authFlag != null) { result.put("authFlag", authFlag); } @@ -65,7 +65,7 @@ public final class SagePayUtil { public static Map buildCardCapturePaymentResponse (Boolean captureResult, String captureCode, String captureFlag, BigDecimal captureAmount, String captureRefNum, String captureAltRefNum, String captureMessage) { - Map result = new HashMap(); + Map result = new HashMap<>(); if(captureResult != null) { result.put("captureResult", captureResult); } if(captureCode != null) { result.put("captureCode", captureCode); } if(captureFlag != null) { result.put("captureFlag", captureFlag); } @@ -79,7 +79,7 @@ public final class SagePayUtil { public static Map buildCardReleasePaymentResponse (Boolean releaseResult, String releaseCode, BigDecimal releaseAmount, String releaseRefNum, String releaseAltRefNum, String releaseMessage) { - Map result = new HashMap(); + Map result = new HashMap<>(); if(releaseResult != null) { result.put("releaseResult", releaseResult); } if(releaseCode != null) { result.put("releaseCode", releaseCode); } if(releaseAmount != null) { result.put("releaseAmount", releaseAmount); } @@ -92,7 +92,7 @@ public final class SagePayUtil { public static Map buildCardVoidPaymentResponse (Boolean refundResult, BigDecimal refundAmount, String refundRefNum, String refundAltRefNum, String refundMessage) { - Map result = new HashMap(); + Map result = new HashMap<>(); if(refundResult != null) { result.put("refundResult", refundResult); } if(refundAmount != null) { result.put("refundAmount", refundAmount); } if(refundRefNum != null) { result.put("refundRefNum", refundRefNum); } @@ -104,7 +104,7 @@ public final class SagePayUtil { public static Map buildCardRefundPaymentResponse (Boolean refundResult, String refundCode, BigDecimal refundAmount, String refundRefNum, String refundAltRefNum, String refundMessage) { - Map result = new HashMap(); + Map result = new HashMap<>(); if(refundResult != null) { result.put("refundResult", refundResult); } if(refundCode != null) { result.put("refundCode", refundCode); } if(refundAmount != null) { result.put("refundAmount", refundAmount); } @@ -143,7 +143,7 @@ public final class SagePayUtil { public static Map getResponseData(HttpResponse response) throws IOException { - Map responseData = new HashMap(); + Map responseData = new HashMap<>(); HttpEntity httpEntity = response.getEntity(); if (httpEntity != null) { InputStream inputStream = httpEntity.getContent(); @@ -171,7 +171,7 @@ public final class SagePayUtil { HttpPost httpPost = new HttpPost(uri); httpPost.addHeader("User-Agent", "HTTP Client"); httpPost.addHeader("Content-type", "application/x-www-form-urlencoded"); - List postParameters = new ArrayList(); + List postParameters = new ArrayList<>(); for (Entry entry : parameters.entrySet()) { postParameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java index 127d567b43..3cb6bf0c64 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java @@ -706,7 +706,7 @@ public class ValueLinkServices { private static void setTimeoutReversal(DispatchContext dctx, Map ctx, Map request) { String vlInterface = (String) request.get("Interface"); // clone the context - Map context = new HashMap(); + Map context = new HashMap<>(); context.putAll(ctx); // append the rollback interface @@ -762,7 +762,7 @@ public class ValueLinkServices { currency = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); } - Map redeemCtx = new HashMap(); + Map redeemCtx = new HashMap<>(); redeemCtx.put("userLogin", userLogin); redeemCtx.put("paymentConfig", paymentConfig); redeemCtx.put("cardNumber", giftCard.get("cardNumber")); @@ -855,7 +855,7 @@ public class ValueLinkServices { currency = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); } - Map redeemCtx = new HashMap(); + Map redeemCtx = new HashMap<>(); redeemCtx.put("userLogin", userLogin); redeemCtx.put("paymentConfig", paymentConfig); redeemCtx.put("cardNumber", giftCard.get("cardNumber")); @@ -920,7 +920,7 @@ public class ValueLinkServices { currency = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator); } - Map refundCtx = new HashMap(); + Map refundCtx = new HashMap<>(); refundCtx.put("userLogin", userLogin); refundCtx.put("paymentConfig", paymentConfig); refundCtx.put("cardNumber", giftCard.get("cardNumber")); @@ -1085,7 +1085,7 @@ public class ValueLinkServices { } // make a map of answer info - Map answerMap = new HashMap(); + Map answerMap = new HashMap<>(); if (responseAnswers != null) { for (GenericValue answer : responseAnswers) { GenericValue question = null; @@ -1117,7 +1117,7 @@ public class ValueLinkServices { int qtyLoop = quantity.intValue(); for (int i = 0; i < qtyLoop; i++) { // activate a gift card - Map activateCtx = new HashMap(); + Map activateCtx = new HashMap<>(); activateCtx.put("paymentConfig", paymentConfig); activateCtx.put("vlPromoCode", promoCode); activateCtx.put("currency", currency); @@ -1151,7 +1151,7 @@ public class ValueLinkServices { } // create the fulfillment record - Map vlFulFill = new HashMap(); + Map vlFulFill = new HashMap<>(); vlFulFill.put("typeEnumId", "GC_ACTIVATE"); vlFulFill.put("merchantId", EntityUtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId", delegator)); vlFulFill.put("partyId", partyId); @@ -1207,7 +1207,7 @@ public class ValueLinkServices { } } - Map emailCtx = new HashMap(); + Map emailCtx = new HashMap<>(); String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); if (UtilValidate.isEmpty(bodyScreenLocation)) { bodyScreenLocation = ProductStoreWorker.getDefaultProductStoreEmailScreenLocation(emailType); @@ -1330,7 +1330,7 @@ public class ValueLinkServices { } // make a map of answer info - Map answerMap = new HashMap(); + Map answerMap = new HashMap<>(); if (responseAnswers != null) { for (GenericValue answer : responseAnswers) { GenericValue question = null; @@ -1355,7 +1355,7 @@ public class ValueLinkServices { String pinNumber = (String) answerMap.get(pinNumberKey); // reload the gift card - Map reloadCtx = new HashMap(); + Map reloadCtx = new HashMap<>(); reloadCtx.put("paymentConfig", paymentConfig); reloadCtx.put("currency", currency); reloadCtx.put("partyId", partyId); @@ -1375,7 +1375,7 @@ public class ValueLinkServices { } // create the fulfillment record - Map vlFulFill = new HashMap(); + Map vlFulFill = new HashMap<>(); vlFulFill.put("typeEnumId", "GC_RELOAD"); vlFulFill.put("merchantId", EntityUtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId", delegator)); vlFulFill.put("partyId", partyId); @@ -1442,7 +1442,7 @@ public class ValueLinkServices { if (productStoreEmail == null) { Debug.logError("No gift card purchase email setting found for this store; cannot send gift card information", module); } else { - Map emailCtx = new HashMap(); + Map emailCtx = new HashMap<>(); answerMap.put("locale", locale); String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java index 127c8e0c27..0dbd4fdd83 100644 --- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java +++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/util/UtilAccounting.java @@ -98,7 +98,7 @@ public final class UtilAccounting { } public static List getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException { - List glAccountClassIds = new LinkedList(); + List glAccountClassIds = new LinkedList<>(); getGlAccountClassChildren(glAccountClass, glAccountClassIds); return glAccountClassIds; } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java index d44abe756d..c12b64ec29 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementEvents.java @@ -88,7 +88,7 @@ public class ContentManagementEvents { String pubValue = (String)map.get(pubContentId); String paramName = Integer.toString(counter) + "_" + pubContentId; String paramValue = (String)paramMap.get(paramName); - Map serviceIn = new HashMap(); + Map serviceIn = new HashMap<>(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentIdTo", contentId); serviceIn.put("contentId", pubContentId); @@ -200,7 +200,7 @@ public class ContentManagementEvents { // make a map of the values that are passed in using the top subSite as the key. // Content can only be linked to one subsite under a top site (ends with "_MASTER") - Map siteIdLookup = new HashMap(); + Map siteIdLookup = new HashMap<>(); for (Entry entry : paramMap.entrySet()) { String param = entry.getKey(); int pos = param.indexOf("select_"); @@ -247,7 +247,7 @@ public class ContentManagementEvents { } } // create new link - Map serviceIn = new HashMap(); + Map serviceIn = new HashMap<>(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentId", targContentId); serviceIn.put("contentAssocTypeId", "PUBLISH_LINK"); @@ -265,7 +265,7 @@ public class ContentManagementEvents { return "error"; } - serviceIn = new HashMap(); + serviceIn = new HashMap<>(); serviceIn.put("userLogin", userLogin); serviceIn.put("contentId", targContentId); serviceIn.put("contentAssocTypeId", "PUBLISH_LINK"); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java index af652b0cc3..fbff992fd5 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java @@ -81,7 +81,7 @@ public class ContentManagementServices { if (UtilValidate.isNotEmpty(assocTypesString)) { List lst = StringUtil.split(assocTypesString, "|"); if (assocTypes == null) { - assocTypes = new LinkedList(); + assocTypes = new LinkedList<>(); } assocTypes.addAll(lst); } @@ -156,7 +156,7 @@ public class ContentManagementServices { // ContentPurposes can get passed in as a delimited string or a list. Combine. List contentPurposeList = UtilGenerics.checkList(context.get("contentPurposeList")); if (contentPurposeList == null) { - contentPurposeList = new LinkedList(); + contentPurposeList = new LinkedList<>(); } String contentPurposeString = (String) context.get("contentPurposeString"); if (UtilValidate.isNotEmpty(contentPurposeString)) { @@ -275,7 +275,7 @@ public class ContentManagementServices { } context.putAll(content); if (contentExists) { - Map contentContext = new HashMap(); + Map contentContext = new HashMap<>(); ModelService contentModel = dispatcher.getDispatchContext().getModelService("updateContent"); contentContext.putAll(contentModel.makeValid(content, ModelService.IN_PARAM)); contentContext.put("userLogin", userLogin); @@ -287,7 +287,7 @@ public class ContentManagementServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentUpdatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); } } else { - Map contentContext = new HashMap(); + Map contentContext = new HashMap<>(); ModelService contentModel = dispatcher.getDispatchContext().getModelService("createContent"); contentContext.putAll(contentModel.makeValid(content, ModelService.IN_PARAM)); contentContext.put("userLogin", userLogin); @@ -320,7 +320,7 @@ public class ContentManagementServices { } else if (UtilValidate.isNotEmpty(dataResourceTypeId) && UtilValidate.isNotEmpty(contentId)) { // If dataResource was not previously existing, then update the associated content with its id if (UtilValidate.isNotEmpty(dataResourceId) && !dataResourceExists) { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("userLogin", userLogin); map.put("dataResourceId", dataResourceId); map.put("contentId", contentId); @@ -344,7 +344,7 @@ public class ContentManagementServices { if (Debug.infoOn()) Debug.logInfo("contentAssoc: " + contentAssoc.toString(), module); if (UtilValidate.isNotEmpty(contentAssocTypeId) && contentAssoc.get("contentId") != null && contentAssoc.get("contentIdTo") != null) { if (Debug.infoOn()) Debug.logInfo("in persistContentAndAssoc, deactivateExisting:" + deactivateExisting, module); - Map contentAssocContext = new HashMap(); + Map contentAssocContext = new HashMap<>(); contentAssocContext.put("userLogin", userLogin); contentAssocContext.put("displayFailCond", bDisplayFailCond); contentAssocContext.put("skipPermissionCheck", context.get("skipPermissionCheck")); @@ -405,7 +405,7 @@ public class ContentManagementServices { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue)context.get("userLogin"); - Map results = new HashMap(); + Map results = new HashMap<>(); String siteContentId = (String)context.get("contentId"); String partyId = (String)context.get("partyId"); @@ -420,7 +420,7 @@ public class ContentManagementServices { } for (GenericValue roleType : siteRoles) { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.put("partyId", partyId); serviceContext.put("contentId", siteContentId); serviceContext.put("userLogin", userLogin); @@ -444,7 +444,7 @@ public class ContentManagementServices { // for now, will assume that any error is due to duplicates - ignore if (fromDate == null) { try { - Map newContext = new HashMap(); + Map newContext = new HashMap<>(); newContext.put("contentId", serviceContext.get("contentId")); newContext.put("partyId", serviceContext.get("partyId")); newContext.put("roleTypeId", serviceContext.get("roleTypeId")); @@ -472,7 +472,7 @@ public class ContentManagementServices { // for now, will assume that any error is due to non-existence - ignore try { Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module); - Map newContext = new HashMap(); + Map newContext = new HashMap<>(); newContext.put("contentId", serviceContext.get("contentId")); newContext.put("partyId", serviceContext.get("partyId")); newContext.put("roleTypeId", serviceContext.get("roleTypeId")); @@ -533,8 +533,8 @@ public class ContentManagementServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Map context = UtilMisc.makeMapWritable(rcontext); - Map result = new HashMap(); - Map newDrContext = new HashMap(); + Map result = new HashMap<>(); + Map newDrContext = new HashMap<>(); GenericValue dataResource = delegator.makeValue("DataResource"); dataResource.setPKFields(context); dataResource.setNonPKFields(context); @@ -593,7 +593,7 @@ public class ContentManagementServices { Debug.logInfo("in persist... dataResourceId(0):" + dataResourceId, module); } dataResource = (GenericValue)thisResult.get("dataResource"); - Map fileContext = new HashMap(); + Map fileContext = new HashMap<>(); fileContext.put("userLogin", userLogin); if ("IMAGE_OBJECT".equals(dataResourceTypeId)) { if (imageDataBytes != null) { @@ -607,7 +607,7 @@ public class ContentManagementServices { } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { } else if ("SURVEY".startsWith(dataResourceTypeId)) { } else if ("_FILE".indexOf(dataResourceTypeId) >=0) { - Map uploadImage = new HashMap(); + Map uploadImage = new HashMap<>(); uploadImage.put("userLogin", userLogin); uploadImage.put("dataResourceId", dataResourceId); uploadImage.put("dataResourceTypeId", dataResourceTypeId); @@ -635,7 +635,7 @@ public class ContentManagementServices { if (ServiceUtil.isError(thisResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(thisResult)); } - Map fileContext = new HashMap(); + Map fileContext = new HashMap<>(); fileContext.put("userLogin", userLogin); String forceElectronicText = (String)context.get("forceElectronicText"); if ("IMAGE_OBJECT".equals(dataResourceTypeId)) { @@ -650,7 +650,7 @@ public class ContentManagementServices { } else if ("SHORT_TEXT".equals(dataResourceTypeId)) { } else if ("SURVEY".startsWith(dataResourceTypeId)) { } else if ("_FILE".indexOf(dataResourceTypeId) >=0) { - Map uploadImage = new HashMap(); + Map uploadImage = new HashMap<>(); uploadImage.put("userLogin", userLogin); uploadImage.put("dataResourceId", dataResourceId); uploadImage.put("dataResourceTypeId", dataResourceTypeId); @@ -695,9 +695,9 @@ public class ContentManagementServices { public static Map updateSiteRolesDyn(DispatchContext dctx, Map context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); - Map results = new HashMap(); - Map thisResult = new HashMap(); - Map serviceContext = new HashMap(); + Map results = new HashMap<>(); + Map thisResult = new HashMap<>(); + Map serviceContext = new HashMap<>(); // siteContentId will equal "ADMIN_MASTER", "AGINC_MASTER", etc. // Remember that this service is called in the "multi" mode, // with a new siteContentId each time. @@ -746,7 +746,7 @@ public class ContentManagementServices { //return ServiceUtil.returnError(e.toString()); try { Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module); - Map newContext = new HashMap(); + Map newContext = new HashMap<>(); newContext.put("contentId", serviceContext.get("contentId")); newContext.put("partyId", serviceContext.get("partyId")); newContext.put("roleTypeId", serviceContext.get("roleTypeId")); @@ -766,12 +766,12 @@ public class ContentManagementServices { } public static Map updateOrRemove(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String entityName = (String)context.get("entityName"); String action = (String)context.get("action"); String pkFieldCount = (String)context.get("pkFieldCount"); - Map pkFields = new HashMap(); + Map pkFields = new HashMap<>(); int fieldCount = Integer.parseInt(pkFieldCount); for (int i=0; i resequence(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String contentIdTo = (String)context.get("contentIdTo"); Integer seqInc = (Integer)context.get("seqInc"); @@ -830,7 +830,7 @@ public class ContentManagementServices { int seqIncrement = seqInc; List typeList = UtilGenerics.checkList(context.get("typeList")); if (typeList == null) { - typeList = new LinkedList(); + typeList = new LinkedList<>(); } String contentAssocTypeId = (String)context.get("contentAssocTypeId"); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { @@ -900,10 +900,10 @@ public class ContentManagementServices { } public static Map changeLeafToNode(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map thisResult = new HashMap(); + Map thisResult = new HashMap<>(); String contentId = (String)context.get("contentId"); GenericValue userLogin = (GenericValue)context.get("userLogin"); String userLoginId = userLogin.getString("userLoginId"); @@ -958,7 +958,7 @@ public class ContentManagementServices { } public static Map updateLeafCount(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); List typeList = UtilGenerics.checkList(context.get("typeList")); if (typeList == null) { @@ -986,11 +986,11 @@ public class ContentManagementServices { public static Map updatePageType(DispatchContext dctx, Map rcontext) throws GenericServiceException{ Delegator delegator = dctx.getDelegator(); Map context = UtilMisc.makeMapWritable(rcontext); - Map results = new HashMap(); + Map results = new HashMap<>(); Locale locale = (Locale) context.get("locale"); Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); } String pageMode = (String)context.get("pageMode"); @@ -1026,11 +1026,11 @@ public class ContentManagementServices { public static Map resetToOutlineMode(DispatchContext dctx, Map rcontext) throws GenericServiceException{ Delegator delegator = dctx.getDelegator(); Map context = UtilMisc.makeMapWritable(rcontext); - Map results = new HashMap(); + Map results = new HashMap<>(); Locale locale = (Locale) context.get("locale"); Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); } String contentId = (String)context.get("contentId"); @@ -1069,7 +1069,7 @@ public class ContentManagementServices { } public static Map clearContentAssocViewCache(DispatchContext dctx, Map context) throws GenericServiceException{ - Map results = new HashMap(); + Map results = new HashMap<>(); UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewFrom"); if (utilCache != null) { @@ -1085,7 +1085,7 @@ public class ContentManagementServices { } public static Map clearContentAssocDataResourceViewCache(DispatchContext dctx, Map context) throws GenericServiceException{ - Map results = new HashMap(); + Map results = new HashMap<>(); UtilCache utilCache = UtilCache.findCache("entitycache.entity-list.default.ContentAssocViewDataResourceFrom"); if (utilCache != null) { @@ -1104,7 +1104,7 @@ public class ContentManagementServices { String contentId = content.getString("contentId"); Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); } else { if (visitedSet.contains(contentId)) { @@ -1127,7 +1127,7 @@ public class ContentManagementServices { String contentId = content.getString("contentId"); Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); } else { if (visitedSet.contains(contentId)) { @@ -1165,7 +1165,7 @@ public class ContentManagementServices { } public static Map findSubNodes(DispatchContext dctx, Map context) throws GenericServiceException{ - Map results = new HashMap(); + Map results = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String contentIdTo = (String)context.get("contentId"); try { @@ -1200,7 +1200,7 @@ public class ContentManagementServices { } public static Map initContentChildCounts(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Locale locale = (Locale) context.get("locale"); GenericValue content = (GenericValue)context.get("content"); if (content == null) { @@ -1219,7 +1219,7 @@ public class ContentManagementServices { } public static Map incrementContentChildStats(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); String contentId = (String)context.get("contentId"); @@ -1245,7 +1245,7 @@ public class ContentManagementServices { } public static Map decrementContentChildStats(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); String contentId = (String)context.get("contentId"); @@ -1271,12 +1271,12 @@ public class ContentManagementServices { } public static Map updateContentChildStats(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String contentId = (String)context.get("contentId"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); - List typeList = new LinkedList(); + List typeList = new LinkedList<>(); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { typeList.add(contentAssocTypeId); } else { @@ -1292,11 +1292,11 @@ public class ContentManagementServices { } public static Map updateContentSubscription(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - Map thisResult = new HashMap(); + Map thisResult = new HashMap<>(); String partyId = (String) context.get("partyId"); String webPubPt = (String) context.get("contentId"); String roleTypeId = (String) context.get("useRoleTypeId"); @@ -1358,7 +1358,7 @@ public class ContentManagementServices { if (hasExistingContentRole) { contentRole.store(); } else { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("partyId", partyId); map.put("roleTypeId", roleTypeId); map.put("userLogin", userLogin); @@ -1428,7 +1428,7 @@ public class ContentManagementServices { public static Map updateContentSubscriptionByOrder(DispatchContext dctx, Map rcontext) throws GenericServiceException{ Map context = UtilMisc.makeMapWritable(rcontext); - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -1494,14 +1494,14 @@ public class ContentManagementServices { String contentId = (String)context.get("contentId"); String serviceName = (String)context.get("serviceName"); String contentAssocTypeId = (String)context.get("contentAssocTypeId"); - List contentAssocTypeIdList = new LinkedList(); + List contentAssocTypeIdList = new LinkedList<>(); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { contentAssocTypeIdList = StringUtil.split(contentAssocTypeId, "|"); } if (contentAssocTypeIdList.size() == 0) { contentAssocTypeIdList.add("SUB_CONTENT"); } - Map ctx = new HashMap(); + Map ctx = new HashMap<>(); ctx.put("userLogin", userLogin); ctx.put("contentAssocTypeIdList", contentAssocTypeIdList); try { @@ -1521,7 +1521,7 @@ public class ContentManagementServices { Locale locale = (Locale) context.get("locale"); Set visitedSet = UtilGenerics.checkSet(context.get("visitedSet")); if (visitedSet == null) { - visitedSet = new HashSet(); + visitedSet = new HashSet<>(); context.put("visitedSet", visitedSet); } else { if (visitedSet.contains(contentId)) { @@ -1576,9 +1576,9 @@ public class ContentManagementServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result)); } String contentId = (String)result.get("contentId"); - List parentList = new LinkedList(); + List parentList = new LinkedList<>(); if (UtilValidate.isEmpty(masterRevisionContentId)) { - Map traversMap = new HashMap(); + Map traversMap = new HashMap<>(); traversMap.put("contentId", contentId); traversMap.put("direction", "To"); traversMap.put("contentAssocTypeId", "COMPDOC_PART"); @@ -1592,7 +1592,7 @@ public class ContentManagementServices { } // Update ContentRevision and ContentRevisonItem - Map contentRevisionMap = new HashMap(); + Map contentRevisionMap = new HashMap<>(); contentRevisionMap.put("itemContentId", contentId); contentRevisionMap.put("newDataResourceId", result.get("dataResourceId")); contentRevisionMap.put("oldDataResourceId", oldDataResourceId); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java index 409620f20b..d9e54c516c 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java @@ -61,8 +61,8 @@ import org.apache.ofbiz.security.Security; public final class ContentManagementWorker { public static final String module = ContentManagementWorker.class.getName(); - private static Map cachedWebSitePublishPoints = new HashMap(); - private static Map> cachedStaticValues = new HashMap>(); + private static Map cachedWebSitePublishPoints = new HashMap<>(); + private static Map> cachedStaticValues = new HashMap<>(); private ContentManagementWorker() {} @@ -83,7 +83,7 @@ public final class ContentManagementWorker { Map> lookupCaches = UtilGenerics.checkMap(session.getAttribute("lookupCaches")); if (lookupCaches == null) { - lookupCaches = new HashMap>(); + lookupCaches = new HashMap<>(); session.setAttribute("lookupCaches", lookupCaches); } String entityName = pk.getEntityName(); @@ -102,7 +102,7 @@ public final class ContentManagementWorker { String cacheEntityName = entityName; LifoSet lkupCache = lookupCaches.get(cacheEntityName); if (lkupCache == null) { - lkupCache = new LifoSet(); + lkupCache = new LifoSet<>(); lookupCaches.put(cacheEntityName, lkupCache); } lkupCache.add(pk.getPrimaryKey()); @@ -113,7 +113,7 @@ public final class ContentManagementWorker { String cacheEntityName = entityName; LifoSet lkupCache = lookupCaches.get(cacheEntityName); if (lkupCache == null) { - lkupCache = new LifoSet(); + lkupCache = new LifoSet<>(); lookupCaches.put(cacheEntityName, lkupCache); } @@ -156,7 +156,7 @@ public final class ContentManagementWorker { HttpSession session = request.getSession(); Map currentEntityMap = UtilGenerics.checkMap(session.getAttribute("currentEntityMap")); if (currentEntityMap == null) { - currentEntityMap = new HashMap(); + currentEntityMap = new HashMap<>(); session.setAttribute("currentEntityMap", currentEntityMap); } currentEntityMap.put(entityName, ent); @@ -185,7 +185,7 @@ public final class ContentManagementWorker { HttpSession session = request.getSession(); Map currentEntityMap = UtilGenerics.checkMap(session.getAttribute("currentEntityMap")); if (currentEntityMap == null) { - currentEntityMap = new HashMap(); + currentEntityMap = new HashMap<>(); session.setAttribute("currentEntityMap", currentEntityMap); } Map paramMap = UtilHttp.getParameterMap(request); @@ -278,7 +278,7 @@ public final class ContentManagementWorker { } public static List getPermittedPublishPoints(Delegator delegator, List allPublishPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { - List permittedPublishPointList = new LinkedList(); + List permittedPublishPointList = new LinkedList<>(); // Check that user has permission to admin sites for (GenericValue webSitePP : allPublishPoints) { @@ -293,7 +293,7 @@ public final class ContentManagementWorker { } List passedPurposes = UtilMisc.toList("ARTICLE"); List roles = StringUtil.split(passedRoles, "|"); - List targetOperationList = new LinkedList(); + List targetOperationList = new LinkedList<>(); if (UtilValidate.isEmpty(permittedOperations)) { targetOperationList.add("CONTENT" + entityAction); } else { @@ -325,7 +325,7 @@ public final class ContentManagementWorker { } catch (GenericEntityException e) { throw new GeneralException(e.getMessage()); } - List allPublishPoints = new LinkedList(); + List allPublishPoints = new LinkedList<>(); GenericValue webSitePublishPoint = null; for (GenericValue contentAssoc : relatedPubPts) { String pub = (String)contentAssoc.get("contentId"); @@ -337,7 +337,7 @@ public final class ContentManagementWorker { public static Map getPublishPointMap(Delegator delegator, String pubPtId) throws GeneralException { List publishPointList = getAllPublishPoints(delegator, pubPtId); - Map publishPointMap = new HashMap(); + Map publishPointMap = new HashMap<>(); for (GenericValue webSitePublishPoint : publishPointList) { String pub = (String)webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); @@ -356,7 +356,7 @@ public final class ContentManagementWorker { } public static Map getPublishPointMap(Delegator delegator, List publishPointList) { - Map publishPointMap = new HashMap(); + Map publishPointMap = new HashMap<>(); for (GenericValue webSitePublishPoint : publishPointList) { String pub = (String)webSitePublishPoint.get("contentId"); publishPointMap.put(pub, webSitePublishPoint); @@ -372,12 +372,12 @@ public final class ContentManagementWorker { throw new GeneralException(e.getMessage()); } - List> staticValueList = new LinkedList>(); + List> staticValueList = new LinkedList<>(); for (GenericValue content : assocValueList) { String contentId = (String)content.get("contentId"); String contentName = (String)content.get("contentName"); String description = (String)content.get("description"); - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("contentId", contentId); map.put("contentName", contentName); map.put("description", description); @@ -460,7 +460,7 @@ public final class ContentManagementWorker { if (!ignoreCache) { Map subStaticValueMap = cachedStaticValues.get(parentPlaceholderId); if (subStaticValueMap == null) { - subStaticValueMap = new HashMap(); + subStaticValueMap = new HashMap<>(); cachedStaticValues.put(parentPlaceholderId, subStaticValueMap); } } @@ -473,12 +473,12 @@ public final class ContentManagementWorker { // and another map (publishPointMapAll) that points to one of the top-level points. List allPublishPointList = getAllPublishPoints(delegator, rootPubId); List publishPointList = getPermittedPublishPoints(delegator, allPublishPointList, userLogin, security , permittedAction, permittedOperations, passedRoles); - Map publishPointMap = new HashMap(); - Map publishPointMapAll = new HashMap(); + Map publishPointMap = new HashMap<>(); + Map publishPointMapAll = new HashMap<>(); for (String [] arr : publishPointList) { String contentId = arr[0]; String description = arr[1]; - List subPointList = new LinkedList(); + List subPointList = new LinkedList<>(); Object [] subArr = {contentId, subPointList, description, null}; publishPointMap.put(contentId, subArr); publishPointMapAll.put(contentId, contentId); @@ -521,7 +521,7 @@ public final class ContentManagementWorker { } } - List publishedLinkList = new LinkedList(); + List publishedLinkList = new LinkedList<>(); for (Entry entry : publishPointMap.entrySet()) { String contentId = entry.getKey(); Object [] subPointArr = (Object [])publishPointMap.get(contentId); @@ -552,7 +552,7 @@ public final class ContentManagementWorker { } public static List getPermittedDepartmentPoints(Delegator delegator, List allDepartmentPoints, GenericValue userLogin, Security security, String permittedAction, String permittedOperations, String passedRoles) throws GeneralException { - List permittedDepartmentPointList = new LinkedList(); + List permittedDepartmentPointList = new LinkedList<>(); // Check that user has permission to admin sites for (GenericValue content : allDepartmentPoints) { @@ -565,7 +565,7 @@ public final class ContentManagementWorker { entityAction = "_ADMIN"; List passedPurposes = UtilMisc.toList("ARTICLE"); List roles = StringUtil.split(passedRoles, "|"); - List targetOperationList = new LinkedList(); + List targetOperationList = new LinkedList<>(); if (UtilValidate.isEmpty(permittedOperations)) { targetOperationList.add("CONTENT" + entityAction); } else { @@ -598,7 +598,7 @@ public final class ContentManagementWorker { } catch (GenericEntityException e) { throw new GeneralException(e.getMessage()); } - List allDepartmentPoints = new LinkedList(); + List allDepartmentPoints = new LinkedList<>(); GenericValue departmentContent = null; for (GenericValue contentAssoc : relatedPubPts) { String pub = (String)contentAssoc.get("contentId"); @@ -623,7 +623,7 @@ public final class ContentManagementWorker { if (thisContent == null) throw new RuntimeException("No entity found for id=" + contentId); - List conditionMain = new ArrayList(); + List conditionMain = new ArrayList<>(); conditionMain.add(EntityCondition.makeCondition("contentIdTo", contentId)); if (typeList.size() > 0) { conditionMain.add(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.IN, typeList)); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java b/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java index 22dd779cd7..f654df8439 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/ConvertTree.java @@ -70,7 +70,7 @@ In order to make this service active add the following to the service definition Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); String file = (String) context.get("file"); - Map result = new HashMap(); + Map result = new HashMap<>(); String errMsg = "", sucMsg= ""; GenericValue Entity = null; if (UtilValidate.isNotEmpty(file)) { @@ -104,7 +104,7 @@ In order to make this service active add the following to the service definition Entity.set("createdTxStamp", UtilDateTime.nowTimestamp()); delegator.create(Entity); - Map contentAssoc = new HashMap(); + Map contentAssoc = new HashMap<>(); contentAssoc.put("contentId", "HOME_DOCUMENT"); contentAssoc.put("contentAssocTypeId", "TREE_CHILD"); contentAssoc.put("contentIdTo", "ROOT"); @@ -187,7 +187,7 @@ In order to make this service active add the following to the service definition .queryList(); if (contentAssocs.size() == 0) { - contentAssoc = new HashMap(); + contentAssoc = new HashMap<>(); contentAssoc.put("contentId", contentId); contentAssoc.put("contentAssocTypeId", "TREE_CHILD"); contentAssoc.put("contentIdTo", rootContent); @@ -233,7 +233,7 @@ In order to make this service active add the following to the service definition Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map result = new HashMap(); + Map result = new HashMap<>(); String subContents = null, check = ",", oldChar = "\"", newChar = "", contentNameInprogress = "", contentName = "", contentId = null; GenericValue Entity = null; String errMsg = "", sucMsg= ""; @@ -265,7 +265,7 @@ In order to make this service active add the following to the service definition } if (contentNameMatch == false) { //create DataResource - Map data = new HashMap(); + Map data = new HashMap<>(); data.put("userLogin", userLogin); result = dispatcher.runSync("createDataResource", data); if (ServiceUtil.isError(result)) { @@ -289,7 +289,7 @@ In order to make this service active add the following to the service definition delegator.create(Entity); //Relation Content - Map contentAssoc = new HashMap(); + Map contentAssoc = new HashMap<>(); contentAssoc.put("contentId", contentId); contentAssoc.put("contentAssocTypeId", "SUB_CONTENT"); contentAssoc.put("contentIdTo", rootContent); @@ -330,7 +330,7 @@ In order to make this service active add the following to the service definition } if (contentNameMatch == false) { //create DataResource - Map data = new HashMap(); + Map data = new HashMap<>(); data.put("userLogin", userLogin); result = dispatcher.runSync("createDataResource", data); if (ServiceUtil.isError(result)) { @@ -354,7 +354,7 @@ In order to make this service active add the following to the service definition delegator.create(Entity); //create ContentAssoc - Map contentAssoc = new HashMap(); + Map contentAssoc = new HashMap<>(); contentAssoc.put("contentId", contentId); contentAssoc.put("contentAssocTypeId", "SUB_CONTENT"); contentAssoc.put("contentIdTo", rootContent); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java index 81065d6656..92d991d58e 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/blog/BlogRssServices.java @@ -99,7 +99,7 @@ public class BlogRssServices { } public static List generateEntryList(LocalDispatcher dispatcher, Delegator delegator, String contentId, String entryLink, Locale locale, GenericValue userLogin) { - List entries = new LinkedList(); + List entries = new LinkedList<>(); List contentRecs = null; try { @@ -116,7 +116,7 @@ public class BlogRssServices { for (GenericValue v : contentRecs) { String sub = null; try { - Map dummy = new HashMap(); + Map dummy = new HashMap<>(); sub = ContentWorker.renderSubContentAsText(dispatcher, v.getString("contentId"), mapKey, dummy, locale, mimeTypeId, true); } catch (GeneralException e) { Debug.logError(e, module); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java index 67145c1b9e..652c6cb0cb 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java @@ -61,7 +61,7 @@ public class ContentJsonEvents { ); List assocs = delegator.findList("ContentAssoc", condition, null, null, null, false); - List> nodes = new LinkedList>(); + List> nodes = new LinkedList<>(); for (GenericValue assoc : assocs) { nodes.add(getTreeNode(assoc)); } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java index c224a429b0..9c3656dcf1 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocEvents.java @@ -114,7 +114,7 @@ public class CompDocEvents { request.setAttribute(obj.toString(), val); } // Update ContentRevision and ContentRevisonItem - Map contentRevisionMap = new HashMap(); + Map contentRevisionMap = new HashMap<>(); contentRevisionMap.put("itemContentId", contentId); contentRevisionMap.put("contentId", contentId); contentRevisionMap.put("userLogin", userLogin); @@ -158,7 +158,7 @@ public class CompDocEvents { String rootDir = servletContext.getRealPath("/"); String https = (String) servletContext.getAttribute("https"); - Map mapIn = new HashMap(); + Map mapIn = new HashMap<>(); mapIn.put("contentId", contentId); mapIn.put("locale", locale); mapIn.put("rootDir", rootDir); @@ -207,7 +207,7 @@ public class CompDocEvents { String rootDir = servletContext.getRealPath("/"); String https = (String) servletContext.getAttribute("https"); - Map mapIn = new HashMap(); + Map mapIn = new HashMap<>(); mapIn.put("contentId", contentId); mapIn.put("locale", locale); mapIn.put("rootDir", rootDir); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java index 94d26485f0..6fbce52e6f 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/compdoc/CompDocServices.java @@ -73,7 +73,7 @@ public class CompDocServices { */ public static Map persistRootCompDoc(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale)context.get("locale"); @@ -107,7 +107,7 @@ public class CompDocServices { contentId = (String) persistContentResult.get("contentId"); result.putAll(persistContentResult); - Map contentRevisionMap = new HashMap(); + Map contentRevisionMap = new HashMap<>(); contentRevisionMap.put("itemContentId", contentId); contentRevisionMap.put("contentId", contentId); contentRevisionMap.put("userLogin", userLogin); @@ -139,7 +139,7 @@ public class CompDocServices { String contentRevisionSeqId = (String) context.get("contentRevisionSeqId"); try { - List exprList = new LinkedList(); + List exprList = new LinkedList<>(); exprList.add(EntityCondition.makeCondition("contentIdTo", EntityOperator.EQUALS, contentId)); exprList.add(EntityCondition.makeCondition("contentAssocTypeId", EntityOperator.EQUALS, "COMPDOC_PART")); exprList.add(EntityCondition.makeCondition("rootRevisionContentId", EntityOperator.EQUALS, contentId)); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java index 959b447a36..5f43b69c1d 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentKeywordIndex.java @@ -66,8 +66,8 @@ public class ContentKeywordIndex { boolean removeStems = KeywordSearchUtil.getRemoveStems(); Set stemSet = KeywordSearchUtil.getStemSet(); - Map keywords = new TreeMap(); - List strings = new LinkedList(); + Map keywords = new TreeMap<>(); + List strings = new LinkedList<>(); int pidWeight = 1; keywords.put(content.getString("contentId").toLowerCase(Locale.getDefault()), (long) pidWeight); @@ -186,7 +186,7 @@ public class ContentKeywordIndex { } } - List toBeStored = new LinkedList(); + List toBeStored = new LinkedList<>(); int keywordMaxLength = EntityUtilProperties.getPropertyAsInteger("contentsearch", "content.keyword.max.length", 0); for (Map.Entry entry: keywords.entrySet()) { if (entry.getKey().length() <= keywordMaxLength) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java index f27845ceda..154e3ecb15 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentMapFacade.java @@ -51,7 +51,7 @@ public class ContentMapFacade implements Map { public static final String module = ContentMapFacade.class.getName(); - private static final Set mapKeySet = new HashSet(); + private static final Set mapKeySet = new HashSet<>(); static { mapKeySet.add("fields"); mapKeySet.add("link"); @@ -277,10 +277,10 @@ public class ContentMapFacade implements Map { return dataResource; } else if ("subcontent_all".equalsIgnoreCase(name)) { // subcontent list of ordered subcontent - List subContent = new LinkedList(); + List subContent = new LinkedList<>(); List subs = null; try { - Map expressions = new HashMap(); + Map expressions = new HashMap<>(); expressions.put("contentIdStart", contentId); if(!this.mapKeyFilter.equals("")) { expressions.put("caMapKey", this.mapKeyFilter); @@ -327,7 +327,7 @@ public class ContentMapFacade implements Map { return "=========> " + errorMsg + " <========="; } // TODO: change to use the MapStack instead of a cloned Map - Map renderCtx = new HashMap(); + Map renderCtx = new HashMap<>(); renderCtx.putAll(context); if (this.decoratedContent != null) { renderCtx.put("decoratedContent", decoratedContent); @@ -452,7 +452,7 @@ public class ContentMapFacade implements Map { // key is the mapKey GenericValue sub = null; try { - Map expressions = new HashMap(); + Map expressions = new HashMap<>(); expressions.put("contentIdStart", contentId); expressions.put("caMapKey", name); if(!this.statusFilter.equals("")) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java index febc80fe3a..d78a17f411 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentPermissionServices.java @@ -114,7 +114,7 @@ public class ContentPermissionServices { displayPassCond = true; } Debug.logInfo("displayPassCond(0):" + displayPassCond, ""); - Map results = new HashMap(); + Map results = new HashMap<>(); GenericValue userLogin = (GenericValue) context.get("userLogin"); String partyId = (String) context.get("partyId"); if (UtilValidate.isEmpty(partyId)) { @@ -145,7 +145,7 @@ public class ContentPermissionServices { if (UtilValidate.isNotEmpty(contentPurposeString)) { List purposesFromString = StringUtil.split(contentPurposeString, "|"); if (passedPurposes == null) { - passedPurposes = new LinkedList(); + passedPurposes = new LinkedList<>(); } passedPurposes.addAll(purposesFromString); } @@ -159,7 +159,7 @@ public class ContentPermissionServices { if (UtilValidate.isNotEmpty(targetOperationString)) { List operationsFromString = StringUtil.split(targetOperationString, "|"); if (targetOperations == null) { - targetOperations = new LinkedList(); + targetOperations = new LinkedList<>(); } targetOperations.addAll(operationsFromString); } @@ -168,7 +168,7 @@ public class ContentPermissionServices { EntityPermissionChecker.StdRelatedRoleGetter roleGetter = new EntityPermissionChecker.StdRelatedRoleGetter("Content", "roleTypeId", "contentId", "partyId", "ownerContentId", "ContentRole"); List passedRoles = UtilGenerics.checkList(context.get("roleTypeList")); - if (passedRoles == null) passedRoles = new LinkedList(); + if (passedRoles == null) passedRoles = new LinkedList<>(); String roleTypeString = (String) context.get("roleTypeString"); if (UtilValidate.isNotEmpty(roleTypeString)) { List rolesFromString = StringUtil.split(roleTypeString, "|"); @@ -184,7 +184,7 @@ public class ContentPermissionServices { StringBuilder errBuf = new StringBuilder(); String permissionStatus = null; - List entityIds = new LinkedList(); + List entityIds = new LinkedList<>(); if (passed) { results.put("permissionStatus", "granted"); permissionStatus = "granted"; @@ -250,7 +250,7 @@ public class ContentPermissionServices { } public static Map checkAssocPermission(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = new HashMap<>(); // Security security = dctx.getSecurity(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -277,12 +277,12 @@ public class ContentPermissionServices { "ContentContentToOrFromIsNull", UtilMisc.toMap("contentTo", contentTo, "contentFrom", contentFrom), locale)); } - Map permResults = new HashMap(); + Map permResults = new HashMap<>(); // Use the purposes from the from entity for both cases. List relatedPurposes = EntityPermissionChecker.getRelatedPurposes(contentFrom, null); List relatedPurposesTo = EntityPermissionChecker.getRelatedPurposes(contentTo, relatedPurposes); - Map serviceInMap = new HashMap(); + Map serviceInMap = new HashMap<>(); serviceInMap.put("userLogin", userLogin); serviceInMap.put("targetOperationList", UtilMisc.toList("CONTENT_LINK_TO")); serviceInMap.put("contentPurposeList", relatedPurposesTo); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java index 9348a5fff6..3618306158 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearch.java @@ -113,17 +113,17 @@ public class ContentSearch { public static class ContentSearchContext { public int index = 1; - public List entityConditionList = new LinkedList(); - public List orderByList = new LinkedList(); + public List entityConditionList = new LinkedList<>(); + public List orderByList = new LinkedList<>(); public Set fieldsToSelect = UtilMisc.toSet("contentId"); public DynamicViewEntity dynamicViewEntity = new DynamicViewEntity(); public boolean contentIdGroupBy = false; public boolean includedKeywordSearch = false; public Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); - public List> keywordFixedOrSetAndList = new LinkedList>(); - public Set orKeywordFixedSet = new HashSet(); - public Set andKeywordFixedSet = new HashSet(); - public List contentSearchConstraintList = new LinkedList(); + public List> keywordFixedOrSetAndList = new LinkedList<>(); + public Set orKeywordFixedSet = new HashSet<>(); + public Set andKeywordFixedSet = new HashSet<>(); + public List contentSearchConstraintList = new LinkedList<>(); public ResultSortOrder resultSortOrder = null; public Integer resultOffset = null; public Integer maxResults = null; @@ -250,7 +250,7 @@ public class ContentSearch { dynamicViewEntity.addMemberEntity(entityAlias, "ContentKeyword"); dynamicViewEntity.addAlias(entityAlias, prefix + "Keyword", "keyword", null, null, null, null); dynamicViewEntity.addViewLink("CNT", entityAlias, Boolean.FALSE, ModelKeyMap.makeKeyMapList("contentId")); - List keywordOrList = new LinkedList(); + List keywordOrList = new LinkedList<>(); for (String keyword: keywordFixedOrSet) { keywordOrList.add(EntityCondition.makeCondition(prefix + "Keyword", EntityOperator.LIKE, keyword)); } @@ -305,7 +305,7 @@ public class ContentSearch { } public ArrayList makeContentIdList(EntityListIterator eli) { - ArrayList contentIds = new ArrayList(maxResults == null ? 100 : maxResults); + ArrayList contentIds = new ArrayList<>(maxResults == null ? 100 : maxResults); if (eli == null) { Debug.logWarning("The eli is null, returning zero results", module); return contentIds; @@ -349,7 +349,7 @@ public class ContentSearch { int numRetreived = 1; int duplicatesFound = 0; - Set contentIdSet = new HashSet(); + Set contentIdSet = new HashSet<>(); contentIds.add(searchResult.getString("contentId")); contentIdSet.add(searchResult.getString("contentId")); @@ -456,7 +456,7 @@ public class ContentSearch { @Override public void addConstraint(ContentSearchContext contentSearchContext) { - Set contentIdSet = new HashSet(); + Set contentIdSet = new HashSet<>(); if (includeSubContents) { // find all sub-categories recursively, make a Set of contentId ContentSearch.getAllSubContentIds(contentId, contentIdSet, contentSearchContext.getDelegator(), contentSearchContext.nowTimestamp); @@ -483,7 +483,7 @@ public class ContentSearch { contentSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); contentSearchContext.dynamicViewEntity.addViewLink("CNT", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("contentId")); - List assocConditionFromTo = new LinkedList(); + List assocConditionFromTo = new LinkedList<>(); assocConditionFromTo.add(EntityCondition.makeCondition(prefix + "ContentIdTo", EntityOperator.IN, contentIdSet)); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { assocConditionFromTo.add(EntityCondition.makeCondition(prefix + "ContentAssocTypeId", EntityOperator.EQUALS, contentAssocTypeId)); @@ -504,7 +504,7 @@ public class ContentSearch { contentSearchContext.dynamicViewEntity.addAlias(entityAlias, prefix + "ThruDate", "thruDate", null, null, null, null); contentSearchContext.dynamicViewEntity.addViewLink("CNT", entityAlias, Boolean.TRUE, ModelKeyMap.makeKeyMapList("contentId","contentIdTo")); - List assocConditionToFrom = new LinkedList(); + List assocConditionToFrom = new LinkedList<>(); assocConditionToFrom.add(EntityCondition.makeCondition(prefix + "ContentIdFrom", EntityOperator.IN, contentIdSet)); if (UtilValidate.isNotEmpty(contentAssocTypeId)) { assocConditionToFrom.add(EntityCondition.makeCondition(prefix + "ContentAssocTypeId", EntityOperator.EQUALS, contentAssocTypeId)); @@ -626,11 +626,11 @@ public class ContentSearch { public Set makeFullKeywordSet(Delegator delegator) { Set keywordSet = KeywordSearchUtil.makeKeywordSet(this.keywordsString, null, true); - Set fullKeywordSet = new TreeSet(); + Set fullKeywordSet = new TreeSet<>(); // expand the keyword list according to the thesaurus and create a new set of keywords for (String keyword: keywordSet) { - Set expandedSet = new TreeSet(); + Set expandedSet = new TreeSet<>(); boolean replaceEntered = KeywordSearchUtil.expandKeywordForSearch(keyword, expandedSet, delegator); fullKeywordSet.addAll(expandedSet); if (!replaceEntered) { @@ -655,13 +655,13 @@ public class ContentSearch { // expand the keyword list according to the thesaurus and create a new set of keywords for (String keyword: keywordSet) { - Set expandedSet = new TreeSet(); + Set expandedSet = new TreeSet<>(); boolean replaceEntered = KeywordSearchUtil.expandKeywordForSearch(keyword, expandedSet, contentSearchContext.getDelegator()); if (!replaceEntered) { expandedSet.add(keyword); } Set fixedSet = KeywordSearchUtil.fixKeywordsForSearch(expandedSet, anyPrefix, anySuffix, removeStems, isAnd); - Set fixedKeywordSet = new HashSet(); + Set fixedKeywordSet = new HashSet<>(); fixedKeywordSet.addAll(fixedSet); contentSearchContext.keywordFixedOrSetAndList.add(fixedKeywordSet); } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java index f849986ac7..e0b6729ac8 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchEvents.java @@ -98,7 +98,7 @@ public class ContentSearchEvents { String searchSortOrderString = ContentSearchSession.searchGetSortOrderString(false, request); // ========== populate the result Map - Map result = new HashMap(); + Map result = new HashMap<>(); result.put("contentIds", contentIds); result.put("viewIndex", viewIndex); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java index 6166240fba..7f8d5ec17d 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentSearchSession.java @@ -68,7 +68,7 @@ public class ContentSearchSession { public static void addConstraint(ContentSearchConstraint contentSearchConstraint, HttpSession session) { ContentSearchOptions contentSearchOptions = getContentSearchOptions(session); if (contentSearchOptions.constraintList == null) { - contentSearchOptions.constraintList = new LinkedList(); + contentSearchOptions.constraintList = new LinkedList<>(); } if (!contentSearchOptions.constraintList.contains(contentSearchConstraint)) { contentSearchOptions.constraintList.add(contentSearchConstraint); @@ -131,7 +131,7 @@ public class ContentSearchSession { public List searchGetConstraintStrings(boolean detailed, Delegator delegator, Locale locale) { List contentSearchConstraintList = this.getConstraintList(); - List constraintStrings = new LinkedList(); + List constraintStrings = new LinkedList<>(); if (contentSearchConstraintList == null) { return constraintStrings; } @@ -267,7 +267,7 @@ public class ContentSearchSession { public static List getSearchOptionsHistoryList(HttpSession session) { List optionsHistoryList = UtilGenerics.checkList(session.getAttribute("_CONTENT_SEARCH_OPTIONS_HISTORY_")); if (optionsHistoryList == null) { - optionsHistoryList = new LinkedList(); + optionsHistoryList = new LinkedList<>(); session.setAttribute("_CONTENT_SEARCH_OPTIONS_HISTORY_", optionsHistoryList); } return optionsHistoryList; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java index ee6d094005..0a08d43612 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServices.java @@ -64,7 +64,7 @@ public class ContentServices { */ public static Map findRelatedContent(DispatchContext dctx, Map context) { LocalDispatcher dispatcher = dctx.getDispatcher(); - Map results = new HashMap(); + Map results = new HashMap<>(); GenericValue currentContent = (GenericValue) context.get("currentContent"); String fromDate = (String) context.get("fromDate"); @@ -93,12 +93,12 @@ public class ContentServices { return results; } - Map serviceInMap = new HashMap(); + Map serviceInMap = new HashMap<>(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperations); serviceInMap.put("entityOperation", context.get("entityOperation")); - List permittedList = new LinkedList(); + List permittedList = new LinkedList<>(); Map permResults = null; for (GenericValue content : contentList) { serviceInMap.put("currentContent", content); @@ -126,8 +126,8 @@ public class ContentServices { * This is a generic service for traversing a Content tree, typical of a blog response tree. It calls the ContentWorker.traverse method. */ public static Map findContentParents(DispatchContext dctx, Map context) { - Map results = new HashMap(); - List parentList = new LinkedList(); + Map results = new HashMap<>(); + List parentList = new LinkedList<>(); results.put("parentList", parentList); LocalDispatcher dispatcher = dctx.getDispatcher(); String contentId = (String)context.get("contentId"); @@ -136,7 +136,7 @@ public class ContentServices { if (UtilValidate.isEmpty(direction)) { direction="To"; } - Map traversMap = new HashMap(); + Map traversMap = new HashMap<>(); traversMap.put("contentId", contentId); traversMap.put("direction", direction); traversMap.put("contentAssocTypeId", contentAssocTypeId); @@ -168,7 +168,7 @@ public class ContentServices { */ public static Map traverseContent(DispatchContext dctx, Map context) { Delegator delegator = dctx.getDelegator(); - Map results = new HashMap(); + Map results = new HashMap<>(); Locale locale = (Locale) context.get("locale"); String contentId = (String) context.get("contentId"); @@ -203,7 +203,7 @@ public class ContentServices { thruDate = UtilDateTime.toTimestamp(thruDateStr); } - Map whenMap = new HashMap(); + Map whenMap = new HashMap<>(); whenMap.put("followWhen", context.get("followWhen")); whenMap.put("pickWhen", context.get("pickWhen")); whenMap.put("returnBeforePickWhen", context.get("returnBeforePickWhen")); @@ -214,8 +214,8 @@ public class ContentServices { startContentAssocTypeId = "PUBLISH"; } - Map nodeMap = new HashMap(); - List pickList = new LinkedList(); + Map nodeMap = new HashMap<>(); + List pickList = new LinkedList<>(); ContentWorker.traverse(delegator, content, fromDate, thruDate, whenMap, 0, nodeMap, startContentAssocTypeId, pickList, direction); results.put("nodeMap", nodeMap); @@ -249,7 +249,7 @@ public class ContentServices { Map context = UtilMisc.makeMapWritable(rcontext); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = new HashMap<>(); Locale locale = (Locale) context.get("locale"); context.put("entityOperation", "_UPDATE"); List targetOperationList = ContentWorker.prepTargetOperationList(context, "_UPDATE"); @@ -283,7 +283,7 @@ public class ContentServices { contentAssoc.put("thruDate", UtilDateTime.nowTimestamp()); String permissionStatus = null; - Map serviceInMap = new HashMap(); + Map serviceInMap = new HashMap<>(); serviceInMap.put("userLogin", context.get("userLogin")); serviceInMap.put("targetOperationList", targetOperationList); serviceInMap.put("contentPurposeList", contentPurposeList); @@ -331,7 +331,7 @@ public class ContentServices { Locale locale = (Locale) context.get("locale"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); String sequenceNum = null; - Map results = new HashMap(); + Map results = new HashMap<>(); try { GenericValue activeAssoc = null; @@ -343,7 +343,7 @@ public class ContentServices { sequenceNum = (String) activeAssoc.get("sequenceNum"); } - List exprList = new LinkedList(); + List exprList = new LinkedList<>(); exprList.add(EntityCondition.makeCondition("mapKey", EntityOperator.EQUALS, mapKey)); if (sequenceNum != null) { exprList.add(EntityCondition.makeCondition("sequenceNum", EntityOperator.EQUALS, sequenceNum)); @@ -382,7 +382,7 @@ public class ContentServices { * matching content. */ public static Map renderSubContentAsText(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = new HashMap<>(); LocalDispatcher dispatcher = dctx.getDispatcher(); Map templateContext = UtilGenerics.checkMap(context.get("templateContext")); @@ -408,7 +408,7 @@ public class ContentServices { Writer outWriter = new StringWriter(); if (templateContext == null) { - templateContext = new HashMap(); + templateContext = new HashMap<>(); } try { @@ -432,7 +432,7 @@ public class ContentServices { * matching content. */ public static Map renderContentAsText(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = new HashMap<>(); LocalDispatcher dispatcher = dctx.getDispatcher(); Writer out = (Writer) context.get("outWriter"); @@ -451,7 +451,7 @@ public class ContentServices { } if (templateContext == null) { - templateContext = new HashMap(); + templateContext = new HashMap<>(); } Writer outWriter = new StringWriter(); @@ -475,7 +475,7 @@ public class ContentServices { } public static Map linkContentToPubPt(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); @@ -489,7 +489,7 @@ public class ContentServices { if (Debug.infoOn()) Debug.logInfo("in publishContent, statusId:" + statusId, module); if (Debug.infoOn()) Debug.logInfo("in publishContent, userLogin:" + userLogin, module); - Map mapIn = new HashMap(); + Map mapIn = new HashMap<>(); mapIn.put("contentId", contentId); mapIn.put("contentIdTo", contentIdTo); mapIn.put("contentAssocTypeId", contentAssocTypeId); @@ -513,7 +513,7 @@ public class ContentServices { content.put("statusId", statusId); content.store(); - mapIn = new HashMap(); + mapIn = new HashMap<>(); mapIn.put("contentId", contentId); mapIn.put("contentIdTo", contentIdTo); mapIn.put("contentAssocTypeId", contentAssocTypeId); @@ -543,7 +543,7 @@ public class ContentServices { } public static Map publishContent(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); GenericValue content = (GenericValue)context.get("content"); try { @@ -557,10 +557,10 @@ public class ContentServices { } public static Map getPrefixedMembers(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); Map mapIn = UtilGenerics.checkMap(context.get("mapIn")); String prefix = (String)context.get("prefix"); - Map mapOut = new HashMap(); + Map mapOut = new HashMap<>(); result.put("mapOut", mapOut); if (mapIn != null) { Set> entrySet = mapIn.entrySet(); @@ -576,8 +576,8 @@ public class ContentServices { } public static Map splitString(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); - List outputList = new LinkedList(); + Map result = new HashMap<>(); + List outputList = new LinkedList<>(); String delimiter = UtilFormatOut.checkEmpty((String)context.get("delimiter"), "|"); String inputString = (String)context.get("inputString"); if (UtilValidate.isNotEmpty(inputString)) { @@ -588,7 +588,7 @@ public class ContentServices { } public static Map joinString(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); + Map result = new HashMap<>(); String outputString = null; String delimiter = UtilFormatOut.checkEmpty((String)context.get("delimiter"), "|"); List inputList = UtilGenerics.checkList(context.get("inputList")); @@ -600,8 +600,8 @@ public class ContentServices { } public static Map urlEncodeArgs(DispatchContext dctx, Map context) throws GenericServiceException{ - Map result = new HashMap(); - Map mapFiltered = new HashMap(); + Map result = new HashMap<>(); + Map mapFiltered = new HashMap<>(); Map mapIn = UtilGenerics.checkMap(context.get("mapIn")); if (mapIn != null) { Set> entrySet = mapIn.entrySet(); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java index 73e677a7f2..f7df252eb2 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentServicesComplex.java @@ -79,7 +79,7 @@ public class ContentServicesComplex { } public static Map getAssocAndContentAndDataResourceMethod(Delegator delegator, String contentId, String mapKey, String direction, Timestamp fromDate, Timestamp thruDate, String fromDateStr, String thruDateStr, List assocTypes, List contentTypes) { - List exprList = new LinkedList(); + List exprList = new LinkedList<>(); EntityExpr joinExpr = null; String viewName = null; if (mapKey != null) { @@ -113,7 +113,7 @@ public class ContentServicesComplex { exprList.add(fromExpr); } if (thruDate != null) { - List thruList = new LinkedList(); + List thruList = new LinkedList<>(); EntityExpr thruExpr = EntityCondition.makeCondition("caThruDate", EntityOperator.LESS_THAN, thruDate); thruList.add(thruExpr); @@ -122,7 +122,7 @@ public class ContentServicesComplex { EntityConditionList thruExprList = EntityCondition.makeCondition(thruList, EntityOperator.OR); exprList.add(thruExprList); } else if (fromDate != null) { - List thruList = new LinkedList(); + List thruList = new LinkedList<>(); EntityExpr thruExpr = EntityCondition.makeCondition("caThruDate", EntityOperator.GREATER_THAN, fromDate); thruList.add(thruExpr); @@ -142,7 +142,7 @@ public class ContentServicesComplex { GenericValue a = relatedAssocs.get(i); if (Debug.verboseOn()) Debug.logVerbose(" contentId:" + a.get("contentId") + " To:" + a.get("caContentIdTo") + " fromDate:" + a.get("caFromDate") + " thruDate:" + a.get("caThruDate") + " AssocTypeId:" + a.get("caContentAssocTypeId"), null); } - Map results = new HashMap(); + Map results = new HashMap<>(); results.put("entityList", relatedAssocs); return results; } @@ -162,7 +162,7 @@ public class ContentServicesComplex { if (UtilValidate.isNotEmpty(assocTypesString)) { List lst = StringUtil.split(assocTypesString, "|"); if (assocTypes == null) { - assocTypes = new LinkedList(); + assocTypes = new LinkedList<>(); } assocTypes.addAll(lst); } @@ -171,7 +171,7 @@ public class ContentServicesComplex { if (UtilValidate.isNotEmpty(contentTypesString)) { List lst = StringUtil.split(contentTypesString, "|"); if (contentTypes == null) { - contentTypes = new LinkedList(); + contentTypes = new LinkedList<>(); } contentTypes.addAll(lst); } @@ -210,7 +210,7 @@ public class ContentServicesComplex { } else { viewName = "ContentAssocDataResourceViewTo"; } - List conditionList = new ArrayList(); + List conditionList = new ArrayList<>(); conditionList.add(joinExpr); if (UtilValidate.isNotEmpty(mapKey)) { String mapKeyValue = "is null".equalsIgnoreCase(mapKey) ? null : mapKey; @@ -241,7 +241,7 @@ public class ContentServicesComplex { GenericValue contentAssocDataResourceView = null; GenericValue content = null; GenericValue dataResource = null; - List contentAssocDataResourceList = new LinkedList(); + List contentAssocDataResourceList = new LinkedList<>(); Locale locale = Locale.getDefault(); // TODO: this needs to be passed in try{ for (GenericValue contentAssocView : contentAssocsTypeFiltered) { @@ -259,12 +259,12 @@ public class ContentServicesComplex { contentAssocDataResourceView = delegator.makeValue(viewName); contentAssocDataResourceView.setAllFields(content, true, null, null); } - SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceView, new LinkedList(), locale); + SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssoc, contentAssocDataResourceView, new LinkedList<>(), locale); String dataResourceId = content.getString("dataResourceId"); if (UtilValidate.isNotEmpty(dataResourceId)) dataResource = content.getRelatedOne("DataResource", true); if (dataResource != null) { - SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceView, new LinkedList(), locale); + SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", dataResource, contentAssocDataResourceView, new LinkedList<>(), locale); } contentAssocDataResourceList.add(contentAssocDataResourceView); } @@ -277,7 +277,7 @@ public class ContentServicesComplex { List orderByList = StringUtil.split(orderBy, "|"); contentAssocDataResourceList = EntityUtil.orderBy(contentAssocDataResourceList, orderByList); } - Map results = new HashMap(); + Map results = new HashMap<>(); results.put("entityList", contentAssocDataResourceList); if (UtilValidate.isNotEmpty(contentAssocDataResourceList)) { results.put("view", contentAssocDataResourceList.get(0)); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java index 51e95b2d87..086c519d12 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/ContentWorker.java @@ -200,7 +200,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor ModelService service = dctx.getModelService(serviceName); if (service != null) { //put all requestParameters into templateContext to use them as IN service parameters - Map tempTemplateContext = new HashMap(); + Map tempTemplateContext = new HashMap<>(); tempTemplateContext.putAll(UtilGenerics.checkMap(templateContext.get("requestParameters"))); tempTemplateContext.putAll(templateContext); Map serviceCtx = service.makeValid(tempTemplateContext, ModelService.IN_PARAM); @@ -223,7 +223,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor String contentId = content.getString("contentId"); if (templateContext == null) { - templateContext = new HashMap(); + templateContext = new HashMap<>(); } // create the content facade @@ -480,27 +480,27 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor contentId = (String) content.get("contentId"); contentTypeId = (String) content.get("contentTypeId"); List topicList = content.getRelated("ToContentAssoc", UtilMisc.toMap("contentAssocTypeId", "TOPIC"), null, false); - List topics = new LinkedList(); + List topics = new LinkedList<>(); for (int i = 0; i < topicList.size(); i++) { GenericValue assoc = topicList.get(i); topics.add(assoc.getString("contentId")); } List keywordList = content.getRelated("ToContentAssoc", UtilMisc.toMap("contentAssocTypeId", "KEYWORD"), null, false); - List keywords = new LinkedList(); + List keywords = new LinkedList<>(); for (int i = 0; i < keywordList.size(); i++) { GenericValue assoc = keywordList.get(i); keywords.add(assoc.getString("contentId")); } List purposeValueList = content.getRelated("ContentPurpose", null, null, true); - List purposes = new LinkedList(); + List purposes = new LinkedList<>(); for (int i = 0; i < purposeValueList.size(); i++) { GenericValue purposeValue = purposeValueList.get(i); purposes.add(purposeValue.getString("contentPurposeTypeId")); } - List contentTypeAncestry = new LinkedList(); + List contentTypeAncestry = new LinkedList<>(); getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("content", content); context.put("contentAssocTypeId", contentAssocTypeId); context.put("purposes", purposes); @@ -511,13 +511,13 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor boolean isReturnBefore = checkWhen(context, (String) whenMap.get("returnBeforePickWhen"), false); Map thisNode = null; if (isPick || !isReturnBefore) { - thisNode = new HashMap(); + thisNode = new HashMap<>(); thisNode.put("contentId", contentId); thisNode.put("contentTypeId", contentTypeId); thisNode.put("contentAssocTypeId", contentAssocTypeId); List> kids = UtilGenerics.checkList(masterNode.get("kids")); if (kids == null) { - kids = new LinkedList>(); + kids = new LinkedList<>(); masterNode.put("kids", kids); } kids.add(thisNode); @@ -528,9 +528,9 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } boolean isReturnAfter = checkWhen(context, (String) whenMap.get("returnAfterPickWhen"), false); if (!isReturnAfter) { - List assocTypes = new LinkedList(); + List assocTypes = new LinkedList<>(); List relatedAssocs = getContentAssocsWithId(delegator, contentId, fromDate, thruDate, direction, assocTypes); - Map assocContext = new HashMap(); + Map assocContext = new HashMap<>(); assocContext.put("related", relatedAssocs); for (GenericValue assocValue : relatedAssocs) { contentAssocTypeId = (String) assocValue.get("contentAssocTypeId"); @@ -649,7 +649,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List getPurposes(GenericValue content) { - List purposes = new LinkedList(); + List purposes = new LinkedList<>(); try { List purposeValueList = content.getRelated("ContentPurpose", null, null, true); for (int i = 0; i < purposeValueList.size(); i++) { @@ -663,7 +663,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List getSections(GenericValue content) { - List sections = new LinkedList(); + List sections = new LinkedList<>(); try { List sectionValueList = content.getRelated("FromContentAssoc", null, null, true); for (int i = 0; i < sectionValueList.size(); i++) { @@ -680,7 +680,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List getTopics(GenericValue content) { - List topics = new LinkedList(); + List topics = new LinkedList<>(); try { List topicValueList = content.getRelated("FromContentAssoc", null, null, true); for (int i = 0; i < topicValueList.size(); i++) { @@ -703,7 +703,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor String mapKey = (String) ctx.get("mapKey"); String parentContentId = (String) parentContent.get("contentId"); Map whenMap = UtilGenerics.checkMap(ctx.get("whenMap")); - List> kids = new LinkedList>(); + List> kids = new LinkedList<>(); currentNode.put("kids", kids); String direction = (String) ctx.get("direction"); if (UtilValidate.isEmpty(direction)) { @@ -780,7 +780,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor Debug.logInfo("assocList:" + assocList.size() + " contentId:" + currentContent.getString("contentId"), ""); } - List contentList = new LinkedList(); + List contentList = new LinkedList<>(); String contentIdName = "contentId"; if (linkDir != null && "TO".equalsIgnoreCase(linkDir)) { contentIdName = contentIdName.concat("To"); @@ -807,7 +807,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List getAssociatedContentView(GenericValue currentContent, String linkDir, List assocTypes, List contentTypes, String fromDate, String thruDate) throws GenericEntityException { - List exprListAnd = new LinkedList(); + List exprListAnd = new LinkedList<>(); String origContentId = (String) currentContent.get("contentId"); String contentIdName = "contentId"; @@ -857,7 +857,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List getContentAssocsWithId(Delegator delegator, String contentId, Timestamp fromDate, Timestamp thruDate, String direction, List assocTypes) throws GenericEntityException { - List exprList = new LinkedList(); + List exprList = new LinkedList<>(); EntityExpr joinExpr = null; if (direction != null && "From".equalsIgnoreCase(direction)) { joinExpr = EntityCondition.makeCondition("contentIdTo", EntityOperator.EQUALS, contentId); @@ -873,7 +873,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor exprList.add(fromExpr); } if (thruDate != null) { - List thruList = new LinkedList(); + List thruList = new LinkedList<>(); EntityExpr thruExpr = EntityCondition.makeCondition("thruDate", EntityOperator.LESS_THAN, thruDate); thruList.add(thruExpr); @@ -882,7 +882,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor EntityConditionList thruExprList = EntityCondition.makeCondition(thruList, EntityOperator.OR); exprList.add(thruExprList); } else if (fromDate != null) { - List thruList = new LinkedList(); + List thruList = new LinkedList<>(); EntityExpr thruExpr = EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN, fromDate); thruList.add(thruExpr); @@ -978,8 +978,8 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List> getContentAncestryNodeTrail(Delegator delegator, String contentId, String contentAssocTypeId, String direction) throws GenericEntityException { - List contentAncestorList = new LinkedList(); - List> nodeTrail = new LinkedList>(); + List contentAncestorList = new LinkedList<>(); + List> nodeTrail = new LinkedList<>(); getContentAncestry(delegator, contentId, contentAssocTypeId, direction, contentAncestorList); for (GenericValue value : contentAncestorList) { Map thisNode = ContentWorker.makeNode(value); @@ -989,7 +989,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static String getContentAncestryNodeTrailCsv(Delegator delegator, String contentId, String contentAssocTypeId, String direction) throws GenericEntityException { - List contentAncestorList = new LinkedList(); + List contentAncestorList = new LinkedList<>(); getContentAncestry(delegator, contentId, contentAssocTypeId, direction, contentAncestorList); String csv = StringUtil.join(contentAncestorList, ","); return csv; @@ -1041,13 +1041,13 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static Map callContentPermissionCheckResult(Delegator delegator, LocalDispatcher dispatcher, Map context) { - Map permResults = new HashMap(); + Map permResults = new HashMap<>(); String skipPermissionCheck = (String) context.get("skipPermissionCheck"); if (UtilValidate.isEmpty(skipPermissionCheck) || (!"true".equalsIgnoreCase(skipPermissionCheck) && !"granted".equalsIgnoreCase(skipPermissionCheck))) { GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map serviceInMap = new HashMap(); + Map serviceInMap = new HashMap<>(); serviceInMap.put("userLogin", userLogin); serviceInMap.put("targetOperationList", context.get("targetOperationList")); serviceInMap.put("contentPurposeList", context.get("contentPurposeList")); @@ -1151,7 +1151,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor if (UtilValidate.isNotEmpty(trail)) { passedGlobalNodeTrail = UtilGenerics.checkList(UtilMisc.makeListWritable(trail)); } else { - passedGlobalNodeTrail = new LinkedList>(); + passedGlobalNodeTrail = new LinkedList<>(); } int sz = passedGlobalNodeTrail.size(); if (sz > 0) { @@ -1209,7 +1209,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static Map buildPickContext(Delegator delegator, String contentAssocTypeId, String assocContentId, String direction, GenericValue thisContent) throws GenericEntityException { - Map ctx = new HashMap(); + Map ctx = new HashMap<>(); ctx.put("contentAssocTypeId", contentAssocTypeId); ctx.put("contentId", assocContentId); // This needs to be the opposite @@ -1223,7 +1223,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor ctx.put("content", thisContent); List purposes = getPurposes(thisContent); ctx.put("purposes", purposes); - List contentTypeAncestry = new LinkedList(); + List contentTypeAncestry = new LinkedList<>(); String contentTypeId = thisContent.getString("contentTypeId"); getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); ctx.put("typeAncestry", contentTypeAncestry); @@ -1235,7 +1235,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static void checkConditions(Delegator delegator, Map trailNode, Map contentAssoc, Map whenMap) { - Map context = new HashMap(); + Map context = new HashMap<>(); GenericValue content = (GenericValue)trailNode.get("value"); if (content != null) { context.put("content", content); @@ -1246,7 +1246,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor List topics = getTopics(content); context.put("topics", topics); String contentTypeId = (String)content.get("contentTypeId"); - List contentTypeAncestry = new LinkedList(); + List contentTypeAncestry = new LinkedList<>(); try { getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); } catch (GenericEntityException e) { @@ -1257,7 +1257,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor contentAssoc = delegator.makeValue("ContentAssoc"); try { // TODO: locale needs to be gotten correctly - SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocIn", content, contentAssoc, new LinkedList(), Locale.getDefault()); + SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocIn", content, contentAssoc, new LinkedList<>(), Locale.getDefault()); context.put("contentAssocTypeId", contentAssoc.get("contentAssocTypeId")); context.put("contentAssocPredicateId", contentAssoc.get("contentAssocPredicateId")); context.put("mapKey", contentAssoc.get("mapKey")); @@ -1298,12 +1298,12 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor if (UtilValidate.isNotEmpty(targetOperationString)) { List opsFromString = StringUtil.split(targetOperationString, "|"); if (UtilValidate.isEmpty(targetOperationList)) { - targetOperationList = new LinkedList(); + targetOperationList = new LinkedList<>(); } targetOperationList.addAll(opsFromString); } if (UtilValidate.isEmpty(targetOperationList)) { - targetOperationList = new LinkedList(); + targetOperationList = new LinkedList<>(); if (UtilValidate.isEmpty(md)) { md ="_CREATE"; } @@ -1330,12 +1330,12 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor if (UtilValidate.isNotEmpty(contentPurposeString)) { List purposesFromString = StringUtil.split(contentPurposeString, "|"); if (UtilValidate.isEmpty(contentPurposeList)) { - contentPurposeList = new LinkedList(); + contentPurposeList = new LinkedList<>(); } contentPurposeList.addAll(purposesFromString); } if (UtilValidate.isEmpty(contentPurposeList)) { - contentPurposeList = new LinkedList(); + contentPurposeList = new LinkedList<>(); } if (Debug.infoOn()) { Debug.logInfo("in prepContentPurposeList, contentPurposeList(0):" + contentPurposeList, ""); @@ -1357,7 +1357,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List getContentAssocViewList(Delegator delegator, String contentIdTo, String contentId, String contentAssocTypeId, String statusId, String privilegeEnumId) throws GenericEntityException { - List exprListAnd = new LinkedList(); + List exprListAnd = new LinkedList<>(); if (UtilValidate.isNotEmpty(contentIdTo)) { EntityExpr expr = EntityCondition.makeCondition("caContentIdTo", EntityOperator.EQUALS, contentIdTo); @@ -1406,7 +1406,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor return thisNode; } - thisNode = new HashMap(); + thisNode = new HashMap<>(); thisNode.put("value", thisContent); String contentId = (String)thisContent.get("contentId"); thisNode.put("contentId", contentId); @@ -1442,7 +1442,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List> csvToList(String csv, Delegator delegator) { - List> outList = new LinkedList>(); + List> outList = new LinkedList<>(); List contentIdList = StringUtil.split(csv, ","); GenericValue content = null; String contentName = null; @@ -1451,7 +1451,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); - return new LinkedList>(); + return new LinkedList<>(); } contentName = (String)content.get("contentName"); outList.add(UtilMisc.toList(contentId, contentName)); @@ -1460,7 +1460,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List csvToContentList(String csv, Delegator delegator) { - List trail = new LinkedList(); + List trail = new LinkedList<>(); if (csv == null) { return trail; } @@ -1471,7 +1471,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor content = EntityQuery.use(delegator).from("Content").where("contentId", contentId).cache().queryOne(); } catch (GenericEntityException e) { Debug.logError(e.getMessage(), module); - return new LinkedList(); + return new LinkedList<>(); } trail.add(content); } @@ -1479,7 +1479,7 @@ public class ContentWorker implements org.apache.ofbiz.widget.content.ContentWor } public static List> csvToTrail(String csv, Delegator delegator) { - List> trail = new LinkedList>(); + List> trail = new LinkedList<>(); if (csv == null) { return trail; } diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java index f3b8eb767b..c0ba82e7e7 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/PermissionRecorder.java @@ -39,7 +39,7 @@ public class PermissionRecorder { protected boolean isOn = false; protected GenericValue userLogin; - protected List> permCheckResults = new LinkedList>(); + protected List> permCheckResults = new LinkedList<>(); protected boolean entityPermCheckResult = false; protected String currentContentId = ""; protected Map currentContentMap; @@ -124,7 +124,7 @@ public class PermissionRecorder { public void setCurrentContentId(String id) { if (!currentContentId.equals(id)) { - currentContentMap = new HashMap(); + currentContentMap = new HashMap<>(); permCheckResults.add(currentContentMap); currentContentMap.put("contentId", id); currentContentMap.put("checkResults", new LinkedList<>()); @@ -155,7 +155,7 @@ public class PermissionRecorder { } public void startMatchGroup(List targetOperations, List purposes, List roles, List targStatusList, String targPrivilegeEnumId, String contentId) { - currentContentMap = new HashMap(); + currentContentMap = new HashMap<>(); permCheckResults.add(currentContentMap); String s = null; if (targetOperations != null) { @@ -174,7 +174,7 @@ public class PermissionRecorder { s = targStatusList.toString(); currentContentMap.put("statusId", s); } - List> checkResultList = new LinkedList>(); + List> checkResultList = new LinkedList<>(); currentContentMap.put("privilegeEnumId", privilegeEnumId); currentContentMap.put("contentId", contentId); currentContentMap.put("checkResultList", checkResultList); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java b/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java index 25d1107506..6ce7f0e603 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/content/UploadContentAndImage.java @@ -93,7 +93,7 @@ public class UploadContentAndImage { return "error"; } - Map passedParams = new HashMap(); + Map passedParams = new HashMap<>(); FileItem fi = null; FileItem imageFi = null; byte[] imageBytes = {}; @@ -121,7 +121,7 @@ public class UploadContentAndImage { passedParams.put("targetOperationList", targetOperationList); // Create or update FTL template - Map ftlContext = new HashMap(); + Map ftlContext = new HashMap<>(); ftlContext.put("userLogin", userLogin); ftlContext.put("contentId", passedParams.get("ftlContentId")); ftlContext.put("ownerContentId", passedParams.get("ownerContentId")); @@ -152,7 +152,7 @@ public class UploadContentAndImage { } String ftlContentId = (String)ftlResults.get("contentId"); if (UtilValidate.isNotEmpty(contentIdTo)) { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("fromDate", UtilDateTime.nowTimestamp()); map.put("contentId", ftlContentId); map.put("contentIdTo", contentIdTo); @@ -195,7 +195,7 @@ public class UploadContentAndImage { if (Debug.infoOn()) Debug.logInfo("[UploadContentAndImage]ftlContentId:" + ftlContentId, module); // Create or update summary text subContent if (passedParams.containsKey("summaryData")) { - Map sumContext = new HashMap(); + Map sumContext = new HashMap<>(); sumContext.put("userLogin", userLogin); sumContext.put("contentId", passedParams.get("sumContentId")); sumContext.put("ownerContentId", ftlContentId); @@ -225,7 +225,7 @@ public class UploadContentAndImage { // Create or update electronic text subContent if (passedParams.containsKey("textData")) { - Map txtContext = new HashMap(); + Map txtContext = new HashMap<>(); txtContext.put("userLogin", userLogin); txtContext.put("contentId", passedParams.get("txtContentId")); txtContext.put("ownerContentId", ftlContentId); @@ -254,7 +254,7 @@ public class UploadContentAndImage { } // Create or update image subContent - Map imgContext = new HashMap(); + Map imgContext = new HashMap<>(); if (imageBytes.length > 0) { imgContext.put("userLogin", userLogin); imgContext.put("contentId", passedParams.get("imgContentId")); @@ -352,7 +352,7 @@ public class UploadContentAndImage { return "error"; } - Map passedParams = new HashMap(); + Map passedParams = new HashMap<>(); FileItem fi = null; FileItem imageFi = null; byte[] imageBytes; @@ -422,7 +422,7 @@ public class UploadContentAndImage { Delegator delegator = (Delegator)request.getAttribute("delegator"); HttpSession session = request.getSession(); GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); - Map ftlContext = new HashMap(); + Map ftlContext = new HashMap<>(); String contentPurposeString = (String)passedParams.get("contentPurposeString" + suffix); if (UtilValidate.isEmpty(contentPurposeString)) { @@ -451,7 +451,7 @@ public class UploadContentAndImage { request.setAttribute("_ERROR_MESSAGE_", msg); List errorMsgList = UtilGenerics.checkList(request.getAttribute("_EVENT_MESSAGE_LIST_")); if (errorMsgList == null) { - errorMsgList = new LinkedList(); + errorMsgList = new LinkedList<>(); request.setAttribute("errorMessageList", errorMsgList); } errorMsgList.add(msg); @@ -463,8 +463,8 @@ public class UploadContentAndImage { ModelEntity modelEntity = delegator.getModelEntity("ContentAssocDataResourceViewFrom"); List fieldNames = modelEntity.getAllFieldNames(); - Map ftlContext2 = new HashMap(); - Map ftlContext3 = new HashMap(); + Map ftlContext2 = new HashMap<>(); + Map ftlContext3 = new HashMap<>(); for (String keyName : fieldNames) { Object obj = passedParams.get(keyName + suffix); ftlContext2.put(keyName, obj); @@ -472,17 +472,17 @@ public class UploadContentAndImage { if (Debug.infoOn()) { Debug.logInfo("[UploadContentStuff]ftlContext2:" + ftlContext2, module); } - List errorMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); Locale loc = Locale.getDefault(); try { SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentIn", ftlContext2, ftlContext3, errorMessages, loc); SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentOut", ftlContext3, ftlContext, errorMessages, loc); - ftlContext3 = new HashMap(); + ftlContext3 = new HashMap<>(); SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceIn", ftlContext2, ftlContext3, errorMessages, loc); SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "dataResourceOut", ftlContext3, ftlContext, errorMessages, loc); - ftlContext3 = new HashMap(); + ftlContext3 = new HashMap<>(); SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocIn", ftlContext2, ftlContext3, errorMessages, loc); SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", ftlContext3, ftlContext, errorMessages, loc); } catch (MiniLangException e) { @@ -509,7 +509,7 @@ public class UploadContentAndImage { Debug.logInfo("[UploadContentStuff]msg:" + msg, module); } if (errorMsgList == null) { - errorMsgList = new LinkedList(); + errorMsgList = new LinkedList<>(); request.setAttribute("errorMessageList", errorMsgList); } errorMsgList.add(msg); @@ -520,7 +520,7 @@ public class UploadContentAndImage { request.setAttribute("_ERROR_MESSAGE_", msg); List errorMsgList = UtilGenerics.checkList(request.getAttribute("_EVENT_MESSAGE_LIST_")); if (errorMsgList == null) { - errorMsgList = new LinkedList(); + errorMsgList = new LinkedList<>(); request.setAttribute("errorMessageList", errorMsgList); } errorMsgList.add(msg); @@ -540,7 +540,7 @@ public class UploadContentAndImage { String caContentIdTo = (String)passedParams.get("caContentIdTo"); if (UtilValidate.isNotEmpty(caContentIdTo)) { - Map resequenceContext = new HashMap(); + Map resequenceContext = new HashMap<>(); resequenceContext.put("contentIdTo", caContentIdTo); resequenceContext.put("userLogin", userLogin); try { @@ -562,7 +562,7 @@ public class UploadContentAndImage { Debug.logInfo("[UploadContentStuff]msg:" + msg, module); } if (errorMsgList == null) { - errorMsgList = new LinkedList(); + errorMsgList = new LinkedList<>(); request.setAttribute("errorMessageList", errorMsgList); } errorMsgList.add(msg); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java index 3507bf0d97..a7468e59ad 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutEvents.java @@ -67,7 +67,7 @@ public class LayoutEvents { HttpSession session = request.getSession(); Map uploadResults = LayoutWorker.uploadImageAndParameters(request, "imageData"); Map formInput = UtilGenerics.checkMap(uploadResults.get("formInput")); - Map context = new HashMap(); + Map context = new HashMap<>(); ByteBuffer byteWrap = (ByteBuffer) uploadResults.get("imageData"); if (byteWrap == null) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.image_data_null", locale); @@ -83,7 +83,7 @@ public class LayoutEvents { } } String mimeTypeId = "image/" + imageFileNameExt; - List errorMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); if (locale == null) { locale = Locale.getDefault(); } @@ -121,7 +121,7 @@ public class LayoutEvents { String dataResourceId = (String) result.get("dataResourceId"); String activeContentId = (String) result.get("contentId"); if (UtilValidate.isNotEmpty(activeContentId)) { - Map context2 = new HashMap(); + Map context2 = new HashMap<>(); context2.put("activeContentId", activeContentId); context2.put("contentAssocTypeId", result.get("contentAssocTypeId")); context2.put("fromDate", result.get("fromDate")); @@ -132,7 +132,7 @@ public class LayoutEvents { context2.put("contentIdTo", formInput.get("contentIdTo")); context2.put("mapKey", formInput.get("mapKey")); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); serviceResult = dispatcher.runSync("deactivateAssocs", context2); if (ServiceUtil.isError(serviceResult)) { String errorMessage = ServiceUtil.getErrorMessage(serviceResult); @@ -230,7 +230,7 @@ public class LayoutEvents { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); Locale locale = UtilHttp.getLocale(request); - Map context = new HashMap(); + Map context = new HashMap<>(); Map paramMap = UtilHttp.getParameterMap(request); if (Debug.verboseOn()) Debug.logVerbose("in replaceSubContent, paramMap:" + paramMap, module); String dataResourceId = (String) paramMap.get("dataResourceId"); @@ -266,7 +266,7 @@ public class LayoutEvents { return "error"; } request.setAttribute("contentId", contentIdTo); - Map context2 = new HashMap(); + Map context2 = new HashMap<>(); context2.put("activeContentId", contentId); context2.put("contentAssocTypeId", "SUB_CONTENT"); context2.put("fromDate", result.get("fromDate")); @@ -276,7 +276,7 @@ public class LayoutEvents { context2.put("contentIdTo", contentIdTo); context2.put("mapKey", mapKey); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); serviceResult = dispatcher.runSync("deactivateAssocs", context2); if (ServiceUtil.isError(serviceResult)) { String errorMessage = ServiceUtil.getErrorMessage(serviceResult); @@ -362,7 +362,7 @@ public class LayoutEvents { request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; } - Map serviceIn = new HashMap(); + Map serviceIn = new HashMap<>(); Map results = null; serviceIn.put("fromDate", UtilDateTime.nowTimestamp()); serviceIn.put("contentId", contentId); @@ -388,14 +388,14 @@ public class LayoutEvents { return "error"; } - serviceIn = new HashMap(); + serviceIn = new HashMap<>(); serviceIn.put("userLogin", session.getAttribute("userLogin")); // Can't count on records being unique - Map beenThere = new HashMap(); + Map beenThere = new HashMap<>(); for (int i=0; i errorMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); if (locale == null) { locale = Locale.getDefault(); } @@ -455,7 +455,7 @@ public class LayoutEvents { Debug.logVerbose("in createSubContent, contentIdTo:" + contentIdTo, module); Debug.logVerbose("in createSubContent, mapKey:" + mapKey, module); } - Map context = new HashMap(); + Map context = new HashMap<>(); List errorMessages = new LinkedList<>(); Locale loc = (Locale) request.getSession().getServletContext().getAttribute("locale"); if (loc == null) { @@ -503,14 +503,14 @@ public class LayoutEvents { request.setAttribute("contentId", contentId); request.setAttribute("drDataResourceId", dataResourceId); request.setAttribute("currentEntityName", "SubContentDataResourceId"); - Map context2 = new HashMap(); + Map context2 = new HashMap<>(); context2.put("activeContentId", contentId); context2.put("contentAssocTypeId", "SUB_CONTENT"); context2.put("fromDate", result.get("fromDate")); context2.put("contentIdTo", contentIdTo); context2.put("mapKey", mapKey); context2.put("userLogin", userLogin); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); serviceResult = dispatcher.runSync("deactivateAssocs", context2); if (ServiceUtil.isError(serviceResult)) { String errorMessage = ServiceUtil.getErrorMessage(serviceResult); @@ -530,7 +530,7 @@ public class LayoutEvents { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); Map paramMap = UtilHttp.getParameterMap(request); - Map context = new HashMap(); + Map context = new HashMap<>(); List errorMessages = new LinkedList<>(); Locale loc = (Locale) request.getSession().getServletContext().getAttribute("locale"); if (loc == null) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java index c450d1ced6..ca53d91c47 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/layout/LayoutWorker.java @@ -55,8 +55,8 @@ public final class LayoutWorker { public static Map uploadImageAndParameters(HttpServletRequest request, String uploadField) { Locale locale = UtilHttp.getLocale(request); - Map results = new HashMap(); - Map formInput = new HashMap(); + Map results = new HashMap<>(); + Map formInput = new HashMap<>(); results.put("formInput", formInput); ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, new File(new File("runtime"), "tmp"))); List lst = null; diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java index 9df9b55a05..bb903d5548 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentAsText.java @@ -62,7 +62,7 @@ public class RenderSubContentAsText implements TemplateTransformModel { Debug.logInfo("in RenderSubContent, contentId(0):" + templateRoot.get("contentId"), module); } FreeMarkerWorker.getSiteParameters(request, templateRoot); - final Map savedValuesUp = new HashMap(); + final Map savedValuesUp = new HashMap<>(); FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp); FreeMarkerWorker.overrideWithArgs(templateRoot, args); if (Debug.infoOn()) { @@ -79,7 +79,7 @@ public class RenderSubContentAsText implements TemplateTransformModel { Debug.logInfo("in Render(0), directAssocMode ." + directAssocMode , module); } - final Map savedValues = new HashMap(); + final Map savedValues = new HashMap<>(); return new Writer(out) { diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java index fad9aad1d8..2bb4d427c7 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentCacheTransform.java @@ -64,7 +64,7 @@ public class RenderSubContentCacheTransform implements TemplateTransformModel { final HttpServletResponse response = FreeMarkerWorker.getWrappedObject("response", env); final Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env); FreeMarkerWorker.getSiteParameters(request, templateRoot); - final Map savedValuesUp = new HashMap(); + final Map savedValuesUp = new HashMap<>(); FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp); FreeMarkerWorker.overrideWithArgs(templateRoot, args); final GenericValue userLogin = FreeMarkerWorker.getWrappedObject("userLogin", env); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java index 48c7a60edb..b475db8d42 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/RenderSubContentTransform.java @@ -77,7 +77,7 @@ public class RenderSubContentTransform implements TemplateTransformModel { final Environment env = Environment.getCurrentEnvironment(); Map ctx = FreeMarkerWorker.getWrappedObject("context", env); if (ctx == null) { - ctx = new HashMap(); + ctx = new HashMap<>(); } final String mapKey = FreeMarkerWorker.getArg(args, "mapKey", ctx); final String subContentId = FreeMarkerWorker.getArg(args, "subContentId", ctx); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java index d0687540f0..9e80a40834 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentCacheTransform.java @@ -83,9 +83,9 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel final StringBuilder buf = new StringBuilder(); final Environment env = Environment.getCurrentEnvironment(); final Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env); - final Map savedValuesUp = new HashMap(); + final Map savedValuesUp = new HashMap<>(); FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp); - final Map savedValues = new HashMap(); + final Map savedValues = new HashMap<>(); FreeMarkerWorker.overrideWithArgs(templateRoot, args); String startContentAssocTypeId = (String)templateRoot.get("contentAssocTypeId"); final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env); @@ -105,9 +105,9 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel throw new RuntimeException("Error getting current content. " + e.toString()); } - final Map traverseContext = new HashMap(); + final Map traverseContext = new HashMap<>(); traverseContext.put("delegator", delegator); - Map whenMap = new HashMap(); + Map whenMap = new HashMap<>(); whenMap.put("followWhen", templateRoot.get("followWhen")); whenMap.put("pickWhen", templateRoot.get("pickWhen")); whenMap.put("returnBeforePickWhen", templateRoot.get("returnBeforePickWhen")); @@ -152,7 +152,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel List> globalNodeTrail = UtilGenerics.checkList(templateRoot.get("globalNodeTrail")); if (globalNodeTrail.size() > 0) { int sz = globalNodeTrail.size() ; - nodeTrail = new LinkedList>(); + nodeTrail = new LinkedList<>(); node = UtilGenerics.checkMap(globalNodeTrail.get(sz - 1)); Boolean checkedObj = (Boolean)node.get("checked"); Map whenMap = UtilGenerics.checkMap(templateRoot.get("whenMap")); @@ -229,7 +229,7 @@ public class TraverseSubContentCacheTransform implements TemplateTransformModel Map ndStart = nodeTrail.get(0); contentIdStart = (String)ndStart.get("contentId"); } else { - globalNodeTrail = new LinkedList>(); + globalNodeTrail = new LinkedList<>(); contentIdStart = ""; } boolean bIdEnd = UtilValidate.isNotEmpty(contentIdEnd); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java index 4f858e1973..e7d978bfcf 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/TraverseSubContentTransform.java @@ -111,9 +111,9 @@ public class TraverseSubContentTransform implements TemplateTransformModel { } final GenericValue subContentDataResourceView = view; - final Map traverseContext = new HashMap(); + final Map traverseContext = new HashMap<>(); traverseContext.put("delegator", delegator); - Map whenMap = new HashMap(); + Map whenMap = new HashMap<>(); whenMap.put("followWhen", templateCtx.get("followWhen")); whenMap.put("pickWhen", templateCtx.get("pickWhen")); whenMap.put("returnBeforePickWhen", templateCtx.get("returnBeforePickWhen")); @@ -155,7 +155,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel { @Override public int onStart() throws TemplateModelException, IOException { - List> nodeTrail = new LinkedList>(); + List> nodeTrail = new LinkedList<>(); traverseContext.put("nodeTrail", nodeTrail); Map rootNode = ContentWorker.makeNode(subContentDataResourceView); ContentWorker.traceNodeTrail("1", nodeTrail); @@ -225,7 +225,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel { private boolean checkWhen (GenericValue thisContent, String contentAssocTypeId) { boolean isPick = false; - Map assocContext = new HashMap(); + Map assocContext = new HashMap<>(); if (UtilValidate.isEmpty(contentAssocTypeId)) { contentAssocTypeId = ""; } @@ -240,7 +240,7 @@ public class TraverseSubContentTransform implements TemplateTransformModel { assocContext.put("content", thisContent); List purposes = ContentWorker.getPurposes(thisContent); assocContext.put("purposes", purposes); - List contentTypeAncestry = new LinkedList(); + List contentTypeAncestry = new LinkedList<>(); String contentTypeId = (String)thisContent.get("contentTypeId"); try { ContentWorker.getContentTypeAncestry(delegator, contentTypeId, contentTypeAncestry); diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java index c87dc6dc62..824052642c 100644 --- a/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java +++ b/applications/content/src/main/java/org/apache/ofbiz/content/webapp/ftl/WrapSubContentCacheTransform.java @@ -93,7 +93,7 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel { final Delegator delegator = FreeMarkerWorker.getWrappedObject("delegator", env); final HttpServletRequest request = FreeMarkerWorker.getWrappedObject("request", env); FreeMarkerWorker.getSiteParameters(request, templateCtx); - final Map savedValuesUp = new HashMap(); + final Map savedValuesUp = new HashMap<>(); FreeMarkerWorker.saveContextValues(templateCtx, upSaveKeyNames, savedValuesUp); FreeMarkerWorker.overrideWithArgs(templateCtx, args); final String wrapTemplateId = (String)templateCtx.get("wrapTemplateId"); @@ -129,7 +129,7 @@ public class WrapSubContentCacheTransform implements TemplateTransformModel { // the parent context. But it will already have one and it is the same context that is // being passed. } - final Map savedValues = new HashMap(); + final Map savedValues = new HashMap<>(); FreeMarkerWorker.saveContextValues(templateCtx, saveKeyNames, savedValues); // This order is taken so that the mimeType can be overridden in the transform arguments. String mimeTypeId = ContentWorker.getMimeTypeId(delegator, view, templateCtx); diff --git a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java index a2e745119d..b128787f55 100644 --- a/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java +++ b/applications/humanres/src/main/java/org/apache/ofbiz/humanres/HumanResEvents.java @@ -49,7 +49,7 @@ public class HumanResEvents { String hrefString = request.getParameter("hrefString"); String hrefString2 = request.getParameter("hrefString2"); - Map paramMap = new HashMap(); + Map paramMap = new HashMap<>(); paramMap.put("delegator", delegator); paramMap.put("partyId", partyId); paramMap.put("onclickFunction", onclickFunction); @@ -57,7 +57,7 @@ public class HumanResEvents { paramMap.put("hrefString", hrefString); paramMap.put("hrefString2", hrefString2); - List> categoryList = new ArrayList>(); + List> categoryList = new ArrayList<>(); //check employee position try { @@ -126,10 +126,10 @@ public class HumanResEvents { title = memGroupCtx.getString("groupName"); } - Map josonMap = new HashMap(); - Map dataMap = new HashMap(); - Map dataAttrMap = new HashMap(); - Map attrMap = new HashMap(); + Map josonMap = new HashMap<>(); + Map dataMap = new HashMap<>(); + Map dataAttrMap = new HashMap<>(); + Map attrMap = new HashMap<>(); dataAttrMap.put("onClick", onclickFunction + "('" + memberId + additionParam + "')"); @@ -169,7 +169,7 @@ public class HumanResEvents { String hrefString2 = (String) params.get("hrefString2"); Map partyGroup = UtilGenerics.checkMap(params.get("partyGroup")); - List> resultList = new ArrayList>(); + List> resultList = new ArrayList<>(); List childOfComs = null; try { @@ -184,10 +184,10 @@ public class HumanResEvents { String catNameField = null; String title = null; - Map josonMap = new HashMap(); - Map dataMap = new HashMap(); - Map dataAttrMap = new HashMap(); - Map attrMap = new HashMap(); + Map josonMap = new HashMap<>(); + Map dataMap = new HashMap<>(); + Map dataAttrMap = new HashMap<>(); + Map attrMap = new HashMap<>(); catId = childOfCom.get("partyIdTo"); @@ -259,7 +259,7 @@ public class HumanResEvents { Delegator delegator = (Delegator) params.get("delegator"); String partyId = (String) params.get("partyId"); - List> resultList = new ArrayList>(); + List> resultList = new ArrayList<>(); try { isEmpls = EntityQuery.use(delegator).from("EmplPosition") @@ -270,10 +270,10 @@ public class HumanResEvents { if (UtilValidate.isNotEmpty(isEmpls)) { for (GenericValue childOfEmpl : isEmpls ) { - Map emplMap = new HashMap(); - Map emplAttrMap = new HashMap(); - Map empldataMap = new HashMap(); - Map emplDataAttrMap = new HashMap(); + Map emplMap = new HashMap<>(); + Map emplAttrMap = new HashMap<>(); + Map empldataMap = new HashMap<>(); + Map emplDataAttrMap = new HashMap<>(); String emplId = (String) childOfEmpl.get("emplPositionId"); String typeId = (String) childOfEmpl.get("emplPositionTypeId"); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java index 06ab069e85..1aef81dc17 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMNode.java @@ -73,8 +73,8 @@ public class BOMNode { this.delegator = product.getDelegator(); this.dispatcher = dispatcher; this.userLogin = userLogin; - children = new LinkedList(); - childrenNodes = new LinkedList(); + children = new LinkedList<>(); + childrenNodes = new LinkedList<>(); parentNode = null; productForRules = null; bomTypeId = null; @@ -110,9 +110,9 @@ public class BOMNode { .orderBy("sequenceNum") .filterByDate(inDate).queryList(); } - children = new LinkedList(); + children = new LinkedList<>(); children.addAll(rows); - childrenNodes = new LinkedList(); + childrenNodes = new LinkedList<>(); BOMNode oneChildNode = null; for (GenericValue oneChild : children) { // Configurator @@ -271,7 +271,7 @@ public class BOMNode { // ----------------------------------------------------------- // We try to apply directly the selected features if (newNode.equals(oneChildNode)) { - Map selectedFeatures = new HashMap(); + Map selectedFeatures = new HashMap<>(); if (productFeatures != null) { GenericValue feature = null; for (int j = 0; j < productFeatures.size(); j++) { @@ -281,7 +281,7 @@ public class BOMNode { } if (selectedFeatures.size() > 0) { - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("productId", node.get("productIdTo")); context.put("selectedFeatures", selectedFeatures); Map storeResult = null; @@ -341,9 +341,9 @@ public class BOMNode { .orderBy("sequenceNum") .filterByDate(inDate).queryList(); } - children = new LinkedList(); + children = new LinkedList<>(); children.addAll(rows); - childrenNodes = new LinkedList(); + childrenNodes = new LinkedList<>(); BOMNode oneChildNode = null; for (GenericValue oneChild : children) { @@ -510,7 +510,7 @@ public class BOMNode { Timestamp endDate = null; if (isManufactured(ignoreSupplierProducts)) { BOMNode oneChildNode = null; - List childProductionRuns = new LinkedList(); + List childProductionRuns = new LinkedList<>(); Timestamp maxEndDate = null; for (int i = 0; i < childrenNodes.size(); i++) { oneChildNode = childrenNodes.get(i); @@ -532,7 +532,7 @@ public class BOMNode { } Timestamp startDate = UtilDateTime.toTimestamp(UtilDateTime.toDateTimeString(date)); - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); if (!useSubstitute) { serviceContext.put("productId", getProduct().getString("productId")); serviceContext.put("facilityId", getProduct().getString("facilityId")); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java index 7290ba24fc..1ec08aee39 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMServices.java @@ -62,7 +62,7 @@ public class BOMServices { * @return returns the product's low level code (llc) i.e. the maximum depth */ public static Map getMaxDepth(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); String productId = (String) context.get("productId"); String fromDateStr = (String) context.get("fromDate"); @@ -79,7 +79,7 @@ public class BOMServices { if (fromDate == null) { fromDate = new Date(); } - List bomTypes = new LinkedList(); + List bomTypes = new LinkedList<>(); if (bomType == null) { try { List bomTypesValues = EntityQuery.use(delegator).from("ProductAssocType") @@ -120,7 +120,7 @@ public class BOMServices { * @return the results of the updates the product's low level code */ public static Map updateLowLevelCode(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String productId = (String) context.get("productIdTo"); @@ -173,7 +173,7 @@ public class BOMServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(treeResult)); } BOMTree tree = (BOMTree)treeResult.get("tree"); - List products = new LinkedList(); + List products = new LinkedList<>(); tree.print(products, llc.intValue()); for (int i = 0; i < products.size(); i++) { BOMNode oneNode = products.get(i); @@ -215,7 +215,7 @@ public class BOMServices { * @return the results of the updates the product's low level code */ public static Map initLowLevelCode(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -223,7 +223,7 @@ public class BOMServices { try { List products = EntityQuery.use(delegator).from("Product").orderBy("isVirtual DESC").queryList(); Long zero = 0L; - List allProducts = new LinkedList(); + List allProducts = new LinkedList<>(); for (GenericValue product : products) { product.set("billOfMaterialLevel", zero); allProducts.add(product); @@ -260,7 +260,7 @@ public class BOMServices { * @return returns the ProductAssoc generic value for a duplicate productIdKey ancestor if present */ public static Map searchDuplicatedAncestor(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -293,7 +293,7 @@ public class BOMServices { * @return return the bill of material tree */ public static Map getBOMTree(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -344,7 +344,7 @@ public class BOMServices { * @return return the list of manufacturing components */ public static Map getManufacturingComponents(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -380,7 +380,7 @@ public class BOMServices { // Components // BOMTree tree = null; - List components = new LinkedList(); + List components = new LinkedList<>(); try { tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_SINGLE_LEVEL, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); @@ -422,9 +422,9 @@ public class BOMServices { result.put("components", components); // also return a componentMap (useful in scripts and simple language code) - List> componentsMap = new LinkedList>(); + List> componentsMap = new LinkedList<>(); for (BOMNode node : components) { - Map componentMap = new HashMap(); + Map componentMap = new HashMap<>(); componentMap.put("product", node.getProduct()); componentMap.put("quantity", node.getQuantity()); componentsMap.add(componentMap); @@ -434,7 +434,7 @@ public class BOMServices { } public static Map getNotAssembledComponents(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); String productId = (String) context.get("productId"); @@ -463,8 +463,8 @@ public class BOMServices { } BOMTree tree = null; - List components = new LinkedList(); - List notAssembledComponents = new LinkedList(); + List components = new LinkedList<>(); + List notAssembledComponents = new LinkedList<>(); try { tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); @@ -486,7 +486,7 @@ public class BOMServices { // Service for the Product (Shipment) component // public static Map createShipmentPackages(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -508,8 +508,8 @@ public class BOMServices { } catch (GenericEntityException gee) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingBomErrorLoadingShipmentItems", locale)); } - Map orderReadHelpers = new HashMap(); - Map partyOrderShipments = new HashMap(); + Map orderReadHelpers = new HashMap<>(); + Map partyOrderShipments = new HashMap<>(); for (GenericValue shipmentItem : shipmentItems) { // Get the OrderShipments GenericValue orderShipment = null; @@ -530,7 +530,7 @@ public class BOMServices { String partyId = (orderReadHelper.getPlacingParty() != null? orderReadHelper.getPlacingParty().getString("partyId"): null); // FIXME: is it the customer? if (partyId != null) { if (!partyOrderShipments.containsKey(partyId)) { - List> orderShipmentReadMapList = new LinkedList>(); + List> orderShipmentReadMapList = new LinkedList<>(); partyOrderShipments.put(partyId, orderShipmentReadMapList); } List> orderShipmentReadMapList = UtilGenerics.checkList(partyOrderShipments.get(partyId)); @@ -548,7 +548,7 @@ public class BOMServices { OrderReadHelper orderReadHelper = (OrderReadHelper)orderShipmentReadMap.get("orderReadHelper"); GenericValue orderItem = orderReadHelper.getOrderItem(orderShipment.getString("orderItemSeqId")); // getProductsInPackages - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.put("productId", orderItem.getString("productId")); serviceContext.put("quantity", orderShipment.getBigDecimal("quantity")); Map serviceResult = null; @@ -578,9 +578,9 @@ public class BOMServices { } // Group together products and components // of the same box type. - Map boxTypes = new HashMap(); + Map boxTypes = new HashMap<>(); for (Map.Entry partyOrderShipment : partyOrderShipments.entrySet()) { - Map>> boxTypeContent = new HashMap>>(); + Map>> boxTypeContent = new HashMap<>(); List> orderShipmentReadMapList = UtilGenerics.checkList(partyOrderShipment.getValue()); for (int i = 0; i < orderShipmentReadMapList.size(); i++) { Map orderShipmentReadMap = UtilGenerics.checkMap(orderShipmentReadMapList.get(i)); @@ -592,7 +592,7 @@ public class BOMServices { // this is a multi package shipment item for (int j = 0; j < productsInPackages.size(); j++) { BOMNode component = productsInPackages.get(j); - Map boxTypeContentMap = new HashMap(); + Map boxTypeContentMap = new HashMap<>(); boxTypeContentMap.put("content", orderShipmentReadMap); boxTypeContentMap.put("componentIndex", j); GenericValue product = component.getProduct(); @@ -606,7 +606,7 @@ public class BOMServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingPackageConfiguratorError", locale)); } boxTypes.put(boxTypeId, boxType); - List> box = new LinkedList>(); + List> box = new LinkedList<>(); boxTypeContent.put(boxTypeId, box); } List> boxTypeContentList = UtilGenerics.checkList(boxTypeContent.get(boxTypeId)); @@ -616,7 +616,7 @@ public class BOMServices { } else { // no subcomponents, the product has its own package: // this is a single package shipment item - Map boxTypeContentMap = new HashMap(); + Map boxTypeContentMap = new HashMap<>(); boxTypeContentMap.put("content", orderShipmentReadMap); GenericValue orderItem = orderReadHelper.getOrderItem(orderShipment.getString("orderItemSeqId")); GenericValue product = null; @@ -636,7 +636,7 @@ public class BOMServices { } boxTypes.put(boxTypeId, boxType); - List> box = new LinkedList>(); + List> box = new LinkedList<>(); boxTypeContent.put(boxTypeId, box); } List> boxTypeContentList = UtilGenerics.checkList(boxTypeContent.get(boxTypeId)); @@ -761,7 +761,7 @@ public class BOMServices { * @return returns the list of products in packages */ public static Map getProductsInPackages(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -788,7 +788,7 @@ public class BOMServices { // Components // BOMTree tree = null; - List components = new LinkedList(); + List components = new LinkedList<>(); try { tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java index d543207b34..a8e2d08386 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/bom/BOMTree.java @@ -105,7 +105,7 @@ public class BOMTree { .where("productId", productId, "productFeatureApplTypeId", "STANDARD_FEATURE") .queryList(); - List productFeatures = new LinkedList(); + List productFeatures = new LinkedList<>(); GenericValue oneProductFeatureAppl = null; for (int i = 0; i < productFeaturesAppl.size(); i++) { oneProductFeatureAppl = productFeaturesAppl.get(i); @@ -183,7 +183,7 @@ public class BOMTree { * */ public boolean isConfigured() { - List notConfiguredParts = new LinkedList(); + List notConfiguredParts = new LinkedList<>(); root.isConfigured(notConfiguredParts); return (notConfiguredParts.size() == 0); } @@ -300,8 +300,8 @@ public class BOMTree { * @return List containing all the tree's productId. */ public List getAllProductsId() { - List nodeArr = new LinkedList(); - List productsId = new LinkedList(); + List nodeArr = new LinkedList<>(); + List productsId = new LinkedList<>(); print(nodeArr); for (int i = 0; i < nodeArr.size(); i++) { productsId.add((nodeArr.get(i)).getProduct().getString("productId")); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java index 5efb3f7d05..91aca73977 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java @@ -333,7 +333,7 @@ public class ProductionRun { if (productionRunRoutingTasks == null) this.getProductionRunRoutingTasks(); if (productionRunRoutingTasks != null) { try { - productionRunComponents = new LinkedList(); + productionRunComponents = new LinkedList<>(); GenericValue routingTask; for (Iterator iter = productionRunRoutingTasks.iterator(); iter.hasNext();) { routingTask = iter.next(); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java index e847960935..d6d1a26fda 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunEvents.java @@ -61,7 +61,7 @@ public class ProductionRunEvents { } Collection> componentRows = UtilHttp.parseMultiFormData(parameters); - Map componentsLocationMap = new HashMap(); + Map componentsLocationMap = new HashMap<>(); for (MapcomponentRow : componentRows) { Timestamp fromDate = null; try { diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java index 33c1513a0c..521d72d8c9 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunHelper.java @@ -52,7 +52,7 @@ public final class ProductionRunHelper { * @return Map with the result of the service, the output parameters are */ public static Map getProductionRun(Delegator delegator, String productionRunId) { - Map result = new HashMap(); + Map result = new HashMap<>(); try { if (productionRunId != null) { diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java index ad9fab8fb8..facb452986 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java @@ -81,12 +81,12 @@ public class ProductionRunServices { * @return Map with the result of the service, the output parameters. */ public static Map cancelProductionRun(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); String productionRunId = (String) context.get("productionRunId"); ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); @@ -99,7 +99,7 @@ public class ProductionRunServices { if ("PRUN_CREATED".equals(currentStatusId) || "PRUN_DOC_PRINTED".equals(currentStatusId) || "PRUN_SCHEDULED".equals(currentStatusId)) { try { // First of all, make sure that there aren't production runs that depend on this one. - List mandatoryWorkEfforts = new LinkedList(); + List mandatoryWorkEfforts = new LinkedList<>(); ProductionRunHelper.getLinkedProductionRuns(delegator, dispatcher, productionRunId, mandatoryWorkEfforts); for (int i = 1; i < mandatoryWorkEfforts.size(); i++) { GenericValue mandatoryWorkEffort = (mandatoryWorkEfforts.get(i)).getGenericValue(); @@ -107,7 +107,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChangedMandatoryProductionRunFound", locale)); } } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); // change the production run (header) status to PRUN_CANCELLED serviceContext.put("workEffortId", productionRunId); serviceContext.put("currentStatusId", "PRUN_CANCELLED"); @@ -188,7 +188,7 @@ public class ProductionRunServices { * @return Map with the result of the service, the output parameters. */ public static Map createProductionRun(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -250,7 +250,7 @@ public class ProductionRunServices { // The components are retrieved using the getManufacturingComponents service // (that performs a bom breakdown and if needed runs the configurator). List components = null; - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.put("productId", productId); // the product that we want to manufacture serviceContext.put("quantity", pRQuantity); // the quantity that we want to manufacture serviceContext.put("userLogin", userLogin); @@ -598,12 +598,12 @@ public class ProductionRunServices { } public static Map changeProductionRunStatus(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); String productionRunId = (String) context.get("productionRunId"); String statusId = (String) context.get("statusId"); @@ -622,7 +622,7 @@ public class ProductionRunServices { // PRUN_CREATED --> PRUN_SCHEDULED if ("PRUN_CREATED".equals(currentStatusId) && "PRUN_SCHEDULED".equals(statusId)) { // change the production run status to PRUN_SCHEDULED - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); serviceContext.put("currentStatusId", statusId); @@ -660,7 +660,7 @@ public class ProductionRunServices { // PRUN_CREATED or PRUN_SCHEDULED --> PRUN_DOC_PRINTED if (("PRUN_CREATED".equals(currentStatusId) || "PRUN_SCHEDULED".equals(currentStatusId)) && (statusId == null || "PRUN_DOC_PRINTED".equals(statusId))) { // change only the production run (header) status to PRUN_DOC_PRINTED - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); serviceContext.put("currentStatusId", "PRUN_DOC_PRINTED"); @@ -718,7 +718,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); serviceContext.put("currentStatusId", "PRUN_RUNNING"); @@ -742,7 +742,7 @@ public class ProductionRunServices { // this should be called only when the last task is completed if ("PRUN_RUNNING".equals(currentStatusId) && (statusId == null || "PRUN_COMPLETED".equals(statusId))) { // change only the production run (header) status to PRUN_COMPLETED - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); serviceContext.put("currentStatusId", "PRUN_COMPLETED"); @@ -765,7 +765,7 @@ public class ProductionRunServices { // PRUN_COMPLETED --> PRUN_CLOSED if ("PRUN_COMPLETED".equals(currentStatusId) && (statusId == null || "PRUN_CLOSED".equals(statusId))) { // change the production run status to PRUN_CLOSED - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", productionRunId); serviceContext.put("currentStatusId", "PRUN_CLOSED"); @@ -805,7 +805,7 @@ public class ProductionRunServices { } public static Map changeProductionRunTaskStatus(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -813,7 +813,7 @@ public class ProductionRunServices { String productionRunId = (String) context.get("productionRunId"); String taskId = (String) context.get("workEffortId"); String statusId = (String) context.get("statusId"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); Boolean issueAllComponents = (Boolean) context.get("issueAllComponents"); if (issueAllComponents == null) { issueAllComponents = Boolean.FALSE; @@ -866,7 +866,7 @@ public class ProductionRunServices { if ("PRUN_CREATED".equals(productionRun.getGenericValue().getString("currentStatusId"))) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunTaskCannotStartDocsNotPrinted", locale)); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", taskId); serviceContext.put("currentStatusId", "PRUN_RUNNING"); @@ -905,7 +905,7 @@ public class ProductionRunServices { // PRUN_RUNNING --> PRUN_COMPLETED // this should be called only when the last task is completed if ("PRUN_RUNNING".equals(currentStatusId) && (statusId == null || "PRUN_COMPLETED".equals(statusId))) { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); if (issueAllComponents) { // Issue all the components, if this task needs components and they still need to be issued try { @@ -1076,7 +1076,7 @@ public class ProductionRunServices { } public static Map getWorkEffortCosts(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); String workEffortId = (String)context.get("workEffortId"); Locale locale = (Locale) context.get("locale"); @@ -1110,7 +1110,7 @@ public class ProductionRunServices { } public static Map getProductionRunCost(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -1154,7 +1154,7 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); // this is the id of the actual (real) production run task String productionRunTaskId = (String)context.get("productionRunTaskId"); try { @@ -1275,7 +1275,7 @@ public class ProductionRunServices { } // materials costs: these are the costs derived from the materials used by the production run task try { - Map materialsCostByCurrency = new HashMap(); + Map materialsCostByCurrency = new HashMap<>(); for (GenericValue inventoryConsumed : EntityQuery.use(delegator).from("WorkEffortAndInventoryAssign") .where("workEffortId", productionRunTaskId).queryList()) { BigDecimal quantity = inventoryConsumed.getBigDecimal("quantity"); @@ -1329,7 +1329,7 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); String productionRunId = (String) context.get("productionRunId"); String routingTaskId = (String) context.get("routingTaskId"); if (! UtilValidate.isEmpty(productionRunId) && ! UtilValidate.isEmpty(routingTaskId)) { @@ -1399,7 +1399,7 @@ public class ProductionRunServices { } public static Map addProductionRunComponent(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Timestamp now = UtilDateTime.nowTimestamp(); @@ -1449,7 +1449,7 @@ public class ProductionRunServices { Debug.logWarning(e.getMessage(), module); return ServiceUtil.returnError(e.getMessage()); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", workEffortId); serviceContext.put("productId", productId); @@ -1473,7 +1473,7 @@ public class ProductionRunServices { } public static Map updateProductionRunComponent(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -1526,7 +1526,7 @@ public class ProductionRunServices { Debug.logWarning(e.getMessage(), module); return ServiceUtil.returnError(e.getMessage()); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", theComponent.getString("workEffortId")); serviceContext.put("workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED"); @@ -1550,7 +1550,7 @@ public class ProductionRunServices { } public static Map addProductionRunRoutingTask(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -1626,7 +1626,7 @@ public class ProductionRunServices { long totalTime = ProductionRun.getEstimatedTaskTime(routingTask, pRQuantity, dispatcher); estimatedCompletionDate = TechDataServices.addForward(TechDataServices.getTechDataCalendar(routingTask), estimatedStartDate, totalTime); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("priority", priority); serviceContext.put("workEffortPurposeTypeId", routingTask.get("workEffortPurposeTypeId")); @@ -1700,7 +1700,7 @@ public class ProductionRunServices { } public static Map productionRunProduce(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -1729,7 +1729,7 @@ public class ProductionRunServices { autoCreateLot = Boolean.FALSE; } - List inventoryItemIds = new LinkedList(); + List inventoryItemIds = new LinkedList<>(); result.put("inventoryItemIds", inventoryItemIds); // The production run is loaded ProductionRun productionRun = new ProductionRun(productionRunId, delegator, dispatcher); @@ -1857,7 +1857,7 @@ public class ProductionRunServices { , "facilityId", facility.get("facilityId")).queryOne(); if (productFacility == null) { - Map createProductFacilityCtx = new HashMap(); + Map createProductFacilityCtx = new HashMap<>(); createProductFacilityCtx.put("productId", productionRun.getProductProduced().getString("productId")); createProductFacilityCtx.put("facilityId", facility.get("facilityId")); createProductFacilityCtx.put("userLogin", userLogin); @@ -1918,7 +1918,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } // Recompute reservations - serviceContext = new HashMap(); + serviceContext = new HashMap<>(); serviceContext.put("inventoryItemId", inventoryItemId); serviceContext.put("userLogin", userLogin); serviceResult = dispatcher.runSync("balanceInventoryItems", serviceContext); @@ -1971,7 +1971,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); } // Recompute reservations - serviceContext = new HashMap(); + serviceContext = new HashMap<>(); serviceContext.put("inventoryItemId", inventoryItemId); serviceContext.put("userLogin", userLogin); if (orderItem != null) { @@ -2009,7 +2009,7 @@ public class ProductionRunServices { } public static Map productionRunDeclareAndProduce(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -2066,7 +2066,7 @@ public class ProductionRunServices { } } try { - Map inputMap = new HashMap(); + Map inputMap = new HashMap<>(); inputMap.putAll(context); inputMap.remove("componentsLocationMap"); result = dispatcher.runSync("productionRunProduce", inputMap); @@ -2081,7 +2081,7 @@ public class ProductionRunServices { } public static Map productionRunTaskProduce(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -2109,7 +2109,7 @@ public class ProductionRunServices { ProductionRun productionRun = new ProductionRun(productionRunTaskId, delegator, dispatcher); facilityId = productionRun.getGenericValue().getString("facilityId"); } - List inventoryItemIds = new LinkedList(); + List inventoryItemIds = new LinkedList<>(); if ("SERIALIZED_INV_ITEM".equals(inventoryItemTypeId)) { try { int numOfItems = quantity.intValue(); @@ -2154,7 +2154,7 @@ public class ProductionRunServices { } inventoryItemIds.add(inventoryItemId); // Recompute reservations - serviceContext = new HashMap(); + serviceContext = new HashMap<>(); serviceContext.put("inventoryItemId", inventoryItemId); serviceContext.put("userLogin", userLogin); serviceResult = dispatcher.runSync("balanceInventoryItems", serviceContext); @@ -2209,7 +2209,7 @@ public class ProductionRunServices { } inventoryItemIds.add(inventoryItemId); // Recompute reservations - serviceContext = new HashMap(); + serviceContext = new HashMap<>(); serviceContext.put("inventoryItemId", inventoryItemId); serviceContext.put("userLogin", userLogin); serviceResult = dispatcher.runSync("balanceInventoryItems", serviceContext); @@ -2292,7 +2292,7 @@ public class ProductionRunServices { } public static Map updateProductionRunTask(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -2426,7 +2426,7 @@ public class ProductionRunServices { // Create a new TimeEntry try { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("workEffortId", workEffortId); if (addTaskTime != null) { @@ -2493,7 +2493,7 @@ public class ProductionRunServices { } public static Map createProductionRunFromRequirement(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -2521,7 +2521,7 @@ public class ProductionRunServices { if (quantity == null) { quantity = requirement.getBigDecimal("quantity"); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("productId", requirement.getString("productId")); serviceContext.put("quantity", quantity); @@ -2559,7 +2559,7 @@ public class ProductionRunServices { } public static Map createProductionRunFromConfiguration(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -2593,7 +2593,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(e.getMessage()); } - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.clear(); serviceContext.put("productId", instanceProductId); serviceContext.put("pRQuantity", quantity); @@ -2612,7 +2612,7 @@ public class ProductionRunServices { String productionRunId = (String)serviceResult.get("productionRunId"); result.put("productionRunId", productionRunId); - Map components = new HashMap(); + Map components = new HashMap<>(); for (ConfigOption co : config.getSelectedOptions()) { for (GenericValue selComponent : co.getComponents()) { BigDecimal componentQuantity = null; @@ -2704,7 +2704,7 @@ public class ProductionRunServices { componentQuantity = BigDecimal.ONE; } serviceResult = null; - serviceContext = new HashMap(); + serviceContext = new HashMap<>(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("productId", productId); serviceContext.put("estimatedQuantity", componentQuantity); @@ -2731,7 +2731,7 @@ public class ProductionRunServices { } public static Map createProductionRunForMktgPkg(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); @@ -2789,7 +2789,7 @@ public class ProductionRunServices { // how many should we produce? If there already is some inventory, then just produce enough to bring ATP back up to zero. BigDecimal qtyRequired = BigDecimal.ZERO.subtract(existingAtp); // ok so that's how many we WANT to produce, but let's check how many we can actually produce based on the available components - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.put("productId", orderItem.getString("productId")); serviceContext.put("facilityId", facilityId); serviceContext.put("userLogin", userLogin); @@ -2855,7 +2855,7 @@ public class ProductionRunServices { } public static Map createProductionRunsForOrder(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue)context.get("userLogin"); @@ -2908,7 +2908,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder, "OrderProblemsReadingOrderItemInformation", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } } - List productionRuns = new LinkedList(); + List productionRuns = new LinkedList<>(); for (int i = 0; i < orderItems.size(); i++) { GenericValue orderItemOrShipGroupAssoc = orderItems.get(i); String productId = null; @@ -2966,7 +2966,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturinWorkOrderItemFulfillmentError", UtilMisc.toMap("errorString", gee.getMessage()), locale)); } try { - List components = new LinkedList(); + List components = new LinkedList<>(); BOMTree tree = new BOMTree(productId, "MANUF_COMPONENT", fromDate, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); tree.setRootAmount(amount); @@ -2981,7 +2981,7 @@ public class ProductionRunServices { } public static Map createProductionRunsForProductBom(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin =(GenericValue)context.get("userLogin"); @@ -2998,7 +2998,7 @@ public class ProductionRunServices { quantity = BigDecimal.ONE; } try { - List components = new LinkedList(); + List components = new LinkedList<>(); BOMTree tree = new BOMTree(productId, "MANUF_COMPONENT", startDate, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); tree.setRootAmount(BigDecimal.ZERO); @@ -3010,7 +3010,7 @@ public class ProductionRunServices { if (workEffortId == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunIsNotRequiredForProductId", UtilMisc.toMap("productId", productId, "startDate", startDate), locale)); } - List productionRuns = new LinkedList(); + List productionRuns = new LinkedList<>(); result.put("productionRuns" , productionRuns); result.put("productionRunId" , workEffortId); return result; @@ -3034,7 +3034,7 @@ public class ProductionRunServices { String taskId = (String) context.get("taskId"); try { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); Map serviceResult = null; GenericValue task = EntityQuery.use(delegator).from("WorkEffort").where("workEffortId", taskId).queryOne(); String currentStatusId = task.getString("currentStatusId"); @@ -3096,7 +3096,7 @@ public class ProductionRunServices { oneTask = tasks.get(i); taskId = oneTask.getString("workEffortId"); try { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.put("productionRunId", productionRunId); serviceContext.put("taskId", taskId); serviceContext.put("userLogin", userLogin); @@ -3165,13 +3165,13 @@ public class ProductionRunServices { LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); GenericValue userLogin = (GenericValue) context.get("userLogin"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); String productionRunId = (String) context.get("productionRunId"); String statusId = (String) context.get("statusId"); String startAllTasks = (String) context.get("startAllTasks"); try { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); // Change the task status to running if ("PRUN_DOC_PRINTED".equals(statusId) || @@ -3257,13 +3257,13 @@ public class ProductionRunServices { } BigDecimal totQty = BigDecimal.ZERO; try { - List findOutgoingProductionRunsConds = new LinkedList(); + List findOutgoingProductionRunsConds = new LinkedList<>(); findOutgoingProductionRunsConds.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); findOutgoingProductionRunsConds.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "WEGS_CREATED")); findOutgoingProductionRunsConds.add(EntityCondition.makeCondition("estimatedStartDate", EntityOperator.LESS_THAN_EQUAL_TO, startDate)); - List findOutgoingProductionRunsStatusConds = new LinkedList(); + List findOutgoingProductionRunsStatusConds = new LinkedList<>(); findOutgoingProductionRunsStatusConds.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "PRUN_CREATED")); findOutgoingProductionRunsStatusConds.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "PRUN_SCHEDULED")); findOutgoingProductionRunsStatusConds.add(EntityCondition.makeCondition("currentStatusId", EntityOperator.EQUALS, "PRUN_DOC_PRINTED")); @@ -3296,7 +3296,7 @@ public class ProductionRunServices { GenericValue userLogin = (GenericValue) context.get("userLogin"); String inventoryItemId = (String)context.get("inventoryItemId"); Locale locale = (Locale) context.get("locale"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); try { GenericValue inventoryItem = EntityQuery.use(delegator).from("InventoryItem").where("inventoryItemId", inventoryItemId).queryOne(); if (inventoryItem == null) { @@ -3331,7 +3331,7 @@ public class ProductionRunServices { } public static Map decomposeInventoryItem(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Timestamp now = UtilDateTime.nowTimestamp(); @@ -3340,7 +3340,7 @@ public class ProductionRunServices { // Mandatory input fields String inventoryItemId = (String)context.get("inventoryItemId"); BigDecimal quantity = (BigDecimal)context.get("quantity"); - List inventoryItemIds = new LinkedList(); + List inventoryItemIds = new LinkedList<>(); try { GenericValue inventoryItem = EntityQuery.use(delegator).from("InventoryItem") .where("inventoryItemId", inventoryItemId).queryOne(); @@ -3458,7 +3458,7 @@ public class ProductionRunServices { Delegator delegator = ctx.getDelegator(); Timestamp now = UtilDateTime.nowTimestamp(); Locale locale = (Locale) context.get("locale"); - Map> products = new HashMap>(); + Map> products = new HashMap<>(); try { List resultList = EntityQuery.use(delegator).from("WorkEffortAndGoods") @@ -3546,7 +3546,7 @@ public class ProductionRunServices { } // backorders - List backordersCondList = new LinkedList(); + List backordersCondList = new LinkedList<>(); backordersCondList.add(EntityCondition.makeCondition("quantityNotAvailable", EntityOperator.NOT_EQUAL, null)); backordersCondList.add(EntityCondition.makeCondition("quantityNotAvailable", EntityOperator.GREATER_THAN, BigDecimal.ZERO)); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java index ec453f981a..bb336219a9 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/MrpServices.java @@ -89,7 +89,7 @@ public class MrpServices { } // Proposed requirements are deleted - List listResultRoles = new LinkedList(); + List listResultRoles = new LinkedList<>(); try { listResult = EntityQuery.use(delegator).from("Requirement") .where("requirementTypeId", "PRODUCT_REQUIREMENT","facilityId", facilityId, @@ -98,7 +98,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); } - List requirementStatus = new ArrayList(); + List requirementStatus = new ArrayList<>(); if (listResult != null) { try { for (GenericValue tmpRequirement : listResult) { @@ -482,7 +482,7 @@ public class MrpServices { } } } - Map result = new HashMap(); + Map result = new HashMap<>(); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); Debug.logInfo("return from initMrpEvent", module); return result; @@ -842,8 +842,8 @@ public class MrpServices { // if there are 3 levels with no inventoryEvenPanned we stop } while (bomLevelWithNoEvent < 3); - result = new HashMap(); - List msgResult = new LinkedList(); + result = new HashMap<>(); + List msgResult = new LinkedList<>(); result.put("msgResult", msgResult); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); Debug.logInfo("return from executeMrp", module); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java index f9b2a96845..739c3c0fd6 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/mrp/ProposedOrder.java @@ -126,7 +126,7 @@ public class ProposedOrder { if (routing == null) { // try to find a routing linked to the virtual product BOMTree tree = null; - List components = new LinkedList(); + List components = new LinkedList<>(); try { tree = new BOMTree(product.getString("productId"), "MANUF_COMPONENT", requiredByDate, BOMTree.EXPLOSION_SINGLE_LEVEL, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); @@ -151,7 +151,7 @@ public class ProposedOrder { } } if (routing != null) { - result = new HashMap(); + result = new HashMap<>(); //Looks for all the routingTask (ordered by inversed (begin from the end) sequence number) if (listRoutingTaskAssoc == null) { try { @@ -237,7 +237,7 @@ public class ProposedOrder { Map parameters = UtilMisc.toMap("userLogin", userLogin); if (isBuilt) { try { - List bom = new LinkedList(); + List bom = new LinkedList<>(); BOMTree tree = new BOMTree(productId, "MANUF_COMPONENT", null, BOMTree.EXPLOSION_MANUFACTURING, delegator, dispatcher, userLogin); tree.setRootQuantity(quantity); tree.print(bom); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java index 6ca3fbd7b9..ebe4c1ad12 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/routing/RoutingServices.java @@ -50,7 +50,7 @@ public class RoutingServices { * @return Map with the result of the service, the output parameters. */ public static Map getEstimatedTaskTime(DispatchContext ctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = ctx.getDelegator(); LocalDispatcher dispatcher = ctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); diff --git a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java index 5aec065c23..8104bae781 100644 --- a/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java +++ b/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/techdata/TechDataServices.java @@ -63,13 +63,13 @@ public class TechDataServices { */ public static Map lookupRoutingTask(DispatchContext ctx, Map context) { Delegator delegator = ctx.getDelegator(); - Map result = new HashMap(); + Map result = new HashMap<>(); Locale locale = (Locale) context.get("locale"); String workEffortName = (String) context.get("workEffortName"); String fixedAssetId = (String) context.get("fixedAssetId"); List listRoutingTask = null; - List constraints = new LinkedList(); + List constraints = new LinkedList<>(); if (UtilValidate.isNotEmpty(workEffortName)) { constraints.add(EntityCondition.makeCondition("workEffortName", EntityOperator.GREATER_THAN_EQUAL_TO, workEffortName)); @@ -90,7 +90,7 @@ public class TechDataServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingTechDataWorkEffortNotExist", UtilMisc.toMap("errorString", e.toString()), locale)); } if (listRoutingTask == null) { - listRoutingTask = new LinkedList(); + listRoutingTask = new LinkedList<>(); } if (listRoutingTask.size() == 0) { //FIXME is it correct ? @@ -110,7 +110,7 @@ public class TechDataServices { */ public static Map checkRoutingTaskAssoc(DispatchContext ctx, Map context) { Delegator delegator = ctx.getDelegator(); - Map result = new HashMap(); + Map result = new HashMap<>(); String sequenceNumNotOk = "N"; Locale locale = (Locale) context.get("locale"); String workEffortIdFrom = (String) context.get("workEffortIdFrom"); @@ -216,7 +216,7 @@ public class TechDataServices { * @return a map with the capacity (Double) available and moveDay (int): the number of day it's necessary to move to have capacity available */ public static Map dayStartCapacityAvailable(GenericValue techDataCalendarWeek, int dayStart) { - Map result = new HashMap(); + Map result = new HashMap<>(); int moveDay = 0; Double capacity = null; Time startTime = null; @@ -299,7 +299,7 @@ public class TechDataServices { * @return a map with Timestamp dateTo, Double nextCapacity */ public static Map startNextDay(GenericValue techDataCalendar, Timestamp dateFrom) { - Map result = new HashMap(); + Map result = new HashMap<>(); Timestamp dateTo = null; GenericValue techDataCalendarWeek = null; // TODO read TechDataCalendarExcWeek to manage execption week (maybe it's needed to refactor the entity definition @@ -349,7 +349,7 @@ public class TechDataServices { amount = 0; } else amount -= nextCapacity; - Map result = new HashMap(); + Map result = new HashMap<>(); while (amount > 0) { result = startNextDay(techDataCalendar, dateTo); dateTo = (Timestamp) result.get("dateTo"); @@ -370,7 +370,7 @@ public class TechDataServices { * @return a map with the capacity (Double) available, the startTime and moveDay (int): the number of day it's necessary to move to have capacity available */ public static Map dayEndCapacityAvailable(GenericValue techDataCalendarWeek, int dayEnd) { - Map result = new HashMap(); + Map result = new HashMap<>(); int moveDay = 0; Double capacity = null; Time startTime = null; @@ -453,7 +453,7 @@ public class TechDataServices { * @return a map with Timestamp dateTo, Double previousCapacity */ public static Map endPreviousDay(GenericValue techDataCalendar, Timestamp dateFrom) { - Map result = new HashMap(); + Map result = new HashMap<>(); Timestamp dateTo = null; GenericValue techDataCalendarWeek = null; // TODO read TechDataCalendarExcWeek to manage exception week (maybe it's needed to refactor the entity definition @@ -505,7 +505,7 @@ public class TechDataServices { amount = 0; } else amount -= previousCapacity; - Map result = new HashMap(); + Map result = new HashMap<>(); while (amount > 0) { result = endPreviousDay(techDataCalendar, dateTo); dateTo = (Timestamp) result.get("dateTo"); diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java index 718ec5e895..d930c14a04 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/report/ReportHelper.java @@ -46,11 +46,11 @@ public final class ReportHelper { * conversionRate - # orders/# visits */ public static List> calcConversionRates(List visits, List orders, String keyFieldName) { - List> conversionRates = new LinkedList>(); + List> conversionRates = new LinkedList<>(); // loop through all the visits for (GenericValue visit: visits) { - Map reportValue = new HashMap(); + Map reportValue = new HashMap<>(); reportValue.put(keyFieldName, visit.getString(keyFieldName)); reportValue.put("visits", visit.getLong("visitId")); // actually # of visits diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java index c424f23980..890c90d4f1 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/marketing/tracking/TrackingCodeEvents.java @@ -456,7 +456,7 @@ public class TrackingCodeEvents { public static List makeTrackingCodeOrders(HttpServletRequest request) { Delegator delegator = (Delegator) request.getAttribute("delegator"); java.sql.Timestamp nowStamp = UtilDateTime.nowTimestamp(); - List trackingCodeOrders = new LinkedList(); + List trackingCodeOrders = new LinkedList<>(); Cookie[] cookies = request.getCookies(); Timestamp affiliateReferredTimeStamp = null; diff --git a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java index 5f7fb25f8a..283379b478 100644 --- a/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java +++ b/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java @@ -83,10 +83,10 @@ public class VCard { ByteBuffer byteBuffer = (ByteBuffer) context.get("infile"); byte[] inputByteArray = byteBuffer.array(); InputStream in = new ByteArrayInputStream(inputByteArray); - Map serviceCtx = new HashMap(); + Map serviceCtx = new HashMap<>(); boolean isGroup = false; - List> partiesCreated = new ArrayList>(); - List> partiesExist = new ArrayList>(); + List> partiesCreated = new ArrayList<>(); + List> partiesExist = new ArrayList<>(); try (VCardReader vCardReader = new VCardReader(in)) { ezvcard.VCard vcard = null; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java index edf2bcff0b..fec78a4ec9 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/OrderManagerEvents.java @@ -66,7 +66,7 @@ public class OrderManagerEvents { if (session.getAttribute("OFFLINE_PAYMENTS") != null) { String orderId = (String) request.getAttribute("orderId"); - List toBeStored = new LinkedList(); + List toBeStored = new LinkedList<>(); List paymentPrefs = null; GenericValue placingCustomer = null; try { @@ -217,7 +217,7 @@ public class OrderManagerEvents { } } - List toBeStored = new LinkedList(); + List toBeStored = new LinkedList<>(); for (GenericValue paymentMethodType : paymentMethodTypes) { String paymentMethodTypeId = paymentMethodType.getString("paymentMethodTypeId"); String amountStr = request.getParameter(paymentMethodTypeId + "_amount"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java index ef9ddcf8c5..81ff94b532 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java @@ -595,7 +595,7 @@ public class OrderReturnServices { GenericValue userLogin = (GenericValue) context.get("userLogin"); String returnId = (String) context.get("returnId"); Locale locale = (Locale) context.get("locale"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); GenericValue returnHeader = null; List returnItems = null; diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java index a5841ce4ab..d4ff709d4e 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java @@ -2007,7 +2007,7 @@ public class OrderServices { LocalDispatcher dispatcher = ctx.getDispatcher(); Delegator delegator = ctx.getDelegator(); Locale locale = (Locale) context.get("locale"); - Map resp = new HashMap(); + Map resp = new HashMap<>(); GenericValue userLogin = (GenericValue) context.get("userLogin"); BigDecimal cancelQuantity = (BigDecimal) context.get("cancelQuantity"); String orderId = (String) context.get("orderId"); @@ -6300,7 +6300,7 @@ public class OrderServices { String orderId = (String) context.get("orderId"); OrderReadHelper orh = new OrderReadHelper(delegator, orderId); List orderItems = orh.getOrderItems(); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); // In order to improve efficiency a little bit, we will always create the ProductAssoc records // with productId < productIdTo when the two are compared. This way when checking for an existing // record we don't have to check both possible combinations of productIds diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java index 6f7e54244c..6aa4fa63ec 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java @@ -58,7 +58,7 @@ public class QuoteServices { String note = (String) context.get("note"); // prepare the order information - Map sendMap = new HashMap(); + Map sendMap = new HashMap<>(); // get the quote and store GenericValue quote = null; @@ -165,11 +165,11 @@ public class QuoteServices { List quoteWorkEfforts = UtilGenerics.checkList(context.get("quoteWorkEfforts")); List quoteAdjustments = UtilGenerics.checkList(context.get("quoteAdjustments")); Locale locale = (Locale) context.get("locale"); - Map serviceResult = new HashMap(); + Map serviceResult = new HashMap<>(); //TODO create Quote Terms still to be implemented //TODO create Quote Term Attributes still to be implemented - Map result = new HashMap(); + Map result = new HashMap<>(); try { Map quoteIn = UtilMisc.toMap("quoteTypeId", quoteTypeId, "partyId", partyId, "issueDate", issueDate, "statusId", statusId, "currencyUomId", currencyUomId); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java index 782c9c0191..f7fe6d4fe7 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/requirement/RequirementServices.java @@ -96,23 +96,23 @@ public class RequirementServices { .queryList(); // maps to cache the associated suppliers and products data, so we don't do redundant DB and service requests - Map suppliers = new HashMap(); - Map gids = new HashMap(); - Map> inventories = new HashMap>(); - Map productsSold = new HashMap(); + Map suppliers = new HashMap<>(); + Map gids = new HashMap<>(); + Map> inventories = new HashMap<>(); + Map productsSold = new HashMap<>(); // to count quantity, running total, and distinct products in list BigDecimal quantity = BigDecimal.ZERO; BigDecimal amountTotal = BigDecimal.ZERO; - Set products = new HashSet(); + Set products = new HashSet<>(); // time period to count products ordered from, six months ago and the 1st of that month Timestamp timePeriodStart = UtilDateTime.getMonthStart(UtilDateTime.nowTimestamp(), 0, -6); // join in fields with extra data about the suppliers and products - List> requirements = new LinkedList>(); + List> requirements = new LinkedList<>(); for (GenericValue requirement : requirementAndRoles) { - Map union = new HashMap(); + Map union = new HashMap<>(); String productId = requirement.getString("productId"); partyId = requirement.getString("partyId"); String facilityId = requirement.getString("facilityId"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java index ece198f107..48630864d4 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java @@ -107,7 +107,7 @@ public class ShippingEstimateWrapper { } protected void loadEstimates(BigDecimal totalAllowance) { - this.shippingEstimates = new HashMap(); + this.shippingEstimates = new HashMap<>(); if (shippingMethods != null) { for (GenericValue shipMethod : shippingMethods) { String shippingMethodTypeId = shipMethod.getString("shipmentMethodTypeId"); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java index 1d3b6469a2..fea2ece312 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEvents.java @@ -164,7 +164,7 @@ public class ShippingEvents { String productStoreId, String supplierPartyId, List> itemInfo, BigDecimal shippableWeight, BigDecimal shippableQuantity, BigDecimal shippableTotal, String partyId, String productStoreShipMethId, BigDecimal totalAllowance) { String standardMessage = "A problem occurred calculating shipping. Fees will be calculated offline."; - List errorMessageList = new LinkedList(); + List errorMessageList = new LinkedList<>(); if ("NO_SHIPPING".equals(shipmentMethodTypeId)) { return ServiceUtil.returnSuccess(); @@ -217,7 +217,7 @@ public class ShippingEvents { BigDecimal shippingTotal = BigDecimal.ZERO; // prepare the service invocation fields - Map serviceFields = new HashMap(); + Map serviceFields = new HashMap<>(); serviceFields.put("initialEstimateAmt", shippingTotal); serviceFields.put("shippableTotal", shippableTotal); serviceFields.put("shippableQuantity", shippableQuantity); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java index 1724c1ff03..45231cf418 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListEvents.java @@ -327,7 +327,7 @@ public class ShoppingListEvents { Debug.logError(e, module); } - Map serviceInMap = new HashMap(); + Map serviceInMap = new HashMap<>(); serviceInMap.put("shoppingListId", request.getParameter("shoppingListId")); serviceInMap.put("shoppingListItemSeqId", request.getParameter("shoppingListItemSeqId")); serviceInMap.put("productId", request.getParameter("add_product_id")); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java index 502f9b5c37..ef0cf7ecc1 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppinglist/ShoppingListServices.java @@ -581,7 +581,7 @@ public class ShoppingListServices { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); List shoppingList = null; - Map result = new HashMap(); + Map result = new HashMap<>(); try { shoppingList = EntityQuery.use(delegator).from("ShoppingList").where("partyId", null, "shoppingListTypeId", "SLT_SPEC_PURP").queryList(); } catch (GenericEntityException e) { diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java index d3dbecead8..5310fcd11b 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/test/OrderTestServices.java @@ -89,7 +89,7 @@ public class OrderTestServices { salesChannel = "WEB_SALES_CHANNEL"; } - List productsList = new LinkedList(); + List productsList = new LinkedList<>(); try { if (UtilValidate.isNotEmpty(productId)) { productsList.add(productId); diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java index 5d35030c32..565b69e5e2 100644 --- a/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java +++ b/applications/order/src/main/java/org/apache/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java @@ -225,8 +225,8 @@ public class ZipSalesServices { String city = shippingAddress.getString("city"); // setup the return lists. - List orderAdjustments = new LinkedList(); - List> itemAdjustments = new LinkedList>(); + List orderAdjustments = new LinkedList<>(); + List> itemAdjustments = new LinkedList<>(); // check for a valid state/province geo String validStates = EntityUtilProperties.getPropertyValue("zipsales", "zipsales.valid.states", delegator); @@ -263,7 +263,7 @@ public class ZipSalesServices { } private static ListgetItemTaxList(Delegator delegator, GenericValue item, String zipCode, String city, BigDecimal itemAmount, BigDecimal shippingAmount, boolean isUseTax) throws GeneralException { - List adjustments = new LinkedList(); + List adjustments = new LinkedList<>(); // check the item for tax status if (item != null && item.get("taxable") != null && "N".equals(item.getString("taxable"))) { diff --git a/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java b/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java index 4dbb12ce6d..393169288a 100644 --- a/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java +++ b/applications/party/src/main/java/org/apache/ofbiz/party/content/PartyContentWrapper.java @@ -214,7 +214,7 @@ public class PartyContentWrapper implements ContentWrapper { } if (partyContent != null) { // when rendering the product content, always include the Product and ProductContent records that this comes from - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("party", party); inContext.put("partyContent", partyContent); ContentWorker.renderContentAsText(dispatcher, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, cache); @@ -264,11 +264,11 @@ public class PartyContentWrapper implements ContentWrapper { .filterByDate() .queryList(); - List contentList = new LinkedList(); + List contentList = new LinkedList<>(); if (partyContentList != null) { for (GenericValue partyContent: partyContentList) { StringWriter outWriter = new StringWriter(); - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("party", party); inContext.put("partyContent", partyContent); ContentWorker.renderContentAsText(dispatcher, partyContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java index fee8ed3a38..3040993bd3 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/catalog/CatalogWorker.java @@ -68,7 +68,7 @@ public final class CatalogWorker { } public static List getAllCatalogIds(ServletRequest request) { - List catalogIds = new LinkedList(); + List catalogIds = new LinkedList<>(); List catalogs = null; Delegator delegator = (Delegator) request.getAttribute("delegator"); try { @@ -194,8 +194,8 @@ public final class CatalogWorker { } public static List getCatalogIdsAvailable(List partyCatalogs, List storeCatalogs) { - List categoryIds = new LinkedList(); - List allCatalogLinks = new LinkedList(); + List categoryIds = new LinkedList<>(); + List allCatalogLinks = new LinkedList<>(); if (partyCatalogs != null) allCatalogLinks.addAll(partyCatalogs); if (storeCatalogs != null) allCatalogLinks.addAll(storeCatalogs); @@ -386,7 +386,7 @@ public final class CatalogWorker { public static Collection getCatalogQuickaddCategories(ServletRequest request, String prodCatalogId) { if (UtilValidate.isEmpty(prodCatalogId)) return null; - Collection categoryIds = new LinkedList(); + Collection categoryIds = new LinkedList<>(); Collection prodCatalogCategories = getProdCatalogCategories(request, prodCatalogId, "PCCT_QUICK_ADD"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java index 112f54481e..f107b1d072 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlFilter.java @@ -88,7 +88,7 @@ public class CatalogUrlFilter implements Filter { try { // look for productId if (alternativeUrl.endsWith("-p")) { - List productContentConds = new LinkedList(); + List productContentConds = new LinkedList<>(); productContentConds.add(EntityCondition.makeCondition("productContentTypeId", "ALTERNATIVE_URL")); productContentConds.add(EntityUtil.getFilterByDateExpr()); List productContentInfos = EntityQuery.use(delegator).from("ProductContentAndInfo").where(productContentConds).orderBy("-fromDate").cache(true).queryList(); @@ -143,7 +143,7 @@ public class CatalogUrlFilter implements Filter { // look for productCategoryId if (alternativeUrl.endsWith("-c")) { - List productCategoryContentConds = new LinkedList(); + List productCategoryContentConds = new LinkedList<>(); productCategoryContentConds.add(EntityCondition.makeCondition("prodCatContentTypeId", "ALTERNATIVE_URL")); productCategoryContentConds.add(EntityUtil.getFilterByDateExpr()); List productCategoryContentInfos = EntityQuery.use(delegator).from("ProductCategoryContentAndInfo").where(productCategoryContentConds).orderBy("-fromDate").cache(true).queryList(); @@ -208,7 +208,7 @@ public class CatalogUrlFilter implements Filter { if (UtilValidate.isNotEmpty(productId)) { try { - List conds = new LinkedList(); + List conds = new LinkedList<>(); conds.add(EntityCondition.makeCondition("productId", productId)); conds.add(EntityUtil.getFilterByDateExpr()); List productCategoryMembers = EntityQuery.use(delegator).select("productCategoryId").from("ProductCategoryMember").where(conds).orderBy("-fromDate").cache(true).queryList(); @@ -233,7 +233,7 @@ public class CatalogUrlFilter implements Filter { // look for productCategoryId from productId if (UtilValidate.isNotEmpty(productId)) { try { - List rolllupConds = new LinkedList(); + List rolllupConds = new LinkedList<>(); rolllupConds.add(EntityCondition.makeCondition("productId", productId)); rolllupConds.add(EntityUtil.getFilterByDateExpr()); List productCategoryMembers = EntityQuery.use(delegator).from("ProductCategoryMember").where(rolllupConds).orderBy("-fromDate").cache(true).queryList(); @@ -251,13 +251,13 @@ public class CatalogUrlFilter implements Filter { // generate trail elements from productCategoryId if (UtilValidate.isNotEmpty(productCategoryId)) { - List trailElements = new LinkedList(); + List trailElements = new LinkedList<>(); trailElements.add(productCategoryId); String parentProductCategoryId = productCategoryId; while (UtilValidate.isNotEmpty(parentProductCategoryId)) { // find product category rollup try { - List rolllupConds = new LinkedList(); + List rolllupConds = new LinkedList<>(); rolllupConds.add(EntityCondition.makeCondition("productCategoryId", parentProductCategoryId)); rolllupConds.add(EntityUtil.getFilterByDateExpr()); List productCategoryRollups = EntityQuery.use(delegator).from("ProductCategoryRollup").where(rolllupConds).orderBy("-fromDate").cache(true).queryList(); @@ -282,7 +282,7 @@ public class CatalogUrlFilter implements Filter { List trail = CategoryWorker.getTrail(httpRequest); if (trail == null) { - trail = new LinkedList(); + trail = new LinkedList<>(); } // adjust trail @@ -410,7 +410,7 @@ public class CatalogUrlFilter implements Filter { url = urlBuilder.toString(); } else { if (UtilValidate.isEmpty(trail)) { - trail = new LinkedList(); + trail = new LinkedList<>(); } url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId); } @@ -453,7 +453,7 @@ public class CatalogUrlFilter implements Filter { url = urlBuilder.toString(); } else { if (UtilValidate.isEmpty(trail)) { - trail = new LinkedList(); + trail = new LinkedList<>(); } url = CatalogUrlServlet.makeCatalogUrl(contextPath, trail, productId, productCategoryId, previousCategoryId); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java index d64feb7556..79a618b5f4 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CatalogUrlServlet.java @@ -106,7 +106,7 @@ public class CatalogUrlServlet extends HttpServlet { } else if (pathElements.size() > 2) { List trail = CategoryWorker.getTrail(request); if (trail == null) { - trail = new LinkedList(); + trail = new LinkedList<>(); } if (trail.contains(pathElements.get(0))) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java index da46cf34c1..c3a8e7556b 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryContentWrapper.java @@ -146,7 +146,7 @@ public class CategoryContentWrapper implements ContentWrapper { GenericValue categoryContent = EntityUtil.getFirst(categoryContentList); if (categoryContent != null) { // when rendering the category content, always include the Product Category and ProductCategoryContent records that this comes from - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("productCategory", productCategory); inContext.put("categoryContent", categoryContent); ContentWorker.renderContentAsText(dispatcher, categoryContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, cache); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java index aa26938c2b..fcf9d8d896 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryServices.java @@ -96,7 +96,7 @@ public class CategoryServices { } List orderByFields = UtilGenerics.checkList(context.get("orderByFields")); - if (orderByFields == null) orderByFields = new LinkedList(); + if (orderByFields == null) orderByFields = new LinkedList<>(); String entityName = getCategoryFindEntityName(delegator, orderByFields, introductionDateLimit, releaseDateLimit); GenericValue productCategory; @@ -111,7 +111,7 @@ public class CategoryServices { if (activeOnly) { productCategoryMembers = EntityUtil.filterByDate(productCategoryMembers, true); } - List filterConditions = new LinkedList(); + List filterConditions = new LinkedList<>(); if (introductionDateLimit != null) { EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("introductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("introductionDate", EntityOperator.LESS_THAN_EQUAL_TO, introductionDateLimit)); filterConditions.add(condition); @@ -217,7 +217,7 @@ public class CategoryServices { Timestamp releaseDateLimit = (Timestamp) context.get("releaseDateLimit"); List orderByFields = UtilGenerics.checkList(context.get("orderByFields")); - if (orderByFields == null) orderByFields = new LinkedList(); + if (orderByFields == null) orderByFields = new LinkedList<>(); String entityName = getCategoryFindEntityName(delegator, orderByFields, introductionDateLimit, releaseDateLimit); String prodCatalogId = (String) context.get("prodCatalogId"); @@ -291,7 +291,7 @@ public class CategoryServices { if (activeOnly) { productCategoryMembers = EntityUtil.filterByDate(productCategoryMembers, true); } - List filterConditions = new LinkedList(); + List filterConditions = new LinkedList<>(); if (introductionDateLimit != null) { EntityCondition condition = EntityCondition.makeCondition(EntityCondition.makeCondition("introductionDate", EntityOperator.EQUALS, null), EntityOperator.OR, EntityCondition.makeCondition("introductionDate", EntityOperator.LESS_THAN_EQUAL_TO, introductionDateLimit)); filterConditions.add(condition); @@ -339,7 +339,7 @@ public class CategoryServices { highIndex = listSize; } } else { - List mainCondList = new LinkedList(); + List mainCondList = new LinkedList<>(); mainCondList.add(EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, productCategory.getString("productCategoryId"))); if (activeOnly) { mainCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp)); @@ -366,7 +366,7 @@ public class CategoryServices { if (limitView) { if (viewProductCategoryId != null) { // do manual checking to filter view allow - productCategoryMembers = new LinkedList(); + productCategoryMembers = new LinkedList<>(); GenericValue nextValue; int chunkSize = 0; listSize = 0; @@ -409,7 +409,7 @@ public class CategoryServices { // null safety if (productCategoryMembers == null) { - productCategoryMembers = new LinkedList(); + productCategoryMembers = new LinkedList<>(); } if (highIndex > listSize) { @@ -421,7 +421,7 @@ public class CategoryServices { } } - Map result = new HashMap(); + Map result = new HashMap<>(); result.put("viewIndex", viewIndex); result.put("viewSize", viewSize); result.put("lowIndex", lowIndex); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java index 1f57b5161e..566247deb2 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/CategoryWorker.java @@ -84,7 +84,7 @@ public final class CategoryWorker { public static void getCategoriesWithNoParent(ServletRequest request, String attributeName) { Delegator delegator = (Delegator) request.getAttribute("delegator"); - Collection results = new LinkedList(); + Collection results = new LinkedList<>(); try { Collection allCategories = EntityQuery.use(delegator).from("ProductCategory").queryList(); @@ -138,7 +138,7 @@ public final class CategoryWorker { } public static List getRelatedCategoriesRet(Delegator delegator, String attributeName, String parentId, boolean limitView, boolean excludeEmpty, boolean recursive) { - List categories = new LinkedList(); + List categories = new LinkedList<>(); if (Debug.verboseOn()) Debug.logVerbose("[CategoryWorker.getRelatedCategories] ParentID: " + parentId, module); @@ -243,7 +243,7 @@ public final class CategoryWorker { } public static List adjustTrail(List origTrail, String currentCategoryId, String previousCategoryId) { - List trail = new LinkedList(); + List trail = new LinkedList<>(); if (origTrail != null) { trail.addAll(origTrail); } @@ -354,7 +354,7 @@ public final class CategoryWorker { } public static List filterProductsInCategory(Delegator delegator, List valueObjects, String productCategoryId, String productIdFieldName) throws GenericEntityException { - List newList = new LinkedList(); + List newList = new LinkedList<>(); if (productCategoryId == null) return newList; if (valueObjects == null) return null; @@ -405,13 +405,13 @@ public final class CategoryWorker { String productCategoryId = (String) context.get("productCategoryId"); Map results = ServiceUtil.returnSuccess(); Delegator delegator = dctx.getDelegator(); - List trailElements = new LinkedList(); + List trailElements = new LinkedList<>(); trailElements.add(productCategoryId); String parentProductCategoryId = productCategoryId; while (UtilValidate.isNotEmpty(parentProductCategoryId)) { // find product category rollup try { - List rolllupConds = new LinkedList(); + List rolllupConds = new LinkedList<>(); rolllupConds.add(EntityCondition.makeCondition("productCategoryId", parentProductCategoryId)); rolllupConds.add(EntityUtil.getFilterByDateExpr()); List productCategoryRollups = EntityQuery.use(delegator).from("ProductCategoryRollup").where(rolllupConds).orderBy("sequenceNum").cache(true).queryList(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java index 1e16dd2c29..1e22be17cc 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoCatalogUrlServlet.java @@ -95,7 +95,7 @@ public class SeoCatalogUrlServlet extends HttpServlet { } else if (pathElements.size() > 2) { List trail = CategoryWorker.getTrail(request); if (trail == null) { - trail = new LinkedList(); + trail = new LinkedList<>(); } if (trail.contains(pathElements.get(0))) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java index 873a0e1566..c51f254b18 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoConfigUtil.java @@ -101,13 +101,13 @@ public final class SeoConfigUtil { */ public static void init() { String result = "success"; - seoPatterns = new HashMap(); - seoReplacements = new HashMap(); - forwardReplacements = new HashMap(); - forwardResponseCodes = new HashMap(); - userExceptionPatterns = new LinkedList(); - specialProductIds = new HashMap(); - charFilters = new HashMap(); + seoPatterns = new HashMap<>(); + seoReplacements = new HashMap<>(); + forwardReplacements = new HashMap<>(); + forwardResponseCodes = new HashMap<>(); + userExceptionPatterns = new LinkedList<>(); + specialProductIds = new HashMap<>(); + charFilters = new HashMap<>(); try { URL seoConfigFilename = UtilURL.fromResource(SEO_CONFIG_FILENAME); Document configDoc = UtilXml.readXmlDocument(seoConfigFilename, false); @@ -135,7 +135,7 @@ public final class SeoConfigUtil { if (categoryUrlEnabled) { String allowedContextValue = UtilXml.childElementValue(categoryUrlElement, ELEMENT_ALLOWED_CONTEXT_PATHS, null); - allowedContextPaths = new HashSet(); + allowedContextPaths = new HashSet<>(); if (UtilValidate.isNotEmpty(allowedContextValue)) { List allowedContextPathList = StringUtil.split(allowedContextValue, ALLOWED_CONTEXT_PATHS_SEPERATOR); for (String path : allowedContextPathList) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java index 5a67896e57..a1adffacd9 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/category/SeoContextFilter.java @@ -64,7 +64,7 @@ public class SeoContextFilter implements Filter { private String allowedPaths = ""; private String redirectPath = ""; private String errorCode = ""; - private List allowedPathList = new ArrayList(); + private List allowedPathList = new ArrayList<>(); public void init(FilterConfig config) throws ServletException { this.config = config; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java index d5f45393cf..1dbc80ee4d 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ParametricSearch.java @@ -59,7 +59,7 @@ public class ParametricSearch { } public static Map> makeCategoryFeatureLists(String productCategoryId, Delegator delegator, int perTypeMaxSize) { - Map> productFeaturesByTypeMap = new HashMap>(); + Map> productFeaturesByTypeMap = new HashMap<>(); try { List productFeatureCategoryAppls = EntityQuery.use(delegator).from("ProductFeatureCategoryAppl").where("productCategoryId", productCategoryId).cache(true).queryList(); productFeatureCategoryAppls = EntityUtil.filterByDate(productFeatureCategoryAppls, true); @@ -70,7 +70,7 @@ public class ParametricSearch { String productFeatureTypeId = productFeature.getString("productFeatureTypeId"); Map featuresByType = productFeaturesByTypeMap.get(productFeatureTypeId); if (featuresByType == null) { - featuresByType = new HashMap(); + featuresByType = new HashMap<>(); productFeaturesByTypeMap.put(productFeatureTypeId, featuresByType); } if (featuresByType.size() < perTypeMaxSize) { @@ -95,7 +95,7 @@ public class ParametricSearch { String productFeatureTypeId = productFeature.getString("productFeatureTypeId"); Map featuresByType = productFeaturesByTypeMap.get(productFeatureTypeId); if (featuresByType == null) { - featuresByType = new HashMap(); + featuresByType = new HashMap<>(); productFeaturesByTypeMap.put(productFeatureTypeId, featuresByType); } if (featuresByType.size() < perTypeMaxSize) { @@ -109,7 +109,7 @@ public class ParametricSearch { } // now before returning, order the features in each list by description - Map> productFeaturesByTypeMapSorted = new HashMap>(); + Map> productFeaturesByTypeMapSorted = new HashMap<>(); for (Map.Entry> entry: productFeaturesByTypeMap.entrySet()) { List sortedFeatures = EntityUtil.orderBy(entry.getValue().values(), UtilMisc.toList("description","defaultSequenceNum")); productFeaturesByTypeMapSorted.put(entry.getKey(), sortedFeatures); @@ -122,15 +122,15 @@ public class ParametricSearch { return getAllFeaturesByType(delegator, DEFAULT_PER_TYPE_MAX_SIZE); } public static Map> getAllFeaturesByType(Delegator delegator, int perTypeMaxSize) { - Map> productFeaturesByTypeMap = new HashMap>(); - Set typesWithOverflowMessages = new HashSet(); + Map> productFeaturesByTypeMap = new HashMap<>(); + Set typesWithOverflowMessages = new HashSet<>(); try (EntityListIterator productFeatureEli = EntityQuery.use(delegator).from("ProductFeature").orderBy("description").queryIterator()) { GenericValue productFeature = null; while ((productFeature = productFeatureEli.next()) != null) { String productFeatureTypeId = productFeature.getString("productFeatureTypeId"); List featuresByType = productFeaturesByTypeMap.get(productFeatureTypeId); if (featuresByType == null) { - featuresByType = new LinkedList(); + featuresByType = new LinkedList<>(); productFeaturesByTypeMap.put(productFeatureTypeId, featuresByType); } if (featuresByType.size() > perTypeMaxSize) { @@ -155,7 +155,7 @@ public class ParametricSearch { /** Handles parameters coming in prefixed with "pft_" where the text in the key following the prefix is a productFeatureTypeId and the value is a productFeatureId; meant to be used with drop-downs and such */ public static Map makeFeatureIdByTypeMap(Map parameters) { - Map featureIdByType = new HashMap(); + Map featureIdByType = new HashMap<>(); if (parameters == null) return featureIdByType; @@ -175,7 +175,7 @@ public class ParametricSearch { /** Handles parameters coming in prefixed with "SEARCH_FEAT" where the parameter value is a productFeatureId; meant to be used with text entry boxes or check-boxes and such */ public static List makeFeatureIdListFromPrefixed(Map parameters) { - List featureIdList = new LinkedList(); + List featureIdList = new LinkedList<>(); if (parameters == null) return featureIdList; for (Map.Entry entry: parameters.entrySet()) { @@ -217,7 +217,7 @@ public class ParametricSearch { * meant to be used with text entry boxes or check-boxes and such **/ public static List makeProductFeatureCategoryIdListFromPrefixed(Map parameters) { - List prodFeatureCategoryIdList = new LinkedList(); + List prodFeatureCategoryIdList = new LinkedList<>(); if (parameters == null) return prodFeatureCategoryIdList; for (Map.Entry entry: parameters.entrySet()) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java index 39a411c7e4..7874ec1207 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/feature/ProductFeatureServices.java @@ -97,8 +97,8 @@ public class ProductFeatureServices { if ("ProductFeatureAndAppl".equals(entityToSearch) && productFeatureApplTypeId != null) allFeatures = EntityUtil.filterByAnd(allFeatures, UtilMisc.toMap("productFeatureApplTypeId", productFeatureApplTypeId)); - List featureTypes = new LinkedList(); - Map> featuresByType = new LinkedHashMap>(); + List featureTypes = new LinkedList<>(); + Map> featuresByType = new LinkedHashMap<>(); for (GenericValue feature: allFeatures) { String featureType = feature.getString("productFeatureTypeId"); if (!featureTypes.contains(featureType)) { @@ -106,7 +106,7 @@ public class ProductFeatureServices { } List features = featuresByType.get(featureType); if (features == null) { - features = new LinkedList(); + features = new LinkedList<>(); featuresByType.put(featureType, features); } features.add(feature); @@ -132,7 +132,7 @@ public class ProductFeatureServices { String productId = (String) context.get("productId"); List curProductFeatureAndAppls = UtilGenerics.checkList(context.get("productFeatureAppls")); - List existingVariantProductIds = new LinkedList(); + List existingVariantProductIds = new LinkedList<>(); try { /* @@ -196,20 +196,20 @@ public class ProductFeatureServices { // need to keep 2 lists, oldCombinations and newCombinations, and keep swapping them after each looping. Otherwise, you'll get a // concurrent modification exception - List> oldCombinations = new LinkedList>(); + List> oldCombinations = new LinkedList<>(); // loop through each feature type for (Map.Entry> entry: features.entrySet()) { List currentFeatures = entry.getValue(); - List> newCombinations = new LinkedList>(); + List> newCombinations = new LinkedList<>(); List> combinations; // start with either existing combinations or from scratch if (oldCombinations.size() > 0) { combinations = oldCombinations; } else { - combinations = new LinkedList>(); + combinations = new LinkedList<>(); } // in both cases, use each feature of current feature type's idCode and @@ -219,9 +219,9 @@ public class ProductFeatureServices { if (combinations.size()==0) { for (GenericValue currentFeature: currentFeatures) { if ("SELECTABLE_FEATURE".equals(currentFeature.getString("productFeatureApplTypeId"))) { - Map newCombination = new HashMap(); - List newFeatures = new LinkedList(); - List newFeatureIds = new LinkedList(); + Map newCombination = new HashMap<>(); + List newFeatures = new LinkedList<>(); + List newFeatureIds = new LinkedList<>(); if (currentFeature.getString("idCode") != null) { newCombination.put("defaultVariantProductId", productId + currentFeature.getString("idCode")); } else { @@ -238,7 +238,7 @@ public class ProductFeatureServices { for (Map combination: combinations) { for (GenericValue currentFeature: currentFeatures) { if ("SELECTABLE_FEATURE".equals(currentFeature.getString("productFeatureApplTypeId"))) { - Map newCombination = new HashMap(); + Map newCombination = new HashMap<>(); // .clone() is important, or you'll keep adding to the same List for all the variants // have to cast twice: once from get() and once from clone() List newFeatures = UtilMisc.makeListWritable(UtilGenerics.checkList(combination.get("curProductFeatureAndAppls"))); @@ -263,7 +263,7 @@ public class ProductFeatureServices { } int defaultCodeCounter = 1; - Set defaultVariantProductIds = new HashSet(); // this map will contain the codes already used (as keys) + Set defaultVariantProductIds = new HashSet<>(); // this map will contain the codes already used (as keys) defaultVariantProductIds.add(productId); // now figure out which of these combinations already have productIds associated with them @@ -293,7 +293,7 @@ public class ProductFeatureServices { * Result: products (a List of Product GenericValues) */ public static Map getCategoryVariantProducts(DispatchContext dctx, Map context) { - Map results = new HashMap(); + Map results = new HashMap<>(); LocalDispatcher dispatcher = dctx.getDispatcher(); List productFeatures = UtilGenerics.checkList(context.get("productFeatures")); @@ -312,12 +312,12 @@ public class ProductFeatureServices { List memberProducts = UtilGenerics.checkList(result.get("categoryMembers")); if ((memberProducts != null) && (memberProducts.size() > 0)) { // construct a Map of productFeatureTypeId -> productFeatureId from the productFeatures List - Map featuresByType = new HashMap(); + Map featuresByType = new HashMap<>(); for (GenericValue nextFeature: productFeatures) { featuresByType.put(nextFeature.getString("productFeatureTypeId"), nextFeature.getString("productFeatureId")); } - List products = new LinkedList(); // final list of variant products + List products = new LinkedList<>(); // final list of variant products for (GenericValue memberProduct: memberProducts) { // find variants for each member product of the category diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java index 53ea685084..7d1bd9062f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java @@ -82,7 +82,7 @@ public class PriceServices { public static Map calculateProductPrice(DispatchContext dctx, Map context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = new HashMap<>(); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); GenericValue product = (GenericValue) context.get("product"); @@ -201,7 +201,7 @@ public class PriceServices { BigDecimal amount = (BigDecimal) context.get("amount"); - List productPriceEcList = new LinkedList(); + List productPriceEcList = new LinkedList<>(); productPriceEcList.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)); // this funny statement is for backward compatibility purposes; the productPricePurposeId is a new pk field on the ProductPrice entity and in order databases may not be populated, until the pk is updated and such; this will ease the transition somewhat if ("PURCHASE".equals(productPricePurposeId)) { @@ -333,7 +333,7 @@ public class PriceServices { boolean validPriceFound = false; BigDecimal defaultPrice = BigDecimal.ZERO; - List orderItemPriceInfos = new LinkedList(); + List orderItemPriceInfos = new LinkedList<>(); if (defaultPriceValue != null) { // If a price calc formula (service) is specified, then use it to get the unit price if ("ProductPrice".equals(defaultPriceValue.getEntityName()) && UtilValidate.isNotEmpty(defaultPriceValue.getString("customPriceCalcService"))) { @@ -417,8 +417,8 @@ public class PriceServices { List nonQuantityProductPriceRules = null; if (findAllQuantityPrices) { // split into list with quantity conditions and list without, then iterate through each quantity cond one - quantityProductPriceRules = new LinkedList(); - nonQuantityProductPriceRules = new LinkedList(); + quantityProductPriceRules = new LinkedList<>(); + nonQuantityProductPriceRules = new LinkedList<>(); for (GenericValue productPriceRule: allProductPriceRules) { List productPriceCondList = EntityQuery.use(delegator).from("ProductPriceCond").where("productPriceRuleId", productPriceRule.get("productPriceRuleId")).cache(true).queryList(); @@ -444,12 +444,12 @@ public class PriceServices { } if (findAllQuantityPrices) { - List> allQuantityPrices = new LinkedList>(); + List> allQuantityPrices = new LinkedList<>(); // if findAllQuantityPrices then iterate through quantityProductPriceRules // foreach create an entry in the out list and eval that rule and all nonQuantityProductPriceRules rather than a single rule for (GenericValue quantityProductPriceRule: quantityProductPriceRules) { - List ruleListToUse = new LinkedList(); + List ruleListToUse = new LinkedList<>(); ruleListToUse.add(quantityProductPriceRule); ruleListToUse.addAll(nonQuantityProductPriceRules); @@ -516,7 +516,7 @@ public class PriceServices { if ("true".equals(EntityUtilProperties.getPropertyValue("catalog", "convertProductPriceCurrency", delegator))) { if (UtilValidate.isNotEmpty(currencyDefaultUomId) && UtilValidate.isNotEmpty(currencyUomIdTo) && !currencyDefaultUomId.equals(currencyUomIdTo)) { if (UtilValidate.isNotEmpty(result)) { - Map convertPriceMap = new HashMap(); + Map convertPriceMap = new HashMap<>(); for (Map.Entry entry : result.entrySet()) { BigDecimal tempPrice; switch (entry.getKey()) { @@ -535,7 +535,7 @@ public class PriceServices { } if (tempPrice != null && tempPrice != BigDecimal.ZERO) { - Map priceResults = new HashMap(); + Map priceResults = new HashMap<>(); try { priceResults = dispatcher.runSync("convertUom", UtilMisc. toMap("uomId", currencyDefaultUomId, "uomIdTo", currencyUomIdTo, "originalValue", tempPrice, "defaultDecimalScale", 2L, "defaultRoundingMode", "HalfUp")); @@ -634,7 +634,7 @@ public class PriceServices { // Genercally I don't think that rule sets will get that big though, so the default is optimize for smaller rule set. if (optimizeForLargeRuleSet) { // ========= find all rules that must be run for each input type; this is kind of like a pre-filter to slim down the rules to run ========= - TreeSet productPriceRuleIds = new TreeSet(); + TreeSet productPriceRuleIds = new TreeSet<>(); // ------- These are all of the conditions that DON'T depend on the current inputs ------- @@ -754,7 +754,7 @@ public class PriceServices { } } - productPriceRules = new LinkedList(); + productPriceRules = new LinkedList<>(); for (String productPriceRuleId: productPriceRuleIds) { GenericValue productPriceRule = EntityQuery.use(delegator).from("ProductPriceRule").where("productPriceRuleId", productPriceRuleId).cache().queryOne(); if (productPriceRule == null) continue; @@ -762,7 +762,7 @@ public class PriceServices { } } else { productPriceRules = EntityQuery.use(delegator).from("ProductPriceRule").cache(true).queryList(); - if (productPriceRules == null) productPriceRules = new LinkedList(); + if (productPriceRules == null) productPriceRules = new LinkedList<>(); } return productPriceRules; @@ -774,9 +774,9 @@ public class PriceServices { String webSiteId, String partyId, BigDecimal quantity, String currencyUomId, Delegator delegator, Timestamp nowTimestamp, Locale locale) throws GenericEntityException { - Map calcResults = new HashMap(); + Map calcResults = new HashMap<>(); - List orderItemPriceInfos = new LinkedList(); + List orderItemPriceInfos = new LinkedList<>(); boolean isSale = false; // ========= go through each price rule by id and eval all conditions ========= @@ -1205,9 +1205,9 @@ public class PriceServices { public static Map calculatePurchasePrice(DispatchContext dctx, Map context) { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); - Map result = new HashMap(); + Map result = new HashMap<>(); - List orderItemPriceInfos = new LinkedList(); + List orderItemPriceInfos = new LinkedList<>(); boolean validPriceFound = false; BigDecimal price = BigDecimal.ZERO; diff --git a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java index ccfb59babb..3b1587199f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/product/store/ProductStoreWorker.java @@ -55,7 +55,7 @@ import org.apache.ofbiz.webapp.website.WebSiteWorker; public final class ProductStoreWorker { public static final String module = ProductStoreWorker.class.getName(); - private static Map defaultProductStoreEmailScreenLocation = new HashMap(); + private static Map defaultProductStoreEmailScreenLocation = new HashMap<>(); static { defaultProductStoreEmailScreenLocation.put("PRDS_ODR_CONFIRM", "component://ecommerce/widget/EmailOrderScreens.xml#OrderConfirmNotice"); @@ -257,7 +257,7 @@ public final class ProductStoreWorker { public static List getAvailableStoreShippingMethods(Delegator delegator, String productStoreId, GenericValue shippingAddress, List itemSizes, Map featureIdMap, BigDecimal weight, BigDecimal orderTotal) { if (featureIdMap == null) { - featureIdMap = new HashMap(); + featureIdMap = new HashMap<>(); } List shippingMethods = null; try { @@ -483,7 +483,7 @@ public final class ProductStoreWorker { } public static List getSurveys(Delegator delegator, String productStoreId, String groupName, String productId, String surveyApplTypeId, String parentProductId) { - List surveys = new LinkedList(); + List surveys = new LinkedList<>(); List storeSurveys = null; try { storeSurveys = EntityQuery.use(delegator).from("ProductStoreSurveyAppl").where("productStoreId", productStoreId, "surveyApplTypeId", surveyApplTypeId).orderBy("sequenceNum").cache(true).queryList(); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java index 359212be0c..8ab4770f9b 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSession.java @@ -88,12 +88,12 @@ public class PackingSession implements java.io.Serializable { this.picklistBinId = binId; this.userLogin = userLogin; this.facilityId = facilityId; - this.packLines = new LinkedList(); - this.packEvents = new LinkedList(); - this.itemInfos = new LinkedList(); + this.packLines = new LinkedList<>(); + this.packEvents = new LinkedList<>(); + this.itemInfos = new LinkedList<>(); this.packageSeq = 1; - this.packageWeights = new HashMap(); - this.shipmentBoxTypes = new HashMap(); + this.packageWeights = new HashMap<>(); + this.shipmentBoxTypes = new HashMap<>(); } public PackingSession(LocalDispatcher dispatcher, GenericValue userLogin, String facilityId) { @@ -130,7 +130,7 @@ public class PackingSession implements java.io.Serializable { } // get the reservations for the item - Map invLookup = new HashMap(); + Map invLookup = new HashMap<>(); invLookup.put("orderId", orderId); invLookup.put("orderItemSeqId", orderItemSeqId); invLookup.put("shipGroupSeqId", shipGroupSeqId); @@ -153,7 +153,7 @@ public class PackingSession implements java.io.Serializable { } } else { // more than one reservation found - Map toCreateMap = new HashMap(); + Map toCreateMap = new HashMap<>(); Iterator i = reservations.iterator(); BigDecimal qtyRemain = quantity; @@ -278,7 +278,7 @@ public class PackingSession implements java.io.Serializable { } protected String findOrderItemSeqId(String productId, String orderId, String shipGroupSeqId, BigDecimal quantity) throws GeneralException { - Map lookupMap = new HashMap(); + Map lookupMap = new HashMap<>(); lookupMap.put("orderId", orderId); lookupMap.put("productId", productId); lookupMap.put("statusId", "ITEM_APPROVED"); @@ -291,7 +291,7 @@ public class PackingSession implements java.io.Serializable { if (orderItems != null) { for (GenericValue item: orderItems) { // get the reservations for the item - Map invLookup = new HashMap(); + Map invLookup = new HashMap<>(); invLookup.put("orderId", orderId); invLookup.put("orderItemSeqId", item.getString("orderItemSeqId")); invLookup.put("shipGroupSeqId", shipGroupSeqId); @@ -372,23 +372,23 @@ public class PackingSession implements java.io.Serializable { * @return result Map with packageMap and sortedKeys */ public Map getPackingSessionLinesByPackage() { - Map> packageMap = new HashMap>(); + Map> packageMap = new HashMap<>(); for (PackingSessionLine line : packLines) { int pSeq = line.getPackageSeq(); List packageLineList = packageMap.get(pSeq); if (packageLineList == null) { - packageLineList = new LinkedList(); + packageLineList = new LinkedList<>(); packageMap.put(pSeq, packageLineList); } packageLineList.add(line); } Object[] keys = packageMap.keySet().toArray(); java.util.Arrays.sort(keys); - List sortedKeys = new LinkedList(); + List sortedKeys = new LinkedList<>(); for (Object key : keys) { sortedKeys.add(key); } - Map result = new HashMap(); + Map result = new HashMap<>(); result.put("packageMap", packageMap); result.put("sortedKeys", sortedKeys); return result; @@ -503,7 +503,7 @@ public class PackingSession implements java.io.Serializable { } public List getCurrentShipmentIds(String orderId, String orderItemSeqId, String shipGroupSeqId) { - Set shipmentIds = new HashSet(); + Set shipmentIds = new HashSet<>(); List issues = this.getItemIssuances(orderId, orderItemSeqId, shipGroupSeqId); if (issues != null) { @@ -512,7 +512,7 @@ public class PackingSession implements java.io.Serializable { } } - List retList = new LinkedList(); + List retList = new LinkedList<>(); retList.addAll(shipmentIds); return retList; } @@ -681,7 +681,7 @@ public class PackingSession implements java.io.Serializable { } protected void checkReservations(boolean ignore) throws GeneralException { - List errors = new LinkedList(); + List errors = new LinkedList<>(); for (PackingSessionLine line: this.getLines()) { BigDecimal reservedQty = this.getCurrentReservedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); BigDecimal packedQty = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), line.getShipGroupSeqId(), line.getProductId()); @@ -701,7 +701,7 @@ public class PackingSession implements java.io.Serializable { } protected void checkEmptyLines() throws GeneralException { - List lines = new LinkedList(); + List lines = new LinkedList<>(); lines.addAll(this.getLines()); for (PackingSessionLine l: lines) { if (l.getQuantity().compareTo(BigDecimal.ZERO) == 0) { @@ -724,7 +724,7 @@ public class PackingSession implements java.io.Serializable { throw new IllegalArgumentException("Value for orderId is null"); } - Map lookupMap = new HashMap(); + Map lookupMap = new HashMap<>(); lookupMap.put("orderId", orderId); if (UtilValidate.isNotEmpty(orderItemSeqId)) { lookupMap.put("orderItemSeqId", orderItemSeqId); @@ -744,7 +744,7 @@ public class PackingSession implements java.io.Serializable { protected void createShipment() throws GeneralException { // first create the shipment Delegator delegator = this.getDelegator(); - Map newShipment = new HashMap(); + Map newShipment = new HashMap<>(); newShipment.put("originFacilityId", this.facilityId); newShipment.put("primaryShipGroupSeqId", primaryShipGrp); newShipment.put("primaryOrderId", primaryOrderId); @@ -796,7 +796,7 @@ public class PackingSession implements java.io.Serializable { } protected void issueItemsToShipment() throws GeneralException { - List processedLines = new LinkedList(); + List processedLines = new LinkedList<>(); for (PackingSessionLine line: this.getLines()) { if (this.checkLine(processedLines, line)) { BigDecimal totalPacked = this.getPackedQuantity(line.getOrderId(), line.getOrderItemSeqId(), @@ -823,7 +823,7 @@ public class PackingSession implements java.io.Serializable { for (int i = 0; i < packageSeq; i++) { String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(i+1, 5); - Map pkgCtx = new HashMap(); + Map pkgCtx = new HashMap<>(); pkgCtx.put("shipmentId", shipmentId); pkgCtx.put("shipmentPackageSeqId", shipmentPackageSeqId); pkgCtx.put("shipmentBoxTypeId", getShipmentBoxType(i+1)); @@ -870,7 +870,7 @@ public class PackingSession implements java.io.Serializable { // first find the picklist id GenericValue bin = this.getDelegator().findOne("PicklistBin", UtilMisc.toMap("picklistBinId", picklistBinId), false); if (bin != null) { - Map ctx = new HashMap(); + Map ctx = new HashMap<>(); ctx.put("picklistId", bin.getString("picklistId")); ctx.put("partyId", pickerPartyId); ctx.put("roleTypeId", "PICKER"); @@ -927,7 +927,7 @@ public class PackingSession implements java.io.Serializable { BigDecimal shipmentCostEstimate = null; Map serviceResult = null; try { - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); serviceContext.put("shippingContactMechId", shippingContactMechId); serviceContext.put("shipmentMethodTypeId", shipmentMethodTypeId); serviceContext.put("carrierPartyId", carrierPartyId); @@ -935,7 +935,7 @@ public class PackingSession implements java.io.Serializable { serviceContext.put("productStoreId", productStoreId); if (UtilValidate.isEmpty(shippableItemInfo)) { - shippableItemInfo = new LinkedList(); + shippableItemInfo = new LinkedList<>(); for (PackingSessionLine line: getLines()) { List oiasgas = getDelegator().findByAnd("OrderItemAndShipGroupAssoc", UtilMisc.toMap("orderId", line.getOrderId(), "orderItemSeqId", line.getOrderItemSeqId(), "shipGroupSeqId", line.getShipGroupSeqId()), null, false); shippableItemInfo.addAll(oiasgas); @@ -992,7 +992,7 @@ public class PackingSession implements java.io.Serializable { } public List getPackageSeqIds() { - Set packageSeqIds = new TreeSet(); + Set packageSeqIds = new TreeSet<>(); if (! UtilValidate.isEmpty(this.getLines())) { for (PackingSessionLine line: this.getLines()) { packageSeqIds.add(line.getPackageSeq()); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java index 2fd4fcc72b..92d5109ef0 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/packing/PackingSessionLine.java @@ -181,7 +181,7 @@ public class PackingSessionLine implements java.io.Serializable { quantity = this.getQuantity(); } - Map issueMap = new HashMap(); + Map issueMap = new HashMap<>(); issueMap.put("shipmentId", shipmentId); issueMap.put("orderId", this.getOrderId()); issueMap.put("orderItemSeqId", this.getOrderItemSeqId()); @@ -206,7 +206,7 @@ public class PackingSessionLine implements java.io.Serializable { // find the pick list item Debug.logInfo("Looking up picklist item for bin ID #" + picklistBinId, module); Delegator delegator = dispatcher.getDelegator(); - Map itemLookup = new HashMap(); + Map itemLookup = new HashMap<>(); itemLookup.put("picklistBinId", picklistBinId); itemLookup.put("orderId", this.getOrderId()); itemLookup.put("orderItemSeqId", this.getOrderItemSeqId()); @@ -243,7 +243,7 @@ public class PackingSessionLine implements java.io.Serializable { // assign item to package String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(this.getPackageSeq(), 5); - Map packageMap = new HashMap(); + Map packageMap = new HashMap<>(); packageMap.put("shipmentId", shipmentId); packageMap.put("shipmentItemSeqId", this.getShipmentItemSeqId()); packageMap.put("quantity", this.getQuantity()); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/picklist/PickListServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/picklist/PickListServices.java index 242c6befbf..acaa947076 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/picklist/PickListServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/picklist/PickListServices.java @@ -49,8 +49,8 @@ public class PickListServices { if (orderHeaderList == null) { // convert the ID list to headers if (orderIdList != null) { - List conditionList1 = new LinkedList(); - List conditionList2 = new LinkedList(); + List conditionList1 = new LinkedList<>(); + List conditionList2 = new LinkedList<>(); // we are only concerned about approved sales orders conditionList2.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ORDER_APPROVED")); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java index 192e6482c6..c6a8f3139f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentServices.java @@ -65,10 +65,10 @@ public class ShipmentServices { public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); public static Map createShipmentEstimate(DispatchContext dctx, Map context) { - Map result = new HashMap(); + Map result = new HashMap<>(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); - List storeAll = new LinkedList(); + List storeAll = new LinkedList<>(); String productStoreShipMethId = (String)context.get("productStoreShipMethId"); GenericValue productStoreShipMeth = null; @@ -292,7 +292,7 @@ public class ShipmentServices { shipAddress.set("postalCodeGeoId", shippingPostalCode); } // Get the possible estimates. - List estimateList = new LinkedList(); + List estimateList = new LinkedList<>(); for (GenericValue thisEstimate: estimates) { try { @@ -370,8 +370,8 @@ public class ShipmentServices { } // make the shippable item size/feature objects - List shippableItemSizes = new LinkedList(); - Map shippableFeatureMap = new HashMap(); + List shippableItemSizes = new LinkedList<>(); + Map shippableFeatureMap = new HashMap<>(); if (shippableItemInfo != null) { for (Map itemMap: shippableItemInfo) { // add the item sizes @@ -412,7 +412,7 @@ public class ShipmentServices { int estimateIndex = 0; if (estimateList.size() > 1) { - TreeMap estimatePriority = new TreeMap(); + TreeMap estimatePriority = new TreeMap<>(); for (GenericValue currentEstimate: estimateList) { int prioritySum = 0; @@ -615,7 +615,7 @@ public class ShipmentServices { GenericValue routeSeg = EntityUtil.getFirst(routeSegs); // to store list - List toStore = new LinkedList(); + List toStore = new LinkedList<>(); // make the staging records GenericValue stageShip = delegator.makeValue("OdbcShipmentOut"); @@ -667,7 +667,7 @@ public class ShipmentServices { Delegator delegator = dctx.getDelegator(); GenericValue userLogin = (GenericValue) context.get("userLogin"); Locale locale = (Locale) context.get("locale"); - Map shipmentMap = new HashMap(); + Map shipmentMap = new HashMap<>(); EntityQuery eq = EntityQuery.use(delegator) .from("OdbcPackageIn") @@ -704,7 +704,7 @@ public class ShipmentServices { delegator.store(rtSeg); } - Map pkgCtx = new HashMap(); + Map pkgCtx = new HashMap<>(); pkgCtx.put("shipmentId", shipmentId); pkgCtx.put("shipmentPackageSeqId", packageSeqId); @@ -755,7 +755,7 @@ public class ShipmentServices { for (Map.Entry entry: shipmentMap.entrySet()) { String shipmentId = entry.getKey(); String voidInd = entry.getValue(); - Map shipCtx = new HashMap(); + Map shipCtx = new HashMap<>(); shipCtx.put("shipmentId", shipmentId); if ("Y".equals(voidInd)) { shipCtx.put("statusId", "SHIPMENT_CANCELLED"); @@ -836,7 +836,7 @@ public class ShipmentServices { } // store the quantity of each product shipped in a hashmap keyed to productId - Map shippedCountMap = new HashMap(); + Map shippedCountMap = new HashMap<>(); for (GenericValue item: shipmentAndItems) { BigDecimal shippedQuantity = item.getBigDecimal("quantity"); BigDecimal quantity = shippedCountMap.get(item.getString("productId")); @@ -845,7 +845,7 @@ public class ShipmentServices { } // store the quantity of each product received in a hashmap keyed to productId - Map receivedCountMap = new HashMap(); + Map receivedCountMap = new HashMap<>(); for (GenericValue item: shipmentReceipts) { BigDecimal receivedQuantity = item.getBigDecimal("quantityAccepted"); BigDecimal quantity = receivedCountMap.get(item.getString("productId")); @@ -1052,7 +1052,7 @@ public class ShipmentServices { Locale localePar = (Locale) context.get("locale"); // prepare the shipment information - Map sendMap = new HashMap(); + Map sendMap = new HashMap<>(); GenericValue shipment = null ; GenericValue orderHeader = null; try { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java index 5b8abcdd4b..96f3975ce7 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/shipment/ShipmentWorker.java @@ -110,7 +110,7 @@ public final class ShipmentWorker { public static List> getPackageSplit(DispatchContext dctx, List> shippableItemInfo, BigDecimal maxWeight) { // create the package list w/ the first package - List> packages = new LinkedList>(); + List> packages = new LinkedList<>(); if (UtilValidate.isNotEmpty(shippableItemInfo)) { for (Map itemInfo: shippableItemInfo) { @@ -128,7 +128,7 @@ public final class ShipmentWorker { BigDecimal partialQty = pieces > 1 ? BigDecimal.ONE.divide(BigDecimal.valueOf(pieces), generalRounding) : BigDecimal.ONE; for (long x = 0; x < pieces; x++) { if (weight.compareTo(maxWeight) >= 0) { - Map newPackage = new HashMap(); + Map newPackage = new HashMap<>(); newPackage.put(productId, partialQty); packages.add(newPackage); } else if (totalWeight.compareTo(BigDecimal.ZERO) > 0) { @@ -151,7 +151,7 @@ public final class ShipmentWorker { } } if (!addedToPackage) { - Map packageMap = new HashMap(); + Map packageMap = new HashMap<>(); packageMap.put(productId, partialQty); packages.add(packageMap); } @@ -186,7 +186,7 @@ public final class ShipmentWorker { } if (!"WT_lb".equals(weightUomId)) { // attempt a conversion to pounds - Map result = new HashMap(); + Map result = new HashMap<>(); try { result = dispatcher.runSync("convertUom", UtilMisc.toMap("uomId", weightUomId, "uomIdTo", "WT_lb", "originalValue", productWeight)); if (ServiceUtil.isError(result)) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java index ca649ca605..043ed41e38 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/dhl/DhlServices.java @@ -243,7 +243,7 @@ public class DhlServices { "FacilityShipmentDhlShipmentTemplateLocationNotFound", locale)); } StringWriter outWriter = new StringWriter(); - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("action", "RateEstimate"); inContext.put("userid", userid); inContext.put("password", password); @@ -319,8 +319,8 @@ public class DhlServices { * Parses an XML document from DHL to get the rate estimate */ public static Map handleDhlRateResponse(Document rateResponseDocument, Locale locale) { - List errorList = new LinkedList(); - Map dhlRateCodeMap = new HashMap(); + List errorList = new LinkedList<>(); + Map dhlRateCodeMap = new HashMap<>(); // process RateResponse Element rateResponseElement = rateResponseDocument.getDocumentElement(); DhlServices.handleErrors(rateResponseElement, errorList, locale); @@ -355,10 +355,10 @@ public class DhlServices { List chargeNodeList = UtilXml.childElementList(responseChargesElement, "Charge"); - List> chargeList = new LinkedList>(); + List> chargeList = new LinkedList<>(); if (UtilValidate.isNotEmpty(chargeNodeList)) { for (Element responseChargeElement: chargeNodeList) { - Map charge = new HashMap(); + Map charge = new HashMap<>(); Element responseChargeTypeElement = UtilXml.firstChildElement( responseChargeElement, "Type"); @@ -471,7 +471,7 @@ public class DhlServices { * Parse response from DHL registration request to get shipping key */ public static Map handleDhlRegisterResponse(Document registerResponseDocument, Locale locale) { - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); // process RegisterResponse Element registerResponseElement = registerResponseDocument.getDocumentElement(); DhlServices.handleErrors(registerResponseElement, errorList, locale); @@ -732,7 +732,7 @@ public class DhlServices { "FacilityShipmentDhlRateEstimateTemplateNotConfigured", locale)); } StringWriter outWriter = new StringWriter(); - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("action", "GenerateLabel"); inContext.put("userid", userid); inContext.put("password", password); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java index 866612de01..a51284271f 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java @@ -152,7 +152,7 @@ public class FedexServices { String shipmentGatewayConfigId = (String) context.get("shipmentGatewayConfigId"); String resource = (String) context.get("configProps"); Locale locale = (Locale) context.get("locale"); - List errorList = new LinkedList (); + List errorList = new LinkedList<> (); Boolean replaceMeterNumber = (Boolean) context.get("replaceMeterNumber"); @@ -168,7 +168,7 @@ public class FedexServices { String companyPartyId = (String) context.get("companyPartyId"); String contactPartyName = (String) context.get("contactPartyName"); - Map result = new HashMap(); + Map result = new HashMap<>(); String accountNumber = getShipmentGatewayConfigValue(delegator, shipmentGatewayConfigId, "accessAccountNbr", resource, "shipment.fedex.access.accountNbr"); if (UtilValidate.isEmpty(accountNumber)) { @@ -214,7 +214,7 @@ public class FedexServices { .queryList(); // Get the first valid postal address (address1, city, postalCode and countryGeoId are required by Fedex) - List postalAddressConditions = new LinkedList(); + List postalAddressConditions = new LinkedList<>(); postalAddressConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "POSTAL_ADDRESS")); postalAddressConditions.add(EntityCondition.makeCondition("address1", EntityOperator.NOT_EQUAL, null)); postalAddressConditions.add(EntityCondition.makeCondition("address1", EntityOperator.NOT_EQUAL, "")); @@ -254,7 +254,7 @@ public class FedexServices { } // Get the first valid primary phone number (required by Fedex) - List phoneNumberConditions = new LinkedList(); + List phoneNumberConditions = new LinkedList<>(); phoneNumberConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "TELECOM_NUMBER")); phoneNumberConditions.add(EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.EQUALS, "PRIMARY_PHONE")); phoneNumberConditions.add(EntityCondition.makeCondition("areaCode", EntityOperator.NOT_EQUAL, null)); @@ -278,7 +278,7 @@ public class FedexServices { phoneNumber = phoneNumber.replaceAll("[^+\\d]", ""); // Get the first valid fax number - List faxNumberConditions = new LinkedList(); + List faxNumberConditions = new LinkedList<>(); faxNumberConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "TELECOM_NUMBER")); faxNumberConditions.add(EntityCondition.makeCondition("contactMechPurposeTypeId", EntityOperator.EQUALS, "FAX_NUMBER")); faxNumberConditions.add(EntityCondition.makeCondition("areaCode", EntityOperator.NOT_EQUAL, null)); @@ -297,7 +297,7 @@ public class FedexServices { } // Get the first valid email address - List emailConditions = new LinkedList(); + List emailConditions = new LinkedList<>(); emailConditions.add(EntityCondition.makeCondition("contactMechTypeId", EntityOperator.EQUALS, "EMAIL_ADDRESS")); emailConditions.add(EntityCondition.makeCondition("infoString", EntityOperator.NOT_EQUAL, null)); emailConditions.add(EntityCondition.makeCondition("infoString", EntityOperator.NOT_EQUAL, "")); @@ -316,7 +316,7 @@ public class FedexServices { } // Populate the Freemarker context - Map subscriptionRequestContext = new HashMap(); + Map subscriptionRequestContext = new HashMap<>(); subscriptionRequestContext.put("AccountNumber", accountNumber); subscriptionRequestContext.put("PersonName", contactPartyName); subscriptionRequestContext.put("CompanyName", companyName); @@ -474,7 +474,7 @@ public class FedexServices { } try { - Map shipRequestContext = new HashMap(); + Map shipRequestContext = new HashMap<>(); // Get the shipment and the shipmentRouteSegment GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", shipmentId).queryOne(); @@ -981,7 +981,7 @@ public class FedexServices { */ public static Map handleFedexShipReply(String fDXShipReplyString, GenericValue shipmentRouteSegment, List shipmentPackageRouteSegs, Locale locale) throws GenericEntityException { - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); GenericValue shipmentPackageRouteSeg = shipmentPackageRouteSegs.get(0); Document fdxShipReplyDocument = null; diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java index 1a7c10068f..3a4b55b76b 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/ups/UpsServices.java @@ -79,8 +79,8 @@ public class UpsServices { public final static String module = UpsServices.class.getName(); - private static final Map unitsUpsToOfbiz = new HashMap(); - private static final Map unitsOfbizToUps = new HashMap(); + private static final Map unitsUpsToOfbiz = new HashMap<>(); + private static final Map unitsOfbizToUps = new HashMap<>(); static { unitsUpsToOfbiz.put("LBS", "WT_lb"); unitsUpsToOfbiz.put("KGS", "WT_kg"); @@ -214,7 +214,7 @@ public class UpsServices { } List itemIssuances = shipment.getRelated("ItemIssuance", null, null, false); - Set orderIdSet = new TreeSet(); + Set orderIdSet = new TreeSet<>(); for (GenericValue itemIssuance: itemIssuances) { orderIdSet.add(itemIssuance.getString("orderId")); } @@ -707,7 +707,7 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(shipmentConfirmResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); if ("1".equals(responseStatusCode)) { @@ -979,7 +979,7 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(shipmentAcceptResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); if ("1".equals(responseStatusCode)) { @@ -1349,7 +1349,7 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(voidShipmentResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); // handle other response elements @@ -1546,7 +1546,7 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(trackResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); if ("1".equals(responseStatusCode)) { @@ -1745,12 +1745,12 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(rateResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); if ("1".equals(responseStatusCode)) { List rates = UtilXml.childElementList(rateResponseElement, "RatedShipment"); - Map rateMap = new HashMap(); + Map rateMap = new HashMap<>(); BigDecimal firstRate = null; if (UtilValidate.isEmpty(rates)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, @@ -2234,17 +2234,17 @@ public class UpsServices { Element responseElement = UtilXml.firstChildElement(avResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); if ("1".equals(responseStatusCode)) { - List> matches = new LinkedList>(); + List> matches = new LinkedList<>(); List avResultList = UtilXml.childElementList(avResponseElement, "AddressValidationResult"); // TODO: return error if there are no matches? if (UtilValidate.isNotEmpty(avResultList)) { for (Element avResultElement: avResultList) { - Map match = new HashMap(); + Map match = new HashMap<>(); match.put("Rank", UtilXml.childElementValue(avResultElement, "Rank")); match.put("Quality", UtilXml.childElementValue(avResultElement, "Quality")); @@ -2571,7 +2571,7 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(shipmentConfirmResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); if (!"1".equals(responseStatusCode)) { errorList.add(0, UtilProperties.getMessage(resourceError, "FacilityShipmentUpsShipmentConfirmFailedForReturnShippingLabel", locale)); @@ -2678,7 +2678,7 @@ public class UpsServices { Locale locale = (Locale) context.get("locale"); String rateResponseString = null; String productStoreId = (String) context.get("productStoreId"); - List> shippingRates = new LinkedList>(); + List> shippingRates = new LinkedList<>(); GenericValue shipmentRouteSegment = null; Map shipmentGatewayConfig = ShipmentServices.getShipmentGatewayConfigFromShipment(delegator, shipmentId, locale); String shipmentGatewayConfigId = (String) shipmentGatewayConfig.get("shipmentGatewayConfigId"); @@ -2985,7 +2985,7 @@ public class UpsServices { List productStoreShipmentMethods = EntityQuery.use(delegator).from("ProductStoreShipmentMethView").where("productStoreId", productStoreId).queryList(); for (GenericValue productStoreShipmentMethod :productStoreShipmentMethods) { if ("UPS".equals(productStoreShipmentMethod.get("partyId"))) { - Map thisUpsRateCodeMap = new HashMap(); + Map thisUpsRateCodeMap = new HashMap<>(); carrierShipmentMethod = EntityQuery.use(delegator).from("CarrierShipmentMethod") .where("shipmentMethodTypeId", productStoreShipmentMethod.getString("shipmentMethodTypeId"), "partyId", productStoreShipmentMethod.getString("partyId"), "roleTypeId", productStoreShipmentMethod.getString("roleTypeId")) .queryOne(); @@ -3017,13 +3017,13 @@ public class UpsServices { // handle Response element info Element responseElement = UtilXml.firstChildElement(rateResponseElement, "Response"); String responseStatusCode = UtilXml.childElementValue(responseElement, "ResponseStatusCode"); - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); UpsServices.handleErrors(responseElement, errorList, locale); String totalRates = null; if ("1".equals(responseStatusCode)) { List rates = UtilXml.childElementList(rateResponseElement, "RatedShipment"); - Map rateMap = new HashMap(); + Map rateMap = new HashMap<>(); if (UtilValidate.isEmpty(rates)) { return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "FacilityShipmentUpsNoRateAvailable", locale)); } else { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java index 30627e4f0f..a9e9029644 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java @@ -76,7 +76,7 @@ public class UspsServices { public final static String module = UspsServices.class.getName(); public final static String resourceError = "ProductUiLabels"; - private static List domesticCountries = new LinkedList(); + private static List domesticCountries = new LinkedList<>(); // Countries treated as domestic for rate enquiries static { domesticCountries.add("USA"); @@ -483,7 +483,7 @@ public class UspsServices { List detailElementList = UtilXml.childElementList(trackInfoElement, "TrackDetail"); if (UtilValidate.isNotEmpty(detailElementList)) { - List trackingDetailList = new LinkedList(); + List trackingDetailList = new LinkedList<>(); for (Element detailElement: detailElementList) { trackingDetailList.add(UtilXml.elementValue(detailElement)); } diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java index 69336d939d..6ff188a230 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServicesTests.java @@ -186,7 +186,7 @@ public class UspsServicesTests extends OFBizTestCase { public void testUspsDomesticRate() throws Exception { // prepare the context - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("service", "Priority"); context.put("originZip", "20770"); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java index 86f43fd0d1..54892637da 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickServices.java @@ -88,7 +88,7 @@ public class VerifyPickServices { String orderId = (String) context.get("orderId"); try { shipmentId = pickSession.complete(orderId, locale); - Map shipment = new HashMap(); + Map shipment = new HashMap<>(); shipment.put("shipmentId", shipmentId); pickSession.clearAllRows(); return shipment; diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java index 5561dfc1fc..241fa8b041 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSession.java @@ -66,7 +66,7 @@ public class VerifyPickSession implements Serializable { this._delegator = _dispatcher.getDelegator(); this.delegatorName = _delegator.getDelegatorName(); this.userLogin = userLogin; - this.pickRows = new LinkedList(); + this.pickRows = new LinkedList<>(); } public LocalDispatcher getDispatcher() { @@ -90,7 +90,7 @@ public class VerifyPickSession implements Serializable { } // get the reservations for the item - Map inventoryLookupMap = new HashMap(); + Map inventoryLookupMap = new HashMap<>(); inventoryLookupMap.put("orderId", orderId); inventoryLookupMap.put("orderItemSeqId", orderItemSeqId); inventoryLookupMap.put("shipGroupSeqId", shipGroupSeqId); @@ -107,7 +107,7 @@ public class VerifyPickSession implements Serializable { this.createVerifyPickRow(checkCode, reservation, orderId, orderItemSeqId, shipGroupSeqId, productId, originGeoId, quantity, locale); } else { // more than one reservation found - Map reserveQtyMap = new HashMap(); + Map reserveQtyMap = new HashMap<>(); BigDecimal qtyRemain = quantity; for (GenericValue reservation : reservations) { @@ -154,7 +154,7 @@ public class VerifyPickSession implements Serializable { protected String findOrderItemSeqId(String productId, String orderId, String shipGroupSeqId, BigDecimal quantity, Locale locale) throws GeneralException { - Map orderItemLookupMap = new HashMap(); + Map orderItemLookupMap = new HashMap<>(); orderItemLookupMap.put("orderId", orderId); orderItemLookupMap.put("productId", productId); orderItemLookupMap.put("statusId", "ITEM_APPROVED"); @@ -166,7 +166,7 @@ public class VerifyPickSession implements Serializable { if (orderItems != null) { for (GenericValue orderItem : orderItems) { // get the reservations for the item - Map inventoryLookupMap = new HashMap(); + Map inventoryLookupMap = new HashMap<>(); inventoryLookupMap.put("orderId", orderId); inventoryLookupMap.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); inventoryLookupMap.put("shipGroupSeqId", shipGroupSeqId); @@ -256,7 +256,7 @@ public class VerifyPickSession implements Serializable { } public List getPickRows(String orderId) { - List pickVerifyRows = new LinkedList(); + List pickVerifyRows = new LinkedList<>(); for (VerifyPickSessionRow line: this.getPickRows()) { if (orderId.equals(line.getOrderId())) { pickVerifyRows.add(line); @@ -311,7 +311,7 @@ public class VerifyPickSession implements Serializable { this.updateProduct(); // Update the shipment status to Picked, this will trigger createInvoicesFromShipment and finally a invoice will be created - Map updateShipmentCtx = new HashMap(); + Map updateShipmentCtx = new HashMap<>(); updateShipmentCtx.put("shipmentId", shipmentId); updateShipmentCtx.put("statusId", "SHIPMENT_PICKED"); updateShipmentCtx.put("userLogin", this.getUserLogin()); @@ -324,7 +324,7 @@ public class VerifyPickSession implements Serializable { } protected void checkReservedQty(String orderId, Locale locale) throws GeneralException { - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); for (VerifyPickSessionRow pickRow : this.getPickRows(orderId)) { BigDecimal reservedQty = this.getReservedQty(pickRow.getOrderId(), pickRow.getOrderItemSeqId(), pickRow.getShipGroupSeqId()); BigDecimal verifiedQty = this.getReadyToVerifyQuantity(pickRow.getOrderId(), pickRow.getOrderItemSeqId()); @@ -369,7 +369,7 @@ public class VerifyPickSession implements Serializable { } protected void issueItemsToShipment(String shipmentId, Locale locale) throws GeneralException { - List processedRows = new LinkedList(); + List processedRows = new LinkedList<>(); for (VerifyPickSessionRow pickRow : this.getPickRows()) { if (this.checkLine(processedRows, pickRow)) { BigDecimal totalVerifiedQty = this.getVerifiedQuantity(pickRow.getOrderId(), pickRow.getOrderItemSeqId(), pickRow.getShipGroupSeqId(), pickRow.getProductId(), pickRow.getInventoryItemId()); @@ -392,7 +392,7 @@ public class VerifyPickSession implements Serializable { protected String createShipment(VerifyPickSessionRow line) throws GeneralException { Delegator delegator = this.getDelegator(); String orderId = line.getOrderId(); - Map newShipment = new HashMap(); + Map newShipment = new HashMap<>(); newShipment.put("originFacilityId", facilityId); newShipment.put("primaryShipGroupSeqId", line.getShipGroupSeqId()); newShipment.put("primaryOrderId", orderId); @@ -434,7 +434,7 @@ public class VerifyPickSession implements Serializable { protected void updateProduct() throws GeneralException { for (VerifyPickSessionRow pickRow : this.getPickRows()) { if (UtilValidate.isNotEmpty(pickRow.getOriginGeoId())) { - Map updateProductCtx = new HashMap(); + Map updateProductCtx = new HashMap<>(); updateProductCtx.put("originGeoId", pickRow.getOriginGeoId()); updateProductCtx.put("productId", pickRow.getProductId()); updateProductCtx.put("userLogin", this.getUserLogin()); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSessionRow.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSessionRow.java index e7c43274cb..882646af57 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSessionRow.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/verify/VerifyPickSessionRow.java @@ -126,7 +126,7 @@ public class VerifyPickSessionRow implements Serializable { quantity = this.getReadyToVerifyQty(); } - Map issueOrderItemMap = new HashMap(); + Map issueOrderItemMap = new HashMap<>(); issueOrderItemMap.put("shipmentId", shipmentId); issueOrderItemMap.put("orderId", this.getOrderId()); issueOrderItemMap.put("orderItemSeqId", this.getOrderItemSeqId()); @@ -150,7 +150,7 @@ public class VerifyPickSessionRow implements Serializable { if (picklistBinId != null) { // find the pick list item Delegator delegator = dispatcher.getDelegator(); - Map picklistItemMap = new HashMap(); + Map picklistItemMap = new HashMap<>(); picklistItemMap.put("picklistBinId", picklistBinId); picklistItemMap.put("orderId", this.getOrderId()); picklistItemMap.put("orderItemSeqId", this.getOrderItemSeqId()); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java index 1e4f2fda77..dc06a3969e 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageServices.java @@ -147,7 +147,7 @@ public class WeightPackageServices { weightPackageSession.setEstimatedShipCost(estimatedShippingCost); weightPackageSession.setActualShipCost(newEstimatedShippingCost); - Map response = new HashMap(); + Map response = new HashMap<>(); try { String getActualShippingQuoteFromUps = EntityUtilProperties.getPropertyValue("shipment", "shipment.ups.shipping", "N", delegator); String result = weightPackageSession.complete(orderId, locale, getActualShippingQuoteFromUps); @@ -172,7 +172,7 @@ public class WeightPackageServices { String shipmentId = (String) context.get("shipmentId"); String orderId = (String) context.get("orderId"); - Map response = new HashMap(); + Map response = new HashMap<>(); try { String getActualShippingQuoteFromUps = EntityUtilProperties.getPropertyValue("shipment", "shipment.ups.shipping", "N", delegator); if (weightPackageSession.completeShipment(orderId, getActualShippingQuoteFromUps)) { diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java index 804ac5c705..ea25497bca 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSession.java @@ -84,7 +84,7 @@ public class WeightPackageSession implements Serializable { this.picklistBinId = picklistBinId; this.userLogin = userLogin; this.facilityId = facilityId; - this.weightPackageLines = new LinkedList(); + this.weightPackageLines = new LinkedList<>(); } public WeightPackageSession(LocalDispatcher dispatcher, GenericValue userLogin, String facilityId) { @@ -215,7 +215,7 @@ public class WeightPackageSession implements Serializable { } public List getPackedLines(String orderId) { - List packedLines = new LinkedList(); + List packedLines = new LinkedList<>(); if (UtilValidate.isNotEmpty(orderId)) { for (WeightPackageSessionLine packedLine: this.getPackedLines()) { if (orderId.equals(packedLine.getOrderId())) @@ -355,7 +355,7 @@ public class WeightPackageSession implements Serializable { List shipmentRouteSegments = EntityQuery.use(delegator).from("ShipmentRouteSegment").where("shipmentId", shipmentId).queryList(); if (UtilValidate.isNotEmpty(shipmentRouteSegments)) { for (GenericValue shipmentRouteSegment : shipmentRouteSegments) { - Map shipmentRouteSegmentMap = new HashMap(); + Map shipmentRouteSegmentMap = new HashMap<>(); shipmentRouteSegmentMap.put("shipmentId", shipmentId); shipmentRouteSegmentMap.put("shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId")); shipmentRouteSegmentMap.put("userLogin", userLogin); @@ -374,7 +374,7 @@ public class WeightPackageSession implements Serializable { List shipmentRouteSegments = this.getDelegator().findByAnd("ShipmentRouteSegment", UtilMisc.toMap("shipmentId", shipmentId), null, false); if (UtilValidate.isNotEmpty(shipmentRouteSegments)) { for (GenericValue shipmentRouteSegment : shipmentRouteSegments) { - Map shipmentRouteSegmentMap = new HashMap(); + Map shipmentRouteSegmentMap = new HashMap<>(); shipmentRouteSegmentMap.put("shipmentId", shipmentId); shipmentRouteSegmentMap.put("shipmentRouteSegmentId", shipmentRouteSegment.getString("shipmentRouteSegmentId")); shipmentRouteSegmentMap.put("userLogin", userLogin); @@ -403,7 +403,7 @@ public class WeightPackageSession implements Serializable { for (WeightPackageSessionLine packedLine : this.getPackedLines(orderId)) { String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(++shipPackSeqId, 5); - Map shipmentPackageMap = new HashMap(); + Map shipmentPackageMap = new HashMap<>(); shipmentPackageMap.put("shipmentId", shipmentId); shipmentPackageMap.put("shipmentPackageSeqId", shipmentPackageSeqId); shipmentPackageMap.put("weight", packedLine.getPackageWeight()); @@ -439,7 +439,7 @@ public class WeightPackageSession implements Serializable { for (GenericValue orderItem : orderItems) { List orderItemShipGrpInvReserves = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false); if (UtilValidate.isEmpty(orderItemShipGrpInvReserves)) { - Map orderItemStatusMap = new HashMap(); + Map orderItemStatusMap = new HashMap<>(); orderItemStatusMap.put("orderId", orderId); orderItemStatusMap.put("orderItemSeqId", orderItem.getString("orderItemSeqId")); orderItemStatusMap.put("userLogin", userLogin); @@ -477,7 +477,7 @@ public class WeightPackageSession implements Serializable { } protected void setShipmentToPacked() throws GeneralException { - Map shipmentMap = new HashMap(); + Map shipmentMap = new HashMap<>(); shipmentMap.put("shipmentId", shipmentId); shipmentMap.put("statusId", "SHIPMENT_PACKED"); shipmentMap.put("userLogin", userLogin); @@ -497,7 +497,7 @@ public class WeightPackageSession implements Serializable { BigDecimal shipmentCostEstimate = BigDecimal.ZERO; Map shipCostEstimateResult = null; try { - Map shipCostEstimateMap = new HashMap(); + Map shipCostEstimateMap = new HashMap<>(); shipCostEstimateMap.put("shippingContactMechId", shippingContactMechId); shipCostEstimateMap.put("shipmentMethodTypeId", shipmentMethodTypeId); shipCostEstimateMap.put("carrierPartyId", carrierPartyId); diff --git a/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSessionLine.java b/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSessionLine.java index efbcaa5ade..a0dc4efb62 100644 --- a/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSessionLine.java +++ b/applications/product/src/main/java/org/apache/ofbiz/shipment/weightPackage/WeightPackageSessionLine.java @@ -117,7 +117,7 @@ public class WeightPackageSessionLine implements java.io.Serializable { protected void applyLineToPackage(String shipmentId, GenericValue userLogin, LocalDispatcher dispatcher, int shipPackSeqId) throws GeneralException { String shipmentPackageSeqId = UtilFormatOut.formatPaddedNumber(shipPackSeqId, 5); - Map packageMap = new HashMap(); + Map packageMap = new HashMap<>(); packageMap.put("shipmentId", shipmentId); packageMap.put("shipmentItemSeqId", this.getShipmentItemSeqId()); // quanity given, by defult one because it is a required field diff --git a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java index b56e82072c..dfdf00a6fb 100644 --- a/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java +++ b/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/content/WorkEffortContentWrapper.java @@ -302,7 +302,7 @@ public class WorkEffortContentWrapper implements ContentWrapper { } if (workEffortContent != null) { // when rendering the product content, always include the Product and ProductContent records that this comes from - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("workEffort", workEffort); inContext.put("workEffortContent", workEffortContent); ContentWorker.renderContentAsText(dispatcher, workEffortContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); @@ -334,11 +334,11 @@ public class WorkEffortContentWrapper implements ContentWrapper { .filterByDate() .queryList(); - List contentList = new LinkedList(); + List contentList = new LinkedList<>(); if (partyContentList != null) { for (GenericValue workEffortContent: partyContentList) { StringWriter outWriter = new StringWriter(); - Map inContext = new HashMap(); + Map inContext = new HashMap<>(); inContext.put("workEffort", workEffort); inContext.put("workEffortContent", workEffortContent); ContentWorker.renderContentAsText(dispatcher, workEffortContent.getString("contentId"), outWriter, inContext, locale, mimeTypeId, null, null, false); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/MiscTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/MiscTests.java index 55844a7b83..9eeebe9ae5 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/MiscTests.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/MiscTests.java @@ -74,10 +74,10 @@ public class MiscTests extends GenericTestCaseBase { BigDecimal bigDecimal = new BigDecimal("1.234"); URL url = new URL("http://ofbiz.apache.org"); List baseList = UtilMisc.toList("a", "1", "b", "2", "c", "3"); - List arrayList = new ArrayList(); + List arrayList = new ArrayList<>(); arrayList.addAll(baseList); Map baseMap = UtilMisc.toMap("a", "1", "b", "2", "c", "3"); - Map hashMap = new HashMap(); + Map hashMap = new HashMap<>(); hashMap.putAll(baseMap); Object[] testObjects = new Object[] { string, diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestJSONConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestJSONConverters.java index a3e67a0e4e..0750227ae6 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestJSONConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/test/TestJSONConverters.java @@ -44,7 +44,7 @@ public class TestJSONConverters extends TestCase { public void testJSONToMap() throws Exception { Converter> converter = UtilGenerics.cast(Converters.getConverter(JSON.class, Map.class)); Map map, convertedMap; - map = new HashMap(); + map = new HashMap<>(); map.put("field1", "value1"); JSON json = JSON.from(map); convertedMap = UtilGenerics.toMap(converter.convert(json)); @@ -54,7 +54,7 @@ public class TestJSONConverters extends TestCase { public void testJSONToList() throws Exception { Converter> converter = UtilGenerics.cast(Converters.getConverter(JSON.class, List.class)); List list, convertedList; - list = new ArrayList(); + list = new ArrayList<>(); list.add("field1"); list.add("field2"); JSON json = JSON.from(list); @@ -65,7 +65,7 @@ public class TestJSONConverters extends TestCase { public void testMapToJSON() throws Exception { Converter, JSON> converter = UtilGenerics.cast(Converters.getConverter(Map.class, JSON.class)); JSON json; - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); map.put("field1", "value1"); map.put("field2", new BigDecimal("3.7")); json = converter.convert(map); @@ -75,7 +75,7 @@ public class TestJSONConverters extends TestCase { public void testListToJSON() throws Exception { Converter, JSON> converter = UtilGenerics.cast(Converters.getConverter(List.class, JSON.class)); JSON json; - List list = new ArrayList(); + List list = new ArrayList<>(); list.add("field1"); list.add("field2"); json = converter.convert(list); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java b/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java index e6c13a0974..cccc4472d3 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java @@ -40,7 +40,7 @@ public final class FlexibleLocation { private static final Map locationResolvers; static { - Map resolverMap = new HashMap(8); + Map resolverMap = new HashMap<>(8); LocationResolver standardUrlResolver = new StandardUrlLocationResolver(); resolverMap.put("http", standardUrlResolver); resolverMap.put("https", standardUrlResolver); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java index 05754d51da..31ffaa7944 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java @@ -177,7 +177,7 @@ public final class UtilHttp { } public static Map getMultiPartParameterMap(HttpServletRequest request) { - Map multiPartMap = new HashMap(); + Map multiPartMap = new HashMap<>(); Delegator delegator = (Delegator) request.getAttribute("delegator"); HttpSession session = request.getSession(); boolean isMultiPart = ServletFileUpload.isMultipartContent(request); @@ -238,7 +238,7 @@ public final class UtilHttp { if (mapValue instanceof List) { checkList(mapValue, Object.class).add(item.getString()); } else if (mapValue instanceof String) { - List newList = new LinkedList(); + List newList = new LinkedList<>(); newList.add((String) mapValue); newList.add(item.getString()); multiPartMap.put(fieldName, newList); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java index f8474a230b..11e7d1724f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java @@ -46,7 +46,7 @@ public class FlexibleMapAccessorTests extends GenericTestCaseBase { } private static void fmaTest(String label, String getText, String putText, String fseText, Locale locale, T var, String value) { - Map testMap = new HashMap(); + Map testMap = new HashMap<>(); FlexibleMapAccessor fmaGet = FlexibleMapAccessor.getInstance(getText); assertEquals(label + ":get-original-name", getText, fmaGet.getOriginalName()); assertEquals(label + ":get-isEmpty", false, fmaGet.isEmpty()); @@ -105,7 +105,7 @@ public class FlexibleMapAccessorTests extends GenericTestCaseBase { assertNotNull(label + ":put-null-map", caught); assertTrue(label + ":put-null-map-isEmpty", testMap.isEmpty()); } - Set> set = new HashSet>(); + Set> set = new HashSet<>(); assertFalse(label + ":not-in-set", set.contains(fmaGet)); set.add(fmaGet); assertTrue(label + ":in-set", set.contains(fmaGet)); @@ -114,7 +114,7 @@ public class FlexibleMapAccessorTests extends GenericTestCaseBase { private static void fmaEmptyTest(String label, String text) { FlexibleMapAccessor> fma = FlexibleMapAccessor.getInstance(text); assertTrue(label + ":isEmpty", fma.isEmpty()); - Map testMap = new HashMap(); + Map testMap = new HashMap<>(); assertNull(label + ":get", fma.get(null)); assertNull(label + ":get", fma.get(testMap)); assertTrue(label + ":map-isEmpty-initial", testMap.isEmpty()); @@ -173,7 +173,7 @@ public class FlexibleMapAccessorTests extends GenericTestCaseBase { boolean isVerbose = Debug.isOn(Debug.VERBOSE); try { Debug.set(Debug.VERBOSE, true); - Map testMap = new CantRemoveMap(); + Map testMap = new CantRemoveMap<>(); testMap.put("throwException", new ThrowException()); assertNull("no var", FlexibleMapAccessor.getInstance("var").get(testMap)); Object result = FlexibleMapAccessor.getInstance("throwException.value").get(testMap); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/GenericMapTest.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/GenericMapTest.java index 1285e544e5..62e38f0b05 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/GenericMapTest.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/test/GenericMapTest.java @@ -50,7 +50,7 @@ public class GenericMapTest extends GenericTestCaseBase { "removeInternal-false", "size", }; - protected final Map counts = new HashMap(); + protected final Map counts = new HashMap<>(); protected final Map proxyMap; protected TestGenericMap() { @@ -62,9 +62,9 @@ public class GenericMapTest extends GenericTestCaseBase { counts.put(countName, 0); } if (srcMap != null) { - proxyMap = new HashMap(srcMap); + proxyMap = new HashMap<>(srcMap); } else { - proxyMap = new HashMap(); + proxyMap = new HashMap<>(); } } @@ -73,7 +73,7 @@ public class GenericMapTest extends GenericTestCaseBase { } public List getCounts() { - List result = new ArrayList(); + List result = new ArrayList<>(); for (String countName: countNames) { result.add(counts.get(countName)); } @@ -108,7 +108,7 @@ public class GenericMapTest extends GenericTestCaseBase { return new IteratorWrapper, Map.Entry>(proxyMap.entrySet().iterator()) { @Override protected Map.Entry convert(Map.Entry src) { - return new GenericMapEntry(TestGenericMap.this, src.getKey(), noteAccess); + return new GenericMapEntry<>(TestGenericMap.this, src.getKey(), noteAccess); } @Override protected void noteRemoval(Map.Entry dest, Map.Entry src) { @@ -150,7 +150,7 @@ public class GenericMapTest extends GenericTestCaseBase { } public void testFoo() throws Exception { - TestGenericMap map = new TestGenericMap(); + TestGenericMap map = new TestGenericMap<>(); map.put("a", 0); Debug.logInfo("put a\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module); assertEquals("get a", Integer.valueOf(0), map.get("a")); map.put("b", 1); Debug.logInfo("put b\t\tcounts=" + map.getCounts() + ", modCount=" + map.getModCount(), module); @@ -167,7 +167,7 @@ public class GenericMapTest extends GenericTestCaseBase { Debug.logInfo("map=" + map, module); Debug.logInfo("counts=" + map.getCounts() + ", modCount=" + map.getModCount(), module); // this seems to call size() - new HashMap(map); + new HashMap<>(map); Debug.logInfo("counts=" + map.getCounts() + ", modCount=" + map.getModCount(), module); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java index 232db797ec..a1fbed18fd 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/FlexibleStringExpander.java @@ -298,7 +298,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty { return new FlexibleStringExpander[] { new ConstOffsetElem(chars, offset, length) }; } int origLen = length; - ArrayList strElems = new ArrayList(); + ArrayList strElems = new ArrayList<>(); int currentInd = offset; int end = -1; while (start != -1) { @@ -652,7 +652,7 @@ public abstract class FlexibleStringExpander implements Serializable, IsEmpty { @Override protected Object get(Map context, TimeZone timeZone, Locale locale) { try { - Map contextCopy = new HashMap(context); + Map contextCopy = new HashMap<>(context); Object obj = ScriptUtil.evaluate(this.language, this.script, this.parsedScript, contextCopy); if (obj != null) { return obj; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java index 3205d502f0..7d7359ff6d 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/NodeELResolver.java @@ -102,7 +102,7 @@ public class NodeELResolver extends ELResolver { } else if (nodeList.getLength() == 1) { result = nodeList.item(0); } else { - List newList = new ArrayList(nodeList.getLength()); + List newList = new ArrayList<>(nodeList.getLength()); for (int i = 0; i < nodeList.getLength(); i++) { newList.add(nodeList.item(i)); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java index 206bb33b93..3cf36b45cf 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/AssertTests.java @@ -84,7 +84,7 @@ public class AssertTests extends TestCase { } catch (IllegalArgumentException e) {} //----------------------------------------------------------------------- - List strList = new ArrayList(); + List strList = new ArrayList<>(); try { Assert.notEmpty("foo", strList); fail("notEmpty(Collection) - IllegalArgumentException not thrown"); @@ -97,7 +97,7 @@ public class AssertTests extends TestCase { } //----------------------------------------------------------------------- - Map strMap = new HashMap(); + Map strMap = new HashMap<>(); try { Assert.notEmpty("foo", strMap); fail("notEmpty(Map) - IllegalArgumentException not thrown"); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java index bfd33f2a19..246c93550b 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ObjectTypeTests.java @@ -66,15 +66,15 @@ public class ObjectTypeTests extends GenericTestCaseBase { super(name); ntstmp = new Timestamp(781L); ntstmp.setNanos(123000000); - list = new ArrayList(); + list = new ArrayList<>(); list.add("one"); list.add("two"); list.add("three"); - map = new LinkedHashMap(); + map = new LinkedHashMap<>(); map.put("one", "1"); map.put("two", "2"); map.put("three", "3"); - set = new LinkedHashSet(list); + set = new LinkedHashSet<>(list); Calendar cal = UtilDateTime.getCalendarInstance(localeData.goodTimeZone, localeData.goodLocale); cal.set(1969, Calendar.DECEMBER, 31, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java index 8e589ef8c5..3596f9d4d5 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/ReferenceCleanerTests.java @@ -34,7 +34,7 @@ public class ReferenceCleanerTests extends GenericTestCaseBase { public void testReferenceCleaner() throws Exception { assertStaticHelperClass(ReferenceCleaner.class); - final SynchronousQueue queue = new SynchronousQueue(); + final SynchronousQueue queue = new SynchronousQueue<>(); Object obj = new Object(); ReferenceCleaner.Soft soft = new ReferenceCleaner.Soft(obj) { public void remove() throws Exception { @@ -53,7 +53,7 @@ public class ReferenceCleanerTests extends GenericTestCaseBase { queue.put("phantom"); } }; - HashSet foundEvents = new HashSet(); + HashSet foundEvents = new HashSet<>(); useAllMemory(); assertSame("still-soft", obj, soft.get()); assertSame("still-weak", obj, weak.get()); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java index c0f7eacfa3..8ef486cf6d 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/test/StringUtilTests.java @@ -200,7 +200,7 @@ public class StringUtilTests extends GenericTestCaseBase { } public void testConvertChar() { - Map conversions = new HashMap(); + Map conversions = new HashMap<>(); conversions.put('0', 0); conversions.put('1', 1); conversions.put('2', 2); conversions.put('3', 3); conversions.put('4', 4); conversions.put('5', 5); conversions.put('6', 6); conversions.put('7', 7); conversions.put('8', 8); conversions.put('9', 9); diff --git a/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java b/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java index d59a0fa0bd..4e78a50a90 100644 --- a/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java +++ b/framework/base/src/test/java/org/apache/ofbiz/base/util/UtilCodecTests.java @@ -77,7 +77,7 @@ public class UtilCodecTests { assertEquals(label + "(encoder):encode", wanted, encoder.encode(toEncode)); } private static void checkStringForHtmlStrictNone_test(String label, String fixed, String input, String... wantedMessages) { - List gottenMessages = new ArrayList(); + List gottenMessages = new ArrayList<>(); assertEquals(label, fixed, UtilCodec.checkStringForHtmlStrictNone(label, input, gottenMessages)); assertEquals(label, Arrays.asList(wantedMessages), gottenMessages); } diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java index 07442b99e2..c742024dd9 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFilesMapping.java @@ -31,7 +31,7 @@ public final class JsLanguageFilesMapping { public static class datejs { - private static Map localeFiles = new HashMap(); + private static Map localeFiles = new HashMap<>(); private static String defaultDateJs = "/common/js/jquery/plugins/datejs/date-en-US.js"; static { @@ -206,7 +206,7 @@ public final class JsLanguageFilesMapping { } public static class jquery { - private static Map localeFiles = new HashMap(); + private static Map localeFiles = new HashMap<>(); private static String defaultDateJs = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; static { @@ -381,7 +381,7 @@ public final class JsLanguageFilesMapping { } public static class validation { - private static Map localeFiles = new HashMap(); + private static Map localeFiles = new HashMap<>(); private static String defaultValidation = "/common/js/jquery/plugins/validate/localization/messages_en.js"; static { @@ -555,7 +555,7 @@ public final class JsLanguageFilesMapping { } public static class dateTime { - private static Map localeFiles = new HashMap(); + private static Map localeFiles = new HashMap<>(); private static String defaultDateTime = "/common/js/jquery/ui/i18n/jquery.ui.datepicker-en.js"; static { @@ -729,7 +729,7 @@ public final class JsLanguageFilesMapping { } public static class select2 { - private static Map localeFiles = new HashMap(); + private static Map localeFiles = new HashMap<>(); private static String defaultSelect2 = "/common/js/jquery/plugins/select2/js/i18n/en.js"; static { diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java index 9345342c81..cd8d30b17f 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java @@ -519,7 +519,7 @@ public class EmailServices { // check if attachment screen location passed in if (UtilValidate.isNotEmpty(xslfoAttachScreenLocationList)) { - List> bodyParts = new LinkedList>(); + List> bodyParts = new LinkedList<>(); if (bodyText != null) { bodyText = FlexibleStringExpander.expandString(bodyText, screenContext, locale); bodyParts.add(UtilMisc.toMap("content", bodyText, "type", UtilValidate.isNotEmpty(contentType) ? contentType : "text/html")); diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java b/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java index 46e3d04d6a..afc8c07191 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java @@ -53,13 +53,13 @@ public final class GeoWorker { public static List expandGeoGroup(GenericValue geo) { if (geo == null) { - return new LinkedList(); + return new LinkedList<>(); } if (!"GROUP".equals(geo.getString("geoTypeId"))) { return UtilMisc.toList(geo); } - List geoList = new LinkedList(); + List geoList = new LinkedList<>(); List thisGeoAssoc = null; try { thisGeoAssoc = geo.getRelated("AssocGeoAssoc", UtilMisc.toMap("geoAssocTypeId", "GROUP_MEMBER"), null, false); @@ -84,7 +84,7 @@ public final class GeoWorker { if (UtilValidate.isEmpty(geoIdByTypeMapOrig)) { return geoIdByTypeMapOrig; } - Map geoIdByTypeMapTemp = new LinkedHashMap(); + Map geoIdByTypeMapTemp = new LinkedHashMap<>(); for (Map.Entry geoIdByTypeEntry: geoIdByTypeMapOrig.entrySet()) { List geoAssocList = EntityQuery.use(delegator) .from("GeoAssoc") @@ -97,7 +97,7 @@ public final class GeoWorker { } } geoIdByTypeMapTemp = expandGeoRegionDeep(geoIdByTypeMapTemp, delegator); - Map geoIdByTypeMapNew = new LinkedHashMap(); + Map geoIdByTypeMapNew = new LinkedHashMap<>(); // add the temp Map first, then the original over top of it, ie give the original priority over the sub/expanded values geoIdByTypeMapNew.putAll(geoIdByTypeMapTemp); geoIdByTypeMapNew.putAll(geoIdByTypeMapOrig); diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java b/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java index 5d93220474..0582278e0d 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ContextHelper.java @@ -115,13 +115,13 @@ public final class ContextHelper { if (isService()) { errorMessages = UtilGenerics.checkList(getResults().get(ModelService.ERROR_MESSAGE_LIST)); if (errorMessages == null) { - errorMessages = new LinkedList(); + errorMessages = new LinkedList<>(); getResults().put(ModelService.ERROR_MESSAGE_LIST, errorMessages); } } else { errorMessages = UtilGenerics.checkList(getResults().get("_error_message_list_")); if (errorMessages == null) { - errorMessages = new LinkedList(); + errorMessages = new LinkedList<>(); getResults().put("_error_message_list_", errorMessages); } } @@ -147,7 +147,7 @@ public final class ContextHelper { public Map getParameters() { Map parameters = UtilGenerics.checkMap(this.context.getAttribute(ScriptUtil.PARAMETERS_KEY)); if (parameters == null) { - parameters = new LinkedHashMap(); + parameters = new LinkedHashMap<>(); this.context.setAttribute(ScriptUtil.PARAMETERS_KEY, parameters, ScriptContext.ENGINE_SCOPE); } return parameters; @@ -168,7 +168,7 @@ public final class ContextHelper { public Map getResults() { Map results = UtilGenerics.checkMap(this.context.getAttribute(ScriptUtil.RESULT_KEY)); if (results == null) { - results = new LinkedHashMap(); + results = new LinkedHashMap<>(); this.context.setAttribute(ScriptUtil.RESULT_KEY, results, ScriptContext.ENGINE_SCOPE); } return results; diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ScriptHelperImpl.java b/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ScriptHelperImpl.java index d7fc083586..056514ae93 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ScriptHelperImpl.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/scripting/ScriptHelperImpl.java @@ -53,7 +53,7 @@ public final class ScriptHelperImpl implements ScriptHelper { private static GenericValue runFindByPrimaryKey(ModelEntity modelEntity, ContextHelper ctxHelper, boolean useCache, boolean autoFieldMap, Map fieldMap, List selectFieldList) throws ScriptException { - Map entityContext = new HashMap(); + Map entityContext = new HashMap<>(); Delegator delegator = ctxHelper.getDelegator(); Map context = ctxHelper.getBindings(); if (autoFieldMap) { @@ -75,7 +75,7 @@ public final class ScriptHelperImpl implements ScriptHelper { entityContext.remove("timeZone"); Set fieldsToSelect = null; if (selectFieldList != null) { - fieldsToSelect = new HashSet(selectFieldList); + fieldsToSelect = new HashSet<>(selectFieldList); } if (fieldsToSelect != null && useCache) { String errMsg = "Error running script " + ctxHelper.getScriptName() + ": Problem invoking the findOne method: Cannot specify selectFieldList argument when useCache is set to true "; @@ -116,7 +116,7 @@ public final class ScriptHelperImpl implements ScriptHelper { public Map createServiceMap(String serviceName, Map inputMap) throws ScriptException { Assert.notNull("serviceName", serviceName, "inputMap", inputMap); - Map toMap = new HashMap(); + Map toMap = new HashMap<>(); ModelService modelService = null; try { modelService = ctxHelper.getDispatcher().getDispatchContext().getModelService(serviceName); @@ -226,7 +226,7 @@ public final class ScriptHelperImpl implements ScriptHelper { } } } - Map inMap = new HashMap(inputMap); + Map inMap = new HashMap<>(inputMap); if (includeUserLogin && !inMap.containsKey("userLogin")) { GenericValue userLogin = ctxHelper.getUserLogin(); if (userLogin != null) { diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusServices.java index 72e38f19c7..80651deaa2 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusServices.java @@ -52,7 +52,7 @@ public class StatusServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonStatusMandatory", locale)); } - List statusItems = new LinkedList(); + List statusItems = new LinkedList<>(); for (String statusTypeId: statusTypes) { try { List myStatusItems = EntityQuery.use(delegator) @@ -66,7 +66,7 @@ public class StatusServices { Debug.logError(e, module); } } - Map ret = new LinkedHashMap(); + Map ret = new LinkedHashMap<>(); ret.put("statusItems",statusItems); return ret; } diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusWorker.java b/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusWorker.java index 9be37fd2ab..e21d4ff8ba 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusWorker.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/status/StatusWorker.java @@ -57,7 +57,7 @@ public final class StatusWorker { public static void getStatusItems(PageContext pageContext, String attributeName, String statusTypeIdOne, String statusTypeIdTwo) { Delegator delegator = (Delegator) pageContext.getRequest().getAttribute("delegator"); - List statusItems = new LinkedList(); + List statusItems = new LinkedList<>(); try { List calItems = EntityQuery.use(delegator) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/telecom/TelecomServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/telecom/TelecomServices.java index 06d1850f5d..4d21cfae0d 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/telecom/TelecomServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/telecom/TelecomServices.java @@ -68,7 +68,7 @@ public class TelecomServices { try { - Map createCommEventCtx = new HashMap(); + Map createCommEventCtx = new HashMap<>(); createCommEventCtx = ctx.makeValidContext("createCommunicationEvent", ModelService.IN_PARAM, context); createCommEventCtx.put("content", message); createCommEventCtx.put("communicationEventTypeId", "PHONE_COMMUNICATION"); @@ -82,7 +82,7 @@ public class TelecomServices { } String communicationEventId = (String) createCommEventResult.get("communicationEventId"); - Map conditions = new HashMap(); + Map conditions = new HashMap<>(); conditions.put("productStoreId", productStoreId); conditions.put("telecomMsgTypeEnumId", telecomMsgTypeEnumId); conditions.put("telecomMethodTypeId", telecomMethodTypeId); @@ -90,7 +90,7 @@ public class TelecomServices { if (productStoreTelecomSetting != null) { GenericValue customMethod = productStoreTelecomSetting.getRelatedOne("CustomMethod", false); if (UtilValidate.isNotEmpty(customMethod.getString("customMethodName"))) { - Map serviceCtx = new HashMap(); + Map serviceCtx = new HashMap<>(); serviceCtx.put("numbers", numbers); serviceCtx.put("message", message); if (telecomGatewayConfigId != null) { diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java b/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java index 787e09d707..e5005a8157 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/test/PerformFindTests.java @@ -43,7 +43,7 @@ public class PerformFindTests extends OFBizTestCase { } private List getCompleteList(Map context) { - List foundElements = new LinkedList(); + List foundElements = new LinkedList<>(); try (EntityListIterator listIt = (EntityListIterator) context.get("listIt")) { if (listIt != null) { foundElements = listIt.getCompleteList(); @@ -115,7 +115,7 @@ public class PerformFindTests extends OFBizTestCase { GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne(); prepareData(); - Map inputFields = new HashMap(); + Map inputFields = new HashMap<>(); //first test without condition Map performFindMap = UtilMisc.toMap("userLogin", userLogin, "entityName", "Testing", "inputFields", inputFields); Map result = dispatcher.runSync("performFind", performFindMap); diff --git a/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java b/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java index d427dc2b32..166304ef74 100644 --- a/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java +++ b/framework/common/src/test/java/org/apache/ofbiz/common/GetLocaleListTests.java @@ -79,6 +79,6 @@ public class GetLocaleListTests { params.put("localeString", "fr"); List> res = runScript(); assertThat(localeStrings(res), hasItems("en_ZA", "fr", "fr_BE", "fr_CA", "fr_FR", "fr_LU", "fr_CH")); - assertEquals(new HashSet(localeStrings(res)).size(), localeStrings(res).size()); + assertEquals(new HashSet<>(localeStrings(res)).size(), localeStrings(res).size()); } } diff --git a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java index bd8118929b..2ea7fc8414 100644 --- a/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java +++ b/framework/datafile/src/main/java/org/apache/ofbiz/datafile/RecordIterator.java @@ -166,7 +166,7 @@ public class RecordIterator { // if this record has children, put it on the parentStack and get/check the children now if (this.curRecord.getModelRecord().childRecords.size() > 0) { - Stack parentStack = new Stack(); + Stack parentStack = new Stack<>(); parentStack.push(curRecord); while (this.nextRecord != null && this.nextRecord.getModelRecord().parentRecord != null) { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/Datasource.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/Datasource.java index f3ece0575f..0a2968799c 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/Datasource.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/Datasource.java @@ -181,7 +181,7 @@ public final class Datasource { if (sqlLoadPathElementList.isEmpty()) { this.sqlLoadPathList = Collections.emptyList(); } else { - List sqlLoadPathList = new ArrayList(sqlLoadPathElementList.size()); + List sqlLoadPathList = new ArrayList<>(sqlLoadPathElementList.size()); for (Element sqlLoadPathElement : sqlLoadPathElementList) { sqlLoadPathList.add(new SqlLoadPath(sqlLoadPathElement)); } @@ -191,7 +191,7 @@ public final class Datasource { if (readDataElementList.isEmpty()) { this.readDataList = Collections.emptyList(); } else { - List readDataList = new ArrayList(readDataElementList.size()); + List readDataList = new ArrayList<>(readDataElementList.size()); for (Element readDataElement : readDataElementList) { readDataList.add(new ReadData(readDataElement)); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/DelegatorElement.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/DelegatorElement.java index 38a00a422b..358e2b4c32 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/DelegatorElement.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/DelegatorElement.java @@ -98,8 +98,8 @@ public final class DelegatorElement { if (groupMapElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing" + lineNumberText); } else { - List groupMapList = new ArrayList(groupMapElementList.size()); - Map groupMapMap = new HashMap(); + List groupMapList = new ArrayList<>(groupMapElementList.size()); + Map groupMapMap = new HashMap<>(); for (Element groupMapElement : groupMapElementList) { GroupMap groupMap = new GroupMap(groupMapElement); groupMapList.add(groupMap); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java index e8d9256e6b..309c8e8861 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityConfig.java @@ -81,8 +81,8 @@ public final class EntityConfig { if (resourceLoaderElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing"); } else { - List resourceLoaderList = new ArrayList(resourceLoaderElementList.size()); - Map resourceLoaderMap = new HashMap(); + List resourceLoaderList = new ArrayList<>(resourceLoaderElementList.size()); + Map resourceLoaderMap = new HashMap<>(); for (Element resourceLoaderElement : resourceLoaderElementList) { ResourceLoader resourceLoader = new ResourceLoader(resourceLoaderElement); resourceLoaderList.add(resourceLoader); @@ -113,8 +113,8 @@ public final class EntityConfig { if (delegatorElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing"); } else { - List delegatorList = new ArrayList(delegatorElementList.size()); - Map delegatorMap = new HashMap(); + List delegatorList = new ArrayList<>(delegatorElementList.size()); + Map delegatorMap = new HashMap<>(); for (Element delegatorElement : delegatorElementList) { DelegatorElement delegator = new DelegatorElement(delegatorElement); delegatorList.add(delegator); @@ -127,8 +127,8 @@ public final class EntityConfig { if (entityModelReaderElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing"); } else { - List entityModelReaderList = new ArrayList(entityModelReaderElementList.size()); - Map entityModelReaderMap = new HashMap(); + List entityModelReaderList = new ArrayList<>(entityModelReaderElementList.size()); + Map entityModelReaderMap = new HashMap<>(); for (Element entityModelReaderElement : entityModelReaderElementList) { EntityModelReader entityModelReader = new EntityModelReader(entityModelReaderElement); entityModelReaderList.add(entityModelReader); @@ -141,8 +141,8 @@ public final class EntityConfig { if (entityGroupReaderElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing"); } else { - List entityGroupReaderList = new ArrayList(entityGroupReaderElementList.size()); - Map entityGroupReaderMap = new HashMap(); + List entityGroupReaderList = new ArrayList<>(entityGroupReaderElementList.size()); + Map entityGroupReaderMap = new HashMap<>(); for (Element entityGroupReaderElement : entityGroupReaderElementList) { EntityGroupReader entityGroupReader = new EntityGroupReader(entityGroupReaderElement); entityGroupReaderList.add(entityGroupReader); @@ -156,8 +156,8 @@ public final class EntityConfig { this.entityEcaReaderList = Collections.emptyList(); this.entityEcaReaderMap = Collections.emptyMap(); } else { - List entityEcaReaderList = new ArrayList(entityEcaReaderElementList.size()); - Map entityEcaReaderMap = new HashMap(); + List entityEcaReaderList = new ArrayList<>(entityEcaReaderElementList.size()); + Map entityEcaReaderMap = new HashMap<>(); for (Element entityEcaReaderElement : entityEcaReaderElementList) { EntityEcaReader entityEcaReader = new EntityEcaReader(entityEcaReaderElement); entityEcaReaderList.add(new EntityEcaReader(entityEcaReaderElement)); @@ -171,8 +171,8 @@ public final class EntityConfig { this.entityDataReaderList = Collections.emptyList(); this.entityDataReaderMap = Collections.emptyMap(); } else { - List entityDataReaderList = new ArrayList(entityDataReaderElementList.size()); - Map entityDataReaderMap = new HashMap(); + List entityDataReaderList = new ArrayList<>(entityDataReaderElementList.size()); + Map entityDataReaderMap = new HashMap<>(); for (Element entityDataReaderElement : entityDataReaderElementList) { EntityDataReader entityDataReader = new EntityDataReader(entityDataReaderElement); entityDataReaderList.add(entityDataReader); @@ -185,8 +185,8 @@ public final class EntityConfig { if (fieldTypeElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing"); } else { - List fieldTypeList = new ArrayList(fieldTypeElementList.size()); - Map fieldTypeMap = new HashMap(); + List fieldTypeList = new ArrayList<>(fieldTypeElementList.size()); + Map fieldTypeMap = new HashMap<>(); for (Element fieldTypeElement : fieldTypeElementList) { FieldType fieldType = new FieldType(fieldTypeElement); fieldTypeList.add(fieldType); @@ -199,8 +199,8 @@ public final class EntityConfig { if (datasourceElementList.isEmpty()) { throw new GenericEntityConfException(" element child elements are missing"); } else { - List datasourceList = new ArrayList(datasourceElementList.size()); - Map datasourceMap = new HashMap(); + List datasourceList = new ArrayList<>(datasourceElementList.size()); + Map datasourceMap = new HashMap<>(); for (Element datasourceElement : datasourceElementList) { Datasource datasource = new Datasource(datasourceElement); datasourceList.add(datasource); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityDataReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityDataReader.java index 5fe0d2263e..91dbccb2a8 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityDataReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityDataReader.java @@ -57,7 +57,7 @@ public final class EntityDataReader { if (resourceElementList.isEmpty()) { this.resourceList = Collections.emptyList(); } else { - List resourceList = new ArrayList(resourceElementList.size()); + List resourceList = new ArrayList<>(resourceElementList.size()); for (Element resourceElement : resourceElementList) { resourceList.add(new Resource(resourceElement)); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityEcaReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityEcaReader.java index 16379ee2b0..53ec2dfa31 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityEcaReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityEcaReader.java @@ -49,7 +49,7 @@ public final class EntityEcaReader { if (resourceElementList.isEmpty()) { this.resourceList = Collections.emptyList(); } else { - List resourceList = new ArrayList(resourceElementList.size()); + List resourceList = new ArrayList<>(resourceElementList.size()); for (Element resourceElement : resourceElementList) { resourceList.add(new Resource(resourceElement)); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityGroupReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityGroupReader.java index 60fb0bdcce..b12724cabf 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityGroupReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityGroupReader.java @@ -53,7 +53,7 @@ public final class EntityGroupReader { if (resourceElementList.isEmpty()) { this.resourceList = Collections.emptyList(); } else { - List resourceList = new ArrayList(resourceElementList.size()); + List resourceList = new ArrayList<>(resourceElementList.size()); for (Element resourceElement : resourceElementList) { resourceList.add(new Resource(resourceElement)); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityModelReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityModelReader.java index 40c7bfdc30..cebc36512e 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityModelReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/config/model/EntityModelReader.java @@ -49,7 +49,7 @@ public final class EntityModelReader { if (resourceElementList.isEmpty()) { this.resourceList = Collections.emptyList(); } else { - List resourceList = new ArrayList(resourceElementList.size()); + List resourceList = new ArrayList<>(resourceElementList.size()); for (Element resourceElement : resourceElementList) { resourceList.add(new Resource(resourceElement)); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java index ceaf9cc8c4..d58e26235d 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DBCPConnectionFactory.java @@ -146,7 +146,7 @@ public class DBCPConnectionFactory implements ConnectionFactory { poolConfig.setTestOnReturn(jdbcElement.getTestOnReturn()); poolConfig.setTestWhileIdle(jdbcElement.getTestWhileIdle()); - GenericObjectPool pool = new GenericObjectPool(factory, poolConfig); + GenericObjectPool pool = new GenericObjectPool<>(factory, poolConfig); factory.setPool(pool); mds = new DebugManagedDataSource<>(pool, xacf.getTransactionRegistry()); @@ -165,7 +165,7 @@ public class DBCPConnectionFactory implements ConnectionFactory { } public static Map getDataSourceInfo(String helperName) { - Map dataSourceInfo = new HashMap(); + Map dataSourceInfo = new HashMap<>(); DebugManagedDataSource mds = dsCache.get(helperName); if (mds != null) { dataSourceInfo = mds.getInfo(); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java index 86cd32a967..6825253b19 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/connection/DebugManagedDataSource.java @@ -52,7 +52,7 @@ public class DebugManagedDataSource extends ManagedDataSou } public Map getInfo() { - Map dataSourceInfo = new HashMap(); + Map dataSourceInfo = new HashMap<>(); dataSourceInfo.put("poolNumActive", super.getPool().getNumActive()); dataSourceInfo.put("poolNumIdle", super.getPool().getNumIdle()); dataSourceInfo.put("poolNumTotal", (super.getPool().getNumIdle() + super.getPool().getNumActive())); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java index 7950e4b537..154b0c2d8b 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java @@ -71,7 +71,7 @@ public class GenericDAO { public static final String module = GenericDAO.class.getName(); - private static final ConcurrentHashMap genericDAOs = new ConcurrentHashMap(); + private static final ConcurrentHashMap genericDAOs = new ConcurrentHashMap<>(); private final GenericHelperInfo helperInfo; private final ModelFieldTypeReader modelFieldTypeReader; private final Datasource datasource; @@ -183,7 +183,7 @@ public class GenericDAO { ModelEntity modelEntity = entity.getModelEntity(); // we don't want to update ALL fields, just the nonpk fields that are in the passed GenericEntity - List partialFields = new LinkedList(); + List partialFields = new LinkedList<>(); Collection keys = entity.getAllKeys(); Iterator nopkIter = modelEntity.getNopksIterator(); @@ -293,7 +293,7 @@ public class GenericDAO { StringBuilder sql = new StringBuilder("UPDATE ").append(modelEntity.getTableName(datasource)); sql.append(" SET "); - List params = new LinkedList(); + List params = new LinkedList<>(); for (Map.Entry entry: fieldsToSet.entrySet()) { String name = entry.getKey(); ModelField field = modelEntity.getField(name); @@ -350,7 +350,7 @@ public class GenericDAO { throw new GenericEntityException("Failed to get model entity for " + meName, e); } - Map findByMap = new HashMap(); + Map findByMap = new HashMap<>(); // Now iterate the ModelViewLinks to construct the "WHERE" part for update/insert Iterator linkIter = modelViewEntity.getViewLinksIterator(); @@ -420,7 +420,7 @@ public class GenericDAO { } // Construct fieldsToSave list for this member entity - List meFieldsToSave = new LinkedList(); + List meFieldsToSave = new LinkedList<>(); for (ModelField modelField: fieldsToSave) { if (memberModelEntity.isField(modelField.getName())) { ModelField meModelField = memberModelEntity.getField(modelField.getName()); @@ -513,9 +513,9 @@ public class GenericDAO { } // we don't want to select ALL fields, just the nonpk fields that are in the passed GenericEntity - List partialFields = new LinkedList(); + List partialFields = new LinkedList<>(); - Set tempKeys = new TreeSet(keys); + Set tempKeys = new TreeSet<>(keys); Iterator entityFieldIter = modelEntity.getFieldsIterator(); while (entityFieldIter.hasNext()) { @@ -595,12 +595,12 @@ public class GenericDAO { } // make two ArrayLists of fields, one for fields to select and the other for where clause fields (to find by) - List selectFields = new LinkedList(); + List selectFields = new LinkedList<>(); if (UtilValidate.isNotEmpty(fieldsToSelect)) { - Set tempKeys = new HashSet(); + Set tempKeys = new HashSet<>(); tempKeys.addAll(fieldsToSelect); - Set fieldSetsToInclude = new HashSet(); - Set addedFields = new HashSet(); + Set fieldSetsToInclude = new HashSet<>(); + Set addedFields = new HashSet<>(); for (String fieldToSelect : fieldsToSelect) { if (tempKeys.contains(fieldToSelect)) { ModelField curField = modelEntity.getField(fieldToSelect); @@ -622,8 +622,8 @@ public class GenericDAO { } if (UtilValidate.isNotEmpty(fieldSetsToInclude)) { Iterator fieldIter = modelEntity.getFieldsIterator(); - Set extraFields = new HashSet(); - Set reasonSets = new HashSet(); + Set extraFields = new HashSet<>(); + Set reasonSets = new HashSet<>(); while (fieldIter.hasNext()) { ModelField curField = fieldIter.next(); String fieldSet = curField.getFieldSet(); @@ -668,9 +668,9 @@ public class GenericDAO { List viewHavingConditions = null; List viewOrderByList = null; if (modelViewEntity != null) { - viewWhereConditions = new LinkedList(); - viewHavingConditions = new LinkedList(); - viewOrderByList = new LinkedList(); + viewWhereConditions = new LinkedList<>(); + viewHavingConditions = new LinkedList<>(); + viewOrderByList = new LinkedList<>(); modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, viewWhereConditions, viewHavingConditions, viewOrderByList, null); } @@ -678,7 +678,7 @@ public class GenericDAO { sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, modelFieldTypeReader, datasource)); // WHERE clause - List whereEntityConditionParams = new LinkedList(); + List whereEntityConditionParams = new LinkedList<>(); makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams); // GROUP BY clause for view-entity @@ -687,11 +687,11 @@ public class GenericDAO { } // HAVING clause - List havingEntityConditionParams = new LinkedList(); + List havingEntityConditionParams = new LinkedList<>(); makeConditionHavingString(sqlBuffer, " HAVING ", modelEntity, havingEntityCondition, viewHavingConditions, havingEntityConditionParams); // ORDER BY clause - List orderByExpanded = new LinkedList(); + List orderByExpanded = new LinkedList<>(); // add the manually specified ones, then the ones in the view entity's entity-condition if (orderBy != null) { orderByExpanded.addAll(orderBy); @@ -755,7 +755,7 @@ public class GenericDAO { modelViewEntity = (ModelViewEntity) modelEntity; } - List conditions = new LinkedList(); + List conditions = new LinkedList<>(); if (UtilValidate.isNotEmpty(whereEntityCondition)) { conditions.add(whereEntityCondition); } @@ -857,7 +857,7 @@ public class GenericDAO { // get the column name string to select StringBuilder selsb = new StringBuilder(); - List fldlist = new LinkedList(); + List fldlist = new LinkedList<>(); for (Iterator iterator = modelEntityTwo.getFieldsIterator(); iterator.hasNext();) { ModelField mf = iterator.next(); @@ -885,7 +885,7 @@ public class GenericDAO { // construct the source entity qualifier // get the fields from relation description - Map bindMap = new HashMap(); + Map bindMap = new HashMap<>(); for (ModelKeyMap mkm : modelRelationOne.getKeyMaps()) { // get the equivalent column names in the relation String sfldname = mkm.getFieldName(); @@ -914,7 +914,7 @@ public class GenericDAO { sqlsb.append(SqlJdbcUtil.makeOrderByClause(modelEntityTwo, orderBy, true, datasource)); // now execute the query - List retlist = new LinkedList(); + List retlist = new LinkedList<>(); Delegator gd = value.getDelegator(); try (SQLProcessor sqlP = new SQLProcessor(value.getDelegator(), helperInfo)) { @@ -1016,9 +1016,9 @@ public class GenericDAO { List viewHavingConditions = null; List viewOrderByList = null; if (modelViewEntity != null) { - viewWhereConditions = new LinkedList(); - viewHavingConditions = new LinkedList(); - viewOrderByList = new LinkedList(); + viewWhereConditions = new LinkedList<>(); + viewHavingConditions = new LinkedList<>(); + viewOrderByList = new LinkedList<>(); modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, viewWhereConditions, viewHavingConditions, viewOrderByList, null); } @@ -1026,7 +1026,7 @@ public class GenericDAO { sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, modelFieldTypeReader, datasource)); // WHERE clause - List whereEntityConditionParams = new LinkedList(); + List whereEntityConditionParams = new LinkedList<>(); makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams); // GROUP BY clause for view-entity @@ -1035,7 +1035,7 @@ public class GenericDAO { } // HAVING clause - List havingEntityConditionParams = new LinkedList(); + List havingEntityConditionParams = new LinkedList<>(); makeConditionHavingString(sqlBuffer, " HAVING ", modelEntity, havingEntityCondition, viewHavingConditions, havingEntityConditionParams); if (isGroupBy) { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperDAO.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperDAO.java index 228f0f4414..38e7e212db 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperDAO.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperDAO.java @@ -104,7 +104,7 @@ public class GenericHelperDAO implements GenericHelper { */ public List findAllByPrimaryKeys(List primaryKeys) throws GenericEntityException { if (primaryKeys == null) return null; - List results = new LinkedList(); + List results = new LinkedList<>(); for (GenericPK primaryKey: primaryKeys) { GenericValue result = this.findByPrimaryKey(primaryKey); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperFactory.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperFactory.java index d555960e16..477673ff5d 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperFactory.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericHelperFactory.java @@ -36,7 +36,7 @@ public class GenericHelperFactory { public static final String module = GenericHelperFactory.class.getName(); // protected static UtilCache helperCache = new UtilCache("entity.GenericHelpers", 0, 0); - protected static final Map helperCache = new HashMap(); + protected static final Map helperCache = new HashMap<>(); public static GenericHelper getHelper(GenericHelperInfo helperInfo) { GenericHelper helper = helperCache.get(helperInfo.getHelperFullName()); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/ReadOnlyHelperDAO.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/ReadOnlyHelperDAO.java index 61a7275bc3..afeddc0853 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/ReadOnlyHelperDAO.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/ReadOnlyHelperDAO.java @@ -98,7 +98,7 @@ public class ReadOnlyHelperDAO implements GenericHelper { */ public List findAllByPrimaryKeys(List primaryKeys) throws GenericEntityException { if (primaryKeys == null) return null; - List results = new LinkedList(); + List results = new LinkedList<>(); for (GenericPK primaryKey: primaryKeys) { GenericValue result = this.findByPrimaryKey(primaryKey); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java index 8d1fc7f470..2832744601 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java @@ -172,8 +172,8 @@ public class DatabaseUtil { // get ALL tables from this database TreeSet tableNames = this.getTableNames(messages); - TreeSet fkTableNames = tableNames == null ? null : new TreeSet(tableNames); - TreeSet indexTableNames = tableNames == null ? null : new TreeSet(tableNames); + TreeSet fkTableNames = tableNames == null ? null : new TreeSet<>(tableNames); + TreeSet indexTableNames = tableNames == null ? null : new TreeSet<>(tableNames); if (tableNames == null) { String message = "Could not get table name information from the database, aborting."; @@ -202,12 +202,12 @@ public class DatabaseUtil { timer.timerString("Before Individual Table/Column Check"); - List modelEntityList = new ArrayList(modelEntities.values()); + List modelEntityList = new ArrayList<>(modelEntities.values()); // sort using compareTo method on ModelEntity Collections.sort(modelEntityList); int curEnt = 0; int totalEnt = modelEntityList.size(); - List entitiesAdded = new LinkedList(); + List entitiesAdded = new LinkedList<>(); String schemaName; try { schemaName = getSchemaName(messages); @@ -217,7 +217,7 @@ public class DatabaseUtil { Debug.logError(message, module); return; } - List> tableFutures = new LinkedList>(); + List> tableFutures = new LinkedList<>(); for (ModelEntity entity: modelEntityList) { curEnt++; @@ -252,7 +252,7 @@ public class DatabaseUtil { if (tableNames.contains(tableName)) { tableNames.remove(tableName); - Map fieldColNames = new HashMap(); + Map fieldColNames = new HashMap<>(); Iterator fieldIter = entity.getFieldsIterator(); while (fieldIter.hasNext()) { ModelField field = fieldIter.next(); @@ -425,7 +425,7 @@ public class DatabaseUtil { // for each newly added table, add fk indices if (datasourceInfo.getUseForeignKeyIndices()) { int totalFkIndices = 0; - List> fkIndicesFutures = new LinkedList>(); + List> fkIndicesFutures = new LinkedList<>(); for (ModelEntity curEntity: entitiesAdded) { if (curEntity.getRelationsOneSize() > 0) { fkIndicesFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) { @@ -454,7 +454,7 @@ public class DatabaseUtil { // for each newly added table, add declared indexes if (datasourceInfo.getUseIndices()) { int totalDis = 0; - List> disFutures = new LinkedList>(); + List> disFutures = new LinkedList<>(); for (ModelEntity curEntity: entitiesAdded) { if (curEntity.getIndexesSize() > 0) { disFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) { @@ -720,12 +720,12 @@ public class DatabaseUtil { // go through each table and make a ModelEntity object, add to list // for each entity make corresponding ModelField objects // then print out XML for the entities/fields - List newEntList = new LinkedList(); + List newEntList = new LinkedList<>(); boolean isCaseSensitive = getIsCaseSensitive(messages); // iterate over the table names is alphabetical order - for (String tableName: new TreeSet(colInfo.keySet())) { + for (String tableName: new TreeSet<>(colInfo.keySet())) { Map colMap = colInfo.get(tableName); ModelEntity newEntity = new ModelEntity(tableName, colMap, modelFieldTypeReader, isCaseSensitive); newEntList.add(newEntity); @@ -777,7 +777,7 @@ public class DatabaseUtil { return dbData; } - private static final List detections = new ArrayList(); + private static final List detections = new ArrayList<>(); private static final String goodFormatStr; private static final String badFormatStr; @@ -922,7 +922,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Table Info From Database", module); // get ALL tables from this database - TreeSet tableNames = new TreeSet(); + TreeSet tableNames = new TreeSet<>(); ResultSet tableSet = null; String lookupSchemaName = null; @@ -1029,7 +1029,7 @@ public class DatabaseUtil { private Map> getColumnInfo(Set tableNames, boolean getPks, Collection messages, ExecutorService executor) { // if there are no tableNames, don't even try to get the columns if (tableNames.size() == 0) { - return new HashMap>(); + return new HashMap<>(); } Connection connection = null; @@ -1059,7 +1059,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Column Info From Database", module); - Map> colInfo = new HashMap>(); + Map> colInfo = new HashMap<>(); try { String lookupSchemaName = getSchemaName(dbData); boolean needsUpperCase = false; @@ -1114,7 +1114,7 @@ public class DatabaseUtil { Map tableColInfo = colInfo.get(ccInfo.tableName); if (tableColInfo == null) { - tableColInfo = new HashMap(); + tableColInfo = new HashMap<>(); colInfo.put(ccInfo.tableName, tableColInfo); } tableColInfo.put(ccInfo.columnName, ccInfo); @@ -1153,7 +1153,7 @@ public class DatabaseUtil { } if (pkCount == 0) { Debug.logInfo("Searching in " + tableNames.size() + " tables for primary key fields ...", module); - List> pkFetcherFutures = new LinkedList>(); + List> pkFetcherFutures = new LinkedList<>(); for (String curTable: tableNames) { curTable = curTable.substring(curTable.indexOf('.') + 1); //cut off schema name pkFetcherFutures.add(executor.submit(createPrimaryKeyFetcher(dbData, lookupSchemaName, needsUpperCase, colInfo, messages, curTable))); @@ -1266,7 +1266,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Foreign Key (Reference) Info From Database", module); - Map> refInfo = new HashMap>(); + Map> refInfo = new HashMap<>(); try { // ResultSet rsCols = dbData.getCrossReference(null, null, null, null, null, null); @@ -1323,7 +1323,7 @@ public class DatabaseUtil { Map tableRefInfo = refInfo.get(rcInfo.fkTableName); if (tableRefInfo == null) { - tableRefInfo = new HashMap(); + tableRefInfo = new HashMap<>(); refInfo.put(rcInfo.fkTableName, tableRefInfo); if (Debug.verboseOn()) Debug.logVerbose("Adding new Map for table: " + rcInfo.fkTableName, module); } @@ -1400,7 +1400,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Index Info From Database", module); - Map> indexInfo = new HashMap>(); + Map> indexInfo = new HashMap<>(); try { int totalIndices = 0; String lookupSchemaName = getSchemaName(dbData); @@ -1445,7 +1445,7 @@ public class DatabaseUtil { Set tableIndexList = indexInfo.get(tableName); if (tableIndexList == null) { - tableIndexList = new TreeSet(); + tableIndexList = new TreeSet<>(); indexInfo.put(tableName, tableIndexList); if (Debug.verboseOn()) Debug.logVerbose("Adding new Map for table: " + tableName, module); } @@ -1535,7 +1535,7 @@ public class DatabaseUtil { private abstract class AbstractCountingCallable implements Callable { protected final ModelEntity entity; protected final Map modelEntities; - protected final List messages = new LinkedList(); + protected final List messages = new LinkedList<>(); protected int count; protected AbstractCountingCallable(ModelEntity entity, Map modelEntities) { @@ -1890,7 +1890,7 @@ public class DatabaseUtil { return; } - if (messages == null) messages = new ArrayList(); + if (messages == null) messages = new ArrayList<>(); for (String fieldInfo: fieldsWrongSize) { String entityName = fieldInfo.substring(0, fieldInfo.indexOf('.')); @@ -2190,7 +2190,7 @@ public class DatabaseUtil { /* ====================================================================== */ /* ====================================================================== */ public void createPrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength, List messages) { - if (messages == null) messages = new ArrayList(); + if (messages == null) messages = new ArrayList<>(); String err = createPrimaryKey(entity, usePkConstraintNames, constraintNameClipLength); if (UtilValidate.isNotEmpty(err)) { messages.add(err); @@ -2249,7 +2249,7 @@ public class DatabaseUtil { } public void deletePrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength, List messages) { - if (messages == null) messages = new ArrayList(); + if (messages == null) messages = new ArrayList<>(); String err = deletePrimaryKey(entity, usePkConstraintNames, constraintNameClipLength); if (UtilValidate.isNotEmpty(err)) { messages.add(err); @@ -2405,7 +2405,7 @@ public class DatabaseUtil { } public void deleteDeclaredIndices(ModelEntity entity, List messages) { - if (messages == null) messages = new ArrayList(); + if (messages == null) messages = new ArrayList<>(); String err = deleteDeclaredIndices(entity); if (UtilValidate.isNotEmpty(err)) { messages.add(err); @@ -2572,7 +2572,7 @@ public class DatabaseUtil { } public void deleteForeignKeyIndices(ModelEntity entity, List messages) { - if (messages == null) messages = new ArrayList(); + if (messages == null) messages = new ArrayList<>(); String err = deleteForeignKeyIndices(entity, datasourceInfo.getConstraintNameClipLength()); if (UtilValidate.isNotEmpty(err)) { messages.add(err); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java index 80ed6a5d97..67ed2795f9 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/JdbcValueHandler.java @@ -54,7 +54,7 @@ public abstract class JdbcValueHandler { for the specified Java type. The JdbcValueHandler instances are initialized with the SQL type recommended by Sun/Oracle. */ - Map> result = new HashMap>(); + Map> result = new HashMap<>(); // JDBC 1 result.put("Array", new ArrayJdbcValueHandler(Types.ARRAY)); result.put("java.sql.Array", new ArrayJdbcValueHandler(Types.ARRAY)); @@ -102,7 +102,7 @@ public abstract class JdbcValueHandler { method must be called with the correct type, or an exception will be thrown. */ - Map result = new HashMap(); + Map result = new HashMap<>(); // SQL 2003 Data Types result.put("ARRAY", Types.ARRAY); result.put("BIGINT", Types.BIGINT); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java index 2a9cca70e4..af285ef536 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SQLProcessor.java @@ -56,7 +56,7 @@ public class SQLProcessor implements AutoCloseable { public static final String module = SQLProcessor.class.getName(); /** Used for testing connections when test is enabled */ - private static final List CONNECTION_TEST_LIST = new ArrayList(); + private static final List CONNECTION_TEST_LIST = new ArrayList<>(); public static final int MAX_CONNECTIONS = 1000; public static final boolean ENABLE_TEST = false; diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java index 298743294a..ea6625b00f 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/SqlJdbcUtil.java @@ -72,7 +72,7 @@ public final class SqlJdbcUtil { public static final String module = SqlJdbcUtil.class.getName(); private static final int CHAR_BUFFER_SIZE = 4096; - private static Map fieldTypeMap = new HashMap(); + private static Map fieldTypeMap = new HashMap<>(); static { fieldTypeMap.put("java.lang.String", 1); fieldTypeMap.put("String", 1); @@ -141,7 +141,7 @@ public final class SqlJdbcUtil { // view-link and already be in the big join; SO keep a set of all aliases // in the join so far and if the left entity alias isn't there yet, and this // isn't the first one, throw an exception - Set joinedAliasSet = new TreeSet(); + Set joinedAliasSet = new TreeSet<>(); // TODO: at view-link read time make sure they are ordered properly so that each // left hand alias after the first view-link has already been linked before @@ -463,9 +463,9 @@ public final class SqlJdbcUtil { sql.append(makeFromClause(modelEntity, modelFieldTypeReader, datasourceInfo)); String viewWhereClause = makeViewWhereClause(modelEntity, datasourceInfo.getJoinStyle()); ModelViewEntity modelViewEntity = (ModelViewEntity)modelEntity; - List whereConditions = new LinkedList(); - List havingConditions = new LinkedList(); - List orderByList = new LinkedList(); + List whereConditions = new LinkedList<>(); + List havingConditions = new LinkedList<>(); + List orderByList = new LinkedList<>(); modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, whereConditions, havingConditions, orderByList, null); String viewConditionClause; diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/DynamicViewEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/DynamicViewEntity.java index e3289ea805..c1b98d9061 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/DynamicViewEntity.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/DynamicViewEntity.java @@ -58,22 +58,22 @@ public class DynamicViewEntity { protected String title = ""; /** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */ - protected Map memberModelMemberEntities = new HashMap(); + protected Map memberModelMemberEntities = new HashMap<>(); /** List of alias-alls which act as a shortcut for easily pulling over member entity fields */ - protected List aliasAlls = new ArrayList(); + protected List aliasAlls = new ArrayList<>(); /** List of aliases with information in addition to what is in the standard field list */ - protected List aliases = new ArrayList(); + protected List aliases = new ArrayList<>(); /** List of fields to group by */ protected List groupBy; /** List of view links to define how entities are connected (or "joined") */ - protected List viewLinks = new ArrayList(); + protected List viewLinks = new ArrayList<>(); /** relations defining relationships between this entity and other entities */ - protected List relations = new ArrayList(); + protected List relations = new ArrayList<>(); public DynamicViewEntity() { } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelField.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelField.java index 4a5bfac51e..be32c44a9e 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelField.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelField.java @@ -142,7 +142,7 @@ public final class ModelField extends ModelChild { Listvalidators = Collections.emptyList(); List elementList = UtilXml.childElementList(fieldElement, "validate"); if (!elementList.isEmpty()) { - validators = new ArrayList(elementList.size()); + validators = new ArrayList<>(elementList.size()); for (Element validateElement : elementList) { validators.add(validateElement.getAttribute("name").intern()); } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelFieldTypeReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelFieldTypeReader.java index 0ff9d0866f..b9a2d03f76 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelFieldTypeReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelFieldTypeReader.java @@ -50,7 +50,7 @@ public class ModelFieldTypeReader implements Serializable { protected static Map createFieldTypeCache(Element docElement, String location) { docElement.normalize(); - Map fieldTypeMap = new HashMap(); + Map fieldTypeMap = new HashMap<>(); List fieldTypeList = UtilXml.childElementList(docElement, "field-type-def"); for (Element curFieldType: fieldTypeList) { String fieldTypeName = curFieldType.getAttribute("type"); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelRelation.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelRelation.java index 4e3489ffce..05c63f1e12 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelRelation.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelRelation.java @@ -91,7 +91,7 @@ public final class ModelRelation extends ModelChild { ListkeyMaps = Collections.emptyList(); List elementList = UtilXml.childElementList(relationElement, "key-map"); if (!elementList.isEmpty()) { - keyMaps = new ArrayList(elementList.size()); + keyMaps = new ArrayList<>(elementList.size()); for (Element keyMapElement : elementList) { keyMaps.add(new ModelKeyMap(keyMapElement)); } @@ -138,7 +138,7 @@ public final class ModelRelation extends ModelChild { this.isAutoRelation = isAutoRelation; StringBuilder sb = new StringBuilder(); sb.append(modelEntity == null ? "Unknown" : modelEntity.getEntityName()).append("->").append(title).append(relEntityName).append("["); - Set keyMapSet = new TreeSet(keyMaps); + Set keyMapSet = new TreeSet<>(keyMaps); Iterator setIter = keyMapSet.iterator(); while (setIter.hasNext()) { ModelKeyMap keyMap = setIter.next(); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java index 6c9c9c442e..c33a0c291e 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/model/ModelViewEntity.java @@ -553,7 +553,7 @@ public class ModelViewEntity extends ModelEntity { List aliases = containedModelFields.get(alias.getField()); if (aliases == null) { - aliases = new LinkedList(); + aliases = new LinkedList<>(); containedModelFields.put(alias.getField(), aliases); } aliases.add(alias.getName()); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java index 1b7de991cc..ce964d29fc 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/Converters.java @@ -80,7 +80,7 @@ public class Converters implements ConverterLoader { } public JSON convert(GenericValue obj) throws ConversionException { - Map fieldMap = new HashMap(obj); + Map fieldMap = new HashMap<>(obj); fieldMap.put("_DELEGATOR_NAME_", obj.getDelegator().getDelegatorName()); fieldMap.put("_ENTITY_NAME_", obj.getEntityName()); try { @@ -97,7 +97,7 @@ public class Converters implements ConverterLoader { } public List convert(GenericValue obj) throws ConversionException { - List tempList = new LinkedList(); + List tempList = new LinkedList<>(); tempList.add(obj); return tempList; } @@ -109,7 +109,7 @@ public class Converters implements ConverterLoader { } public Set convert(GenericValue obj) throws ConversionException { - Set tempSet = new HashSet(); + Set tempSet = new HashSet<>(); tempSet.add(obj); return tempSet; } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java index 9627a70cd2..3c9ac662ff 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityCrypto.java @@ -52,7 +52,7 @@ public final class EntityCrypto { public static final String module = EntityCrypto.class.getName(); private final Delegator delegator; - private final ConcurrentMap keyMap = new ConcurrentHashMap(); + private final ConcurrentMap keyMap = new ConcurrentHashMap<>(); private final StorageHandler[] handlers; public EntityCrypto(Delegator delegator, String kekText) throws EntityCryptoException { diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java index 9375164ad0..7a5f7cd12c 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java @@ -92,7 +92,7 @@ public class EntityDataLoader { public static List getUrlList(String helperName, String componentName, List readerNames) { String paths = getPathsString(helperName); - List urlList = new LinkedList(); + List urlList = new LinkedList<>(); // first get files from resources if (readerNames != null) { @@ -167,7 +167,7 @@ public class EntityDataLoader { File loadDir = new File(path); if (loadDir.exists() && loadDir.isDirectory()) { File[] files = loadDir.listFiles(); - List tempFileList = new LinkedList(); + List tempFileList = new LinkedList<>(); if (files != null) { for (File file : files) { if (file.getName().toLowerCase(Locale.getDefault()).endsWith(".xml")) { @@ -199,9 +199,9 @@ public class EntityDataLoader { } public static List getUrlByComponentList(String helperName, List components, List readerNames) { - List urlList = new LinkedList(); + List urlList = new LinkedList<>(); for (String readerName: readerNames) { - List loadReaderNames = new LinkedList(); + List loadReaderNames = new LinkedList<>(); loadReaderNames.add(readerName); for (String component : components) { urlList.addAll(getUrlList(helperName, component, loadReaderNames)); @@ -212,7 +212,7 @@ public class EntityDataLoader { public static List getUrlByComponentList(String helperName, List components) { Datasource datasourceInfo = EntityConfig.getDatasource(helperName); - List readerNames = new LinkedList(); + List readerNames = new LinkedList<>(); for (ReadData readerInfo : datasourceInfo.getReadDataList()) { String readerName = readerInfo.getReaderName(); // ignore the "tenant" reader if the multitenant property is "N" @@ -291,7 +291,7 @@ public class EntityDataLoader { if (baseName != null) { try { - List toBeStored = new LinkedList(); + List toBeStored = new LinkedList<>(); toBeStored.add( delegator.makeValue( "SecurityPermission", diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java index 7c6a48612b..378b6ed2b1 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityQuery.java @@ -503,7 +503,7 @@ public class EntityQuery { } private EntityCondition makeDateCondition() { - List conditions = new ArrayList(); + List conditions = new ArrayList<>(); if (UtilValidate.isEmpty(this.filterByFieldNames)) { this.filterByDate(filterByDateMoment, "fromDate", "thruDate"); } @@ -523,7 +523,7 @@ public class EntityQuery { public List getFieldList(final String fieldName) throws GenericEntityException {select(fieldName); try (EntityListIterator genericValueEli = queryIterator()) { if (Boolean.TRUE.equals(this.distinct)) { - Set distinctSet = new HashSet(); + Set distinctSet = new HashSet<>(); GenericValue value = null; while ((value = genericValueEli.next()) != null) { T fieldValue = UtilGenerics.cast(value.get(fieldName)); @@ -531,10 +531,10 @@ public class EntityQuery { distinctSet.add(fieldValue); } } - return new ArrayList(distinctSet); + return new ArrayList<>(distinctSet); } else { - List fieldList = new LinkedList(); + List fieldList = new LinkedList<>(); GenericValue value = null; while ((value = genericValueEli.next()) != null) { T fieldValue = UtilGenerics.cast(value.get(fieldName)); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java index ca1db123c1..19f052efd4 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntitySaxReader.java @@ -161,7 +161,7 @@ public class EntitySaxReader extends DefaultHandler { public List getMessageList() { if (this.checkDataOnly && this.messageList == null) { - messageList = new LinkedList(); + messageList = new LinkedList<>(); } return this.messageList; } @@ -322,7 +322,7 @@ public class EntitySaxReader extends DefaultHandler { Template template = new Template("FMImportFilter", templateReader, config); NodeModel nodeModel = NodeModel.wrap(this.rootNodeForTemplate); - Map context = new HashMap(); + Map context = new HashMap<>(); TemplateHashModel staticModels = FreeMarkerWorker.getDefaultOfbizWrapper().getStaticModels(); context.put("Static", staticModels); diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityTypeUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityTypeUtil.java index a80c6122ed..3b42807de6 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityTypeUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityTypeUtil.java @@ -82,7 +82,7 @@ public final class EntityTypeUtil { public static List getDescendantTypes(GenericValue typeValue) { // assumes Child relation is "Child" - List descendantTypes = new ArrayList(); + List descendantTypes = new ArrayList<>(); // first get all childrenTypes ... List childrenTypes = null; diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java index 8aa931e1b6..8f4ce6b381 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java @@ -63,7 +63,7 @@ public final class EntityUtil { @SafeVarargs public static Map makeFields(V... args) { - Map fields = new HashMap(); + Map fields = new HashMap<>(); if (args != null) { for (int i = 0; i < args.length;) { if (!(args[i] instanceof String)) throw new IllegalArgumentException("Key(" + i + "), with value(" + args[i] + ") is not a String."); @@ -197,7 +197,7 @@ public final class EntityUtil { if (fromDateName == null) fromDateName = "fromDate"; if (thruDateName == null) thruDateName = "thruDate"; - List result = new LinkedList(); + List result = new LinkedList<>(); Iterator iter = datedValues.iterator(); if (allAreSame) { @@ -314,9 +314,9 @@ public final class EntityUtil { */ public static List localizedOrderBy(Collection values, List orderBy, Locale locale) { if (values == null) return null; - if (values.isEmpty()) return new ArrayList(); + if (values.isEmpty()) return new ArrayList<>(); //force check entity label before order by - List localizedValues = new ArrayList(); + List localizedValues = new ArrayList<>(); for (T value : values) { T newValue = UtilGenerics.cast(value.clone()); for (String orderByField : orderBy) { @@ -345,14 +345,14 @@ public final class EntityUtil { */ public static List orderBy(Collection values, List orderBy) { if (values == null) return null; - if (values.isEmpty()) return new ArrayList(); + if (values.isEmpty()) return new ArrayList<>(); if (UtilValidate.isEmpty(orderBy)) { - List newList = new ArrayList(); + List newList = new ArrayList<>(); newList.addAll(values); return newList; } - List result = new ArrayList(); + List result = new ArrayList<>(); result.addAll(values); if (Debug.verboseOn()) Debug.logVerbose("Sorting " + values.size() + " values, orderBy=" + orderBy.toString(), module); Collections.sort(result, new OrderByList(orderBy)); @@ -371,7 +371,7 @@ public final class EntityUtil { public static List getRelated(String relationName, Map fields, List values, boolean useCache) throws GenericEntityException { if (values == null) return null; - List result = new LinkedList(); + List result = new LinkedList<>(); for (GenericValue value: values) { result.addAll(value.getRelated(relationName, fields, null, useCache)); } @@ -413,7 +413,7 @@ public final class EntityUtil { search = null; for (GenericValue entity: entities) { if (now.equals(entity.get("fromDate"))) { - search = new HashMap(); + search = new HashMap<>(); for (Map.Entry entry: entity.getPrimaryKey().entrySet()) { search.put(entry.getKey(), entry.getValue()); } @@ -424,14 +424,14 @@ public final class EntityUtil { entity.store(); } if (search == null) { - search = new HashMap(); + search = new HashMap<>(); search.putAll(EntityUtil.getFirst(entities)); } } else { /* why is this being done? leaving out for now... search = new HashMap(search); */ - search = new HashMap(); + search = new HashMap<>(); search.putAll(find); } if (now.equals(search.get("fromDate"))) { @@ -472,10 +472,10 @@ public final class EntityUtil { if (genericValueEli == null || fieldName == null) { return null; } - List fieldList = new LinkedList(); + List fieldList = new LinkedList<>(); Set distinctSet = null; if (distinct) { - distinctSet = new HashSet(); + distinctSet = new HashSet<>(); } GenericValue value = null; @@ -537,7 +537,7 @@ public final class EntityUtil { endIndex = size; } - return new PagedList(startIndex, endIndex, size, viewIndex, viewSize, dataItems); + return new PagedList<>(startIndex, endIndex, size, viewIndex, viewSize, dataItems); } } diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java index 7919bd9c0f..9a003119e5 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/SequenceUtil.java @@ -43,7 +43,7 @@ public class SequenceUtil { public static final String module = SequenceUtil.class.getName(); - private final ConcurrentMap sequences = new ConcurrentHashMap(); + private final ConcurrentMap sequences = new ConcurrentHashMap<>(); private final GenericHelperInfo helperInfo; private final String tableName; private final String nameColName; diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/EntityGroupUtil.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/EntityGroupUtil.java index 372bb693ab..7383f77aae 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/EntityGroupUtil.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/EntityGroupUtil.java @@ -41,7 +41,7 @@ public final class EntityGroupUtil { private EntityGroupUtil () {} public static Set getEntityNamesByGroup(String entityGroupId, Delegator delegator, boolean requireStampFields) throws GenericEntityException { - Set entityNames = new HashSet(); + Set entityNames = new HashSet<>(); List entitySyncGroupIncludes = EntityQuery.use(delegator).from("EntityGroupEntry").where("entityGroupId", entityGroupId).queryList(); List modelEntities = getModelEntitiesFromRecords(entitySyncGroupIncludes, delegator, requireStampFields); @@ -53,7 +53,7 @@ public final class EntityGroupUtil { } public static List getModelEntitiesFromRecords(List entityGroupEntryValues, Delegator delegator, boolean requireStampFields) throws GenericEntityException { - List entityModelToUseList = new LinkedList(); + List entityModelToUseList = new LinkedList<>(); for (String entityName: delegator.getModelReader().getEntityNames()) { ModelEntity modelEntity = delegator.getModelEntity(entityName); diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java index 3684a7d197..bb2615d69d 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataLoadContainer.java @@ -137,7 +137,7 @@ public class EntityDataLoadContainer implements Container { } Delegator delegator = getDelegator(delegatorNameProp, null); - List expr = new ArrayList(); + List expr = new ArrayList<>(); expr.add(EntityCondition.makeCondition("disabled", EntityOperator.EQUALS, "N")); expr.add(EntityCondition.makeCondition("disabled", EntityOperator.EQUALS, null)); @@ -165,7 +165,7 @@ public class EntityDataLoadContainer implements Container { GenericHelperInfo helperInfo = getHelperInfo(delegator, entityGroup); DatabaseUtil dbUtil = new DatabaseUtil(helperInfo); Map modelEntities = getModelEntities(delegator, entityGroup); - TreeSet modelEntityNames = new TreeSet(modelEntities.keySet()); + TreeSet modelEntityNames = new TreeSet<>(modelEntities.keySet()); Collection allComponents = ComponentConfig.getAllComponents(); // data loading logic starts here @@ -303,7 +303,7 @@ public class EntityDataLoadContainer implements Container { private void dropDbConstraints(DatabaseUtil dbUtil, Map modelEntities, TreeSet modelEntityNames) { - List messages = new ArrayList(); + List messages = new ArrayList<>(); Debug.logImportant("Dropping foreign key indices...", module); for (String entityName : modelEntityNames) { @@ -335,7 +335,7 @@ public class EntityDataLoadContainer implements Container { private void createDbConstraints(DatabaseUtil dbUtil, Map modelEntities, TreeSet modelEntityNames) { - List messages = new ArrayList(); + List messages = new ArrayList<>(); Debug.logImportant("Creating foreign keys...", module); for (String entityName : modelEntityNames) { @@ -367,7 +367,7 @@ public class EntityDataLoadContainer implements Container { private void dropPrimaryKeys(DatabaseUtil dbUtil, Map modelEntities, TreeSet modelEntityNames) { - List messages = new ArrayList(); + List messages = new ArrayList<>(); Debug.logImportant("Dropping primary keys...", module); for (String entityName : modelEntityNames) { @@ -383,7 +383,7 @@ public class EntityDataLoadContainer implements Container { private void createPrimaryKeys(DatabaseUtil dbUtil, Map modelEntities, TreeSet modelEntityNames) { - List messages = new ArrayList(); + List messages = new ArrayList<>(); Debug.logImportant("Creating primary keys...", module); for (String entityName : modelEntityNames) { @@ -397,8 +397,8 @@ public class EntityDataLoadContainer implements Container { } private void repairDbColumns(DatabaseUtil dbUtil, Map modelEntities) { - List fieldsToRepair = new ArrayList(); - List messages = new ArrayList(); + List fieldsToRepair = new ArrayList<>(); + List messages = new ArrayList<>(); dbUtil.checkDb(modelEntities, fieldsToRepair, messages, false, false, false, false); if (UtilValidate.isNotEmpty(fieldsToRepair)) { dbUtil.repairColumnSizeChanges(modelEntities, fieldsToRepair, messages); @@ -426,8 +426,8 @@ public class EntityDataLoadContainer implements Container { boolean continueOnFail = isPropertySet(loadDataProps, CONTINUE_ON_FAIL); List urlList = prepareDataUrls(delegator, baseDelegator, allComponents, helperInfo, loadDataProps); - List infoMessages = new ArrayList(); - List errorMessages = new ArrayList(); + List infoMessages = new ArrayList<>(); + List errorMessages = new ArrayList<>(); int totalRowsChanged = 0; logDataLoadingPlan(urlList, delegator.getDelegatorName()); @@ -462,7 +462,7 @@ public class EntityDataLoadContainer implements Container { Collection allComponents, GenericHelperInfo helperInfo, Map loadDataProps) throws ContainerException { - List urlList = new ArrayList(); + List urlList = new ArrayList<>(); // prepare command line properties passed by user List files = getLoadFiles(loadDataProps.get(DATA_FILE)); @@ -500,7 +500,7 @@ public class EntityDataLoadContainer implements Container { } private List getLoadFiles(String fileProp) { - List fileList = new ArrayList(); + List fileList = new ArrayList<>(); Optional.ofNullable(fileProp) .ifPresent(props -> fileList.addAll(StringUtil.split(props, ","))); return fileList; @@ -519,8 +519,8 @@ public class EntityDataLoadContainer implements Container { private List prepareTenantLoadComponents(Delegator delegator, Delegator baseDelegator, Collection allComponents, String component) { - List loadComponents = new ArrayList(); - List queryConditions = new ArrayList(); + List loadComponents = new ArrayList<>(); + List queryConditions = new ArrayList<>(); if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId()) && EntityUtil.isMultiTenantEnabled()) { @@ -547,7 +547,7 @@ public class EntityDataLoadContainer implements Container { } private List retireveDataUrlsFromFileList(List files) throws ContainerException { - List fileUrls = new ArrayList(); + List fileUrls = new ArrayList<>(); for(String file: files) { URL url = UtilURL.fromResource(file); if (url == null) { diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java index 903662aa6b..d001f09c7d 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/data/EntityDataServices.java @@ -167,7 +167,7 @@ public class EntityDataServices { } private static List getFileList(File root) { - List fileList = new LinkedList(); + List fileList = new LinkedList<>(); // check for a file list file File listFile = new File(root, "FILELIST.txt"); @@ -337,7 +337,7 @@ public class EntityDataServices { String groupName = (String) context.get("groupName"); Boolean fixSizes = (Boolean) context.get("fixColSizes"); if (fixSizes == null) fixSizes = Boolean.FALSE; - List messages = new LinkedList(); + List messages = new LinkedList<>(); GenericHelperInfo helperInfo = delegator.getGroupHelperInfo(groupName); DatabaseUtil dbUtil = new DatabaseUtil(helperInfo); @@ -376,7 +376,7 @@ public class EntityDataServices { // step 5 - repair field sizes if (fixSizes) { Debug.logImportant("Updating column field size changes", module); - List fieldsWrongSize = new LinkedList(); + List fieldsWrongSize = new LinkedList<>(); dbUtil.checkDb(modelEntities, fieldsWrongSize, messages, true, true, true, true); if (fieldsWrongSize.size() > 0) { dbUtil.repairColumnSizeChanges(modelEntities, fieldsWrongSize, messages); diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java index bfddbe57a6..13227034a1 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/DelegatorEcaHandler.java @@ -48,7 +48,7 @@ public class DelegatorEcaHandler implements EntityEcaHandler { protected Delegator delegator = null; protected String delegatorName = null; protected String entityEcaReaderName = null; - protected AtomicReference> dctx = new AtomicReference>(); + protected AtomicReference> dctx = new AtomicReference<>(); public DelegatorEcaHandler() { } @@ -60,7 +60,7 @@ public class DelegatorEcaHandler implements EntityEcaHandler { Callable creator = () -> { return EntityServiceFactory.getDispatchContext(DelegatorEcaHandler.this.delegator); }; - FutureTask futureTask = new FutureTask(creator); + FutureTask futureTask = new FutureTask<>(creator); if (this.dctx.compareAndSet(null, futureTask)) { ExecutionPool.GLOBAL_BATCH.submit(futureTask); } @@ -102,7 +102,7 @@ public class DelegatorEcaHandler implements EntityEcaHandler { } if (!rules.isEmpty() && Debug.verboseOn()) Debug.logVerbose("Running ECA (" + event + ").", module); - Set actionsRun = new TreeSet(); + Set actionsRun = new TreeSet<>(); for (EntityEcaRule eca: rules) { eca.eval(currentOperation, this.getDispatchContext(), value, isError, actionsRun); } diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaCondition.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaCondition.java index 9222089111..9e40416fe0 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaCondition.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaCondition.java @@ -109,7 +109,7 @@ public final class EntityEcaCondition implements java.io.Serializable { if (Debug.verboseOn()) Debug.logVerbose("Comparing : " + lhsValue + " " + operator + " " + rhsValue, module); // evaluate the condition & invoke the action(s) - List messages = new LinkedList(); + List messages = new LinkedList<>(); Boolean cond = ObjectType.doRealCompare(lhsValue, rhsValue, operator, compareType, format, messages, null, dctx.getClassLoader(), constant); // if any messages were returned send them out @@ -182,7 +182,7 @@ public final class EntityEcaCondition implements java.io.Serializable { } protected List getFieldNames() { - List fieldNameList = new ArrayList(); + List fieldNameList = new ArrayList<>(); if( UtilValidate.isNotEmpty(lhsValueName) ) { fieldNameList.add(lhsValueName); } diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java index 82faf2e05b..f20025f793 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaRule.java @@ -51,7 +51,7 @@ public final class EntityEcaRule implements java.io.Serializable { private final List conditions; private final List actionsAndSets; private boolean enabled = true; - private final List conditionFieldNames = new ArrayList(); + private final List conditionFieldNames = new ArrayList<>(); public EntityEcaRule(Element eca) { this.entityName = eca.getAttribute("entity"); @@ -59,8 +59,8 @@ public final class EntityEcaRule implements java.io.Serializable { this.eventName = eca.getAttribute("event"); this.runOnError = "true".equals(eca.getAttribute("run-on-error")); this.enabled = !"false".equals(eca.getAttribute("enabled")); - ArrayList conditions = new ArrayList(); - ArrayList actionsAndSets = new ArrayList(); + ArrayList conditions = new ArrayList<>(); + ArrayList actionsAndSets = new ArrayList<>(); for (Element element: UtilXml.childElementList(eca)) { if ("condition".equals(element.getNodeName())) { EntityEcaCondition ecaCond = new EntityEcaCondition(element, true, false); @@ -130,7 +130,7 @@ public final class EntityEcaRule implements java.io.Serializable { return; } // Are fields tested in a condition missing? If so, we need to load them - List fieldsToLoad = new ArrayList(); + List fieldsToLoad = new ArrayList<>(); for( String conditionFieldName : conditionFieldNames) { if( value.get(conditionFieldName) == null) { fieldsToLoad.add(conditionFieldName); @@ -147,7 +147,7 @@ public final class EntityEcaRule implements java.io.Serializable { } } - Map context = new HashMap(); + Map context = new HashMap<>(); context.putAll(value); boolean allCondTrue = true; diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java index 27f98118f1..4304840bb7 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/eca/EntityEcaUtil.java @@ -57,7 +57,7 @@ public final class EntityEcaUtil { Map>> ecaCache = entityEcaReaders.get(entityEcaReaderName); if (ecaCache == null) { // FIXME: Collections are not thread safe - ecaCache = new HashMap>>(); + ecaCache = new HashMap<>(); readConfig(entityEcaReaderName, ecaCache); ecaCache = entityEcaReaders.putIfAbsentAndGet(entityEcaReaderName, ecaCache); } @@ -90,7 +90,7 @@ public final class EntityEcaUtil { return; } - List>> futures = new LinkedList>>(); + List>> futures = new LinkedList<>(); for (Resource eecaResourceElement : entityEcaReaderInfo.getResourceList()) { ResourceHandler handler = new MainResourceHandler(EntityConfig.ENTITY_ENGINE_XML_FILENAME, eecaResourceElement.getLoader(), eecaResourceElement.getLocation()); futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(createEcaLoaderCallable(handler))); @@ -110,14 +110,14 @@ public final class EntityEcaUtil { Map> eventMap = ecaCache.get(entityName); List rules = null; if (eventMap == null) { - eventMap = new HashMap>(); - rules = new LinkedList(); + eventMap = new HashMap<>(); + rules = new LinkedList<>(); ecaCache.put(entityName, eventMap); eventMap.put(eventName, rules); } else { rules = eventMap.get(eventName); if (rules == null) { - rules = new LinkedList(); + rules = new LinkedList<>(); eventMap.put(eventName, rules); } } @@ -132,7 +132,7 @@ public final class EntityEcaUtil { } private static List getEcaDefinitions(ResourceHandler handler) { - List rules = new LinkedList(); + List rules = new LinkedList<>(); Element rootElement = null; try { rootElement = handler.getDocument().getDocumentElement(); diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java index 145bf49f1b..37ca532c0d 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/permission/EntityPermissionChecker.java @@ -95,7 +95,7 @@ public class EntityPermissionChecker { if (UtilValidate.isNotEmpty(targetOperationString)) { List operationsFromString = StringUtil.split(targetOperationString, "|"); if (targetOperationList == null) { - targetOperationList = new ArrayList(); + targetOperationList = new ArrayList<>(); } targetOperationList.addAll(operationsFromString); } @@ -111,7 +111,7 @@ public class EntityPermissionChecker { if (UtilValidate.isNotEmpty(idString)) { entityIdList = StringUtil.split(idString, "|"); } else { - entityIdList = new LinkedList(); + entityIdList = new LinkedList<>(); } String entityName = entityNameExdr.expandString(context); HttpServletRequest request = (HttpServletRequest)context.get("request"); @@ -178,13 +178,13 @@ public class EntityPermissionChecker { Security security, String entityAction, String privilegeEnumId, String quickCheckContentId) { - List entityIds = new LinkedList(); + List entityIds = new LinkedList<>(); if (content != null) entityIds.add(content); if (UtilValidate.isNotEmpty(quickCheckContentId)) { List quickList = StringUtil.split(quickCheckContentId, "|"); if (UtilValidate.isNotEmpty(quickList)) entityIds.addAll(quickList); } - Map results = new HashMap(); + Map results = new HashMap<>(); boolean passed = false; if (userLogin != null && entityAction != null) { passed = security.hasEntityPermission("CONTENTMGR", entityAction, userLogin); @@ -270,7 +270,7 @@ public class EntityPermissionChecker { .where(EntityCondition.makeCondition(lcEntityName + "OperationId", EntityOperator.IN, targetOperationList)) .cache(true) .queryList(); - Map entities = new HashMap(); + Map entities = new HashMap<>(); String pkFieldName = modelEntity.getFirstPkFieldName(); //TODO: privilegeEnumId test @@ -321,8 +321,8 @@ public class EntityPermissionChecker { // Note that "quickCheck" id come first in the list // Check with no roles or purposes on the chance that the permission fields contain _NA_ s. - Map> purposes = new HashMap>(); - Map> roles = new HashMap>(); + Map> purposes = new HashMap<>(); + Map> roles = new HashMap<>(); //List purposeList = null; //List roleList = null; for (Object id: entityIdList) { @@ -421,7 +421,7 @@ public class EntityPermissionChecker { if (entity == null) continue; String entityId = entity.getString(pkFieldName); - List ownedContentIdList = new LinkedList(); + List ownedContentIdList = new LinkedList<>(); getEntityOwners(delegator, entity, ownedContentIdList, "Content", "ownerContentId"); List ownedContentRoleIds = getUserRolesFromList(delegator, ownedContentIdList, partyId, "contentId", "partyId", "roleTypeId", "ContentRole"); @@ -520,7 +520,7 @@ public class EntityPermissionChecker { // Check with no roles or purposes on the chance that the permission fields contain _NA_ s. String pkFieldName = modelEntity.getFirstPkFieldName(); - Map entities = new HashMap(); + Map entities = new HashMap<>(); //List purposeList = null; //List roleList = null; for (Object id: entityIdList) { @@ -619,7 +619,7 @@ public class EntityPermissionChecker { boolean hasRoleOperation = false; boolean hasNeed = false; - List newHasRoleList = new LinkedList(); + List newHasRoleList = new LinkedList<>(); for (String roleOp: targetOperations) { int idx1 = roleOp.indexOf("HAS_"); if (idx1 == 0) { @@ -757,9 +757,9 @@ public class EntityPermissionChecker { List purposeIds = null; if (passedPurposes == null) { - purposeIds = new LinkedList(); + purposeIds = new LinkedList<>(); } else { - purposeIds = new LinkedList(); + purposeIds = new LinkedList<>(); purposeIds.addAll(passedPurposes); } @@ -791,7 +791,7 @@ public class EntityPermissionChecker { */ public static List getUserRoles(GenericValue entity, GenericValue userLogin, Delegator delegator) throws GenericEntityException { - List roles = new LinkedList(); + List roles = new LinkedList<>(); if (entity == null) return roles; String entityName = entity.getEntityName(); // TODO: Need to use ContentManagementWorker.getAuthorContent first @@ -828,7 +828,7 @@ public class EntityPermissionChecker { party = contentRole.getRelatedOne("Party", false); partyTypeId = (String)party.get("partyTypeId"); if (partyTypeId != null && partyTypeId.equals("PARTY_GROUP")) { - Map map = new HashMap(); + Map map = new HashMap<>(); // At some point from/thru date will need to be added map.put("partyIdFrom", partyId); @@ -1021,7 +1021,7 @@ public class EntityPermissionChecker { } public void clearList() { - this.entityList = new LinkedList(); + this.entityList = new LinkedList<>(); } public void init(Delegator delegator) throws GenericEntityException { @@ -1121,7 +1121,7 @@ public class EntityPermissionChecker { public static class StdAuxiliaryValueGetter implements AuxiliaryValueGetter { - protected List entityList = new LinkedList(); + protected List entityList = new LinkedList<>(); protected String auxiliaryFieldName; protected String entityName; protected String entityIdName; @@ -1152,7 +1152,7 @@ public class EntityPermissionChecker { } public void clearList() { - this.entityList = new LinkedList(); + this.entityList = new LinkedList<>(); } public void setList(List lst) { @@ -1162,7 +1162,7 @@ public class EntityPermissionChecker { public void init(Delegator delegator, String entityId) throws GenericEntityException { if (this.entityList == null) { - this.entityList = new LinkedList(); + this.entityList = new LinkedList<>(); } if (UtilValidate.isEmpty(this.entityName)) { return; @@ -1198,7 +1198,7 @@ public class EntityPermissionChecker { public static class StdRelatedRoleGetter implements RelatedRoleGetter { - protected List roleIdList = new LinkedList(); + protected List roleIdList = new LinkedList<>(); protected String roleTypeFieldName; protected String partyFieldName; protected String entityName; @@ -1241,7 +1241,7 @@ public class EntityPermissionChecker { } public void clearList() { - this.roleIdList = new LinkedList(); + this.roleIdList = new LinkedList<>(); } public void setList(List lst) { @@ -1260,7 +1260,7 @@ public class EntityPermissionChecker { public void initWithAncestors(Delegator delegator, GenericValue entity, String partyId) throws GenericEntityException { - List ownedContentIdList = new LinkedList(); + List ownedContentIdList = new LinkedList<>(); getEntityOwners(delegator, entity, ownedContentIdList, this.entityName, this.ownerEntityFieldName); if (ownedContentIdList.size() > 0) { List lst = getUserRolesFromList(delegator, ownedContentIdList, partyId, this.roleEntityIdName, this.partyFieldName, this.roleTypeFieldName, this.roleEntityName); @@ -1321,7 +1321,7 @@ public class EntityPermissionChecker { .cache(true) .queryList(); List roleListFiltered = EntityUtil.filterByDate(roleList); - Set distinctSet = new HashSet(); + Set distinctSet = new HashSet<>(); for (GenericValue contentRole: roleListFiltered) { String roleTypeId = contentRole.getString(roleTypeIdFieldName); distinctSet.add(roleTypeId); diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java index 91813053c9..ec15b64b94 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncContext.java @@ -106,8 +106,8 @@ public class EntitySyncContext { //results for a given time block, we will do a query to find the next create/update/remove //time for that entity, and also keep track of a global next with the lowest future next value; //using these we can skip a lot of queries and speed this up significantly - public Map nextEntityCreateTxTime = new HashMap(); - public Map nextEntityUpdateTxTime = new HashMap(); + public Map nextEntityCreateTxTime = new HashMap<>(); + public Map nextEntityUpdateTxTime = new HashMap<>(); public Timestamp nextCreateTxTime = null; public Timestamp nextUpdateTxTime = null; public Timestamp nextRemoveTxTime = null; @@ -320,7 +320,7 @@ public class EntitySyncContext { public ArrayList assembleValuesToCreate() throws SyncDataErrorException { // first grab all values inserted in the date range, then get the updates (leaving out all values inserted in the data range) - ArrayList valuesToCreate = new ArrayList(); // make it an ArrayList to easily merge in sorted lists + ArrayList valuesToCreate = new ArrayList<>(); // make it an ArrayList to easily merge in sorted lists if (this.nextCreateTxTime != null && (this.nextCreateTxTime.equals(currentRunEndTime) || this.nextCreateTxTime.after(currentRunEndTime))) { // this means that for all entities in this pack we found on the last pass that there would be nothing for this one, so just return nothing... @@ -474,7 +474,7 @@ public class EntitySyncContext { public ArrayList assembleValuesToStore() throws SyncDataErrorException { // simulate two ordered lists and merge them on-the-fly for faster combined sorting - ArrayList valuesToStore = new ArrayList(); // make it an ArrayList to easily merge in sorted lists + ArrayList valuesToStore = new ArrayList<>(); // make it an ArrayList to easily merge in sorted lists if (this.nextUpdateTxTime != null && (this.nextUpdateTxTime.equals(currentRunEndTime) || this.nextUpdateTxTime.after(currentRunEndTime))) { // this means that for all entities in this pack we found on the last pass that there would be nothing for this one, so just return nothing... @@ -626,7 +626,7 @@ public class EntitySyncContext { public LinkedList assembleKeysToRemove() throws SyncDataErrorException { // get all removed items from the given time range, add to list for those - LinkedList keysToRemove = new LinkedList(); + LinkedList keysToRemove = new LinkedList<>(); if (this.nextRemoveTxTime != null && (this.nextRemoveTxTime.equals(currentRunEndTime) || this.nextRemoveTxTime.after(currentRunEndTime))) { // this means that for all entities in this pack we found on the last pass that there would be nothing for this one, so just return nothing... @@ -871,7 +871,7 @@ public class EntitySyncContext { } public Set makeEntityNameToUseSet() { - Set entityNameToUseSet = new HashSet(); + Set entityNameToUseSet = new HashSet<>(); for (ModelEntity modelEntity: this.entityModelToUseList) { entityNameToUseSet.add(modelEntity.getEntityName()); } @@ -1182,7 +1182,7 @@ public class EntitySyncContext { @Override public void saveSyncErrorInfo(EntitySyncContext esc) { if (esc != null) { - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); esc.saveSyncErrorInfo("ESR_OTHER_ERROR", errorList); this.addErrorMessages(errorList); } @@ -1200,7 +1200,7 @@ public class EntitySyncContext { @Override public void saveSyncErrorInfo(EntitySyncContext esc) { if (esc != null) { - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); esc.saveSyncErrorInfo("ESR_DATA_ERROR", errorList); this.addErrorMessages(errorList); } @@ -1218,7 +1218,7 @@ public class EntitySyncContext { @Override public void saveSyncErrorInfo(EntitySyncContext esc) { if (esc != null) { - List errorList = new LinkedList(); + List errorList = new LinkedList<>(); esc.saveSyncErrorInfo("ESR_SERVICE_ERROR", errorList); this.addErrorMessages(errorList); } diff --git a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java index 802a571b87..33c3b95c7e 100644 --- a/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java +++ b/framework/entityext/src/main/java/org/apache/ofbiz/entityext/synchronization/EntitySyncServices.java @@ -290,7 +290,7 @@ public class EntitySyncServices { gotMoreData = false; // call pullAndReportEntitySyncData, initially with no results, then with results from last loop - Map remoteCallContext = new HashMap(); + Map remoteCallContext = new HashMap<>(); remoteCallContext.put("entitySyncId", entitySyncId); remoteCallContext.put("delegatorName", context.get("remoteDelegatorName")); remoteCallContext.put("userLogin", context.get("userLogin")); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangUtil.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangUtil.java index 94161db40f..0b03961fba 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangUtil.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangUtil.java @@ -61,7 +61,7 @@ public final class MiniLangUtil { private static final Set SCRIPT_PREFIXES; static { - Set scriptPrefixes = new HashSet(); + Set scriptPrefixes = new HashSet<>(); for (String scriptName : ScriptUtil.SCRIPT_NAMES) { scriptPrefixes.add(scriptName.concat(":")); } diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangValidate.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangValidate.java index de25d9a6cc..568e8b8c45 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangValidate.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/MiniLangValidate.java @@ -44,7 +44,7 @@ public final class MiniLangValidate { * @throws ValidationException If an invalid attribute name is found and validation.level=strict */ public static void attributeNames(SimpleMethod method, Element element, String... validAttributeNames) throws ValidationException { - Set validNames = new HashSet(); + Set validNames = new HashSet<>(); for (String name : validAttributeNames) { validNames.add(name); } @@ -78,7 +78,7 @@ public final class MiniLangValidate { * @throws ValidationException If an invalid child element is found and validation.level=strict */ public static void childElements(SimpleMethod method, Element element, String... validChildElementNames) throws ValidationException { - Set validNames = new HashSet(); + Set validNames = new HashSet<>(); for (String name : validChildElementNames) { validNames.add(name); } @@ -245,7 +245,7 @@ public final class MiniLangValidate { * @throws ValidationException If none of the required child elements are found and validation.level=strict */ public static void requireAnyChildElement(SimpleMethod method, Element element, String... elementNames) throws ValidationException { - Set childElementNames = new HashSet(); + Set childElementNames = new HashSet<>(); Node node = element.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { @@ -293,7 +293,7 @@ public final class MiniLangValidate { * @throws ValidationException If any of the required child elements are not found and validation.level=strict */ public static void requiredChildElements(SimpleMethod method, Element element, String... elementNames) throws ValidationException { - Set childElementNames = new HashSet(); + Set childElementNames = new HashSet<>(); Node node = element.getFirstChild(); while (node != null) { if (node.getNodeType() == Node.ELEMENT_NODE) { diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java index 26f12dc1f3..053c511726 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMapProcessor.java @@ -41,7 +41,7 @@ public class SimpleMapProcessor { private static final UtilCache> simpleMapProcessorsURLCache = UtilCache.createUtilCache("minilang.SimpleMapProcessorsURL", 0, 0); protected static Map getAllProcessors(URL xmlURL) throws MiniLangException { - Map mapProcessors = new HashMap(); + Map mapProcessors = new HashMap<>(); // read in the file Document document = null; try { diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java index 57a565c280..fe5956231e 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/SimpleMethod.java @@ -88,7 +88,7 @@ public final class SimpleMethod extends MiniLangElement { private static final UtilCache simpleMethodsResourceCache = UtilCache.createUtilCache("minilang.SimpleMethodsResource", 0, 0); static { - Map> mapFactories = new HashMap>(); + Map> mapFactories = new HashMap<>(); Iterator> it = UtilGenerics.cast(ServiceLoader.load(MethodOperation.Factory.class, SimpleMethod.class.getClassLoader()).iterator()); while (it.hasNext()) { MethodOperation.Factory factory = it.next(); @@ -123,7 +123,7 @@ public final class SimpleMethod extends MiniLangElement { if (UtilValidate.isEmpty(fromLocation)) { fromLocation = ""; } - Map simpleMethods = new HashMap(); + Map simpleMethods = new HashMap<>(); Document document = null; try { document = UtilXml.readXmlDocument(content, true, true); @@ -135,7 +135,7 @@ public final class SimpleMethod extends MiniLangElement { } private static Map getAllSimpleMethods(URL xmlURL) throws MiniLangException { - Map simpleMethods = new LinkedHashMap(); + Map simpleMethods = new LinkedHashMap<>(); Document document = null; try { document = UtilXml.readXmlDocument(xmlURL, true, true); @@ -220,13 +220,13 @@ public final class SimpleMethod extends MiniLangElement { */ public static List getSimpleMethodsList(String xmlResource, ClassLoader loader) throws MiniLangException { Map simpleMethodMap = getSimpleMethods(xmlResource, loader); - return new ArrayList(simpleMethodMap.values()); + return new ArrayList<>(simpleMethodMap.values()); } public static List readOperations(Element simpleMethodElement, SimpleMethod simpleMethod) throws MiniLangException { Assert.notNull("simpleMethodElement", simpleMethodElement, "simpleMethod", simpleMethod); List operationElements = UtilXml.childElementList(simpleMethodElement); - ArrayList methodOperations = new ArrayList(operationElements.size()); + ArrayList methodOperations = new ArrayList<>(operationElements.size()); if (UtilValidate.isNotEmpty(operationElements)) { for (Element curOperElem : operationElements) { String nodeName = UtilXml.getNodeNameIgnorePrefix(curOperElem); @@ -391,7 +391,7 @@ public final class SimpleMethod extends MiniLangElement { private void addMessage(MethodContext methodContext, String messageListName, String message) { List messages = methodContext.getEnv(messageListName); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); methodContext.putEnv(messageListName, messages); } messages.add(message); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/artifact/ArtifactInfoContext.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/artifact/ArtifactInfoContext.java index 62f86675bd..e0f5d9c7ad 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/artifact/ArtifactInfoContext.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/artifact/ArtifactInfoContext.java @@ -28,9 +28,9 @@ import org.apache.ofbiz.minilang.SimpleMethod; */ public final class ArtifactInfoContext { - private final Set entityNameSet = new HashSet(); - private final Set serviceNameSet = new HashSet(); - private final Set simpleMethodNameSet = new HashSet(); + private final Set entityNameSet = new HashSet<>(); + private final Set serviceNameSet = new HashSet<>(); + private final Set simpleMethodNameSet = new HashSet<>(); /** * Adds an entity name to this context. diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MethodContext.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MethodContext.java index 53f45b58c7..596cf2c2da 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MethodContext.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/MethodContext.java @@ -47,14 +47,14 @@ public final class MethodContext { private Delegator delegator; private LocalDispatcher dispatcher; - private Map env = new HashMap(); + private Map env = new HashMap<>(); private ClassLoader loader; private Locale locale; private int methodType; private Map parameters; private HttpServletRequest request = null; private HttpServletResponse response = null; - private Map results = new HashMap(); + private Map results = new HashMap<>(); private Security security; private TimeZone timeZone; private int traceCount = 0; diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallClassMethod.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallClassMethod.java index bba5c1f782..e8b375ee71 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallClassMethod.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallClassMethod.java @@ -73,12 +73,12 @@ public final class CallClassMethod extends MethodOperation { this.retFieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("ret-field")); List parameterElements = UtilXml.childElementList(element); if (parameterElements.size() > 0) { - ArrayList> parameterList = new ArrayList>(parameterElements.size()); + ArrayList> parameterList = new ArrayList<>(parameterElements.size()); for (Element parameterElement : parameterElements) { if ("string".equals(parameterElement.getNodeName())) { parameterList.add(new StringObject(parameterElement, simpleMethod)); } else if ("field".equals(parameterElement.getNodeName())) { - parameterList.add(new FieldObject(parameterElement, simpleMethod)); + parameterList.add(new FieldObject<>(parameterElement, simpleMethod)); } } parameterList.trimToSize(); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallObjectMethod.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallObjectMethod.java index 95361671ed..8cc3fb1d71 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallObjectMethod.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallObjectMethod.java @@ -64,12 +64,12 @@ public final class CallObjectMethod extends MethodOperation { this.retFieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("ret-field")); List parameterElements = UtilXml.childElementList(element); if (parameterElements.size() > 0) { - ArrayList> parameterList = new ArrayList>(parameterElements.size()); + ArrayList> parameterList = new ArrayList<>(parameterElements.size()); for (Element parameterElement : parameterElements) { if ("string".equals(parameterElement.getNodeName())) { parameterList.add(new StringObject(parameterElement, simpleMethod)); } else if ("field".equals(parameterElement.getNodeName())) { - parameterList.add(new FieldObject(parameterElement, simpleMethod)); + parameterList.add(new FieldObject<>(parameterElement, simpleMethod)); } } parameterList.trimToSize(); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallService.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallService.java index 66da4dbdf2..a88ca7c66e 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallService.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallService.java @@ -113,7 +113,7 @@ public final class CallService extends MethodOperation { defaultMessage = new FlexibleMessage(UtilXml.firstChildElement(element, "default-message"), null);// "service.default.message" List resultsToMapElements = UtilXml.childElementList(element, "results-to-map"); if (UtilValidate.isNotEmpty(resultsToMapElements)) { - List resultsToMapList = new ArrayList(resultsToMapElements.size()); + List resultsToMapList = new ArrayList<>(resultsToMapElements.size()); for (Element resultsToMapElement : resultsToMapElements) { resultsToMapList.add(resultsToMapElement.getAttribute("map-name")); } @@ -123,7 +123,7 @@ public final class CallService extends MethodOperation { } List resultToFieldElements = UtilXml.childElementList(element, "result-to-field"); if (UtilValidate.isNotEmpty(resultToFieldElements)) { - List resultToFieldList = new ArrayList(resultToFieldElements.size()); + List resultToFieldList = new ArrayList<>(resultToFieldElements.size()); for (Element resultToFieldElement : resultToFieldElements) { resultToFieldList.add(new ResultToField(resultToFieldElement)); } @@ -133,7 +133,7 @@ public final class CallService extends MethodOperation { } List resultToRequestElements = UtilXml.childElementList(element, "result-to-request"); if (UtilValidate.isNotEmpty(resultToRequestElements)) { - List resultToRequestList = new ArrayList(resultToRequestElements.size()); + List resultToRequestList = new ArrayList<>(resultToRequestElements.size()); for (Element resultToRequestElement : resultToRequestElements) { resultToRequestList.add(new ResultToRequest(resultToRequestElement)); } @@ -143,7 +143,7 @@ public final class CallService extends MethodOperation { } List resultToSessionElements = UtilXml.childElementList(element, "result-to-session"); if (UtilValidate.isNotEmpty(resultToSessionElements)) { - List resultToSessionList = new ArrayList(resultToSessionElements.size()); + List resultToSessionList = new ArrayList<>(resultToSessionElements.size()); for (Element resultToSessionElement : resultToSessionElements) { resultToSessionList.add(new ResultToSession(resultToSessionElement)); } @@ -153,7 +153,7 @@ public final class CallService extends MethodOperation { } List resultToResultElements = UtilXml.childElementList(element, "result-to-result"); if (UtilValidate.isNotEmpty(resultToResultElements)) { - List resultToResultList = new ArrayList(resultToResultElements.size()); + List resultToResultList = new ArrayList<>(resultToResultElements.size()); for (Element resultToResultElement : resultToResultElements) { resultToResultList.add(new ResultToResult(resultToResultElement)); } @@ -179,7 +179,7 @@ public final class CallService extends MethodOperation { } Map inMap = inMapFma.get(methodContext.getEnvMap()); if (inMap == null) { - inMap = new HashMap(); + inMap = new HashMap<>(); } // before invoking the service, clear messages if (methodContext.getMethodType() == MethodContext.EVENT) { @@ -419,7 +419,7 @@ public final class CallService extends MethodOperation { private final FlexibleServletAccessor requestFsa; private ResultToRequest(Element element) { - requestFsa = new FlexibleServletAccessor(element.getAttribute("request-name"), element.getAttribute("result-name")); + requestFsa = new FlexibleServletAccessor<>(element.getAttribute("request-name"), element.getAttribute("result-name")); resultFma =FlexibleMapAccessor.getInstance(element.getAttribute("result-name")); } @@ -452,7 +452,7 @@ public final class CallService extends MethodOperation { private final FlexibleServletAccessor requestFsa; private ResultToSession(Element element) { - requestFsa = new FlexibleServletAccessor(element.getAttribute("session-name"), element.getAttribute("result-name")); + requestFsa = new FlexibleServletAccessor<>(element.getAttribute("session-name"), element.getAttribute("result-name")); resultFma =FlexibleMapAccessor.getInstance(element.getAttribute("result-name")); } diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallServiceAsynch.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallServiceAsynch.java index f74705232b..9393926fee 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallServiceAsynch.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallServiceAsynch.java @@ -70,7 +70,7 @@ public final class CallServiceAsynch extends MethodOperation { String serviceName = serviceNameFse.expandString(methodContext.getEnvMap()); Map inMap = inMapFma.get(methodContext.getEnvMap()); if (inMap == null) { - inMap = new HashMap(); + inMap = new HashMap<>(); } if (includeUserLogin) { GenericValue userLogin = methodContext.getUserLogin(); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java index 4d352faf59..a3fac30c24 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMapProcessor.java @@ -74,16 +74,16 @@ public final class CallSimpleMapProcessor extends MethodOperation { public boolean exec(MethodContext methodContext) throws MiniLangException { List messages = errorListFma.get(methodContext.getEnvMap()); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); errorListFma.put(methodContext.getEnvMap(), messages); } Map inMap = inMapFma.get(methodContext.getEnvMap()); if (inMap == null) { - inMap = new HashMap(); + inMap = new HashMap<>(); } Map outMap = outMapFma.get(methodContext.getEnvMap()); if (outMap == null) { - outMap = new HashMap(); + outMap = new HashMap<>(); outMapFma.put(methodContext.getEnvMap(), outMap); } // run external map processor first diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMethod.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMethod.java index 5867ffb345..1442c3f683 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMethod.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/CallSimpleMethod.java @@ -82,7 +82,7 @@ public final class CallSimpleMethod extends MethodOperation { if (!"function".equals(this.scope)) { MiniLangValidate.handleError("Inline scope cannot include elements.", simpleMethod, element); } - List resultToFieldList = new ArrayList(resultToFieldElements.size()); + List resultToFieldList = new ArrayList<>(resultToFieldElements.size()); for (Element resultToFieldElement : resultToFieldElements) { resultToFieldList.add(new ResultToField(resultToFieldElement, simpleMethod)); } @@ -103,7 +103,7 @@ public final class CallSimpleMethod extends MethodOperation { } MethodContext localContext = methodContext; if ("function".equals(this.scope)) { - Map localEnv = new HashMap(); + Map localEnv = new HashMap<>(); localEnv.putAll(methodContext.getEnvMap()); localEnv.remove(this.simpleMethod.getEventResponseCodeName()); localEnv.remove(this.simpleMethod.getServiceResponseMessageName()); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/SetServiceFields.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/SetServiceFields.java index cb64d685fe..584657dde8 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/SetServiceFields.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/callops/SetServiceFields.java @@ -100,10 +100,10 @@ public final class SetServiceFields extends MethodOperation { } Map toMap = toMapFma.get(methodContext.getEnvMap()); if (toMap == null) { - toMap = new HashMap(); + toMap = new HashMap<>(); toMapFma.put(methodContext.getEnvMap(), toMap); } - List errorMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); Map validAttributes = modelService.makeValid(fromMap, mode, true, errorMessages, methodContext.getTimeZone(), methodContext.getLocale()); if (errorMessages.size() > 0) { for (Object obj : errorMessages) { diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/CombinedCondition.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/CombinedCondition.java index aee1815dda..e8554dd41f 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/CombinedCondition.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/CombinedCondition.java @@ -45,7 +45,7 @@ public abstract class CombinedCondition extends MiniLangElement implements Condi if (MiniLangValidate.validationOn() && childElements.isEmpty()) { MiniLangValidate.handleError("No conditional elements.", simpleMethod, element); } - List conditionalList = new ArrayList(childElements.size()); + List conditionalList = new ArrayList<>(childElements.size()); for (Element conditionalElement : UtilXml.childElementList(element)) { conditionalList.add(ConditionalFactory.makeConditional(conditionalElement, simpleMethod)); } diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java index c73707bf0e..008f207401 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/Compare.java @@ -48,7 +48,7 @@ public abstract class Compare { } private static Map createInstanceMap() { - Map writableMap = new HashMap(10); + Map writableMap = new HashMap<>(10); writableMap.put("contains", new CompareContains()); writableMap.put("equals", new CompareEquals()); writableMap.put("greater", new CompareGreater()); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/ConditionalFactory.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/ConditionalFactory.java index 5c721333bd..4f594b9041 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/ConditionalFactory.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/ConditionalFactory.java @@ -42,7 +42,7 @@ public abstract class ConditionalFactory { private static final Map> conditionalFactories; static { - Map> factories = new HashMap>(); + Map> factories = new HashMap<>(); Iterator> it = UtilGenerics.cast(ServiceLoader.load(ConditionalFactory.class, ConditionalFactory.class.getClassLoader()).iterator()); while (it.hasNext()) { ConditionalFactory factory = it.next(); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/MasterIf.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/MasterIf.java index f9ca9c1851..a5c271aadf 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/MasterIf.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/conditional/MasterIf.java @@ -56,7 +56,7 @@ public final class MasterIf extends MethodOperation { if (elseIfElements.isEmpty()) { this.elseIfs = null; } else { - List elseIfs = new ArrayList(elseIfElements.size()); + List elseIfs = new ArrayList<>(elseIfElements.size()); for (Element elseIfElement : elseIfElements) { elseIfs.add(new ElseIf(elseIfElement, simpleMethod)); } diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityData.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityData.java index 7f3b3e8b84..3b2f628e9a 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityData.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/entityops/EntityData.java @@ -81,7 +81,7 @@ public final class EntityData extends EntityOperation { public boolean exec(MethodContext methodContext) throws MiniLangException { List messages = errorListFma.get(methodContext.getEnvMap()); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); errorListFma.put(methodContext.getEnvMap(), messages); } String location = this.locationFse.expandString(methodContext.getEnvMap()); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/AddError.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/AddError.java index fda602a1d1..ee1720dc82 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/AddError.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/AddError.java @@ -59,7 +59,7 @@ public final class AddError extends MethodOperation { if (message != null) { List messages = errorListFma.get(methodContext.getEnvMap()); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); errorListFma.put(methodContext.getEnvMap(), messages); } messages.add(message); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Assert.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Assert.java index 819ef2d8ba..1f90dac92d 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Assert.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/Assert.java @@ -60,7 +60,7 @@ public final class Assert extends MethodOperation { if (MiniLangValidate.validationOn() && childElements.isEmpty()) { MiniLangValidate.handleError("No conditional elements.", simpleMethod, element); } - List conditionalList = new ArrayList(childElements.size()); + List conditionalList = new ArrayList<>(childElements.size()); for (Element conditionalElement : UtilXml.childElementList(element)) { conditionalList.add(ConditionalFactory.makeConditional(conditionalElement, simpleMethod)); } @@ -85,7 +85,7 @@ public final class Assert extends MethodOperation { messageBuffer.append("failed: "); condition.prettyPrint(messageBuffer, methodContext); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); errorListFma.put(methodContext.getEnvMap(), messages); } messages.add(messageBuffer.toString()); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CheckId.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CheckId.java index d042b29d49..1583010791 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CheckId.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CheckId.java @@ -107,7 +107,7 @@ public final class CheckId extends MethodOperation { if (message != null) { List messages = errorListFma.get(methodContext.getEnvMap()); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); } errorListFma.put(methodContext.getEnvMap(), messages); messages.add(message.concat(": ").concat(errorMsg)); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CreateObject.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CreateObject.java index 22bfda8bd3..5d04c0f621 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CreateObject.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/CreateObject.java @@ -72,12 +72,12 @@ public final class CreateObject extends MethodOperation { fieldFma = FlexibleMapAccessor.getInstance(element.getAttribute("field")); List parameterElements = UtilXml.childElementList(element); if (parameterElements.size() > 0) { - ArrayList> parameterList = new ArrayList>(parameterElements.size()); + ArrayList> parameterList = new ArrayList<>(parameterElements.size()); for (Element parameterElement : parameterElements) { if ("string".equals(parameterElement.getNodeName())) { parameterList.add(new StringObject(parameterElement, simpleMethod)); } else if ("field".equals(parameterElement.getNodeName())) { - parameterList.add(new FieldObject(parameterElement, simpleMethod)); + parameterList.add(new FieldObject<>(parameterElement, simpleMethod)); } } parameterList.trimToSize(); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/FieldToList.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/FieldToList.java index 8436d1b82f..716b0c7089 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/FieldToList.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/FieldToList.java @@ -58,7 +58,7 @@ public final class FieldToList extends MethodOperation { if (fieldVal != null) { List toList = listFma.get(methodContext.getEnvMap()); if (toList == null) { - toList = new LinkedList(); + toList = new LinkedList<>(); listFma.put(methodContext.getEnvMap(), toList); } toList.add(fieldVal); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/ListToList.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/ListToList.java index 3703a962e8..29359aeb90 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/ListToList.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/ListToList.java @@ -57,7 +57,7 @@ public final class ListToList extends MethodOperation { if (fromList != null) { List toList = toListFma.get(methodContext.getEnvMap()); if (toList == null) { - toList = new LinkedList(); + toList = new LinkedList<>(); toListFma.put(methodContext.getEnvMap(), toList); } toList.addAll(fromList); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/MapToMap.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/MapToMap.java index 784b9ee6f6..57de0c7327 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/MapToMap.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/MapToMap.java @@ -58,7 +58,7 @@ public final class MapToMap extends MethodOperation { if (!toMapFma.isEmpty()) { Map toMap = toMapFma.get(methodContext.getEnvMap()); if (toMap == null) { - toMap = new HashMap(); + toMap = new HashMap<>(); toMapFma.put(methodContext.getEnvMap(), toMap); } toMap.putAll(fromMap); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java index 09418877d8..68af57e86c 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java @@ -56,7 +56,7 @@ public final class OrderMapList extends MethodOperation { listFma = FlexibleMapAccessor.getInstance(element.getAttribute("list")); List orderByElements = UtilXml.childElementList(element, "order-by"); if (orderByElements.size() > 0) { - List> orderByList = new ArrayList>(orderByElements.size()); + List> orderByList = new ArrayList<>(orderByElements.size()); for (Element orderByElement : orderByElements) { FlexibleMapAccessor fma = FlexibleMapAccessor.getInstance(orderByElement.getAttribute("field")); orderByList.add(fma); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java index 16c91759f4..e992cce9a4 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/SetOperation.java @@ -172,7 +172,7 @@ public final class SetOperation extends MethodOperation { if ("NewMap".equals(this.type)) { newValue = new HashMap(); } else if ("NewList".equals(this.type)) { - newValue = new LinkedList(); + newValue = new LinkedList<>(); } else { try { String format = null; diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/StringToList.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/StringToList.java index 0d384811a6..56a3dc00f4 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/StringToList.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/StringToList.java @@ -80,7 +80,7 @@ public final class StringToList extends MethodOperation { } List toList = listFma.get(methodContext.getEnvMap()); if (toList == null) { - toList = new LinkedList(); + toList = new LinkedList<>(); listFma.put(methodContext.getEnvMap(), toList); } toList.add(value); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/eventops/RequestParametersToList.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/eventops/RequestParametersToList.java index c414ba8f24..561487f9fe 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/eventops/RequestParametersToList.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/eventops/RequestParametersToList.java @@ -83,7 +83,7 @@ public final class RequestParametersToList extends MethodOperation { if (parameterValues != null) { List valueList = listFma.get(methodContext.getEnvMap()); if (valueList == null) { - valueList = new LinkedList(); + valueList = new LinkedList<>(); listFma.put(methodContext.getEnvMap(), valueList); } for (int i = 0; i < parameterValues.length; i++) { diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/CheckPermission.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/CheckPermission.java index 00ee9a1e23..132623ba9e 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/CheckPermission.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/CheckPermission.java @@ -60,7 +60,7 @@ public final class CheckPermission extends MethodOperation { primaryPermissionInfo = new PermissionInfo(element); List altPermElements = UtilXml.childElementList(element, "alt-permission"); if (!altPermElements.isEmpty()) { - List permissionInfoList = new ArrayList(altPermElements.size()); + List permissionInfoList = new ArrayList<>(altPermElements.size()); for (Element altPermElement : altPermElements) { permissionInfoList.add(new PermissionInfo(altPermElement)); } @@ -90,7 +90,7 @@ public final class CheckPermission extends MethodOperation { if (!hasPermission && messageElement != null) { List messages = errorListFma.get(methodContext.getEnvMap()); if (messages == null) { - messages = new LinkedList(); + messages = new LinkedList<>(); errorListFma.put(methodContext.getEnvMap(), messages); } messages.add(messageElement.getMessage(methodContext)); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MakeInString.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MakeInString.java index fb8d36916b..88045a0f62 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MakeInString.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MakeInString.java @@ -36,7 +36,7 @@ public class MakeInString { public static final String module = MakeInString.class.getName(); String fieldName; - List operations = new ArrayList(); + List operations = new ArrayList<>(); public MakeInString(Element makeInStringElement) { fieldName = makeInStringElement.getAttribute("field"); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MapProcessor.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MapProcessor.java index fb7181f8a0..cd6359c9e4 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MapProcessor.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/MapProcessor.java @@ -32,9 +32,9 @@ import org.w3c.dom.Element; */ public class MapProcessor { - List makeInStrings = new ArrayList(); + List makeInStrings = new ArrayList<>(); String name; - List simpleMapProcesses = new ArrayList(); + List simpleMapProcesses = new ArrayList<>(); public MapProcessor(Element simpleMapProcessorElement) { name = simpleMapProcessorElement.getAttribute("name"); diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/SimpleMapProcess.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/SimpleMapProcess.java index aeb6074aa6..892ea539e3 100644 --- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/SimpleMapProcess.java +++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/operation/SimpleMapProcess.java @@ -36,7 +36,7 @@ public class SimpleMapProcess { public static final String module = SimpleMapProcess.class.getName(); String field = ""; - List simpleMapOperations = new ArrayList(); + List simpleMapOperations = new ArrayList<>(); public SimpleMapProcess(Element simpleMapProcessElement) { this.field = simpleMapProcessElement.getAttribute("field"); diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/ServiceConfigUtil.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/ServiceConfigUtil.java index 34dc5cdd5b..d35f788b7b 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/ServiceConfigUtil.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/ServiceConfigUtil.java @@ -50,7 +50,7 @@ public final class ServiceConfigUtil { private static final String SERVICE_ENGINE_XML_FILENAME = "serviceengine.xml"; // Keep the ServiceConfig instance in a cache - so the configuration can be reloaded at run-time. There will be only one ServiceConfig instance in the cache. private static final UtilCache serviceConfigCache = UtilCache.createUtilCache("service.ServiceConfig", 0, 0, false); - private static final List configListeners = new CopyOnWriteArrayList(); + private static final List configListeners = new CopyOnWriteArrayList<>(); private ServiceConfigUtil() {} diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/Engine.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/Engine.java index 67ff872c59..c667e2875c 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/Engine.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/Engine.java @@ -56,8 +56,8 @@ public final class Engine { this.parameters = Collections.emptyList(); this.parameterMap = Collections.emptyMap(); } else { - List parameters = new ArrayList(parameterElementList.size()); - Map parameterMap = new HashMap(); + List parameters = new ArrayList<>(parameterElementList.size()); + Map parameterMap = new HashMap<>(); for (Element parameterElement : parameterElementList) { Parameter parameter = new Parameter(parameterElement); parameters.add(parameter); diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/JmsService.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/JmsService.java index 6d7ec556fb..331001b7da 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/JmsService.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/JmsService.java @@ -52,7 +52,7 @@ public final class JmsService { if (serverElementList.isEmpty()) { this.servers = Collections.emptyList(); } else { - List servers = new ArrayList(serverElementList.size()); + List servers = new ArrayList<>(serverElementList.size()); for (Element serverElement : serverElementList) { servers.add(new Server(serverElement)); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/NotificationGroup.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/NotificationGroup.java index b9561c5b3b..c670cdf059 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/NotificationGroup.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/NotificationGroup.java @@ -52,7 +52,7 @@ public final class NotificationGroup { if (notifyElementList.size() < 2) { throw new ServiceConfigException(" element(s) missing"); } else { - List notifyList = new ArrayList(notifyElementList.size()); + List notifyList = new ArrayList<>(notifyElementList.size()); for (Element notifyElement : notifyElementList) { notifyList.add(new Notify(notifyElement)); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceConfig.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceConfig.java index 94753050e3..09a8910372 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceConfig.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceConfig.java @@ -36,7 +36,7 @@ import org.w3c.dom.Element; public final class ServiceConfig { public static ServiceConfig create(Element serviceConfigElement) throws ServiceConfigException { - Map serviceEngineMap = new HashMap(); + Map serviceEngineMap = new HashMap<>(); List engineElementList = UtilXml.childElementList(serviceConfigElement, "service-engine"); for (Element engineElement : engineElementList) { ServiceEngine engineModel = new ServiceEngine(engineElement); diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceEngine.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceEngine.java index 951b613269..f02ef4196c 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceEngine.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ServiceEngine.java @@ -71,8 +71,8 @@ public final class ServiceEngine { this.engines = Collections.emptyList(); this.engineMap = Collections.emptyMap(); } else { - List engines = new ArrayList(engineElementList.size()); - Map engineMap = new HashMap(); + List engines = new ArrayList<>(engineElementList.size()); + Map engineMap = new HashMap<>(); for (Element childEngineElement : engineElementList) { Engine engine = new Engine(childEngineElement); engines.add(engine); @@ -85,7 +85,7 @@ public final class ServiceEngine { if (serviceLocationElementList.isEmpty()) { this.serviceLocations = Collections.emptyList(); } else { - List serviceLocations = new ArrayList(serviceLocationElementList.size()); + List serviceLocations = new ArrayList<>(serviceLocationElementList.size()); for (Element serviceLocationElement : serviceLocationElementList) { String location = serviceLocationElement.getAttribute("location").intern(); if (location.contains("localhost") && Start.getInstance().getConfig().portOffset != 0) { @@ -102,7 +102,7 @@ public final class ServiceEngine { if (notificationGroupElementList.isEmpty()) { this.notificationGroups = Collections.emptyList(); } else { - List notificationGroups = new ArrayList(notificationGroupElementList.size()); + List notificationGroups = new ArrayList<>(notificationGroupElementList.size()); for (Element notificationGroupElement : notificationGroupElementList) { notificationGroups.add(new NotificationGroup(notificationGroupElement)); } @@ -112,7 +112,7 @@ public final class ServiceEngine { if (startupServiceElementList.isEmpty()) { this.startupServices = Collections.emptyList(); } else { - List startupServices = new ArrayList(startupServiceElementList.size()); + List startupServices = new ArrayList<>(startupServiceElementList.size()); for (Element startupServiceElement : startupServiceElementList) { startupServices.add(new StartupService(startupServiceElement)); } @@ -122,7 +122,7 @@ public final class ServiceEngine { if (resourceLoaderElementList.isEmpty()) { this.resourceLoaders = Collections.emptyList(); } else { - List resourceLoaders = new ArrayList(resourceLoaderElementList.size()); + List resourceLoaders = new ArrayList<>(resourceLoaderElementList.size()); for (Element resourceLoaderElement : resourceLoaderElementList) { resourceLoaders.add(new ResourceLoader(resourceLoaderElement)); } @@ -132,7 +132,7 @@ public final class ServiceEngine { if (globalServicesElementList.isEmpty()) { this.globalServices = Collections.emptyList(); } else { - List globalServices = new ArrayList(globalServicesElementList.size()); + List globalServices = new ArrayList<>(globalServicesElementList.size()); for (Element globalServicesElement : globalServicesElementList) { globalServices.add(new GlobalServices(globalServicesElement)); } @@ -142,7 +142,7 @@ public final class ServiceEngine { if (serviceGroupsElementList.isEmpty()) { this.serviceGroups = Collections.emptyList(); } else { - List serviceGroups = new ArrayList(serviceGroupsElementList.size()); + List serviceGroups = new ArrayList<>(serviceGroupsElementList.size()); for (Element serviceGroupsElement : serviceGroupsElementList) { serviceGroups.add(new ServiceGroups(serviceGroupsElement)); } @@ -152,7 +152,7 @@ public final class ServiceEngine { if (serviceEcasElementList.isEmpty()) { this.serviceEcas = Collections.emptyList(); } else { - List serviceEcas = new ArrayList(serviceEcasElementList.size()); + List serviceEcas = new ArrayList<>(serviceEcasElementList.size()); for (Element serviceEcasElement : serviceEcasElementList) { serviceEcas.add(new ServiceEcas(serviceEcasElement)); } @@ -162,7 +162,7 @@ public final class ServiceEngine { if (jmsServiceElementList.isEmpty()) { this.jmsServices = Collections.emptyList(); } else { - List jmsServices = new ArrayList(jmsServiceElementList.size()); + List jmsServices = new ArrayList<>(jmsServiceElementList.size()); for (Element jmsServiceElement : jmsServiceElementList) { jmsServices.add(new JmsService(jmsServiceElement)); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java index 76ee85a92d..b2e73348c7 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/config/model/ThreadPool.java @@ -163,7 +163,7 @@ public final class ThreadPool { if (runFromPoolElementList.isEmpty()) { this.runFromPools = Collections.emptyList(); } else { - List runFromPools = new ArrayList(runFromPoolElementList.size()); + List runFromPools = new ArrayList<>(runFromPoolElementList.size()); for (Element runFromPoolElement : runFromPoolElementList) { runFromPools.add(new RunFromPool(runFromPoolElement)); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java index 314b4c4a94..74fbc9d524 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaAction.java @@ -136,7 +136,7 @@ public class ServiceEcaAction implements java.io.Serializable { if (UtilValidate.isNotEmpty(resultMapName)) { Map resultMap = UtilGenerics.checkMap(context.get(resultMapName)); if (resultMap == null) { - resultMap = new HashMap(); + resultMap = new HashMap<>(); } resultMap.putAll(dctx.getModelService(this.serviceName).makeValid(actionResult, ModelService.OUT_PARAM, false, null)); context.put(resultMapName, resultMap); @@ -194,7 +194,7 @@ public class ServiceEcaAction implements java.io.Serializable { } else { List origErrorMessageList = UtilGenerics.checkList(result.get(ModelService.ERROR_MESSAGE_LIST)); if (origErrorMessageList == null) { - origErrorMessageList = new LinkedList(); + origErrorMessageList = new LinkedList<>(); result.put(ModelService.ERROR_MESSAGE_LIST, origErrorMessageList); } origErrorMessageList.add(0, errorMessage); diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaCondition.java b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaCondition.java index 912b3b8a0f..c0dd839f6a 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaCondition.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaCondition.java @@ -175,7 +175,7 @@ public class ServiceEcaCondition implements java.io.Serializable { if (Debug.verboseOn()) Debug.logVerbose("Comparing : " + lhsValue + " " + operator + " " + rhsValue, module); // evaluate the condition & invoke the action(s) - List messages = new LinkedList(); + List messages = new LinkedList<>(); Boolean cond = ObjectType.doRealCompare(lhsValue, rhsValue, operator, compareType, format, messages, null, dctx.getClassLoader(), isConstant); // if any messages were returned send them out diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaRule.java b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaRule.java index 202370ad8f..18134bdee0 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaRule.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaRule.java @@ -44,8 +44,8 @@ public final class ServiceEcaRule implements java.io.Serializable { public final String eventName; public final boolean runOnFailure; public final boolean runOnError; - public final List conditions = new ArrayList(); - public final List actionsAndSets = new ArrayList(); + public final List conditions = new ArrayList<>(); + public final List actionsAndSets = new ArrayList<>(); public boolean enabled = true; public final String definitionLocation; @@ -104,7 +104,7 @@ public final class ServiceEcaRule implements java.io.Serializable { } public List getEcaActionList() { - List actionList = new LinkedList(); + List actionList = new LinkedList<>(); for (Object actionOrSet: this.actionsAndSets) { if (actionOrSet instanceof ServiceEcaAction) { actionList.add((ServiceEcaAction) actionOrSet); @@ -114,7 +114,7 @@ public final class ServiceEcaRule implements java.io.Serializable { } public List getEcaConditionList() { - List condList = new LinkedList(); + List condList = new LinkedList<>(); condList.addAll(this.conditions); return condList; } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaSetField.java b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaSetField.java index 98576a19e0..8ec8c0665e 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaSetField.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaSetField.java @@ -71,7 +71,7 @@ public class ServiceEcaSetField { if (UtilValidate.isNotEmpty(this.mapName) && context.containsKey(this.mapName)) { valueMap = UtilGenerics.checkMap(context.get(mapName)); } else { - valueMap = new HashMap(); + valueMap = new HashMap<>(); } // process the context changes Object newValue = null; diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java index 7e3f2582fb..effeec6a88 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/eca/ServiceEcaUtil.java @@ -51,7 +51,7 @@ public final class ServiceEcaUtil { public static final String module = ServiceEcaUtil.class.getName(); // using a cache is dangerous here because if someone clears it the ECAs won't run: public static UtilCache ecaCache = new UtilCache("service.ServiceECAs", 0, 0, false); - private static Map>> ecaCache = new ConcurrentHashMap>>(); + private static Map>> ecaCache = new ConcurrentHashMap<>(); private ServiceEcaUtil() {} @@ -66,7 +66,7 @@ public final class ServiceEcaUtil { return; } - List>> futures = new LinkedList>>(); + List>> futures = new LinkedList<>(); List serviceEcasList = null; try { serviceEcasList = ServiceConfigUtil.getServiceEngine().getServiceEcas(); @@ -100,7 +100,7 @@ public final class ServiceEcaUtil { } private static List getEcaDefinitions(ResourceHandler handler) { - List handlerRules = new LinkedList(); + List handlerRules = new LinkedList<>(); Element rootElement = null; try { rootElement = handler.getDocument().getDocumentElement(); @@ -132,14 +132,14 @@ public final class ServiceEcaUtil { List rules = null; if (eventMap == null) { - eventMap = new HashMap>(); - rules = new LinkedList(); + eventMap = new HashMap<>(); + rules = new LinkedList<>(); ecaCache.put(serviceName, eventMap); eventMap.put(eventName, rules); } else { rules = eventMap.get(eventName); if (rules == null) { - rules = new LinkedList(); + rules = new LinkedList<>(); eventMap.put(eventName, rules); } } @@ -163,7 +163,7 @@ public final class ServiceEcaUtil { if (event != null) { return eventMap.get(event); } else { - List rules = new LinkedList(); + List rules = new LinkedList<>(); for (Collection col: eventMap.values()) { rules.addAll(col); } @@ -186,7 +186,7 @@ public final class ServiceEcaUtil { } if (Debug.verboseOn()) Debug.logVerbose("Running ECA (" + event + ").", module); - Set actionsRun = new TreeSet(); + Set actionsRun = new TreeSet<>(); for (ServiceEcaRule eca: rules) { eca.eval(serviceName, dctx, context, result, isError, isFailure, actionsRun); } diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java b/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java index b0ed1eeae0..e5b5e79414 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsListenerFactory.java @@ -46,10 +46,10 @@ public class JmsListenerFactory implements Runnable { public static final String TOPIC_LISTENER_CLASS = "org.apache.ofbiz.service.jms.JmsTopicListener"; public static final String QUEUE_LISTENER_CLASS = "org.apache.ofbiz.service.jms.JmsQueueListener"; - protected static Map listeners = new ConcurrentHashMap(); - protected static Map servers = new ConcurrentHashMap(); + protected static Map listeners = new ConcurrentHashMap<>(); + protected static Map servers = new ConcurrentHashMap<>(); - private static final AtomicReference jlFactoryRef = new AtomicReference(null); + private static final AtomicReference jlFactoryRef = new AtomicReference<>(null); protected Delegator delegator; protected boolean firstPass = true; diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java b/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java index 6240dd7ccb..c2a6b2348e 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/jms/JmsServiceEngine.java @@ -111,7 +111,7 @@ public class JmsServiceEngine extends AbstractEngine { List serverList = UtilXml.childElementList(serviceElement, "server"); if ("none".equals(sendMode)) { - return new ArrayList(); + return new ArrayList<>(); } else if ("all".equals(sendMode)) { return serverList; } else { @@ -311,7 +311,7 @@ public class JmsServiceEngine extends AbstractEngine { JmsService serviceElement = getServiceElement(modelService); List serverList = serviceElement.getServers(); - Map result = new HashMap(); + Map result = new HashMap<>(); for (Server server: serverList) { String serverType = server.getType(); if ("topic".equals(serverType)) diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java index 2b60c1123e..680a0545e0 100644 --- a/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java +++ b/framework/service/src/main/java/org/apache/ofbiz/service/rmi/ExampleRemoteClient.java @@ -65,7 +65,7 @@ public class ExampleRemoteClient { } public Map runTestService() throws RemoteException, GenericServiceException { - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("message", "Remote Service Test"); return rd.runSync("testScv", context); } diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/EntityXmlAssertTest.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/EntityXmlAssertTest.java index aca300f0ab..7f2a2f143d 100644 --- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/EntityXmlAssertTest.java +++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/EntityXmlAssertTest.java @@ -71,7 +71,7 @@ public class EntityXmlAssertTest extends OFBizTestCase { try { URL entityXmlURL = FlexibleLocation.resolveLocation(entityXmlUrlString); - List errorMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); if ("assert".equals(this.action)) { EntityDataAssert.assertData(entityXmlURL, delegator, errorMessages); diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/JunitSuiteWrapper.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/JunitSuiteWrapper.java index a07ce3d8a4..e3d2935696 100644 --- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/JunitSuiteWrapper.java +++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/JunitSuiteWrapper.java @@ -38,7 +38,7 @@ public class JunitSuiteWrapper { public static final String module = JunitSuiteWrapper.class.getName(); - protected List modelTestSuiteList = new LinkedList(); + protected List modelTestSuiteList = new LinkedList<>(); public JunitSuiteWrapper(String componentName, String suiteName, String testCase) { for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuiteInfos(componentName)) { @@ -79,7 +79,7 @@ public class JunitSuiteWrapper { } public List getAllTestList() { - List allTestList = new LinkedList(); + List allTestList = new LinkedList<>(); for (ModelTestSuite modelTestSuite: this.modelTestSuiteList) { for (Test tst: modelTestSuite.getTestList()) { diff --git a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java index 6c458249cc..311c303a17 100644 --- a/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java +++ b/framework/testtools/src/main/java/org/apache/ofbiz/testtools/TestRunContainer.java @@ -170,7 +170,7 @@ public class TestRunContainer implements Container { class JunitXmlListener extends XMLJUnitResultFormatter { - Map startTimes = new HashMap(); + Map startTimes = new HashMap<>(); public JunitXmlListener(OutputStream out) { this.setOutput(out); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java index 8181eb860e..e4102f078a 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ConfigXMLReader.java @@ -66,7 +66,7 @@ public class ConfigXMLReader { public static final RequestResponse emptyNoneRequestResponse = RequestResponse.createEmptyNoneRequestResponse(); public static Set findControllerFilesWithRequest(String requestUri, String controllerPartialPath) throws GeneralException { - Set allControllerRequestSet = new HashSet(); + Set allControllerRequestSet = new HashSet<>(); if (UtilValidate.isEmpty(requestUri)) { return allControllerRequestSet; } @@ -76,7 +76,7 @@ public class ConfigXMLReader { try { // find controller.xml file with webappMountPoint + "/WEB-INF" in the path List controllerFiles = FileUtil.findXmlFiles(null, controllerPartialPath, "site-conf", "site-conf.xsd"); - controllerConfigs = new LinkedList(); + controllerConfigs = new LinkedList<>(); for (File controllerFile : controllerFiles) { URL controllerUrl = null; try { @@ -131,7 +131,7 @@ public class ConfigXMLReader { // if (controllerLocAndRequestSet.size() > 0) Debug.logInfo("============== In findRequestNamesLinkedtoInWidget, controllerLocAndRequestSet: " + controllerLocAndRequestSet, module); return controllerLocAndRequestSet; } else { - return new HashSet(); + return new HashSet<>(); } } @@ -186,16 +186,16 @@ public class ConfigXMLReader { private String securityClass; private String defaultRequest; private String statusCode; - private List includes = new ArrayList(); - private Map firstVisitEventList = new LinkedHashMap(); - private Map preprocessorEventList = new LinkedHashMap(); - private Map postprocessorEventList = new LinkedHashMap(); - private Map afterLoginEventList = new LinkedHashMap(); - private Map beforeLogoutEventList = new LinkedHashMap(); - private Map eventHandlerMap = new HashMap(); - private Map viewHandlerMap = new HashMap(); + private List includes = new ArrayList<>(); + private Map firstVisitEventList = new LinkedHashMap<>(); + private Map preprocessorEventList = new LinkedHashMap<>(); + private Map postprocessorEventList = new LinkedHashMap<>(); + private Map afterLoginEventList = new LinkedHashMap<>(); + private Map beforeLogoutEventList = new LinkedHashMap<>(); + private Map eventHandlerMap = new HashMap<>(); + private Map viewHandlerMap = new HashMap<>(); private MultivaluedMapContext requestMapMap = new MultivaluedMapContext<>(); - private Map viewMapMap = new HashMap(); + private Map viewMapMap = new HashMap<>(); public ControllerConfig(URL url) throws WebAppConfigurationException { this.url = url; @@ -468,7 +468,7 @@ public class ConfigXMLReader { public boolean securityCert = false; public boolean securityExternalView = true; public boolean securityDirectRequest = true; - public Map requestResponseMap = new HashMap(); + public Map requestResponseMap = new HashMap<>(); public Metrics metrics = null; public RequestMap(Element requestMapElement) { @@ -534,8 +534,8 @@ public class ConfigXMLReader { public boolean saveLastView = false; public boolean saveCurrentView = false; public boolean saveHomeView = false; - public Map redirectParameterMap = new HashMap(); - public Map redirectParameterValueMap = new HashMap(); + public Map redirectParameterMap = new HashMap<>(); + public Map redirectParameterValueMap = new HashMap<>(); public RequestResponse() { } diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/JWTManager.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/JWTManager.java index 9e93af9178..29f30b481d 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/JWTManager.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/JWTManager.java @@ -209,7 +209,7 @@ public class JWTManager { * @return Map of the claims contained in the token */ public static Map validateToken(String jwtToken, String key) { - Map result = new HashMap(); + Map result = new HashMap<>(); if (UtilValidate.isEmpty(jwtToken) || UtilValidate.isEmpty(key)) { String msg = "JWT token or key can not be empty."; Debug.logError(msg, module); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java index 73bafb2229..e3d06eca9d 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java @@ -205,7 +205,7 @@ public class LoginWorker { List errorMessageList = UtilGenerics.checkList(request.getAttribute("_ERROR_MESSAGE_LIST")); if (!hasBasePermission(userLogin, request) || isFlaggedLoggedOut(userLogin, userLogin.getDelegator())) { if (errorMessageList == null) { - errorMessageList = new LinkedList(); + errorMessageList = new LinkedList<>(); request.setAttribute("_ERROR_MESSAGE_LIST", errorMessageList); } errorMessageList.add("User does not have permission or is flagged as logged out"); @@ -427,7 +427,7 @@ public class LoginWorker { password = (String) request.getAttribute("PASSWORD"); } - List unpwErrMsgList = new LinkedList(); + List unpwErrMsgList = new LinkedList<>(); if (UtilValidate.isEmpty(username)) { unpwErrMsgList.add(UtilProperties.getMessage(resourceWebapp, "loginevents.username_was_empty_reenter", UtilHttp.getLocale(request))); } @@ -1257,7 +1257,7 @@ public class LoginWorker { } protected static boolean checkValidIssuer(Delegator delegator, Map x500Map, BigInteger serialNumber) throws GeneralException { - List conds = new LinkedList(); + List conds = new LinkedList<>(); conds.add(EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeConditionMap("commonName", x500Map.get("CN")), EntityCondition.makeConditionMap("commonName", null), EntityCondition.makeConditionMap("commonName", ""))); @@ -1372,7 +1372,7 @@ public class LoginWorker { */ public static Collection getAppBarWebInfos(Security security, GenericValue userLogin, String serverName, String menuName) { Collection allInfos = webapps.getAppBarWebInfos(serverName, menuName); - Collection allowedInfos = new ArrayList(allInfos.size()); + Collection allowedInfos = new ArrayList<>(allInfos.size()); for (ComponentConfig.WebappInfo info : allInfos) { if (hasApplicationPermission(info, security, userLogin)) { allowedInfos.add(info); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ProtectViewWorker.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ProtectViewWorker.java index 7eb6651ab6..7eea7f9a45 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ProtectViewWorker.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ProtectViewWorker.java @@ -43,8 +43,8 @@ public final class ProtectViewWorker { private final static String module = ProtectViewWorker.class.getName(); private static final String resourceWebapp = "WebappUiLabels"; - private static final Map hitsByViewAccessed = new ConcurrentHashMap(); - private static final Map durationByViewAccessed = new ConcurrentHashMap(); + private static final Map hitsByViewAccessed = new ConcurrentHashMap<>(); + private static final Map durationByViewAccessed = new ConcurrentHashMap<>(); private static final Long one = 1L; private ProtectViewWorker () {} diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java index 35ecdd7a96..2cf6646568 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java @@ -851,7 +851,7 @@ public class RequestHandler { if (Debug.infoOn()) Debug.logInfo("Sending redirect to: [" + url + "]. " + showSessionId(req), module); // set the attributes in the session so we can access it. Enumeration attributeNameEnum = UtilGenerics.cast(req.getAttributeNames()); - Map reqAttrMap = new HashMap(); + Map reqAttrMap = new HashMap<>(); Integer statusCode; try { statusCode = Integer.valueOf(statusCodeString); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java index 0223a16cd5..8d6b6efd41 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/CoreEvents.java @@ -128,7 +128,7 @@ public class CoreEvents { String runAsSystemUser = (String) params.remove("SERVICE_RUN_AS_SYSTEM"); // the frequency map - Map freqMap = new HashMap(); + Map freqMap = new HashMap<>(); freqMap.put("SECONDLY", 1); freqMap.put("MINUTELY", 2); @@ -172,7 +172,7 @@ public class CoreEvents { } // make the context valid; using the makeValid method from ModelService - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); Iterator ci = modelService.getInParamNames().iterator(); while (ci.hasNext()) { String name = ci.next(); @@ -361,7 +361,7 @@ public class CoreEvents { session.removeAttribute("_SAVED_SYNC_RESULT_"); Map serviceFieldsToSave = checkMap(request.getParameterMap(), String.class, String[].class); - Map savedFields = new HashMap(); + Map savedFields = new HashMap<>(); for (Map.Entry entry : serviceFieldsToSave.entrySet()) { String key = entry.getKey(); @@ -398,14 +398,14 @@ public class CoreEvents { servicePathMap = checkMap(servicePathObject); } else if (servicePathObject instanceof GenericEntity) { GenericEntity servicePathEntity = (GenericEntity)servicePathObject; - servicePathMap = new HashMap(); + servicePathMap = new HashMap<>(); for (Map.Entry entry: servicePathEntity.entrySet()) { servicePathMap.put(entry.getKey(), entry.getValue()); } } else if (servicePathObject instanceof Collection) { Collection servicePathColl = checkCollection(servicePathObject); int count=0; - servicePathMap = new HashMap(); + servicePathMap = new HashMap<>(); for (Object value: servicePathColl) { servicePathMap.put("_"+count+"_", value); count++; diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java index 7a517bafa5..9ad5c6a18d 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/EventFactory.java @@ -37,7 +37,7 @@ public class EventFactory { public static final String module = EventFactory.class.getName(); - private final Map handlers = new HashMap(); + private final Map handlers = new HashMap<>(); public EventFactory(ServletContext context, URL controllerConfigURL) { // load all the event handlers diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java index c171c3a764..1521e20808 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/GroovyEventHandler.java @@ -53,7 +53,7 @@ public class GroovyEventHandler implements EventHandler { private static final Set protectedKeys = createProtectedKeys(); private static Set createProtectedKeys() { - Set newSet = new HashSet(); + Set newSet = new HashSet<>(); newSet.add("request"); newSet.add("response"); newSet.add("session"); @@ -77,7 +77,7 @@ public class GroovyEventHandler implements EventHandler { try { beganTransaction = TransactionUtil.begin(); - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("request", request); context.put("response", response); HttpSession session = request.getSession(); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java index 2f82ad6073..0d6e2151ce 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/RequestBodyMapHandlerFactory.java @@ -26,7 +26,7 @@ import javax.servlet.ServletRequest; /** Factory class that provides the proper RequestBodyMapHandler based on the content type of the ServletRequest */ public class RequestBodyMapHandlerFactory { - private final static Map requestBodyMapHandlers = new HashMap(); + private final static Map requestBodyMapHandlers = new HashMap<>(); static { requestBodyMapHandlers.put("application/json", new JSONRequestBodyMapHandler()); } diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java index f5be644355..6b31d5a79b 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ScriptEventHandler.java @@ -62,7 +62,7 @@ public final class ScriptEventHandler implements EventHandler { private static final Set protectedKeys = createProtectedKeys(); private static Set createProtectedKeys() { - Set newSet = new HashSet(); + Set newSet = new HashSet<>(); newSet.add("request"); newSet.add("response"); newSet.add("session"); @@ -85,7 +85,7 @@ public final class ScriptEventHandler implements EventHandler { @Override public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException { try { - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("request", request); context.put("response", response); HttpSession session = request.getSession(); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceEventHandler.java index fe85349fa4..0abd733446 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceEventHandler.java @@ -126,7 +126,7 @@ public class ServiceEventHandler implements EventHandler { Set urlOnlyParameterNames = UtilHttp.getUrlOnlyParameterMap(request).keySet(); // we have a service and the model; build the context - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); for (ModelParam modelParam: model.getInModelParamList()) { String name = modelParam.name; @@ -202,7 +202,7 @@ public class ServiceEventHandler implements EventHandler { // get only the parameters for this service - converted to proper type // TODO: pass in a list for error messages, like could not convert type or not a proper X, return immediately with messages if there are any - List errorMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); serviceContext = model.makeValid(serviceContext, ModelService.IN_PARAM, true, errorMessages, timeZone, locale); if (errorMessages.size() > 0) { // uh-oh, had some problems... diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java index 8d38563986..5c590ff3b8 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/ServiceMultiEventHandler.java @@ -154,8 +154,8 @@ public class ServiceMultiEventHandler implements EventHandler { String messageSuffixStr = UtilProperties.getMessage("DefaultMessagesUiLabels", "service.message.suffix", locale); // prepare the error message and success message lists - List errorMessages = new LinkedList(); - List successMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); + List successMessages = new LinkedList<>(); // Check the global-transaction attribute of the event from the controller to see if the // event should be wrapped in a transaction @@ -206,7 +206,7 @@ public class ServiceMultiEventHandler implements EventHandler { } // build the context - Map serviceContext = new HashMap(); + Map serviceContext = new HashMap<>(); for (ModelParam modelParam: modelService.getInModelParamList()) { String paramName = modelParam.name; diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java index fa1ae4f9bc..d509c411dd 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/event/XmlRpcEventHandler.java @@ -198,7 +198,7 @@ public class XmlRpcEventHandler extends XmlRpcHttpServer implements EventHandler String password = config.getBasicPassword(); // check the account - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("login.username", username); context.put("login.password", password); @@ -380,7 +380,7 @@ public class XmlRpcEventHandler extends XmlRpcHttpServer implements EventHandler } // context placeholder - Map context = new HashMap(); + Map context = new HashMap<>(); if (model != null) { int parameterCount = xmlRpcReq.getParameterCount(); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java index d842142ef4..586a2a6132 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/stats/ServerHitBin.java @@ -58,18 +58,18 @@ public class ServerHitBin { private static final String[] typeIds = {"", "REQUEST", "EVENT", "VIEW", "ENTITY", "SERVICE"}; // these Maps contain Lists of ServerHitBin objects by id, the most recent is first in the list - public static final ConcurrentMap> requestHistory = new ConcurrentHashMap>(); - public static final ConcurrentMap> eventHistory = new ConcurrentHashMap>(); - public static final ConcurrentMap> viewHistory = new ConcurrentHashMap>(); - public static final ConcurrentMap> entityHistory = new ConcurrentHashMap>(); - public static final ConcurrentMap> serviceHistory = new ConcurrentHashMap>(); + public static final ConcurrentMap> requestHistory = new ConcurrentHashMap<>(); + public static final ConcurrentMap> eventHistory = new ConcurrentHashMap<>(); + public static final ConcurrentMap> viewHistory = new ConcurrentHashMap<>(); + public static final ConcurrentMap> entityHistory = new ConcurrentHashMap<>(); + public static final ConcurrentMap> serviceHistory = new ConcurrentHashMap<>(); // these Maps contain ServerHitBin objects by id - public static final ConcurrentMap requestSinceStarted = new ConcurrentHashMap(); - public static final ConcurrentMap eventSinceStarted = new ConcurrentHashMap(); - public static final ConcurrentMap viewSinceStarted = new ConcurrentHashMap(); - public static final ConcurrentMap entitySinceStarted = new ConcurrentHashMap(); - public static final ConcurrentMap serviceSinceStarted = new ConcurrentHashMap(); + public static final ConcurrentMap requestSinceStarted = new ConcurrentHashMap<>(); + public static final ConcurrentMap eventSinceStarted = new ConcurrentHashMap<>(); + public static final ConcurrentMap viewSinceStarted = new ConcurrentHashMap<>(); + public static final ConcurrentMap entitySinceStarted = new ConcurrentHashMap<>(); + public static final ConcurrentMap serviceSinceStarted = new ConcurrentHashMap<>(); public static void countRequest(String id, HttpServletRequest request, long startTime, long runningTime, GenericValue userLogin) { countHit(id, REQUEST, request, startTime, runningTime, userLogin); @@ -172,7 +172,7 @@ public class ServerHitBin { } if (binList == null) { - binList = new ConcurrentLinkedDeque(); + binList = new ConcurrentLinkedDeque<>(); Deque listFromMap = null; switch (type) { case REQUEST: diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ViewFactory.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ViewFactory.java index 913e85097a..23c88589d9 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ViewFactory.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/ViewFactory.java @@ -38,7 +38,7 @@ public class ViewFactory { public static final String module = ViewFactory.class.getName(); - private final Map handlers = new HashMap(); + private final Map handlers = new HashMap<>(); public ViewFactory(ServletContext context, URL controllerConfigURL) { // load all the view handlers diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/PropFindHelper.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/PropFindHelper.java index 7e2b308a9d..d23dc314cd 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/PropFindHelper.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/PropFindHelper.java @@ -55,7 +55,7 @@ public class PropFindHelper extends ResponseHelper { } public List getFindPropsList(String nameSpaceUri) { - List result = new LinkedList(); + List result = new LinkedList<>(); NodeList nodeList = this.requestDocument.getElementsByTagNameNS(nameSpaceUri == null ? "*" : nameSpaceUri, "prop"); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i).getFirstChild(); diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavUtil.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavUtil.java index 65e9a173c5..1ca42ed51c 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavUtil.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/webdav/WebDavUtil.java @@ -96,7 +96,7 @@ public final class WebDavUtil { if ("true".equalsIgnoreCase(UtilProperties.getPropertyValue("security", "password.lowercase"))) { password = password.toLowerCase(); } - Map result = new HashMap(); + Map result = new HashMap<>(); result.put("login.username", username); result.put("login.password", password); return result; diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java index 820b1d110a..584e233f2c 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java @@ -108,7 +108,7 @@ public class WebToolsServices { GenericValue userLogin = (GenericValue) context.get("userLogin"); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); - List messages = new LinkedList(); + List messages = new LinkedList<>(); String filename = (String)context.get("filename"); String fmfilename = (String)context.get("fmfilename"); @@ -213,7 +213,7 @@ public class WebToolsServices { GenericValue userLogin = (GenericValue) context.get("userLogin"); LocalDispatcher dispatcher = dctx.getDispatcher(); Locale locale = (Locale) context.get("locale"); - List messages = new LinkedList(); + List messages = new LinkedList<>(); String path = (String) context.get("path"); String onlyInserts = (String) context.get("onlyInserts"); @@ -239,7 +239,7 @@ public class WebToolsServices { if (baseDir.isDirectory() && baseDir.canRead()) { File[] fileArray = baseDir.listFiles(); - List files = new LinkedList(); + List files = new LinkedList<>(); for (File file: fileArray) { if (file.getName().toUpperCase().endsWith("XML")) { files.add(file); @@ -249,11 +249,11 @@ public class WebToolsServices { int passes=0; int initialListSize = files.size(); int lastUnprocessedFilesCount = 0; - List unprocessedFiles = new LinkedList(); + List unprocessedFiles = new LinkedList<>(); while (files.size()>0 && files.size() != lastUnprocessedFilesCount) { lastUnprocessedFilesCount = files.size(); - unprocessedFiles = new LinkedList(); + unprocessedFiles = new LinkedList<>(); for (File f: files) { Map parseEntityXmlFileArgs = UtilMisc.toMap("onlyInserts", onlyInserts, "createDummyFks", createDummyFks, @@ -324,13 +324,13 @@ public class WebToolsServices { Integer txTimeoutInt = (Integer) context.get("txTimeout"); int txTimeout = txTimeoutInt != null ? txTimeoutInt : -1; - List messages = new LinkedList(); + List messages = new LinkedList<>(); // parse the pass in list of readers to use List readerNames = null; if (UtilValidate.isNotEmpty(readers) && !"none".equalsIgnoreCase(readers)) { if (readers.indexOf(",") == -1) { - readerNames = new LinkedList(); + readerNames = new LinkedList<>(); readerNames.add(readers); } else { readerNames = StringUtil.split(readers, ","); @@ -360,7 +360,7 @@ public class WebToolsServices { // need a list if it is empty if (urlList == null) { - urlList = new LinkedList(); + urlList = new LinkedList<>(); } // process the list of files @@ -368,8 +368,8 @@ public class WebToolsServices { changedFormat.setMinimumIntegerDigits(5); changedFormat.setGroupingUsed(false); - List errorMessages = new LinkedList(); - List infoMessages = new LinkedList(); + List errorMessages = new LinkedList<>(); + List infoMessages = new LinkedList<>(); int totalRowsChanged = 0; if (UtilValidate.isNotEmpty(urlList)) { messages.add("=-=-=-=-=-=-= Doing a data " + (checkDataOnly ? "check" : "load") + " with the following files:"); @@ -473,7 +473,7 @@ public class WebToolsServices { txTimeout = 7200; } - List results = new LinkedList(); + List results = new LinkedList<>(); if (UtilValidate.isNotEmpty(outpath)) { File outdir = new File(outpath); @@ -485,7 +485,7 @@ public class WebToolsServices { try { ModelReader reader = delegator.getModelReader(); Collection ec = reader.getEntityNames(); - passedEntityNames = new TreeSet(ec); + passedEntityNames = new TreeSet<>(ec); } catch (Exception exc) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "EntityImportErrorRetrievingEntityNames", locale)); } @@ -498,7 +498,7 @@ public class WebToolsServices { results.add("["+fileNumber +"] [vvv] " + curEntityName + " skipping view entity"); continue; } - List conds = new LinkedList(); + List conds = new LinkedList<>(); if (UtilValidate.isNotEmpty(fromDate)) { conds.add(EntityCondition.makeCondition("createdStamp", EntityOperator.GREATER_THAN_EQUAL_TO, fromDate)); } @@ -611,9 +611,9 @@ public class WebToolsServices { Map resultMap = ServiceUtil.returnSuccess(); ModelReader reader = delegator.getModelReader(); - Map> entitiesByPackage = new HashMap>(); - Set packageNames = new TreeSet(); - Set tableNames = new TreeSet(); + Map> entitiesByPackage = new HashMap<>(); + Set packageNames = new TreeSet<>(); + Set tableNames = new TreeSet<>(); //put the entityNames TreeSets in a HashMap by packageName try { @@ -627,7 +627,7 @@ public class WebToolsServices { } TreeSet entities = entitiesByPackage.get(ent.getPackageName()); if (entities == null) { - entities = new TreeSet(); + entities = new TreeSet<>(); entitiesByPackage.put(ent.getPackageName(), entities); packageNames.add(ent.getPackageName()); } @@ -638,14 +638,14 @@ public class WebToolsServices { } String search = (String) context.get("search"); - List> packagesList = new LinkedList>(); + List> packagesList = new LinkedList<>(); try { for (String pName : packageNames) { - Map packageMap = new HashMap(); + Map packageMap = new HashMap<>(); TreeSet entities = entitiesByPackage.get(pName); - List> entitiesList = new LinkedList>(); + List> entitiesList = new LinkedList<>(); for (String entityName: entities) { - Map entityMap = new HashMap(); + Map entityMap = new HashMap<>(); String helperName = delegator.getEntityHelperName(entityName); String groupName = delegator.getEntityGroupName(entityName); if (search == null || entityName.toLowerCase().indexOf(search.toLowerCase()) != -1) { @@ -669,9 +669,9 @@ public class WebToolsServices { } // fields list - List> javaNameList = new LinkedList>(); + List> javaNameList = new LinkedList<>(); for (Iterator f = entity.getFieldsIterator(); f.hasNext();) { - Map javaNameMap = new HashMap(); + Map javaNameMap = new HashMap<>(); ModelField field = f.next(); ModelFieldType type = delegator.getEntityFieldType(entity, field.getType()); javaNameMap.put("isPk", field.getIsPk()); @@ -705,14 +705,14 @@ public class WebToolsServices { } // relations list - List> relationsList = new LinkedList>(); + List> relationsList = new LinkedList<>(); for (int r = 0; r < entity.getRelationsSize(); r++) { - Map relationMap = new HashMap(); + Map relationMap = new HashMap<>(); ModelRelation relation = entity.getRelation(r); - List> keysList = new LinkedList>(); + List> keysList = new LinkedList<>(); int row = 1; for (ModelKeyMap keyMap : relation.getKeyMaps()) { - Map keysMap = new HashMap(); + Map keysMap = new HashMap<>(); String fieldName = null; String relFieldName = null; if (keyMap.getFieldName().equals(keyMap.getRelFieldName())) { @@ -738,16 +738,16 @@ public class WebToolsServices { } // index list - List> indexList = new LinkedList>(); + List> indexList = new LinkedList<>(); for (int r = 0; r < entity.getIndexesSize(); r++) { - List fieldNameList = new LinkedList(); + List fieldNameList = new LinkedList<>(); ModelIndex index = entity.getIndex(r); for (Iterator fieldIterator = index.getFields().iterator(); fieldIterator.hasNext();) { fieldNameList.add(fieldIterator.next().getFieldName()); } - Map indexMap = new HashMap(); + Map indexMap = new HashMap<>(); indexMap.put("name", index.getName()); indexMap.put("description", index.getDescription()); indexMap.put("fieldNameList", fieldNameList); @@ -808,9 +808,9 @@ public class WebToolsServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "WebtoolsEomodelFullPathIsNotWriteable", UtilMisc.toMap("eomodeldFullPath", eomodeldFullPath), locale)); } - Set entityNames = new TreeSet(); + Set entityNames = new TreeSet<>(); if (UtilValidate.isNotEmpty(entityPackageNameOrig)) { - Set entityPackageNameSet = new HashSet(); + Set entityPackageNameSet = new HashSet<>(); entityPackageNameSet.addAll(StringUtil.split(entityPackageNameOrig, ",")); Debug.logInfo("Exporting with entityPackageNameSet: " + entityPackageNameSet, module); @@ -838,12 +838,12 @@ public class WebToolsServices { } // write the index.eomodeld file - Map topLevelMap = new HashMap(); + Map topLevelMap = new HashMap<>(); topLevelMap.put("EOModelVersion", "\"2.1\""); - List> entitiesMapList = new LinkedList>(); + List> entitiesMapList = new LinkedList<>(); topLevelMap.put("entities", entitiesMapList); for (String entityName: entityNames) { - Map entitiesMap = new HashMap(); + Map entitiesMap = new HashMap<>(); entitiesMapList.add(entitiesMap); entitiesMap.put("className", "EOGenericRecord"); entitiesMap.put("name", entityName); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java index a2d87c9f88..2c511e77c7 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java @@ -77,40 +77,40 @@ public class ArtifactInfoFactory { protected final ModelReader entityModelReader; protected final DispatchContext dispatchContext; - public Map allEntityInfos = new ConcurrentHashMap(); - public Map allServiceInfos = new ConcurrentHashMap(); - public Map allServiceEcaInfos = new ConcurrentHashMap(); - public Map allFormInfos = new ConcurrentHashMap(); - public Map allScreenInfos = new ConcurrentHashMap(); - public Map allControllerRequestInfos = new ConcurrentHashMap(); - public Map allControllerViewInfos = new ConcurrentHashMap(); + public Map allEntityInfos = new ConcurrentHashMap<>(); + public Map allServiceInfos = new ConcurrentHashMap<>(); + public Map allServiceEcaInfos = new ConcurrentHashMap<>(); + public Map allFormInfos = new ConcurrentHashMap<>(); + public Map allScreenInfos = new ConcurrentHashMap<>(); + public Map allControllerRequestInfos = new ConcurrentHashMap<>(); + public Map allControllerViewInfos = new ConcurrentHashMap<>(); // reverse-associative caches for walking backward in the diagram - public Map> allServiceEcaInfosReferringToServiceName = new ConcurrentHashMap>(); - public Map> allServiceInfosReferringToServiceName = new ConcurrentHashMap>(); - public Map> allFormInfosReferringToServiceName = new ConcurrentHashMap>(); - public Map> allFormInfosBasedOnServiceName = new ConcurrentHashMap>(); - public Map> allScreenInfosReferringToServiceName = new ConcurrentHashMap>(); - public Map> allRequestInfosReferringToServiceName = new ConcurrentHashMap>(); + public Map> allServiceEcaInfosReferringToServiceName = new ConcurrentHashMap<>(); + public Map> allServiceInfosReferringToServiceName = new ConcurrentHashMap<>(); + public Map> allFormInfosReferringToServiceName = new ConcurrentHashMap<>(); + public Map> allFormInfosBasedOnServiceName = new ConcurrentHashMap<>(); + public Map> allScreenInfosReferringToServiceName = new ConcurrentHashMap<>(); + public Map> allRequestInfosReferringToServiceName = new ConcurrentHashMap<>(); - public Map> allServiceInfosReferringToEntityName = new ConcurrentHashMap>(); - public Map> allFormInfosReferringToEntityName = new ConcurrentHashMap>(); - public Map> allScreenInfosReferringToEntityName = new ConcurrentHashMap>(); + public Map> allServiceInfosReferringToEntityName = new ConcurrentHashMap<>(); + public Map> allFormInfosReferringToEntityName = new ConcurrentHashMap<>(); + public Map> allScreenInfosReferringToEntityName = new ConcurrentHashMap<>(); - public Map> allServiceInfosReferringToServiceEcaRule = new ConcurrentHashMap>(); + public Map> allServiceInfosReferringToServiceEcaRule = new ConcurrentHashMap<>(); - public Map> allFormInfosExtendingForm = new ConcurrentHashMap>(); - public Map> allScreenInfosReferringToForm = new ConcurrentHashMap>(); + public Map> allFormInfosExtendingForm = new ConcurrentHashMap<>(); + public Map> allScreenInfosReferringToForm = new ConcurrentHashMap<>(); - public Map> allScreenInfosReferringToScreen = new ConcurrentHashMap>(); - public Map> allViewInfosReferringToScreen = new ConcurrentHashMap>(); + public Map> allScreenInfosReferringToScreen = new ConcurrentHashMap<>(); + public Map> allViewInfosReferringToScreen = new ConcurrentHashMap<>(); - public Map> allRequestInfosReferringToView = new ConcurrentHashMap>(); + public Map> allRequestInfosReferringToView = new ConcurrentHashMap<>(); - public Map> allFormInfosTargetingRequest = new ConcurrentHashMap>(); - public Map> allFormInfosReferringToRequest = new ConcurrentHashMap>(); - public Map> allScreenInfosReferringToRequest = new ConcurrentHashMap>(); - public Map> allRequestInfosReferringToRequest = new ConcurrentHashMap>(); + public Map> allFormInfosTargetingRequest = new ConcurrentHashMap<>(); + public Map> allFormInfosReferringToRequest = new ConcurrentHashMap<>(); + public Map> allScreenInfosReferringToRequest = new ConcurrentHashMap<>(); + public Map> allRequestInfosReferringToRequest = new ConcurrentHashMap<>(); public static ArtifactInfoFactory getArtifactInfoFactory(String delegatorName) throws GeneralException { if (UtilValidate.isEmpty(delegatorName)) { @@ -143,7 +143,7 @@ public class ArtifactInfoFactory { public void prepareAll() throws GeneralException { Debug.logInfo("Loading artifact info objects...", module); - List> futures = new ArrayList>(); + List> futures = new ArrayList<>(); Set entityNames = this.getEntityModelReader().getEntityNames(); for (String entityName: entityNames) { this.getEntityArtifactInfo(entityName); @@ -157,7 +157,7 @@ public class ArtifactInfoFactory { Collection componentConfigs = ComponentConfig.getAllComponents(); ExecutionPool.getAllFutures(futures); - futures = new ArrayList>(); + futures = new ArrayList<>(); for (ComponentConfig componentConfig: componentConfigs) { futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(prepareTaskForComponentAnalysis(componentConfig))); } @@ -328,7 +328,7 @@ public class ArtifactInfoFactory { } public Set getAllArtifactInfosByNamePartial(String artifactNamePartial, String type) { - Set aiBaseSet = new HashSet(); + Set aiBaseSet = new HashSet<>(); if (UtilValidate.isEmpty(artifactNamePartial)) { return aiBaseSet; @@ -396,9 +396,9 @@ public class ArtifactInfoFactory { return () -> { String componentName = componentConfig.getGlobalName(); String rootComponentPath = componentConfig.getRootLocation(); - List screenFiles = new ArrayList(); - List formFiles = new ArrayList(); - List controllerFiles = new ArrayList(); + List screenFiles = new ArrayList<>(); + List formFiles = new ArrayList<>(); + List controllerFiles = new ArrayList<>(); try { screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd"); } catch (IOException ioe) { diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java index 3aa719add4..eb2f508c97 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java @@ -44,8 +44,8 @@ public class ControllerRequestArtifactInfo extends ArtifactInfoBase { protected ConfigXMLReader.RequestMap requestInfoMap; protected ServiceArtifactInfo serviceCalledByRequestEvent = null; - protected Set requestsThatAreResponsesToThisRequest = new TreeSet(); - protected Set viewsThatAreResponsesToThisRequest = new TreeSet(); + protected Set requestsThatAreResponsesToThisRequest = new TreeSet<>(); + protected Set viewsThatAreResponsesToThisRequest = new TreeSet<>(); public ControllerRequestArtifactInfo(URL controllerXmlUrl, String requestUri, ArtifactInfoFactory aif) throws GeneralException { super(aif); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java index 415811fb70..b03b2c89c7 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/EntityArtifactInfo.java @@ -38,8 +38,8 @@ import org.apache.ofbiz.entityext.eca.EntityEcaRule; public class EntityArtifactInfo extends ArtifactInfoBase { protected ModelEntity modelEntity; - protected Set entitiesRelatedOne = new TreeSet(); - protected Set entitiesRelatedMany = new TreeSet(); + protected Set entitiesRelatedOne = new TreeSet<>(); + protected Set entitiesRelatedMany = new TreeSet<>(); public EntityArtifactInfo(String entityName, ArtifactInfoFactory aif) throws GenericEntityException { super(aif); @@ -111,13 +111,13 @@ public class EntityArtifactInfo extends ArtifactInfoBase { /** Get the Services called by Entity ECA */ public Set getServicesCalledByEntityEca() { - Set serviceSet = new HashSet(); + Set serviceSet = new HashSet<>(); // TODO: implement this return serviceSet; } public Set getEntityEcaRules() { - Set eecaSet = new HashSet(); + Set eecaSet = new HashSet<>(); // TODO: implement this return eecaSet; } diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java index 1cf06b2a40..3d649a5058 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/FormWidgetArtifactInfo.java @@ -49,11 +49,11 @@ public class FormWidgetArtifactInfo extends ArtifactInfoBase { protected String formName; protected String formLocation; - protected Set entitiesUsedInThisForm = new TreeSet(); - protected Set servicesUsedInThisForm = new TreeSet(); + protected Set entitiesUsedInThisForm = new TreeSet<>(); + protected Set servicesUsedInThisForm = new TreeSet<>(); protected FormWidgetArtifactInfo formThisFormExtends = null; - protected Set requestsLinkedToInForm = new TreeSet(); - protected Set requestsTargetedByInForm = new TreeSet(); + protected Set requestsLinkedToInForm = new TreeSet<>(); + protected Set requestsTargetedByInForm = new TreeSet<>(); public FormWidgetArtifactInfo(String formName, String formLocation, ArtifactInfoFactory aif) throws GeneralException { super(aif); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/RunTestEvents.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/RunTestEvents.java index 30a12e5353..8ca5b860c8 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/RunTestEvents.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/RunTestEvents.java @@ -43,7 +43,7 @@ public class RunTestEvents { String caseName = request.getParameter("caseName"); String result = null; - List ofbizCommands = new ArrayList(); + List ofbizCommands = new ArrayList<>(); if (caseName == null) { ofbizCommands.add(new StartupCommand.Builder("test").properties( UtilMisc.toMap("component", component, "suitename", suiteName)).build()); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java index 4c9d1afa3f..8214d693f4 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ScreenWidgetArtifactInfo.java @@ -48,10 +48,10 @@ public class ScreenWidgetArtifactInfo extends ArtifactInfoBase { protected String screenName; protected String screenLocation; - protected Set entitiesUsedInThisScreen = new TreeSet(); - protected Set servicesUsedInThisScreen = new TreeSet(); - protected Set formsIncludedInThisScreen = new TreeSet(); - protected Set requestsLinkedToInScreen = new TreeSet(); + protected Set entitiesUsedInThisScreen = new TreeSet<>(); + protected Set servicesUsedInThisScreen = new TreeSet<>(); + protected Set formsIncludedInThisScreen = new TreeSet<>(); + protected Set requestsLinkedToInScreen = new TreeSet<>(); public ScreenWidgetArtifactInfo(String screenName, String screenLocation, ArtifactInfoFactory aif) throws GeneralException { super(aif); @@ -215,7 +215,7 @@ public class ScreenWidgetArtifactInfo extends ArtifactInfoBase { public Set getScreensIncludedInScreen() { // TODO: implement this - return new HashSet(); + return new HashSet<>(); } public Set getScreensIncludingThisScreen() { diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java index cf1c7581be..74ac18f8e2 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceArtifactInfo.java @@ -59,9 +59,9 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { protected ModelService modelService; protected String displayPrefix = null; - Set entitiesUsedByThisService = new TreeSet(); - Set servicesCalledByThisService = new TreeSet(); - Set serviceEcasTriggeredByThisService = new TreeSet(); + Set entitiesUsedByThisService = new TreeSet<>(); + Set servicesCalledByThisService = new TreeSet<>(); + Set serviceEcasTriggeredByThisService = new TreeSet<>(); public ServiceArtifactInfo(String serviceName, ArtifactInfoFactory aif) throws GeneralException { super(aif); @@ -182,7 +182,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { populateServicesFromNameSet(allServiceNameSet); } } else if ("group".equals(this.modelService.engineName)) { - Set allServiceNameSet = new HashSet(); + Set allServiceNameSet = new HashSet<>(); GroupModel groupModel = modelService.internalGroup; if (groupModel == null) { groupModel = ServiceGroupReader.getGroupModel(this.modelService.location); @@ -283,7 +283,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { public Set getServicesCalledByServiceEcas() { // TODO: implement this sometime, not really necessary - return new HashSet(); + return new HashSet<>(); } public Set getServiceEcaRulesTriggeredByService() { @@ -292,7 +292,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { public Set getServicesCallingServiceByEcas() { // TODO: implement this sometime, not really necessary - return new HashSet(); + return new HashSet<>(); } public Set getServiceEcaRulesCallingService() { @@ -320,9 +320,9 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { Debug.logInfo("Writing Service Call Graph EO Model for service [" + this.modelService.name + "] to [" + eomodeldFullPath + "]", module); - Set allDiagramEntitiesWithPrefixes = new HashSet(); - List allServiceList = new LinkedList(); - List allServiceEcaList = new LinkedList(); + Set allDiagramEntitiesWithPrefixes = new HashSet<>(); + List allServiceList = new LinkedList<>(); + List allServiceEcaList = new LinkedList<>(); // make sure that any prefix that might have been set on this is cleared this.setDisplayPrefix(""); @@ -349,7 +349,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { allServiceList.add(calledService); } - Map displaySuffixNumByEcaName = new HashMap(); + Map displaySuffixNumByEcaName = new HashMap<>(); // all SECAs and triggering services that call this service as an action Set callingServiceEcaSet = this.getServiceEcaRulesCallingService(); @@ -390,12 +390,12 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { } // write index.eomodeld file - Map indexEoModelMap = new HashMap(); + Map indexEoModelMap = new HashMap<>(); indexEoModelMap.put("EOModelVersion", "\"2.1\""); - List> entitiesMapList = new LinkedList>(); + List> entitiesMapList = new LinkedList<>(); indexEoModelMap.put("entities", entitiesMapList); for (String entityName: allDiagramEntitiesWithPrefixes) { - Map entitiesMap = new HashMap(); + Map entitiesMap = new HashMap<>(); entitiesMapList.add(entitiesMap); entitiesMap.put("className", "EOGenericRecord"); entitiesMap.put("name", entityName); @@ -450,17 +450,17 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { } public Map createEoModelMap(Set callingServiceSet, Set calledServiceSet, Set callingServiceEcaSet, Set calledServiceEcaSet, boolean useMoreDetailedNames) { - if (callingServiceSet == null) callingServiceSet = new HashSet(); - if (calledServiceSet == null) calledServiceSet = new HashSet(); - if (callingServiceEcaSet == null) callingServiceEcaSet = new HashSet(); - if (calledServiceEcaSet == null) calledServiceEcaSet = new HashSet(); - Map topLevelMap = new HashMap(); + if (callingServiceSet == null) callingServiceSet = new HashSet<>(); + if (calledServiceSet == null) calledServiceSet = new HashSet<>(); + if (callingServiceEcaSet == null) callingServiceEcaSet = new HashSet<>(); + if (calledServiceEcaSet == null) calledServiceEcaSet = new HashSet<>(); + Map topLevelMap = new HashMap<>(); topLevelMap.put("name", this.getDisplayPrefixedName()); topLevelMap.put("className", "EOGenericRecord"); // for classProperties add attribute names AND relationship names to get a nice, complete chart - List classPropertiesList = new LinkedList(); + List classPropertiesList = new LinkedList<>(); topLevelMap.put("classProperties", classPropertiesList); for (ModelParam param: this.modelService.getModelParamList()) { // skip the internal parameters, very redundant in the diagrams @@ -486,10 +486,10 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { } // attributes - List> attributesList = new LinkedList>(); + List> attributesList = new LinkedList<>(); topLevelMap.put("attributes", attributesList); for (ModelParam param: this.modelService.getModelParamList()) { - Map attributeMap = new HashMap(); + Map attributeMap = new HashMap<>(); attributesList.add(attributeMap); if (useMoreDetailedNames) { @@ -502,10 +502,10 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { } // relationships - List> relationshipsMapList = new LinkedList>(); + List> relationshipsMapList = new LinkedList<>(); for (ServiceArtifactInfo sai: callingServiceSet) { - Map relationshipMap = new HashMap(); + Map relationshipMap = new HashMap<>(); relationshipsMapList.add(relationshipMap); relationshipMap.put("name", sai.getDisplayPrefixedName()); @@ -520,7 +520,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { //joinsMap.put("destinationAttribute", keyMap.getRelFieldName()); } for (ServiceArtifactInfo sai: calledServiceSet) { - Map relationshipMap = new HashMap(); + Map relationshipMap = new HashMap<>(); relationshipsMapList.add(relationshipMap); relationshipMap.put("name", sai.getDisplayPrefixedName()); @@ -536,7 +536,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { } for (ServiceEcaArtifactInfo seai: callingServiceEcaSet) { - Map relationshipMap = new HashMap(); + Map relationshipMap = new HashMap<>(); relationshipsMapList.add(relationshipMap); relationshipMap.put("name", seai.getDisplayPrefixedName()); @@ -545,7 +545,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase { relationshipMap.put("isMandatory", "Y"); } for (ServiceEcaArtifactInfo seai: calledServiceEcaSet) { - Map relationshipMap = new HashMap(); + Map relationshipMap = new HashMap<>(); relationshipsMapList.add(relationshipMap); relationshipMap.put("name", seai.getDisplayPrefixedName()); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java index 53069d7838..5a3b4a3b56 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/artifactinfo/ServiceEcaArtifactInfo.java @@ -43,7 +43,7 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase { protected String displayPrefix = null; protected int displaySuffixNum = 0; - protected Set servicesCalledByThisServiceEca = new TreeSet(); + protected Set servicesCalledByThisServiceEca = new TreeSet<>(); public ServiceEcaArtifactInfo(ServiceEcaRule serviceEcaRule, ArtifactInfoFactory aif) throws GeneralException { super(aif); @@ -113,15 +113,15 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase { } public Map createEoModelMap(Set triggeringServiceSet, Set triggeredServiceSet, boolean useMoreDetailedNames) { - if (triggeringServiceSet == null) triggeringServiceSet = new HashSet(); - if (triggeredServiceSet == null) triggeredServiceSet = new HashSet(); - Map topLevelMap = new HashMap(); + if (triggeringServiceSet == null) triggeringServiceSet = new HashSet<>(); + if (triggeredServiceSet == null) triggeredServiceSet = new HashSet<>(); + Map topLevelMap = new HashMap<>(); topLevelMap.put("name", this.getDisplayPrefixedName()); topLevelMap.put("className", "EOGenericRecord"); // for classProperties add attribute names AND relationship names to get a nice, complete chart - List classPropertiesList = new LinkedList(); + List classPropertiesList = new LinkedList<>(); topLevelMap.put("classProperties", classPropertiesList); // conditions for (ServiceEcaCondition ecaCondition: this.serviceEcaRule.getEcaConditionList()) { @@ -155,10 +155,10 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase { */ // relationships - List> relationshipsMapList = new LinkedList>(); + List> relationshipsMapList = new LinkedList<>(); for (ServiceArtifactInfo sai: triggeringServiceSet) { - Map relationshipMap = new HashMap(); + Map relationshipMap = new HashMap<>(); relationshipsMapList.add(relationshipMap); relationshipMap.put("name", sai.getDisplayPrefixedName()); @@ -167,7 +167,7 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase { relationshipMap.put("isMandatory", "Y"); } for (ServiceArtifactInfo sai: triggeredServiceSet) { - Map relationshipMap = new HashMap(); + Map relationshipMap = new HashMap<>(); relationshipsMapList.add(relationshipMap); relationshipMap.put("name", sai.getDisplayPrefixedName()); diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java index fce437da2a..e5a5ab1e66 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelInfo.java @@ -31,7 +31,7 @@ public class LabelInfo { protected String labelKey = ""; protected String labelKeyComment = ""; protected String fileName = ""; - protected Map labelValues = new LinkedHashMap(); + protected Map labelValues = new LinkedHashMap<>(); public LabelInfo(String labelKey, String labelKeyComment, String fileName, String localeStr, String labelValue, String labelComment) { this.labelKey = labelKey; diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java index 9f0782f1b2..5eca715119 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java @@ -54,9 +54,9 @@ public class LabelManagerFactory { protected static Set componentNamesFound = null; protected static Map filesFound = null; - protected Map labels = new TreeMap(); - protected Set localesFound = new TreeSet(); - protected List duplicatedLocalesLabelsList = new LinkedList(); + protected Map labels = new TreeMap<>(); + protected Set localesFound = new TreeSet<>(); + protected List duplicatedLocalesLabelsList = new LinkedList<>(); public static synchronized LabelManagerFactory getInstance() throws IOException { if (componentNamesFound == null) { @@ -72,7 +72,7 @@ public class LabelManagerFactory { } protected static void loadComponentNames() { - componentNamesFound = new TreeSet(); + componentNamesFound = new TreeSet<>(); Collection componentConfigs = ComponentConfig.getAllComponents(); for (ComponentConfig componentConfig : componentConfigs) { componentNamesFound.add(componentConfig.getComponentName()); @@ -80,7 +80,7 @@ public class LabelManagerFactory { } protected static void loadLabelFiles() throws IOException { - filesFound = new TreeMap(); + filesFound = new TreeMap<>(); List cpInfos = ComponentConfig.getAllClasspathInfos(); for (ClasspathInfo cpi : cpInfos) { if ("dir".equals(cpi.type)) { @@ -192,7 +192,7 @@ public class LabelManagerFactory { } public Set getLocalesFound() { - return new TreeSet(localesFound); + return new TreeSet<>(localesFound); } public static Collection getFilesFound() { diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java index ac4905f250..c1b5fdc88a 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelReferences.java @@ -62,12 +62,12 @@ public class LabelReferences { private static final String getResourceRegex = "ServiceUtil\\.getResource\\(\\)"; private static final String getResource = "ServiceUtil.getResource "; - protected Map> references = new TreeMap>(); + protected Map> references = new TreeMap<>(); protected Delegator delegator; protected DispatchContext dispatchContext; protected Map labels; - protected Set labelSet = new HashSet(); - protected Set rootFolders = new HashSet(); + protected Set labelSet = new HashSet<>(); + protected Set rootFolders = new HashSet<>(); public LabelReferences(Delegator delegator, LabelManagerFactory factory) { this.delegator = delegator; @@ -116,7 +116,7 @@ public class LabelReferences { // get labels from simple method files getLabelsFromSimpleMethodFiles(); // get labels from widgets files - List fileList = new LinkedList(); + List fileList = new LinkedList<>(); for (String rootFolder : this.rootFolders) { fileList.addAll(FileUtil.findXmlFiles(rootFolder + "webapp", null, null, null)); fileList.addAll(FileUtil.findXmlFiles(rootFolder + "widget", null, null, null)); @@ -143,7 +143,7 @@ public class LabelReferences { private void setLabelReference(String labelKey, String filePath) { Map reference = references.get(labelKey); if (UtilValidate.isEmpty(reference)) { - reference = new TreeMap(); + reference = new TreeMap<>(); reference.put(filePath, 1); references.put(labelKey, reference); } else { @@ -299,7 +299,7 @@ public class LabelReferences { } private void getLabelsFromFormWidgets(String inFile, File file) throws MalformedURLException, SAXException, ParserConfigurationException, IOException, GenericServiceException { - Set fieldNames = new HashSet(); + Set fieldNames = new HashSet<>(); findUiLabelMapInFile(inFile, file.getPath()); Document formDocument = UtilXml.readXmlDocument(file.toURI().toURL()); Element rootElem = formDocument.getDocumentElement(); diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/artifact/ArtifactInfoContext.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/artifact/ArtifactInfoContext.java index 9bc5092871..07416bce6c 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/artifact/ArtifactInfoContext.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/artifact/ArtifactInfoContext.java @@ -26,12 +26,12 @@ import java.util.Set; */ public final class ArtifactInfoContext { - private final Set entityNameSet = new HashSet(); - private final Set serviceNameSet = new HashSet(); - private final Set screenLocationSet = new HashSet(); - private final Set formLocationSet = new HashSet(); - private final Set requestLocationSet = new HashSet(); - private final Set targetLocationSet = new HashSet(); + private final Set entityNameSet = new HashSet<>(); + private final Set serviceNameSet = new HashSet<>(); + private final Set screenLocationSet = new HashSet<>(); + private final Set formLocationSet = new HashSet<>(); + private final Set requestLocationSet = new HashSet<>(); + private final Set targetLocationSet = new HashSet<>(); /** * Adds an entity name to this context. diff --git a/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java b/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java index fa3a1c6e09..377c189234 100644 --- a/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java +++ b/framework/widget/src/main/java/org/apache/ofbiz/widget/portal/PortalPageWorker.java @@ -70,7 +70,7 @@ public class PortalPageWorker { EntityOperator.OR)), EntityOperator.AND); portalPages = EntityQuery.use(delegator).from("PortalPage").where(cond).queryList(); - List userPortalPages = new ArrayList(); + List userPortalPages = new ArrayList<>(); if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId"); // replace with private pages