Project

General

Profile

« Previous | Next » 

Revision 892efc69

Added by Andreas Kohlbecker almost 14 years ago

merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiOccurrenceSourceExport.java
50 50
	private static final String pluralString = "OccurrenceSources";
51 51
	private static final String parentPluralString = "Taxa";
52 52
	private static Taxon taxon = null;
53
	private static ArrayList processedList = new ArrayList();
54 53

  
55 54
	public PesiOccurrenceSourceExport() {
56 55
		super();
......
142 141
											// Lookup sourceFk by using getSourceFk()
143 142
											Integer sourceFk = getSourceFk(reference, state);
144 143
											
145
											if (sourceFk != null && ! allreadyProcessed(sourceFk)) {
144
											if (sourceFk != null && ! state.alreadyProcessedSource(sourceFk)) {
146 145
												// Add to processed sourceFk's since sourceFk's can be scanned more than once.
147
												addToProcessed(sourceFk);
146
												state.addToProcessedSources(sourceFk);
148 147
												
149 148
												// Query the database for all entries in table 'Occurrence' with the sourceFk just determined.
150 149
												Set<Integer> occurrenceIds = getOccurrenceIds(sourceFk, state);
......
162 161
					}
163 162
				}
164 163
				
164
				state.clearAlreadyProcessedSources();
165
				
165 166
				// Commit transaction
166 167
				commitTransaction(txStatus);
167 168
				logger.error("Committed transaction.");
......
181 182
	
182 183
			logger.error("*** Finished Making " + pluralString + " ..." + getSuccessString(success));
183 184
			
185
			// Delete database table helper
186
			state.deleteStateTables();
187
			
184 188
			return success;
185 189
		} catch (SQLException e) {
186 190
			e.printStackTrace();
......
212 216
		}
213 217
	}
214 218

  
215
	/**
216
	 * Returns whether the given sourceFk was processed before or not.
217
	 * @param sourceFk
218
	 * @return
219
	 */
220
	private static boolean allreadyProcessed(Integer sourceFk) {
221
		if (processedList.contains(sourceFk)) {
222
			return true;
223
		} else {
224
			return false;
225
		}
226
	}
227
	
228
	/**
229
	 * Add given sourceFk to the list of processed sourceFk's.
230
	 * @param sourceFk
231
	 */
232
	private static void addToProcessed(Integer sourceFk) {
233
		processedList.add(sourceFk);
234
	}
235
	
236 219
	/**
237 220
	 * Returns a Set of OccurrenceId's associated to a given SourceFk.
238 221
	 * @param state

Also available in: Unified diff