use of nikita.common.model.noark5.v4.metadata.CommentType in project nikita-noark5-core by HiOA-ABI.
the class CommentTypeService method findByCode.
/**
* retrieve all CommentType that have a particular code.
* <br>
* Note, this will be replaced by OData search.
*
* @param code The code of the object you wish to retrieve
* @return A list of CommentType objects wrapped as a MetadataHateoas
* object
*/
@Override
public MetadataHateoas findByCode(String code) {
MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) commentTypeRepository.findByCode(code), COMMENT_TYPE);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.CommentType in project nikita-noark5-core by HiOA-ABI.
the class CommentTypeService method find.
// find by systemId
/**
* Retrieve a single CommentType object identified by systemId
*
* @param systemId systemId of the CommentType you wish to retrieve
* @return single CommentType object wrapped as a MetadataHateoas object
*/
@Override
public MetadataHateoas find(String systemId) {
MetadataHateoas metadataHateoas = new MetadataHateoas(commentTypeRepository.findBySystemId(systemId));
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.CommentType in project nikita-noark5-core by HiOA-ABI.
the class CommentTypeService method getCommentTypeOrThrow.
/**
* Internal helper method. Rather than having a find and try catch in
* multiple methods, we have it here once. If you call this, be aware
* that you will only ever get a valid CommentType object back. If there
* is no CommentType object, a NoarkEntityNotFoundException exception
* is thrown
*
* @param systemId The systemId of the CommentType object to retrieve
* @return the CommentType object
*/
private CommentType getCommentTypeOrThrow(@NotNull String systemId) {
CommentType commentType = commentTypeRepository.findBySystemId(systemId);
if (commentType == null) {
String info = INFO_CANNOT_FIND_OBJECT + " CommentType, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return commentType;
}
Aggregations