private Object parseEntityReference(Node node, CommitRequest commitRequest) throws InstantiationException, IllegalAccessException, InvocationTargetException, IntrospectionException { Node childNode = node.getFirstChild(); if (ELEMENT_NULL_REF.equals(childNode.getNodeName())) { return null; } InstanceRef ref = commitRequest.parseInstanceRefAndRegister(getIdAttribute(childNode)); return ref.getInstance(); }
protected List<Entity> parseIntoList(CommitRequest commitRequest, JSONArray nodeList) throws JSONException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IntrospectionException, ParseException { List<Entity> result = new ArrayList<>(nodeList.length()); for (int j = 0; j < nodeList.length(); j++) { JSONObject jsonObject = nodeList.getJSONObject(j); InstanceRef ref = commitRequest.parseInstanceRefAndRegister(jsonObject.getString("id")); MetaClass metaClass = ref.getMetaClass(); Entity instance = ref.getInstance(); asJavaTree(commitRequest, instance, metaClass, jsonObject); result.add(instance); } return result; }
private List parseNodeList(CommitRequest commitRequest, NodeList entitiesNodeList) throws InstantiationException, IllegalAccessException, InvocationTargetException, IntrospectionException, ParseException { List entities = new ArrayList(entitiesNodeList.getLength()); for (int j = 0; j < entitiesNodeList.getLength(); j++) { Node entityNode = entitiesNodeList.item(j); if (ELEMENT_INSTANCE.equals(entityNode.getNodeName())) { InstanceRef ref = commitRequest.parseInstanceRefAndRegister(getIdAttribute(entityNode)); MetaClass metaClass = ref.getMetaClass(); Object instance = ref.getInstance(); parseEntity(commitRequest, instance, metaClass, entityNode); entities.add(instance); } } return entities; }
Element commitInstanceEl = (Element) el; String id = commitInstanceEl.attributeValue("id"); InstanceRef ref = commitRequest.parseInstanceRefAndRegister(id); Entity instance = ref.getInstance(); parseEntity(commitInstanceEl, instance, commitRequest); Element removeInstance = (Element) el; String id = removeInstance.attributeValue("id"); InstanceRef ref = commitRequest.parseInstanceRefAndRegister(id); Entity instance = ref.getInstance(); removeInstances.add(instance);
InstanceRef ref = commitRequest.parseInstanceRefAndRegister(id); childMetaClass = ref.getMetaClass(); child = ref.getInstance(); InstanceRef ref = commitRequest.parseInstanceRefAndRegister(jsonChild.getString("id")); Entity child = ref.getInstance(); coll.add(child);