示例#1
0
 /** method to update data in caching layer object from JSON * */
 public boolean updateFromJSON(JSONObject jsonObj) {
   try {
     JSONArray hasArcsArray = jsonObj.optJSONArray("hasArcs");
     if (hasArcsArray != null) {
       ArrayList<Arc> aListOfHasArcs = new ArrayList<Arc>(hasArcsArray.length());
       for (int i = 0; i < hasArcsArray.length(); i++) {
         int id = hasArcsArray.optInt(i);
         if (ArcManager.getInstance().get(id) != null) {
           aListOfHasArcs.add(ArcManager.getInstance().get(id));
         }
       }
       setHasArcs(aListOfHasArcs);
     }
     if (!jsonObj.isNull("hasPropertySet")) {
       int hasPropertySetId = jsonObj.optInt("hasPropertySet");
       PropertySet value = PropertySetManager.getInstance().get(hasPropertySetId);
       if (value != null) {
         setHasPropertySet(value);
       }
     }
     if (!jsonObj.isNull("hasDomainNodes")) {
       int hasDomainNodesId = jsonObj.optInt("hasDomainNodes");
       NodeList value = NodeListManager.getInstance().get(hasDomainNodesId);
       if (value != null) {
         setHasDomainNodes(value);
       }
     }
   } catch (Exception e) {
     logWriter.error("Failure updating from JSON", e);
     return false;
   }
   return true;
 }
示例#2
0
 public void add1HasArcs(Arc newHasArcs) {
   hasArcs.add(newHasArcs);
 }
示例#3
0
 public boolean remove1HasArcs(Arc newHasArcs) {
   return hasArcs.remove(newHasArcs);
 }
示例#4
0
 /** note that this method does not check for duplicates, which may cause a DB error */
 public void addAllHasArcs(Collection<Arc> newHasArcs) {
   hasArcs.addAll(newHasArcs);
 }