use of nikita.common.model.noark5.v4.metadata.ClassificationType in project nikita-noark5-core by HiOA-ABI.
the class ClassificationTypeService method generateDefaultClassificationType.
/**
* Generate a default ClassificationType object
*
* @return the ClassificationType object wrapped as a
* ClassificationTypeHateoas object
*/
@Override
public ClassificationType generateDefaultClassificationType() {
ClassificationType classificationType = new ClassificationType();
classificationType.setCode(TEMPLATE_CLASSIFICATION_TYPE_CODE);
classificationType.setDescription(TEMPLATE_CLASSIFICATION_TYPE_DESCRIPTION);
return classificationType;
}
use of nikita.common.model.noark5.v4.metadata.ClassificationType in project nikita-noark5-core by HiOA-ABI.
the class ClassificationTypeService method findByDescription.
/**
* Retrieve all ClassificationType that have a given description.
* <br>
* Note, this will be replaced by OData search.
*
* @param description Description of object you wish to retrieve. The
* whole text, this is an exact search.
* @return A list of ClassificationType objects wrapped as a MetadataHateoas
* object
*/
@Override
public MetadataHateoas findByDescription(String description) {
MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) classificationTypeRepository.findByDescription(description), CLASSIFICATION_TYPE);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.ClassificationType in project nikita-noark5-core by HiOA-ABI.
the class ClassificationTypeService method createNewClassificationType.
// All CREATE operations
/**
* Persists a new ClassificationType object to the database.
*
* @param classificationType ClassificationType object with values set
* @return the newly persisted ClassificationType object wrapped as a
* MetadataHateoas object
*/
@Override
public MetadataHateoas createNewClassificationType(ClassificationType classificationType) {
classificationType.setDeleted(false);
classificationType.setOwnedBy(SecurityContextHolder.getContext().getAuthentication().getName());
MetadataHateoas metadataHateoas = new MetadataHateoas(classificationTypeRepository.save(classificationType));
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.ClassificationType in project nikita-noark5-core by HiOA-ABI.
the class ClassificationTypeService method find.
// find by systemId
/**
* Retrieve a single ClassificationType object identified by systemId
*
* @param systemId systemId of the ClassificationType you wish to retrieve
* @return single ClassificationType object wrapped as a MetadataHateoas
* object
*/
@Override
public MetadataHateoas find(String systemId) {
MetadataHateoas metadataHateoas = new MetadataHateoas(classificationTypeRepository.findBySystemId(systemId));
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.ClassificationType in project nikita-noark5-core by HiOA-ABI.
the class ClassificationTypeService method handleUpdate.
/**
* Update a ClassificationType identified by its systemId
* <p>
* Copy the values you are allowed to change, code and description
*
* @param systemId The systemId of the classificationType object you wish to
* update
* @param classificationType The updated classificationType object. Note
* the values you are allowed to change are
* copied from this object. This object is not
* persisted.
* @return the updated classificationType
*/
@Override
public MetadataHateoas handleUpdate(String systemId, Long version, ClassificationType classificationType) {
ClassificationType existingClassificationType = getClassificationTypeOrThrow(systemId);
// Copy all the values you are allowed to copy ....
if (null != existingClassificationType.getCode()) {
existingClassificationType.setCode(existingClassificationType.getCode());
}
if (null != existingClassificationType.getDescription()) {
existingClassificationType.setDescription(existingClassificationType.getDescription());
}
// Note this can potentially result in a NoarkConcurrencyException
// exception
existingClassificationType.setVersion(version);
MetadataHateoas classificationTypeHateoas = new MetadataHateoas(classificationTypeRepository.save(existingClassificationType));
metadataHateoasHandler.addLinks(classificationTypeHateoas, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingClassificationType));
return classificationTypeHateoas;
}
Aggregations