/** 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; }
public void add1HasArcs(Arc newHasArcs) { hasArcs.add(newHasArcs); }
public boolean remove1HasArcs(Arc newHasArcs) { return hasArcs.remove(newHasArcs); }
/** note that this method does not check for duplicates, which may cause a DB error */ public void addAllHasArcs(Collection<Arc> newHasArcs) { hasArcs.addAll(newHasArcs); }