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);
}
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 };
}
}
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;
}
Aggregations