/** Returns a repetition of a child of the extending class, creating * it if necessary. * @param finiteList the finiteList containing the desired repetitions * @param rep the repetition number with a <b>0 based index</b> * @throws ConfRepException if repetition can not be accessed * @return repetition */ protected Repeatable getChild(FiniteList finiteList, int rep) throws ConfRepException { return finiteList.getRep(rep); }
/** Constructor for FiniteList * @param repType the Class which is repeating * @param underlyingObject the underlying object that the extending class represents */ public FiniteList(Class<? extends Repeatable> repType, Object underlyingObject) { this.repType = repType; this.underlyingObject = underlyingObject; Repeatable firstRep = createRep(0); this.maxReps = firstRep.getMaxReps(); // this.minReps = firstRep.getMinReps(); reps = new ArrayList<Repeatable>(); reps.add(firstRep); createNewReps(maxReps); }
/** Constructor for AbstractConformanceDataType * @param hapiPrimitive the underlying primitive that the extending class represents */ public AbstractConformanceDataType(Primitive hapiPrimitive) { this.hapiPrimitive = hapiPrimitive; try { if ( getConstantValue() != null ) setValue( getConstantValue() ); } catch ( ConfDataException e ) { log.error( "Could not enforce constant value.", e ); } }
/** Creates a new repetition * @param rep the number representing the number of repetitions */ private void createNewReps(int rep) { while (reps.size() <= rep) reps.add(createRep(reps.size())); }
/** * Returns the desired repetition * @param rep The desired repetition number. Note that in accordance with the HL7 standard * @return The desired repetition * @throws ConformanceException if repetition is not accessible */ public Repeatable getRep(int rep) throws ConfRepException { if (rep < 1 || (maxReps != -1 && maxReps < rep)) throw new ConfRepException(maxReps, rep); rep--; // Decremented because HL7 standard wants 1-offset arrays createNewReps(rep); // Create new reps if needed return reps.get(rep); }
/** This method validates the <code>String</code> value passed in to be no greater then the * maximum allowable length for the extending class. If the <code>String</code> value is valid, this * method will set the underlying HAPI class's value. If the data passed in is invalid for the given * data type, a ConfDataException is thrown. * @throws ConformaceException * @param value the value of the Data Type */ protected void setValue(java.lang.String value) throws ConfDataException { if ((this.getMaxLength() > 0) && (value.length() > this.getMaxLength())) { throw new ConfDataException("DataType length exceeds the Maximum allowable length"); } try { this.hapiPrimitive.setValue(value); } catch (DataTypeException e) { throw new ConfDataException("Invalid Data Populated"); } }
/** Constructor for FiniteList * @param repType the Class which is repeating * @param underlyingObject the underlying object that the extending class represents */ public FiniteList(Class<? extends Repeatable> repType, Object underlyingObject) { this.repType = repType; this.underlyingObject = underlyingObject; Repeatable firstRep = createRep(0); this.maxReps = firstRep.getMaxReps(); // this.minReps = firstRep.getMinReps(); reps = new ArrayList<Repeatable>(); reps.add(firstRep); createNewReps(maxReps); }
/** Constructor for AbstractConformanceDataType * @param hapiPrimitive the underlying primitive that the extending class represents */ public AbstractConformanceDataType(Primitive hapiPrimitive) { this.hapiPrimitive = hapiPrimitive; try { if ( getConstantValue() != null ) setValue( getConstantValue() ); } catch ( ConfDataException e ) { log.error( "Could not enforce constant value.", e ); } }
/** Returns a repetition of a child of the extending class, creating * it if necessary. * @param finiteList the finiteList containing the desired repetitions * @param rep the repetition number with a <b>0 based index</b> * @throws ConfRepException if repetition can not be accessed * @return repetition */ protected Repeatable getChild(FiniteList finiteList, int rep) throws ConfRepException { return finiteList.getRep(rep); }
/** Creates a new repetition * @param rep the number representing the number of repetitions */ private void createNewReps(int rep) { while (reps.size() <= rep) reps.add(createRep(reps.size())); }
/** * Returns the desired repetition * @param rep The desired repetition number. Note that in accordance with the HL7 standard * @return The desired repetition * @throws ConformanceException if repetition is not accessible */ public Repeatable getRep(int rep) throws ConfRepException { if (rep < 1 || (maxReps != -1 && maxReps < rep)) throw new ConfRepException(maxReps, rep); rep--; // Decremented because HL7 standard wants 1-offset arrays createNewReps(rep); // Create new reps if needed return reps.get(rep); }
/** This method validates the <code>String</code> value passed in to be no greater then the * maximum allowable length for the extending class. If the <code>String</code> value is valid, this * method will set the underlying HAPI class's value. If the data passed in is invalid for the given * data type, a ConfDataException is thrown. * @throws ConformaceException * @param value the value of the Data Type */ protected void setValue(java.lang.String value) throws ConfDataException { if ((this.getMaxLength() > 0) && (value.length() > this.getMaxLength())) { throw new ConfDataException("DataType length exceeds the Maximum allowable length"); } try { this.hapiPrimitive.setValue(value); } catch (DataTypeException e) { throw new ConfDataException("Invalid Data Populated"); } }