@@ -88,7 +88,7 @@ public String getPreparedStatement_PublicationReps(String conditions, OrderBy or
8888 PublicationModelLinkTable pubModelTable = PublicationModelLinkTable .table ;
8989
9090 String concat_function_name = (dbSyntax ==DatabaseSyntax .ORACLE ) ? "listagg" : "string_agg" ;
91- String concat_second_arg = (dbSyntax ==DatabaseSyntax .ORACLE ) ? ", ', '" : ", ', '" ;
91+ String concat_second_arg = (dbSyntax ==DatabaseSyntax .ORACLE ) ? ", '@@ '" : ", '@@ '" ;
9292 String string_cast = (dbSyntax ==DatabaseSyntax .ORACLE ) ? "" : "::varchar(255)" ;
9393
9494 String subquery =
@@ -178,44 +178,54 @@ public PublicationRep getPublicationRep(ResultSet rset, DatabaseSyntax dbSyntax)
178178 java .util .Date pubdate = VersionTable .getDate (rset ,dbSyntax ,table .pubdate .toString ());
179179
180180 String bmRefsString = rset .getString ("bmRefs" );
181+ BioModelReferenceRep [] bmRefArray = parseBioModelRefs (bmRefsString );
182+
183+ String mmRefsString = rset .getString ("mmRefs" );
184+ MathModelReferenceRep [] mmRefArray = parseMathModelRefs (mmRefsString );
185+
186+
187+ return new PublicationRep (pubKey ,title ,authorsList .split (";" ),year ,citation ,pubmedid ,doi ,endnoteid ,url ,bmRefArray ,mmRefArray ,wittid ,pubdate );
188+ }
189+
190+ static final String RECORD_SEPARATOR = "@@" ;
191+
192+ static BioModelReferenceRep [] parseBioModelRefs (String bmRefsString ) {
181193 ArrayList <BioModelReferenceRep > bmRefList = new ArrayList <BioModelReferenceRep >();
182- if (bmRefsString != null && bmRefsString .length ()> 0 ) {
183- String [] bmRefStrings = bmRefsString .replace ("[" , "" ).replace ("]" , "" ).split ("," );
194+ if (bmRefsString != null && bmRefsString .length () > 0 ) {
195+ String [] bmRefStrings = bmRefsString .replace ("[" , "" ).replace ("]" , "" ).split (RECORD_SEPARATOR );
184196 for (String bmRefString : bmRefStrings ) {
185- String bmRefComponents [] = bmRefString .split (";" );
186- if (bmRefComponents .length >= 5 ){
197+ String [] bmRefComponents = bmRefString .split (";" );
198+ if (bmRefComponents .length >= 5 ) {
187199 KeyValue bmKey = new KeyValue (bmRefComponents [0 ]);
188200 String bmName = bmRefComponents [1 ];
189201 KeyValue ownerKey = new KeyValue (bmRefComponents [2 ]);
190202 String ownerUserid = bmRefComponents [3 ];
191203 Long versionFlag = Long .valueOf (bmRefComponents [4 ]);
192204 Integer privacy = bmRefComponents .length >= 6 ? Integer .valueOf (bmRefComponents [5 ]) : null ;
193- bmRefList .add (new BioModelReferenceRep (bmKey , bmName , new User (ownerUserid ,ownerKey ), versionFlag , privacy ));
205+ bmRefList .add (new BioModelReferenceRep (bmKey , bmName , new User (ownerUserid , ownerKey ), versionFlag , privacy ));
194206 }
195207 }
196208 }
197- BioModelReferenceRep [] bmRefArray = bmRefList .toArray (new BioModelReferenceRep [0 ]);
198-
199- String mmRefsString = rset .getString ("mmRefs" );
209+ return bmRefList .toArray (new BioModelReferenceRep [0 ]);
210+ }
211+
212+ static MathModelReferenceRep [] parseMathModelRefs (String mmRefsString ) {
200213 ArrayList <MathModelReferenceRep > mmRefList = new ArrayList <MathModelReferenceRep >();
201- if (mmRefsString != null && mmRefsString .length () > 0 ) {
202- String [] mmRefStrings = mmRefsString .replace ("[" , "" ).replace ("]" , "" ).split ("," );
214+ if (mmRefsString != null && mmRefsString .length () > 0 ) {
215+ String [] mmRefStrings = mmRefsString .replace ("[" , "" ).replace ("]" , "" ).split (RECORD_SEPARATOR );
203216 for (String mmRefString : mmRefStrings ) {
204- String mmRefComponents [] = mmRefString .split (";" );
205- if (mmRefComponents .length == 5 ) {
217+ String [] mmRefComponents = mmRefString .split (";" );
218+ if (mmRefComponents .length == 5 ) {
206219 KeyValue mmKey = new KeyValue (mmRefComponents [0 ]);
207220 String mmName = mmRefComponents [1 ];
208221 KeyValue ownerKey = new KeyValue (mmRefComponents [2 ]);
209222 String ownerUserid = mmRefComponents [3 ];
210223 Long versionFlag = Long .valueOf (mmRefComponents [4 ]);
211- mmRefList .add (new MathModelReferenceRep (mmKey , mmName , new User (ownerUserid ,ownerKey ),versionFlag ));
224+ mmRefList .add (new MathModelReferenceRep (mmKey , mmName , new User (ownerUserid , ownerKey ), versionFlag ));
212225 }
213226 }
214227 }
215- MathModelReferenceRep [] mmRefArray = mmRefList .toArray (new MathModelReferenceRep [0 ]);
216-
217-
218- return new PublicationRep (pubKey ,title ,authorsList .split (";" ),year ,citation ,pubmedid ,doi ,endnoteid ,url ,bmRefArray ,mmRefArray ,wittid ,pubdate );
228+ return mmRefList .toArray (new MathModelReferenceRep [0 ]);
219229}
220230
221231}
0 commit comments