use of org.cerberus.crud.entity.Invariant in project cerberus-source by cerberustesting.
the class InvariantService method readToHashMapGp1StringByIdname.
@Override
public HashMap<String, String> readToHashMapGp1StringByIdname(String idName, String defaultValue) {
HashMap<String, String> result = new HashMap<String, String>();
// TODO: handle if the response does not turn ok
AnswerList answer = readByIdname(idName);
for (Invariant inv : (List<Invariant>) answer.getDataList()) {
String gp1 = ParameterParserUtil.parseStringParam(inv.getGp1(), defaultValue);
result.put(inv.getValue(), gp1);
}
return result;
}
use of org.cerberus.crud.entity.Invariant in project cerberus-source by cerberustesting.
the class InvariantService method getPublicPrivateFilter.
@Override
public String getPublicPrivateFilter(String filter) {
String searchSQL = " 1=0 ";
AnswerList answer = this.readByIdname(filter);
List<Invariant> invPrivate = answer.getDataList();
List<String> idnameList = null;
idnameList = new ArrayList<String>();
for (Invariant toto : invPrivate) {
idnameList.add(toto.getValue());
}
searchSQL = SqlUtil.createWhereInClause("idname", idnameList, true);
return searchSQL;
}
use of org.cerberus.crud.entity.Invariant in project cerberus-source by cerberustesting.
the class Homepage method extractRow.
private JSONObject extractRow(String application, HashMap<String, HashMap<String, Integer>> totalMap, List<Invariant> myInvariants) throws JSONException {
JSONObject row = new JSONObject();
row.put("Application", application);
HashMap mapApplication = totalMap.get(application);
int totalPerApplication = 0;
for (Invariant i : myInvariants) {
Integer total = (Integer) mapApplication.get(i.getValue());
totalPerApplication += (total == null ? 0 : total);
}
row.put("Total", totalPerApplication);
for (Invariant i : myInvariants) {
Integer total = (Integer) mapApplication.get(i.getValue());
if (total == null) {
row.put(i.getValue(), 0);
} else {
row.put(i.getValue(), total);
}
}
return row;
}
Aggregations