Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ private void generateGroupDetail(final Path messagesDocPath, final GroupType gro
final ST stGroupStart;
stGroupStart = stGroup.getInstanceOf("groupStart");
stGroupStart.add("groupType", group);
final FieldType field = getField(group.getNumInGroup().getId().intValue());
final FieldType field = getField(group.getNumInGroup().getId());
stGroupStart.add("fieldType", field);

final ST stComponentEnd = stGroup.getInstanceOf("componentEnd");
Expand All @@ -597,7 +597,7 @@ private void generateMain(final Path baseOutputPath, final String title) throws
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 FieldType field = getField(((FieldRefType) member).getId());
final ST stField = stGroup.getInstanceOf("fieldMember");
stField.add("field", field);
if (((FieldRefType) member).getSupported() == SupportType.SUPPORTED) {
Expand All @@ -608,7 +608,7 @@ private void generateMembers(final List<Object> members, final STWriter writer)
stField.add("assign", ((FieldRefType) member).getAssign());
stField.write(writer, templateErrorListener);
} else if (member instanceof GroupRefType) {
final GroupType component = getGroup(((GroupRefType) member).getId().intValue());
final GroupType component = getGroup(((GroupRefType) member).getId());
final ST stComponent = stGroup.getInstanceOf("componentMember");
stComponent.add("component", component);
if (((ComponentRefType) member).getSupported() == SupportType.SUPPORTED) {
Expand All @@ -619,7 +619,7 @@ private void generateMembers(final List<Object> members, final STWriter writer)
}
stComponent.write(writer, templateErrorListener);
} else if (member instanceof ComponentRefType) {
final ComponentType component = getComponent(((ComponentRefType) member).getId().intValue());
final ComponentType component = getComponent(((ComponentRefType) member).getId());
final ST stComponent = stGroup.getInstanceOf("componentMember");
stComponent.add("component", component);
if (((ComponentRefType) member).getSupported() == SupportType.SUPPORTED) {
Expand Down Expand Up @@ -725,7 +725,7 @@ private void generateResponses(final List<ResponseType> responseList, final STWr
private ComponentType getComponent(final int componentId) {
final List<ComponentType> components = repository.getComponents().getComponent();
for (final ComponentType component : components) {
if (component.getId().intValue() == componentId) {
if (component.getId() == componentId) {
return component;
}
}
Expand All @@ -735,7 +735,7 @@ private ComponentType getComponent(final int componentId) {
private FieldType getField(final int id) {
final List<FieldType> fields = repository.getFields().getField();
for (final FieldType fieldType : fields) {
if (fieldType.getId().intValue() == id) {
if (fieldType.getId() == id) {
return fieldType;
}
}
Expand Down Expand Up @@ -780,7 +780,7 @@ private FlowType getFlow(final String name) {
private GroupType getGroup(final int componentId) {
final List<GroupType> groups = repository.getGroups().getGroup();
for (final GroupType group : groups) {
if (group.getId().intValue() == componentId) {
if (group.getId() == componentId) {
return group;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -337,10 +336,10 @@ static Predicate<? super MessageType> hasFlow() {
return m -> m.getFlow() != null;
}

private final List<BigInteger> componentIdList = new ArrayList<>();
private final List<Integer> componentIdList = new ArrayList<>();
private List<ComponentType> componentList = new ArrayList<>();
private final List<BigInteger> fieldIdList = new ArrayList<>();
private final List<BigInteger> groupIdList = new ArrayList<>();
private final List<Integer> fieldIdList = new ArrayList<>();
private final List<Integer> groupIdList = new ArrayList<>();
private List<GroupType> groupList;
private final String inputFile;
private final Predicate<MessageType> messagePredicate;
Expand Down Expand Up @@ -424,7 +423,7 @@ private boolean compress(InputStream is, OutputStream os,
messageList.stream().filter(messagePredicate).collect(Collectors.toList());
filteredMessages.forEach(m -> walk(m.getStructure().getComponentRefOrGroupRefOrFieldRef()));

final List<BigInteger> distinctFieldIds =
final List<Integer> distinctFieldIds =
fieldIdList.stream().distinct().collect(Collectors.toList());
final Fields inFields = (Fields) inRepository.getFields().clone();
final List<FieldType> fieldsWithFlow = inFields.getField().stream()
Expand All @@ -442,15 +441,15 @@ private boolean compress(InputStream is, OutputStream os,
outCodeSets.getCodeSet().addAll(codeSetsWithFlow);
outRepository.setCodeSets(outCodeSets);

final List<BigInteger> distinctComponentsIds =
final List<Integer> distinctComponentsIds =
componentIdList.stream().distinct().collect(Collectors.toList());
final List<ComponentType> componentsWithFlow = componentList.stream()
.filter(c -> distinctComponentsIds.contains(c.getId())).collect(Collectors.toList());
final Components outComponents = new Components();
outComponents.getComponent().addAll(componentsWithFlow);
outRepository.setComponents(outComponents);

final List<BigInteger> distinctGroupIds =
final List<Integer> distinctGroupIds =
groupIdList.stream().distinct().collect(Collectors.toList());
final List<GroupType> groupWithFlow = groupList.stream()
.filter(c -> distinctGroupIds.contains(c.getId())).collect(Collectors.toList());
Expand All @@ -470,16 +469,16 @@ private boolean compress(InputStream is, OutputStream os,
}
}

private ComponentType getComponent(BigInteger id) {
private ComponentType getComponent(int id) {
for (final ComponentType component : componentList) {
if (component.getId().equals(id)) {
if (component.getId() == id) {
return component;
}
}
return null;
}

private List<Object> getComponentMembers(BigInteger id) {
private List<Object> getComponentMembers(int id) {
final ComponentType component = getComponent(id);
if (component != null) {
return component.getComponentRefOrGroupRefOrFieldRef();
Expand All @@ -488,16 +487,16 @@ private List<Object> getComponentMembers(BigInteger id) {
}
}

private GroupType getGroup(BigInteger id) {
private GroupType getGroup(int id) {
for (final GroupType group : groupList) {
if (group.getId().equals(id)) {
if (group.getId() == id) {
return group;
}
}
return null;
}

private List<Object> getGroupMembers(BigInteger id) {
private List<Object> getGroupMembers(int id) {
final GroupType component = getGroup(id);
if (component != null) {
return component.getComponentRefOrGroupRefOrFieldRef();
Expand Down Expand Up @@ -525,7 +524,7 @@ private void walk(List<Object> list) {
final GroupRefType groupRef = (GroupRefType) obj;
final GroupType group = getGroup(groupRef.getId());
if (group == null) {
logger.error("Group missing for groupRef; ID={}", groupRef.getId().intValue());
logger.error("Group missing for groupRef; ID={}", groupRef.getId());
return;
}
fieldIdList.add(group.getNumInGroup().getId());
Expand Down
5 changes: 4 additions & 1 deletion repository/src/main/resources/xsd/repositorytypes.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,11 @@
</xs:annotation>
</xs:attribute>
</xs:complexType>
<!-- Define numeric identifiers to be limited to signed 4-byte integers -->
<xs:simpleType name="id_t">
<xs:restriction base="xs:positiveInteger"/>
<xs:restriction base="xs:positiveInteger">
<xs:maxInclusive value="2147483647"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="identifiersType">
<xs:sequence>
Expand Down