use of org.cristalise.kernel.entity.imports.ImportRole in project kernel by cristal-ise.
the class CreateNewRole method runActivityLogic.
@Override
protected String runActivityLogic(AgentPath agent, ItemPath item, int transitionID, String requestData, Object locker) throws InvalidDataException, ObjectAlreadyExistsException, ObjectCannotBeUpdated, CannotManageException, ObjectNotFoundException {
try {
ImportRole newRole = (ImportRole) Gateway.getMarshaller().unmarshall(requestData);
if (Gateway.getLookup().exists(new RolePath(newRole.getName(), newRole.jobList)))
throw new ObjectAlreadyExistsException("CreateNewRole: Role '" + newRole.getName() + "' already exists.");
newRole.create(agent, true);
return requestData;
} catch (MarshalException | ValidationException | IOException | MappingException e) {
Logger.error(e);
throw new InvalidDataException("CreateNewRole: Couldn't unmarshall new Role: " + requestData);
}
}
Aggregations