@@ -100,8 +100,9 @@ public ConceptSetExpression getConceptSetExpression(@PathParam("id") final int i
100
100
101
101
// create our expression to return
102
102
ConceptSetExpression expression = new ConceptSetExpression ();
103
- expression .items = new ConceptSetExpression .ConceptSetItem [map .size ()];
104
-
103
+ // expression.items = new ConceptSetExpression.ConceptSetItem[map.size()];
104
+ ArrayList <ConceptSetExpression .ConceptSetItem > expressionItems = new ArrayList <>();
105
+
105
106
// lookup the concepts we need information for
106
107
long [] identifiers = new long [map .size ()];
107
108
int identifierIndex = 0 ;
@@ -115,18 +116,17 @@ public ConceptSetExpression getConceptSetExpression(@PathParam("id") final int i
115
116
Collection <Concept > concepts = vocabService .executeIdentifierLookup (vocabSourceInfo .sourceKey , identifiers );
116
117
117
118
// put the concept information into the expression along with the concept set item information
118
- int conceptIndex = 0 ;
119
119
for (Concept concept : concepts ) {
120
- expression .items [conceptIndex ] = new ConceptSetExpression .ConceptSetItem ();
121
- expression .items [conceptIndex ].concept = concept ;
122
-
123
- ConceptSetItem csi = map .get (concept .conceptId );
124
- expression .items [conceptIndex ].includeDescendants = (csi .getIncludeDescendants () == 1 );
125
- expression .items [conceptIndex ].includeMapped = (csi .getIncludeMapped () == 1 );
126
- expression .items [conceptIndex ].isExcluded = (csi .getIsExcluded () == 1 );
127
- conceptIndex ++;
120
+ ConceptSetExpression .ConceptSetItem currentItem = new ConceptSetExpression .ConceptSetItem ();
121
+ currentItem .concept = concept ;
122
+ ConceptSetItem csi = map .get (concept .conceptId );
123
+ currentItem .includeDescendants = (csi .getIncludeDescendants () == 1 );
124
+ currentItem .includeMapped = (csi .getIncludeMapped () == 1 );
125
+ currentItem .isExcluded = (csi .getIsExcluded () == 1 );
126
+ expressionItems .add (currentItem );
128
127
}
129
-
128
+ expression .items = expressionItems .toArray (new ConceptSetExpression .ConceptSetItem [0 ]);
129
+
130
130
return expression ;
131
131
}
132
132
0 commit comments