/** * Constructs a PrimitiveObjectConstraint * * @param path * @param occurrences * @param nodeId * @param parent * @param item */ public CPrimitiveObject(String path, Interval<Integer> occurrences, String nodeId, CAttribute parent, CPrimitive item) { super(item == null, path, item == null ? null : item.getType(), occurrences, nodeId, parent, item == null ? null : item.assumedValue()); this.item = item; }
/** * Return true if the constraint has limit the possible value to * be only one, which means the value has been assigned by the archetype * author at design time * * @return true if has */ public boolean hasAssignedValue() { return item.hasAssignedValue(); }
if(cp.hasDefaultValue()) { return cp.defaultValue(); throw new Exception("unsupported primitive type: " + cp.getType());
/** * @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()); } }
cp = c_primitive(); jj_consume_token(SYM_END_CBLOCK); item2 = new ExpressionLeaf("C_"+cp.getType().toUpperCase(), cp, //SG 2013-01-31: Need to add "C_" because it is a C_* constraint pattern here, with the type usually being displayed in upper case ExpressionLeaf.ReferenceType.CONSTRAINT); break;
cp = c_primitive(); jj_consume_token(SYM_END_CBLOCK); item2 = new ExpressionLeaf("C_"+cp.getType().toUpperCase(), cp, //SG 2013-01-31: Need to add "C_" because it is a C_* constraint pattern here, with the type usually being displayed in upper case ExpressionLeaf.ReferenceType.CONSTRAINT); break;
/** * Constructs a PrimitiveObjectConstraint * * @param path * @param occurrences * @param nodeId * @param parent * @param item */ public CPrimitiveObject(String path, Interval<Integer> occurrences, String nodeId, CAttribute parent, CPrimitive item) { super(item == null, path, item == null ? null : item.getType(), occurrences, nodeId, parent, item == null ? null : item.assumedValue()); this.item = item; }
/** * Return true if the constraint has limit the possible value to * be only one, which means the value has been assigned by the archetype * author at design time * * @return true if has */ public boolean hasAssignedValue() { return item.hasAssignedValue(); }