Improved: Updated case indentation to 0 for all switch statements in framework component. Also done formatting changes as per checkstyle best practices.
(OFBIZ-11904)
This commit is contained in:
@@ -147,15 +147,13 @@ public final class CommonWorkers {
|
||||
EntityCondition stateProvinceFindCond = EntityCondition.makeCondition(
|
||||
EntityCondition.makeCondition("geoIdFrom", country),
|
||||
EntityCondition.makeCondition("geoAssocTypeId", "REGIONS"),
|
||||
EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"),
|
||||
EntityCondition.makeCondition("geoTypeId", "TERRITORY"), EntityCondition.makeCondition("geoTypeId", "COUNTY")));
|
||||
EntityCondition.makeCondition(EntityOperator.OR, EntityCondition.makeCondition("geoTypeId", "STATE"), EntityCondition.makeCondition("geoTypeId", "PROVINCE"), EntityCondition.makeCondition("geoTypeId", "MUNICIPALITY"), EntityCondition.makeCondition("geoTypeId", "TERRITORY"), EntityCondition.makeCondition("geoTypeId", "COUNTY")));
|
||||
geoList.addAll(EntityQuery.use(delegator)
|
||||
.from("GeoAssocAndGeoToWithState")
|
||||
.where(stateProvinceFindCond)
|
||||
.orderBy(sortList)
|
||||
.cache(true)
|
||||
.queryList()
|
||||
);
|
||||
.queryList());
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(e, "Cannot lookup Geo", MODULE);
|
||||
}
|
||||
|
||||
+1
-2
@@ -222,8 +222,7 @@ public class JsLanguageFileMappingCreator {
|
||||
// write it as a Java file
|
||||
File file = new File(output);
|
||||
FileUtils.writeStringToFile(file, writer.toString(), encoding);
|
||||
}
|
||||
catch (IOException | TemplateException e) {
|
||||
} catch (IOException | TemplateException e) {
|
||||
Debug.logError(e, MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage("CommonUiLabels", "CommonOutputFileCouldNotBeCreated", UtilMisc.toMap("errorString", e.getMessage()), (Locale) context.get("locale")));
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public final class KeywordSearchUtil {
|
||||
// replace all %% with %
|
||||
int dblPercIdx = -1;
|
||||
while ((dblPercIdx = strSb.indexOf("%%")) >= 0) {
|
||||
strSb.replace(dblPercIdx, dblPercIdx+2, "%");
|
||||
strSb.replace(dblPercIdx, dblPercIdx + 2, "%");
|
||||
}
|
||||
token = strSb.toString();
|
||||
}
|
||||
|
||||
+6
-6
@@ -87,7 +87,7 @@ public class PreferenceServices {
|
||||
}
|
||||
} catch (GeneralException e) {
|
||||
Debug.logWarning(e.getMessage(), MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "getPreference.readFailure", new Object[] { e.getMessage() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "getPreference.readFailure", new Object[] {e.getMessage() }, locale));
|
||||
}
|
||||
|
||||
Map<String, Object> result = ServiceUtil.returnSuccess();
|
||||
@@ -134,7 +134,7 @@ public class PreferenceServices {
|
||||
}
|
||||
} catch (GeneralException e) {
|
||||
Debug.logWarning(e.getMessage(), MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "getPreference.readFailure", new Object[] { e.getMessage() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "getPreference.readFailure", new Object[] {e.getMessage() }, locale));
|
||||
}
|
||||
// for the 'DEFAULT' values find the related values in general properties and if found use those.
|
||||
Properties generalProperties = UtilProperties.getProperties("general");
|
||||
@@ -181,7 +181,7 @@ public class PreferenceServices {
|
||||
delegator.createOrStore(rec);
|
||||
} catch (GeneralException e) {
|
||||
Debug.logWarning(e.getMessage(), MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "setPreference.writeFailure", new Object[] { e.getMessage() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "setPreference.writeFailure", new Object[] {e.getMessage() }, locale));
|
||||
}
|
||||
|
||||
return ServiceUtil.returnSuccess();
|
||||
@@ -207,7 +207,7 @@ public class PreferenceServices {
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logWarning(e.getMessage(), MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "setPreference.writeFailure", new Object[] { e.getMessage() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "setPreference.writeFailure", new Object[] {e.getMessage() }, locale));
|
||||
}
|
||||
|
||||
return ServiceUtil.returnSuccess();
|
||||
@@ -240,7 +240,7 @@ public class PreferenceServices {
|
||||
}
|
||||
} catch (GeneralException e) {
|
||||
Debug.logWarning(e.getMessage(), MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "setPreference.writeFailure", new Object[] { e.getMessage() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "setPreference.writeFailure", new Object[] {e.getMessage() }, locale));
|
||||
}
|
||||
|
||||
return ServiceUtil.returnSuccess();
|
||||
@@ -279,7 +279,7 @@ public class PreferenceServices {
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logWarning(e.getMessage(), MODULE);
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "copyPreference.writeFailure", new Object[] { e.getMessage() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage(RESOURCE, "copyPreference.writeFailure", new Object[] {e.getMessage() }, locale));
|
||||
}
|
||||
|
||||
return ServiceUtil.returnSuccess();
|
||||
|
||||
@@ -143,7 +143,7 @@ public class QRCodeEvents {
|
||||
return "error";
|
||||
}
|
||||
} catch (IOException | GenericServiceException e) {
|
||||
String errMsg = UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] { e.getMessage() }, locale);
|
||||
String errMsg = UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] {e.getMessage() }, locale);
|
||||
request.setAttribute("_ERROR_MESSAGE_", errMsg);
|
||||
return "error";
|
||||
}
|
||||
|
||||
@@ -205,9 +205,9 @@ public class QRCodeServices {
|
||||
result.put("bufferedImage", bufferedImage);
|
||||
return result;
|
||||
} catch (WriterException e) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] { e.toString() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorGenerateQRCode", new Object[] {e.toString() }, locale));
|
||||
} catch (ChecksumException | FormatException | NotFoundException e) {
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorVerifyQRCode", new Object[] { e.toString() }, locale));
|
||||
return ServiceUtil.returnError(UtilProperties.getMessage("QRCodeUiLabels", "ErrorVerifyQRCode", new Object[] {e.toString() }, locale));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,12 @@ public class PerformFindTests extends OFBizTestCase {
|
||||
|
||||
private static List<GenericValue> getCompleteList(Map<String, Object> context) {
|
||||
List<GenericValue> foundElements = new LinkedList<>();
|
||||
try (EntityListIterator listIt = (EntityListIterator) context.get("listIt")) {
|
||||
if (listIt != null) {
|
||||
foundElements = listIt.getCompleteList();
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(" Failed to extract values from EntityListIterator after a performFind service", MODULE);
|
||||
try (EntityListIterator listIt = (EntityListIterator) context.get("listIt")) {
|
||||
if (listIt != null) {
|
||||
foundElements = listIt.getCompleteList();
|
||||
}
|
||||
} catch (GenericEntityException e) {
|
||||
Debug.logError(" Failed to extract values from EntityListIterator after a performFind service", MODULE);
|
||||
}
|
||||
return foundElements;
|
||||
}
|
||||
@@ -104,11 +104,11 @@ public class PerformFindTests extends OFBizTestCase {
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testPerformFind() throws Exception {
|
||||
performFindConditionFieldEquals();
|
||||
performFindConditionFieldLike();
|
||||
performFindConditionDistinct();
|
||||
performFindFilterByDate();
|
||||
performFindFilterByDateWithDedicateDateField();
|
||||
performFindConditionFieldEquals();
|
||||
performFindConditionFieldLike();
|
||||
performFindConditionDistinct();
|
||||
performFindFilterByDate();
|
||||
performFindFilterByDateWithDedicateDateField();
|
||||
}
|
||||
|
||||
private void performFindConditionFieldEquals() throws Exception {
|
||||
|
||||
@@ -42,29 +42,29 @@ public class UomWorker {
|
||||
|
||||
public static int[] uomTimeToCalTime(String uomId) {
|
||||
if ("TF_ms".equals(uomId)) {
|
||||
return new int[] { Calendar.MILLISECOND, 1 };
|
||||
return new int[] {Calendar.MILLISECOND, 1 };
|
||||
} else if ("TF_s".equals(uomId)) {
|
||||
return new int[] { Calendar.SECOND, 1 };
|
||||
return new int[] {Calendar.SECOND, 1 };
|
||||
} else if ("TF_min".equals(uomId)) {
|
||||
return new int[] { Calendar.MINUTE, 1 };
|
||||
return new int[] {Calendar.MINUTE, 1 };
|
||||
} else if ("TF_hr".equals(uomId)) {
|
||||
return new int[] { Calendar.HOUR, 1 };
|
||||
return new int[] {Calendar.HOUR, 1 };
|
||||
} else if ("TF_day".equals(uomId)) {
|
||||
return new int[] { Calendar.DAY_OF_YEAR, 1 };
|
||||
return new int[] {Calendar.DAY_OF_YEAR, 1 };
|
||||
} else if ("TF_wk".equals(uomId)) {
|
||||
return new int[] { Calendar.WEEK_OF_YEAR, 1 };
|
||||
return new int[] {Calendar.WEEK_OF_YEAR, 1 };
|
||||
} else if ("TF_mon".equals(uomId)) {
|
||||
return new int[] { Calendar.MONTH, 1 };
|
||||
return new int[] {Calendar.MONTH, 1 };
|
||||
} else if ("TF_yr".equals(uomId)) {
|
||||
return new int[] { Calendar.YEAR, 1 };
|
||||
return new int[] {Calendar.YEAR, 1 };
|
||||
} else if ("TF_decade".equals(uomId)) {
|
||||
return new int[] { Calendar.YEAR, 10 };
|
||||
return new int[] {Calendar.YEAR, 10 };
|
||||
} else if ("TF_score".equals(uomId)) {
|
||||
return new int[] { Calendar.YEAR, 20 };
|
||||
return new int[] {Calendar.YEAR, 20 };
|
||||
} else if ("TF_century".equals(uomId)) {
|
||||
return new int[] { Calendar.YEAR, 100 };
|
||||
return new int[] {Calendar.YEAR, 100 };
|
||||
} else if ("TF_millenium".equals(uomId)) {
|
||||
return new int[] { Calendar.YEAR, 1000 };
|
||||
return new int[] {Calendar.YEAR, 1000 };
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user