- DescriptiveScope descriptiveScope;
- GridData data;
- String userId = null;
- if (fromAPI) {
- descriptiveScope = (DescriptiveScope)mapper.readValue(root.get("dictionaryFields").toString(), DescriptiveScope.class);
- data = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
- userId = "API";
-
- //check if update operation or create, get id for data to be updated and update attributeData
- if (request.getParameter("operation").equals("update")) {
- List<Object> duplicateData = commonClassDao.checkDuplicateEntry(descriptiveScope.getScopeName(), "descriptiveScopeName", DescriptiveScope.class);
- int id = 0;
- DescriptiveScope dbdata = (DescriptiveScope) duplicateData.get(0);
- id = dbdata.getId();
- if(id==0){
- isFakeUpdate=true;
- descriptiveScope.setId(1);
- } else {
- descriptiveScope.setId(id);
- }
- descriptiveScope.setUserCreatedBy(this.getUserInfo(userId));
- }
- } else {
- descriptiveScope = (DescriptiveScope)mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), DescriptiveScope.class);
- data = (GridData)mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), GridData.class);
- userId = root.get("userid").textValue();
- }
- String header = "";
- int counter = 0;
- if(data.getAttributes().size() > 0){
- for(Object attribute : data.getAttributes()){
- if(attribute instanceof LinkedHashMap<?, ?>){
- String key = ((LinkedHashMap<?, ?>) attribute).get("option").toString();
- String value = ((LinkedHashMap<?, ?>) attribute).get("number").toString();
- if(counter>0){
- header = header + "AND";
- }
- header = header + key + ":";
- header = header + value;
- counter ++;
- }
- }
+ DescriptiveScope descriptiveScope;
+ GridData data;
+ String userId = null;
+ if(fromAPI){
+ descriptiveScope = mapper.readValue(root.get("dictionaryFields").toString(), DescriptiveScope.class);
+ data = mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
+ userId = "API";
+ }else{
+ descriptiveScope = mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), DescriptiveScope.class);
+ data = mapper.readValue(root.get("descriptiveScopeDictionaryData").toString(), GridData.class);
+ userId = root.get("userid").textValue();