use of nikita.common.model.noark5.v4.metadata.FlowStatus in project nikita-noark5-core by HiOA-ABI.
the class FlowStatusService method find.
// find by systemId
/**
* Retrieve a single FlowStatus object identified by systemId
*
* @param systemId systemId of the FlowStatus you wish to retrieve
* @return single FlowStatus object wrapped as a MetadataHateoas object
*/
@Override
public MetadataHateoas find(String systemId) {
MetadataHateoas metadataHateoas = new MetadataHateoas(flowStatusRepository.findBySystemId(systemId));
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.FlowStatus in project nikita-noark5-core by HiOA-ABI.
the class FlowStatusService method getFlowStatusOrThrow.
/**
* 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 FlowStatus object back. If there is
* no FlowStatus object, a NoarkEntityNotFoundException exception is thrown
*
* @param systemId The systemId of the FlowStatus object to retrieve
* @return the FlowStatus object
*/
private FlowStatus getFlowStatusOrThrow(@NotNull String systemId) {
FlowStatus flowStatus = flowStatusRepository.findBySystemId(systemId);
if (flowStatus == null) {
String info = INFO_CANNOT_FIND_OBJECT + " FlowStatus, using " + "systemId " + systemId;
logger.error(info);
throw new NoarkEntityNotFoundException(info);
}
return flowStatus;
}
use of nikita.common.model.noark5.v4.metadata.FlowStatus in project nikita-noark5-core by HiOA-ABI.
the class FlowStatusService method generateDefaultFlowStatus.
/**
* Generate a default FlowStatus object
*
* @return the FlowStatus object wrapped as a FlowStatusHateoas object
*/
@Override
public FlowStatus generateDefaultFlowStatus() {
FlowStatus flowStatus = new FlowStatus();
flowStatus.setCode(TEMPLATE_FLOW_STATUS_CODE);
flowStatus.setDescription(TEMPLATE_FLOW_STATUS_DESCRIPTION);
return flowStatus;
}
use of nikita.common.model.noark5.v4.metadata.FlowStatus in project nikita-noark5-core by HiOA-ABI.
the class FlowStatusService method createNewFlowStatus.
// All CREATE operations
/**
* Persists a new FlowStatus object to the database.
*
* @param flowStatus FlowStatus object with values set
* @return the newly persisted FlowStatus object wrapped as a MetadataHateoas
* object
*/
@Override
public MetadataHateoas createNewFlowStatus(FlowStatus flowStatus) {
flowStatus.setDeleted(false);
flowStatus.setOwnedBy(SecurityContextHolder.getContext().getAuthentication().getName());
MetadataHateoas metadataHateoas = new MetadataHateoas(flowStatusRepository.save(flowStatus));
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
use of nikita.common.model.noark5.v4.metadata.FlowStatus in project nikita-noark5-core by HiOA-ABI.
the class FlowStatusService method findAll.
// All READ operations
/**
* Retrieve a list of all FlowStatus objects
*
* @return list of FlowStatus objects wrapped as a
* MetadataHateoas object
*/
@Override
public MetadataHateoas findAll() {
MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) flowStatusRepository.findAll(), FLOW_STATUS);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
Aggregations