Search in sources :

Example 1 with GroupRefType

use of io.fixprotocol._2020.orchestra.repository.GroupRefType in project fix-orchestra by FIXTradingCommunity.

the class DocGenerator method generateMembers.

private void generateMembers(final List<Object> members, final STWriter writer) {
    for (final Object member : members) {
        if (member instanceof FieldRefType) {
            final FieldType field = getField(((FieldRefType) member).getId().intValue());
            final ST stField = stGroup.getInstanceOf("fieldMember");
            stField.add("field", field);
            if (((FieldRefType) member).getSupported() == SupportType.SUPPORTED) {
                stField.add("presence", getFieldPresence((FieldRefType) member));
            } else {
                stField.add("presence", supportedMap.get(((FieldRefType) member).getSupported()));
            }
            stField.add("assign", ((FieldRefType) member).getAssign());
            stField.write(writer, templateErrorListener);
        } else if (member instanceof GroupRefType) {
            final GroupType component = getGroup(((GroupRefType) member).getId().intValue());
            final ST stComponent = stGroup.getInstanceOf("componentMember");
            stComponent.add("component", component);
            if (((ComponentRefType) member).getSupported() == SupportType.SUPPORTED) {
                stComponent.add("presence", ((ComponentRefType) member).getPresence().value().toLowerCase());
            } else {
                stComponent.add("presence", supportedMap.get(((ComponentRefType) member).getSupported()));
            }
            stComponent.write(writer, templateErrorListener);
        } else if (member instanceof ComponentRefType) {
            final ComponentType component = getComponent(((ComponentRefType) member).getId().intValue());
            final ST stComponent = stGroup.getInstanceOf("componentMember");
            stComponent.add("component", component);
            if (((ComponentRefType) member).getSupported() == SupportType.SUPPORTED) {
                stComponent.add("presence", ((ComponentRefType) member).getPresence().value().toLowerCase());
            } else {
                stComponent.add("presence", supportedMap.get(((ComponentRefType) member).getSupported()));
            }
            stComponent.write(writer, templateErrorListener);
        }
    }
}
Also used : ST(org.stringtemplate.v4.ST) GroupRefType(io.fixprotocol._2020.orchestra.repository.GroupRefType) ComponentType(io.fixprotocol._2020.orchestra.repository.ComponentType) GroupType(io.fixprotocol._2020.orchestra.repository.GroupType) ComponentRefType(io.fixprotocol._2020.orchestra.repository.ComponentRefType) FieldRefType(io.fixprotocol._2020.orchestra.repository.FieldRefType) FieldType(io.fixprotocol._2020.orchestra.repository.FieldType)

Example 2 with GroupRefType

use of io.fixprotocol._2020.orchestra.repository.GroupRefType in project fix-orchestra by FIXTradingCommunity.

the class RepositoryCompressor method walk.

private void walk(List<Object> list) {
    for (final Object obj : list) {
        if (obj instanceof GroupRefType) {
            final GroupRefType groupRef = (GroupRefType) obj;
            final GroupType group = getGroup(groupRef.getId());
            if (group == null) {
                logger.error("Group missing for groupRef; ID={}", groupRef.getId().intValue());
                return;
            }
            fieldIdList.add(group.getNumInGroup().getId());
            groupIdList.add(groupRef.getId());
            // recursion on referenced component
            walk(getGroupMembers(groupRef.getId()));
        } else if (obj instanceof ComponentRefType) {
            final ComponentRefType componentRef = (ComponentRefType) obj;
            componentIdList.add(componentRef.getId());
            // recursion on referenced component
            walk(getComponentMembers(componentRef.getId()));
        } else if (obj instanceof FieldRefType) {
            final FieldRefType fieldRef = (FieldRefType) obj;
            fieldIdList.add(fieldRef.getId());
        }
    }
}
Also used : GroupRefType(io.fixprotocol._2020.orchestra.repository.GroupRefType) GroupType(io.fixprotocol._2020.orchestra.repository.GroupType) ComponentRefType(io.fixprotocol._2020.orchestra.repository.ComponentRefType) FieldRefType(io.fixprotocol._2020.orchestra.repository.FieldRefType)

Aggregations

ComponentRefType (io.fixprotocol._2020.orchestra.repository.ComponentRefType)2 FieldRefType (io.fixprotocol._2020.orchestra.repository.FieldRefType)2 GroupRefType (io.fixprotocol._2020.orchestra.repository.GroupRefType)2 GroupType (io.fixprotocol._2020.orchestra.repository.GroupType)2 ComponentType (io.fixprotocol._2020.orchestra.repository.ComponentType)1 FieldType (io.fixprotocol._2020.orchestra.repository.FieldType)1 ST (org.stringtemplate.v4.ST)1