@@ -2538,41 +2538,42 @@ private void sendforACMID(ImportTask itask, Shepherd myShepherd) {
25382538
25392539 try {
25402540
2541- int count =0 ;
2542- int batchSize = 50 ;
2543- List <Encounter > allEncs = itask .getEncounters ();
2544- int numEncs = allEncs .size ();
2545-
2546- ArrayList <MediaAsset > assets = new ArrayList <MediaAsset >();
2547-
2548- for (Encounter enc : allEncs ){
2549- count ++;
2550-
2551- ArrayList <MediaAsset > theseAssets = enc .getMedia ();
2552- for (MediaAsset assy : theseAssets ) {
2553- if (!assy .hasAcmId ()) {
2554- assets .add (assy );
2541+ if (itask !=null && itask .getEncounters ()!=null ) {
2542+ int count =0 ;
2543+ int batchSize = 60 ;
2544+ List <Encounter > allEncs = itask .getEncounters ();
2545+ int numEncs = allEncs .size ();
2546+
2547+ ArrayList <MediaAsset > assets = new ArrayList <MediaAsset >();
2548+
2549+ for (Encounter enc : allEncs ){
2550+ count ++;
2551+
2552+ ArrayList <MediaAsset > theseAssets = enc .getMedia ();
2553+ for (MediaAsset assy : theseAssets ) {
2554+ if (!assy .hasAcmId ()) {
2555+ assets .add (assy );
2556+ }
2557+ }
2558+
2559+ if (((assets .size ()>=batchSize ) && assets .size ()>0 ) || count ==numEncs ) {
2560+ System .out .println ("About to send " +assets .size ()+" assets to IA! On " +count +"/" +numEncs );
2561+ itask .setStatus ("Registering image assets for " +count +"/" +numEncs +" encounters." );
2562+ myShepherd .updateDBTransaction ();
2563+ IBEISIA .sendMediaAssetsNew (assets , context );
2564+ assets = new ArrayList <MediaAsset >();
25552565 }
2566+
25562567 }
2557-
2558- if (((assets .size ()>=batchSize ) && assets .size ()>0 ) || count ==numEncs ) {
2559- System .out .println ("About to send " +assets .size ()+" assets to IA! On " +count +"/" +numEncs );
2568+
2569+ if (assets .size ()>0 ) {
25602570 itask .setStatus ("Registering image assets for " +count +"/" +numEncs +" encounters." );
25612571 myShepherd .updateDBTransaction ();
25622572 IBEISIA .sendMediaAssetsNew (assets , context );
2563- assets = new ArrayList <MediaAsset >();
25642573 }
2565-
2566- }
2567-
2568- if (assets .size ()>0 ) {
2569- itask .setStatus ("Registering image assets for " +count +"/" +numEncs +" encounters." );
2570- myShepherd .updateDBTransaction ();
2571- IBEISIA .sendMediaAssetsNew (assets , context );
2572- }
25732574
25742575
2575-
2576+ }
25762577 }
25772578 catch (Exception e ){
25782579 myShepherd .rollbackDBTransaction ();
0 commit comments