/** * @param cpobj * @param archetype * @param errors */ private void validateCPrimitiveObject(CPrimitiveObject cpobj, Archetype archetype, List<ValidationError> errors) { // This finds VOBAV validation problems. CPrimitive item = cpobj.getItem(); if (item.hasAssumedValue()) { Object assumedValue = item.assumedValue(); log.debug("Assumed value for CPrimitiveObject: " + assumedValue); if (!item.validValue(assumedValue)) { ValidationError error = new ValidationError(ErrorType.VOBAV, null, assumedValue, cpobj.getRmTypeName(), cpobj.path()); errors.add(error); } else { log.debug("Found valid assumed value for CPrimitiveObject: " + cpobj.getRmTypeName() + " at " + cpobj.path()); } } else { log.debug("No assumed value found for CPrimitiveObject : " + cpobj.getRmTypeName() + " at " + cpobj.path()); } }
@Override public CObject copy() { return new CPrimitiveObject(path(), getOccurrences(), getNodeId(), getParent(), item); }
protected void printCPrimitiveObject(CPrimitiveObject cpo, Element out) { CPrimitive cp = cpo.getItem(); if (cp == null) { return; } Element children = new Element("children", defaultNamespace); out.getChildren().add(children); children.setAttribute("type", "C_PRIMITIVE_OBJECT", xsiNamespace); printCObjectElements(cpo, children); Element item = new Element("item", defaultNamespace); children.getChildren().add(item); printCPrimitive(cp, item); }
CPrimitiveObject cpo = CPrimitiveObject.createSingleRequired(path, cstring); valueAttr.addChild(cpo);
/** * Create a single required CPrimitiveObject with given primitive item * * @param path * @param item * @return */ public static CPrimitiveObject createSingleRequired(String path, CPrimitive item) { Interval<Integer> occurrences = new Interval<Integer>(1,1); return new CPrimitiveObject(path, occurrences, null, null, item); }
private static void loadProportionTypes( String templateId, String idElement, CObject childCObject, Collection<ProportionTypeVO> proportionTypeVOs) { if (childCObject instanceof CComplexObject) { CComplexObject complexConstrainedObject = (CComplexObject) childCObject; CAttribute constrainedAttribute = complexConstrainedObject.getAttribute("type"); if (constrainedAttribute != null) { for (CObject constrainedObj : constrainedAttribute.getChildren()) { if (constrainedObj instanceof CPrimitiveObject) { CPrimitive consPrimitive = ((CPrimitiveObject) constrainedObj).getItem(); if (consPrimitive instanceof CInteger) { CInteger consInteger = (CInteger) consPrimitive; for (Integer proportionType : consInteger.getList()) { proportionTypeVOs.add( ProportionTypeVO.builder() .idTemplate(templateId) .idElement(idElement) .type(proportionType) .build()); } } } } ; } } }
CPrimitiveObject cpo = CPrimitiveObject.createSingleRequired(path, cstring); valueAttr.addChild(cpo);
/** * Create a single required CPrimitiveObject with given primitive item * * @param path * @param item * @return */ public static CPrimitiveObject createSingleRequired(String path, CPrimitive item) { Interval<Integer> occurrences = new Interval<Integer>(1,1); return new CPrimitiveObject(path, occurrences, null, null, item); }
protected void printCPrimitiveObject(CPrimitiveObject cpo, Writer out) throws IOException { CPrimitive cp = cpo.getItem(); if (cp instanceof CBoolean) { printCBoolean((CBoolean) cp, out); } else if (cp instanceof CDate) { printCDate((CDate) cp, out); } else if (cp instanceof CDateTime) { printCDateTime((CDateTime) cp, out); } else if (cp instanceof CTime) { printCTime((CTime) cp, out); } else if (cp instanceof CDuration) { printCDuration((CDuration) cp, out); } else if (cp instanceof CInteger) { printCInteger((CInteger) cp, out); } else if (cp instanceof CReal) { printCReal((CReal) cp, out); } else if (cp instanceof CString) { printCString((CString) cp, out); } // unknow CPrimitive type }
@Override public CObject copy() { return new CPrimitiveObject(path(), getOccurrences(), getNodeId(), getParent(), item); }
CPrimitiveObject cpo = CPrimitiveObject.createSingleRequired(path, cstring); valueAttr.addChild(cpo);
final public CPrimitiveObject c_primitive_object(String path, CAttribute parent) throws ParseException { CPrimitive c; Interval<Integer> occurrences = new Interval<Integer>(1, 1); c = c_primitive(); {if (true) return new CPrimitiveObject(path, occurrences, null, parent, c);} throw new Error("Missing return statement in function"); }
protected void printCPrimitiveObject(CPrimitiveObject cpo, Writer out) throws IOException { CPrimitive cp = cpo.getItem(); if (cp instanceof CBoolean) { printCBoolean((CBoolean) cp, out); } else if (cp instanceof CDate) { printCDate((CDate) cp, out); } else if (cp instanceof CDateTime) { printCDateTime((CDateTime) cp, out); } else if (cp instanceof CTime) { printCTime((CTime) cp, out); } else if (cp instanceof CDuration) { printCDuration((CDuration) cp, out); } else if (cp instanceof CInteger) { printCInteger((CInteger) cp, out); } else if (cp instanceof CReal) { printCReal((CReal) cp, out); } else if (cp instanceof CString) { printCString((CString) cp, out); } // unknow CPrimitive type }
nameObj.addAttribute(valueAttr); CString cstring = constrainString(name); cpo = CPrimitiveObject.createSingleRequired(path, cstring); valueAttr.addChild(cpo);
final public CPrimitiveObject c_primitive_object(String path, CAttribute parent) throws ParseException { CPrimitive c; Interval<Integer> occurrences = new Interval<Integer>(1, 1); c = c_primitive(); {if (true) return new CPrimitiveObject(path, occurrences, null, parent, c);} throw new Error("Missing return statement in function"); }
private Object createPrimitiveTypeObject(CPrimitiveObject cpo, Archetype archetype) throws Exception { CPrimitive cp = cpo.getItem();
CAttribute valueAttr = CSingleAttribute.createRequired(path, VALUE); nameObj.addAttribute(valueAttr); cpo = CPrimitiveObject.createSingleRequired(path, cstring); valueAttr.addChild(cpo);
CAttribute valueAttr = CSingleAttribute.createRequired(path, VALUE); nameObj.addAttribute(valueAttr); cpo = CPrimitiveObject.createSingleRequired(path, cstring); valueAttr.addChild(cpo);