Commit b7e0f9e3 authored by Steinberg, Jan's avatar Steinberg, Jan
Browse files

now integrating the setspec into bs reference at harvesting step

parent 4133d663
......@@ -16,6 +16,5 @@ public interface BundlesSourceRepository extends JpaRepository<BundlesSource,Lon
BundlesSource findByReference(String reference);
List<BundlesSource> findByType(BundlesSourceType type);
List<BundlesSource> findByType(BundlesSourceType type);
}
......@@ -81,16 +81,17 @@ public class BundlesSourceResource {
if (bundlesSource.getId() != null) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("bundlesSource", "idexists", "A new bundlesSource cannot already have an ID")).body(null);
}
final String setSpec = getSetSpec(bundlesSource.getData());
// final String setSpec = getSetSpec(bundlesSource.getData());
BundlesSource result = bundlesSourceRepository.save(bundlesSource);
if ( result.getType().equals(BundlesSourceType.XSLT_OAI_PMH) && null != setSpec) {
final String currentReference = result.getReference();
result.setReference(currentReference + "___" + setSpec);
result = bundlesSourceRepository.save(result);
}
else if ( result.getType().equals(BundlesSourceType.XML_XSLT_SOURCE) ) {
// if ( result.getType().equals(BundlesSourceType.XSLT_OAI_PMH) && null != setSpec) {
// final String currentReference = result.getReference();
// result.setReference(currentReference + "___" + setSpec);
// result = bundlesSourceRepository.save(result);
// }
// else
if ( result.getType().equals(BundlesSourceType.XML_XSLT_SOURCE) ) {
result.setReference("xmlxslt-bundlessource-" + result.getId() );
result = bundlesSourceRepository.save(result);
}
......@@ -304,6 +305,12 @@ public class BundlesSourceResource {
log.debug("REST request to harvest BundlesSource : {}", id);
BundlesSource bundlesSource = bundlesSourceRepository.findOne(id);
if (null != bundlesSource) {
final String setSpec = getSetSpec(bundlesSource.getData());
if (null != setSpec) {
final String referenceOfBS = bundlesSource.getReference();
bundlesSource.setReference(referenceOfBS + "___" + setSpec);
bundlesSourceRepository.save(bundlesSource);
}
FeedingContext feedingContext = feedingContextFactory.getFeedingContext(bundlesSource);
feederService.feed(feedingContext);
result = ResponseEntity.accepted().build();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment