Revision 49865
Added by Argiro Kokogiannaki over 6 years ago
ClaimHandler.java | ||
---|---|---|
29 | 29 |
DMFContextHandler dmfContextHandler = null; |
30 | 30 |
ProjectHandler projectHandler = null; |
31 | 31 |
ClaimValidation claimValidation = null; |
32 |
Boolean useProductionIndex = false; |
|
32 | 33 |
|
33 | 34 |
private static final Logger logger = Logger.getLogger(ClaimHandler.class); |
34 | 35 |
|
... | ... | |
174 | 175 |
* @throws Exception |
175 | 176 |
*/ |
176 | 177 |
private OpenaireEntity buildOpenaireEntity(String id, String type, String collectedFrom, String accessRights, String embargoDate) throws Exception { |
178 |
logger.info("HEEEEREEE"); |
|
177 | 179 |
if(type==null){ |
178 | 180 |
return null; |
179 | 181 |
} |
180 | 182 |
else if(type.equals(ClaimUtils.CONTEXT)){ |
181 | 183 |
return DMFContextHandler.fetchContextById(id); |
182 | 184 |
}else if (type.equals(ClaimUtils.PROJECT)){ |
183 |
Project project = projectHandler.fetchProjectByID(id); |
|
185 |
Project project = projectHandler.fetchProjectByID(id, false);
|
|
184 | 186 |
if(project == null){ |
187 |
project = projectHandler.fetchProjectByID(id, true); |
|
188 |
} |
|
189 |
if(project == null){ |
|
185 | 190 |
logger.error("Project with id:"+id + " couldn't be fetched."); |
186 | 191 |
} |
187 | 192 |
|
188 | 193 |
return project; |
189 |
}else if (type.equals(ClaimUtils.PUBLICATION)||type.equals(ClaimUtils.DATASET)){ |
|
194 |
}else if (type.equals(ClaimUtils.PUBLICATION)||type.equals(ClaimUtils.DATASET)||type.equals(ClaimUtils.SOFTWARE) ){
|
|
190 | 195 |
ExternalRecordHandler externalRecordHandler = new ExternalRecordHandler(); |
191 | 196 |
if(collectedFrom == null){ |
192 | 197 |
return null; |
... | ... | |
220 | 225 |
return result; |
221 | 226 |
}else if (collectedFrom.equals(ClaimUtils.OPENAIRE)){ |
222 | 227 |
IndexResultHandler indexResultHandler = new IndexResultHandler(); |
223 |
Result result = indexResultHandler.fetchResultById(id); |
|
228 |
Result result = null; |
|
229 |
if(type.equals(ClaimUtils.PUBLICATION)){ |
|
230 |
result = indexResultHandler.fetchPublicationById(id,useProductionIndex); |
|
231 |
|
|
232 |
}else if(type.equals(ClaimUtils.DATASET)){ |
|
233 |
result = indexResultHandler.fetchDatasetById(id,useProductionIndex); |
|
234 |
}else if(type.equals(ClaimUtils.SOFTWARE)){ |
|
235 |
result = indexResultHandler.fetchSoftwareById(id,useProductionIndex); |
|
236 |
} |
|
224 | 237 |
if(result == null){ |
225 |
logger.error("Record with id:"+id + " couldn't be fetched from openaire."); |
|
238 |
logger.error("Record with id:"+id + " and type " + type + " couldn't be fetched from openaire.");
|
|
226 | 239 |
} |
227 | 240 |
return result; |
228 | 241 |
} |
... | ... | |
346 | 359 |
public void setClaimValidation(ClaimValidation claimValidation) { |
347 | 360 |
this.claimValidation = claimValidation; |
348 | 361 |
} |
362 |
|
|
363 |
public Boolean getUseProductionIndex() { |
|
364 |
return useProductionIndex; |
|
365 |
} |
|
366 |
|
|
367 |
public void setUseProductionIndex(Boolean useProductionIndex) { |
|
368 |
this.useProductionIndex = useProductionIndex; |
|
369 |
} |
|
349 | 370 |
} |
Also available in: Unified diff
change migration procedure: search first in beta then in production| add software | change directIndexHandler check for response