Skip to content

Commit

Permalink
fix: replace public attributes with getters/setters in vObject
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Nov 28, 2023
1 parent 7d3eb8d commit a123975
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@

public final class ConstantVObject {

public Map<String, ColumnRendering> columnRender;
private Map<String, ColumnRendering> columnRender;

public static class ColumnRendering {
public Boolean visible;
public String label;
public String size;
public String type;
public ArcPreparedStatementBuilder query;
public Boolean isUpdatable;
public Boolean isRequired;
private Boolean visible;
private String label;
private String size;
private String type;
private ArcPreparedStatementBuilder query;
private Boolean isUpdatable;
private Boolean isRequired;

/**
*
Expand All @@ -34,12 +34,12 @@ public static class ColumnRendering {
* est-ce que je peux modifier la colonne ?
*/
public ColumnRendering(Boolean visible, String label, String size, String type, ArcPreparedStatementBuilder query, Boolean isUpdatable) {
this.visible = visible;
this.label = label;
this.size = size;
this.type = type;
this.query = query;
this.isUpdatable = isUpdatable;
this.setVisible(visible);
this.setLabel(label);
this.setSize(size);
this.setType(type);
this.setQuery(query);
this.setIsUpdatable(isUpdatable);
}

/**
Expand All @@ -61,8 +61,64 @@ public ColumnRendering(Boolean visible, String label, String size, String type,
*/
public ColumnRendering(Boolean visible, String label, String size, String type, ArcPreparedStatementBuilder query, Boolean isUpdatable, Boolean isRequired) {
this(visible, label, size, type, query, isUpdatable);
this.isRequired = isRequired;
this.setIsRequired(isRequired);
}

public Boolean getVisible() {
return visible;
}

public void setVisible(Boolean visible) {
this.visible = visible;
}

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

public String getSize() {
return size;
}

public void setSize(String size) {
this.size = size;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public Boolean getIsUpdatable() {
return isUpdatable;
}

public void setIsUpdatable(Boolean isUpdatable) {
this.isUpdatable = isUpdatable;
}

public Boolean getIsRequired() {
return isRequired;
}

public void setIsRequired(Boolean isRequired) {
this.isRequired = isRequired;
}

public ArcPreparedStatementBuilder getQuery() {
return query;
}

public void setQuery(ArcPreparedStatementBuilder query) {
this.query = query;
}


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ private List<String> buildHeadersVLabel(VObject data, List<String> headers) {
if (data.getConstantVObject()//
.getColumnRender()//
.get(headers.get(i)) != null) {
headersVLabel.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).label);
headersVLabel.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).getLabel());
} else {
headersVLabel.add(ManipString.translateAscii(headers.get(i)));
}
Expand All @@ -421,7 +421,7 @@ private List<String> buildHeadersVSize(VObject data, List<String> headers) {
List<String> headersVSize = new ArrayList<>();
for (int i = 0; i < headers.size(); i++) {
if (data.getConstantVObject().getColumnRender().get(headers.get(i)) != null) {
headersVSize.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).size);
headersVSize.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).getSize());
} else {
headersVSize.add("auto");
}
Expand All @@ -437,7 +437,7 @@ private List<String> buildHeadersVType(VObject data, List<String> headers) {
List<String> headersVType = new ArrayList<>();
for (int i = 0; i < headers.size(); i++) {
if (data.getConstantVObject().getColumnRender().get(headers.get(i)) != null) {
headersVType.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).type);
headersVType.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).getType());
} else {
headersVType.add("text");
}
Expand All @@ -454,7 +454,7 @@ private List<Boolean> buildHeadersVisible(VObject data, List<String> headers) {
List<Boolean> headersVisible = new ArrayList<>();
for (int i = 0; i < headers.size(); i++) {
if (data.getConstantVObject().getColumnRender().get(headers.get(i)) != null) {
headersVisible.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).visible);
headersVisible.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).getVisible());
} else {
headersVisible.add(true);
}
Expand All @@ -471,7 +471,7 @@ private List<Boolean> buildHeadersUpdatable(VObject data, List<String> headers)
List<Boolean> headersUpdatable = new ArrayList<>();
for (int i = 0; i < headers.size(); i++) {
if (data.getConstantVObject().getColumnRender().get(headers.get(i)) != null) {
headersUpdatable.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).isUpdatable);
headersUpdatable.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).getIsUpdatable());
} else {
headersUpdatable.add(true);
}
Expand All @@ -488,7 +488,7 @@ private List<Boolean> buildHeadersRequired(VObject data, List<String> headers) {
List<Boolean> headersRequired = new ArrayList<>();
for (int i = 0; i < headers.size(); i++) {
if (data.getConstantVObject().getColumnRender().get(headers.get(i)) != null) {
headersRequired.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).isRequired);
headersRequired.add(data.getConstantVObject().getColumnRender().get(headers.get(i)).getIsRequired());
} else {
headersRequired.add(true);
}
Expand All @@ -502,10 +502,10 @@ private List<Map<String, String>> buildHeadersVSelect(VObject data, List<String>

for (int i = 0; i < headers.size(); i++) {
if (data.getConstantVObject().getColumnRender().get(headers.get(i)) != null
&& data.getConstantVObject().getColumnRender().get(headers.get(i)).query != null) {
&& data.getConstantVObject().getColumnRender().get(headers.get(i)).getQuery() != null) {
try {
arrayVSelect = UtilitaireDao.get(this.connectionIndex).executeRequest(this.connection,
data.getConstantVObject().getColumnRender().get(headers.get(i)).query);
data.getConstantVObject().getColumnRender().get(headers.get(i)).getQuery());
arrayVSelect.remove(0);
arrayVSelect.remove(0);
Map<String, String> m = new LinkedHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public void exportFile(Map<String, List<String>> h, int n, BufferedWriter bw, Fi
String colName;
while (res.next()) {
// reinitialiser l'arraylist de sortie
output = new ArrayList<String>();
output = new ArrayList<>();
for (int k = 0; k < maxPos; k++) {
output.add("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void initializePilotageBAS(VObject viewPilotageBAS) {
dao.initializePilotageBAS(viewPilotageBAS);

List<String> columns = viewPilotageBAS.getHeadersDLabel();
Map<String, ColumnRendering> columnRendering = viewPilotageBAS.getConstantVObject().columnRender;
Map<String, ColumnRendering> columnRendering = viewPilotageBAS.getConstantVObject().getColumnRender();

// for all columns, set rendering visibility to false
for (int i = 1; i < columns.size(); i++) {
Expand All @@ -112,7 +112,7 @@ public void initializePilotageBAS(VObject viewPilotageBAS) {
for (LineObject l : viewPilotageBAS.getContent()) {
for (int i = 1; i < columns.size(); i++) {
if (!l.getD().get(i).equals("0")) {
columnRendering.get(columns.get(i)).visible = true;
columnRendering.get(columns.get(i)).setVisible(true);
}
}
}
Expand Down

0 comments on commit a123975

Please sign in to comment.