use of org.orcid.jaxb.model.record_rc3.Record in project nikita-noark5-core by HiOA-ABI.
the class RecordService method createDocumentDescriptionAssociatedWithRecord.
@Override
public DocumentDescription createDocumentDescriptionAssociatedWithRecord(String systemID, DocumentDescription documentDescription) {
DocumentDescription persistedDocumentDescription = null;
Record record = recordRepository.findBySystemIdOrderBySystemId(systemID);
if (record == null) {
String info = INFO_CANNOT_FIND_OBJECT + " Record, using systemID " + systemID;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else {
TreeSet<Record> records = (TreeSet<Record>) documentDescription.getReferenceRecord();
if (records == null) {
records = new TreeSet<>();
documentDescription.setReferenceRecord(records);
}
records.add(record);
Set<DocumentDescription> documentDescriptions = record.getReferenceDocumentDescription();
documentDescriptions.add(documentDescription);
persistedDocumentDescription = documentDescriptionService.save(documentDescription);
}
return persistedDocumentDescription;
}
use of org.orcid.jaxb.model.record_rc3.Record in project nikita-noark5-core by HiOA-ABI.
the class RecordService method updateRecordSetFinalized.
public Record updateRecordSetFinalized(Long id) {
Record record = recordRepository.findById(id);
if (record == null) {
// TODO throw Object not find
}
String username = SecurityContextHolder.getContext().getAuthentication().getName();
return recordRepository.save(record);
}
use of org.orcid.jaxb.model.record_rc3.Record in project nikita-noark5-core by HiOA-ABI.
the class RecordService method handleUpdate.
// All UPDATE operations
@Override
public Record handleUpdate(@NotNull String systemId, @NotNull Long version, @NotNull Record incomingRecord) {
Record existingRecord = getRecordOrThrow(systemId);
// Here copy all the values you are allowed to copy ....
// TODO: FIND ALL VALUES
// This might be a class that can only have values set via parameter values rather than request bodies
existingRecord.setVersion(version);
recordRepository.save(existingRecord);
return existingRecord;
}
use of org.orcid.jaxb.model.record_rc3.Record in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryService method createDocumentDescriptionAssociatedWithRegistryEntry.
@Override
public DocumentDescription createDocumentDescriptionAssociatedWithRegistryEntry(String systemID, DocumentDescription documentDescription) {
RegistryEntry registryEntry = getRegistryEntryOrThrow(systemID);
TreeSet<Record> records = (TreeSet<Record>) documentDescription.getReferenceRecord();
// It should always be instaniated ... check this ...
if (records == null) {
records = new TreeSet<>();
documentDescription.setReferenceRecord(records);
}
records.add(registryEntry);
return documentDescriptionService.save(documentDescription);
}
use of org.orcid.jaxb.model.record_rc3.Record in project nikita-noark5-core by HiOA-ABI.
the class FileImportService method createRecordAssociatedWithFile.
@Override
public Record createRecordAssociatedWithFile(String fileSystemId, Record record) {
Record persistedRecord = null;
File file = fileRepository.findBySystemIdOrderBySystemId(fileSystemId);
if (file == null) {
String info = INFO_CANNOT_FIND_OBJECT + " File, using fileSystemId " + fileSystemId;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else {
record.setReferenceFile(file);
persistedRecord = recordImportService.save(record);
}
return persistedRecord;
}
Aggregations