Revision 33abfde1
Added by Andreas Müller almost 16 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/ServiceBase.java | ||
---|---|---|
64 | 64 |
Map<UUID, T> resultMap = new HashMap<UUID, T>(); |
65 | 65 |
Iterator<T> iterator = cdmObjCollection.iterator(); |
66 | 66 |
int i = 0; |
67 |
while(iterator.hasNext()){ |
|
68 |
if ( ( (i % 5000) == 0) && (i > 0) ){logger.debug("Saved " + i + " objects" );} |
|
69 |
T cdmObj = iterator.next(); |
|
70 |
UUID uuid = saveCdmObject(cdmObj); |
|
71 |
if (logger.isDebugEnabled()){logger.debug("Save cdmObj: " + (cdmObj == null? null: cdmObj.toString()));} |
|
72 |
resultMap.put(uuid, cdmObj); |
|
73 |
i++; |
|
74 |
if ( (i % flushAfterNo) == 0){ |
|
75 |
logger.debug("flush"); |
|
76 |
dao.flush(); |
|
67 |
while(iterator.hasNext()){ |
|
68 |
if ( ( (i % 5000) == 0) && (i > 0) ){logger.debug("Saved " + i + " objects" );} |
|
69 |
T cdmObj = iterator.next(); |
|
70 |
UUID uuid = saveCdmObject(cdmObj); |
|
71 |
if (logger.isDebugEnabled()){logger.debug("Save cdmObj: " + (cdmObj == null? null: cdmObj.toString()));} |
|
72 |
resultMap.put(uuid, cdmObj); |
|
73 |
i++; |
|
74 |
if ( (i % flushAfterNo) == 0){ |
|
75 |
try{ |
|
76 |
logger.debug("flush"); |
|
77 |
dao.flush(); |
|
78 |
}catch(Exception e){ |
|
79 |
logger.error("UUUIIIII"); |
|
80 |
e.printStackTrace(); |
|
81 |
} |
|
82 |
} |
|
77 | 83 |
} |
78 |
} |
|
84 |
|
|
79 | 85 |
if ( logger.isInfoEnabled() ){logger.info("Saved " + i + " objects" );} |
80 | 86 |
return resultMap; |
81 | 87 |
} |
Also available in: Unified diff