protected void printArchetypeInternalRef(ArchetypeInternalRef ref, int indent, Writer out) throws IOException { indent(indent, out); out.write("use_node "); out.write(ref.getRmTypeName()); printOccurrences(ref.getOccurrences(), out); out.write(" "); out.write(ref.getTargetPath()); newline(out); }
@Override public CObject copy() { return new ArchetypeInternalRef(path(), getRmTypeName(), getOccurrences(), getNodeId(), getParent(), targetPath); }
private Map<String, String> checkInternalReferences(Archetype archetype, CComplexObject ccobj, Map<String, String> errors) { for (CAttribute cattribute : ccobj.getAttributes()) { for (CObject cobj : cattribute.getChildren()) { if (cobj instanceof ArchetypeInternalRef) { ArchetypeInternalRef ref = (ArchetypeInternalRef) cobj; CObject target = (CObject) archetype.node(ref.getTargetPath()); if (target == null || !target.getRmTypeName().equals( cobj.getRmTypeName())) { // either target unknown or wrong type errors.put(ref.path(), ref.getTargetPath()); } } if (cobj instanceof CComplexObject) { checkInternalReferences(archetype, (CComplexObject) cobj, errors); } } } return errors; }
log.debug("validating internal_ref of rmType: " + ref.getRmTypeName() + " at " + ref.path() + " with target " + ref.getTargetPath()); Class rmType = rmInspector.retrieveRMType(ref.getRmTypeName()); ValidationError error = null; if (rmType == null) { ref.getRmTypeName(), ref.path()); errors.add(error); CObject target = (CObject) archetype.node(ref.getTargetPath()); if (target == null) { error = new ValidationError(ErrorType.VUNP, "INVALIDPATH", ref.getTargetPath(), ref.path()); errors.add(error); } else { if (targetType == null) { error = new ValidationError(ErrorType.VUNP, "UNKNOWNTARGETRM", "Unknown target rm type at path: " + ref.getTargetPath() + " of internalRef at: " + ref.path()); errors.add(error); } else if (!rmType.isAssignableFrom(targetType)) { error = new ValidationError(ErrorType.VUNP, "INVALIDTARGETRM", targetType, ref.path()); errors.add(error);
protected void printArchetypeInternalRef(ArchetypeInternalRef ref, Element out) { Element children = new Element("children", defaultNamespace); out.getChildren().add(children); children.setAttribute("type", "ARCHETYPE_INTERNAL_REF", xsiNamespace); printCObjectElements(ref, children); printString("target_path", ref.getTargetPath(), children); }
{if (true) return new ArchetypeInternalRef(path, type, occurrences, nodeID, parent, target);} throw new Error("Missing return statement in function");
private Map<String, String> checkInternalReferences(Archetype archetype, CComplexObject ccobj, Map<String, String> errors) { for (CAttribute cattribute : ccobj.getAttributes()) { for (CObject cobj : cattribute.getChildren()) { if (cobj instanceof ArchetypeInternalRef) { ArchetypeInternalRef ref = (ArchetypeInternalRef) cobj; ArchetypeConstraint target = archetype.node(ref.getTargetPath()); if (target == null || (! (target instanceof CObject)) || (!((CObject) target).getRmTypeName().equals( cobj.getRmTypeName()))) { // either target unknown or wrong type errors.put(ref.path(), ref.getTargetPath()); } } if (cobj instanceof CComplexObject) { checkInternalReferences(archetype, (CComplexObject) cobj, errors); } } } return errors; }
private Object createArchetypeInternalRefObject(ArchetypeInternalRef cobj, Archetype archetype, Map<String, Archetype> archetypeMap, Map<String, Object> extraValues, GenerationStrategy strategy) throws Exception{ CObject cobjRef = (CObject) archetype.node(cobj.getTargetPath()); return createObject(cobjRef, archetype,archetypeMap, extraValues, strategy) ; }
{if (true) return new ArchetypeInternalRef(path, type, occurrences, nodeID, parent, target);} throw new Error("Missing return statement in function");
private Map<String, String> checkInternalReferences(Archetype archetype, CComplexObject ccobj, Map<String, String> errors) { for (CAttribute cattribute : ccobj.getAttributes()) { for (CObject cobj : cattribute.getChildren()) { if (cobj instanceof ArchetypeInternalRef) { ArchetypeInternalRef ref = (ArchetypeInternalRef) cobj; ArchetypeConstraint target = archetype.node(ref.getTargetPath()); if (target == null || (! (target instanceof CObject)) || (!((CObject) target).getRmTypeName().equals( cobj.getRmTypeName()))) { // either target unknown or wrong type errors.put(ref.path(), ref.getTargetPath()); } } if (cobj instanceof CComplexObject) { checkInternalReferences(archetype, (CComplexObject) cobj, errors); } } } return errors; }
@Override public CObject copy() { return new ArchetypeInternalRef(path(), getRmTypeName(), getOccurrences(), getNodeId(), getParent(), targetPath); }
protected void printArchetypeInternalRef(ArchetypeInternalRef ref, int indent, Writer out) throws IOException { indent(indent, out); out.write("use_node "); out.write(ref.getRmTypeName()); printOccurrences(ref.getOccurrences(), out); out.write(" "); out.write(ref.getTargetPath()); newline(out); }
parentNode = (CObject)parentArchetype.node(((ArchetypeInternalRef) parentNode).getTargetPath());
ArchetypeInternalRef ref = (ArchetypeInternalRef) node; ArchetypeConstraint target = node(ref.getTargetPath()); if(target instanceof CObject) { if (!ref.path().endsWith("]" ) && ref.getTargetPath().endsWith("]")) { atpart+= ref.getTargetPath().substring(ref.getTargetPath().lastIndexOf("[")); loadInternalRefs((CObject)node(ref.getTargetPath()), required && node.isRequired(), ref.path()+atpart, ref.getTargetPath());
((ArchetypeInternalRef) cobj).getTargetPath().equals(((ArchetypeInternalRef) cobj2).getTargetPath())) { error = new ValidationError(ErrorType.VACMM, "INTREF", cobj.path());
ArchetypeInternalRef ref = (ArchetypeInternalRef) node; ArchetypeConstraint target = node(ref.getTargetPath()); if(target instanceof CObject) { if (!ref.path().endsWith("]" ) && ref.getTargetPath().endsWith("]")) { atpart+= ref.getTargetPath().substring(ref.getTargetPath().lastIndexOf("[")); loadInternalRefs((CObject)node(ref.getTargetPath()), required && node.isRequired(), ref.path()+atpart, ref.getTargetPath());