details: https://code.openbravo.com/erp/devel/pi/rev/7a23607a0b6c
changeset: 33414:7a23607a0b6c
user: Asier Lostalé <asier.lostale <at> openbravo.com>
date: Fri Feb 09 09:15:50 2018 +0100
summary: related to bug 37857: minor optimizations
* FIC uses multiple ids only for attachemnts, we can initialize it only in
that case
* In convertJSONArray use more generic variable name
* In convertJSONArray we know which will be the array size, so it can be
initialized
using it
diffstat:
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
| 16 +++------
1 files changed, 6 insertions(+), 10 deletions(-)
diffs (53 lines):
diff -r 81994596bc51 -r 7a23607a0b6c
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Thu Feb 08 18:10:27 2018 +0100
+++
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
Fri Feb 09 09:15:50 2018 +0100
@@ -134,8 +134,6 @@
tabId = readParameter(parameters, "TAB_ID");
// The ID of the record. Only relevant on EDIT, CHANGE and SETSESSION
modes
rowId = readParameter(parameters, "ROW_ID");
- // The IDs of the selected records in case more than one
- List<String> multipleRowIds = null;
// The column changed by the user. Only relevant on CHANGE mode
String changedColumn = readParameter(parameters, "CHANGED_COLUMN");
Tab tab = getTab(tabId);
@@ -185,9 +183,6 @@
if (jsContent.has("_gridVisibleProperties")) {
gridVisibleProperties =
convertJSONArray(jsContent.getJSONArray("_gridVisibleProperties"));
}
- if (jsContent.has("MULTIPLE_ROW_IDS")) {
- multipleRowIds =
convertJSONArray(jsContent.getJSONArray("MULTIPLE_ROW_IDS"));
- }
List<String> overwrittenAuxiliaryInputs = new ArrayList<String>();
// The provided overwrittenAuxiliaryInputs only have to be persisted
when calling the FIC in
@@ -299,8 +294,9 @@
long t7 = System.currentTimeMillis();
List<JSONObject> attachments = new ArrayList<JSONObject>();
int attachmentCount = 0;
- if (multipleRowIds != null) {
- attachmentCount = computeAttachmentCount(tab, multipleRowIds, true);
+ if (jsContent.has("MULTIPLE_ROW_IDS")) {
+ attachmentCount = computeAttachmentCount(tab,
+ convertJSONArray(jsContent.getJSONArray("MULTIPLE_ROW_IDS")),
true);
} else {
attachmentCount = computeAttachmentCount(tab, Arrays.asList(rowId),
false);
}
@@ -428,15 +424,15 @@
}
private List<String> convertJSONArray(JSONArray jsonArray) {
- List<String> visibleProperties = new ArrayList<String>();
+ List<String> elements = new ArrayList<String>(jsonArray.length());
for (int i = 0; i < jsonArray.length(); i++) {
try {
- visibleProperties.add(jsonArray.getString(i));
+ elements.add(jsonArray.getString(i));
} catch (JSONException e) {
throw new OBException("Error while reading the visible properties JSON
array");
}
}
- return visibleProperties;
+ return elements;
}
private JSONObject buildJSONObject(String mode, Tab tab, Map<String,
JSONObject> columnValues,
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits