Search in sources :

Example 1 with Primitive

use of ca.uhn.hl7v2.model.Primitive in project tdi-studio-se by Talend.

the class TypeModel method getPrimitive.

public Primitive getPrimitive(Type type, int component, int subcomponent) {
    Type comp = getComponent(type, component);
    Type sub = getComponent(comp, subcomponent);
    return getPrimitive(sub);
}
Also used : Type(ca.uhn.hl7v2.model.Type)

Example 2 with Primitive

use of ca.uhn.hl7v2.model.Primitive in project tdi-studio-se by Talend.

the class TypeModel method generatePrimitive.

private void generatePrimitive() {
    if (type != null) {
        List<PrimitiveModel> pms = new ArrayList<PrimitiveModel>();
        int numComp = Terser.numComponents(this.type);
        for (int k = 1; k <= numComp; k++) {
            int numSubComp = Terser.numSubComponents(this.type, k);
            for (int m = 1; m <= numSubComp; m++) {
                Primitive p = getPrimitive(this.type, k, m);
                PrimitiveModel pm = new PrimitiveModel(this, p, k, m);
                pms.add(pm);
            }
        }
        primitives = pms.toArray(new PrimitiveModel[0]);
    } else {
        PrimitiveModel pm = new PrimitiveModel(this, null, 1, 1);
        primitives = new PrimitiveModel[] { pm };
    }
}
Also used : Primitive(ca.uhn.hl7v2.model.Primitive) GenericPrimitive(ca.uhn.hl7v2.model.GenericPrimitive) ArrayList(java.util.ArrayList)

Example 3 with Primitive

use of ca.uhn.hl7v2.model.Primitive in project tdi-studio-se by Talend.

the class PrimitiveModel method generateDisplayName.

@Override
protected void generateDisplayName() {
    //$NON-NLS-1$
    String parentName = "";
    if (parent instanceof TypeModel) {
        TypeModel tm = (TypeModel) parent;
        Type type = tm.getType();
        String parentDisplayName = tm.getDisplayName();
        parentName = parentDisplayName;
        if (type != null) {
            String extensionName = type.getName();
            // int extensionIndex = parentDisplayName.indexOf(extensionName);
            // changed for bug TDI-19467
            int extensionIndex = parentDisplayName.lastIndexOf(extensionName);
            parentName = parentDisplayName.substring(0, extensionIndex - 1);
        }
    }
    String typeDispaly = primitive == null ? "" : TalendTextUtils.LBRACKET + this.primitive.getName() + TalendTextUtils.RBRACKET;
    //$NON-NLS-1$ //$NON-NLS-2$
    this.displayName = parentName + "-" + this.componentindex + "-" + this.subcomponentindex + typeDispaly;
}
Also used : Type(ca.uhn.hl7v2.model.Type)

Aggregations

Type (ca.uhn.hl7v2.model.Type)2 GenericPrimitive (ca.uhn.hl7v2.model.GenericPrimitive)1 Primitive (ca.uhn.hl7v2.model.Primitive)1 ArrayList (java.util.ArrayList)1