private void checkIfProcessSupervisorAlreadyExists(final long processDefinitionId, final Long userId, final Long groupId, final Long roleId) throws AlreadyExistsException { try { final List<SProcessSupervisor> processSupervisors = searchSProcessSupervisors(processDefinitionId, userId, groupId, roleId); if (!processSupervisors.isEmpty()) { throw new AlreadyExistsException("This supervisor already exists for process definition id = <" + processDefinitionId + ">, user id = <" + userId + ">, group id = <" + groupId + ">, role id = <" + roleId + ">"); } } catch (final SBonitaReadException e1) { // Nothing to do } }
private void checkIfProcessSupervisorAlreadyExists(final long processDefinitionId, final Long userId, final Long groupId, final Long roleId) throws AlreadyExistsException { try { final List<SProcessSupervisor> processSupervisors = searchSProcessSupervisors(processDefinitionId, userId, groupId, roleId); if (!processSupervisors.isEmpty()) { throw new AlreadyExistsException("This supervisor already exists for process definition id = <" + processDefinitionId + ">, user id = <" + userId + ">, group id = <" + groupId + ">, role id = <" + roleId + ">"); } } catch (final SBonitaReadException e1) { // Nothing to do } }
private Properties getProperties(final byte[] content, final boolean checkIfItAlreadyExists, final PageService pageService) throws SInvalidPageZipMissingIndexException, SInvalidPageZipMissingAPropertyException, SInvalidPageZipInconsistentException, SInvalidPageZipMissingPropertiesException, SInvalidPageTokenException, SBonitaReadException, AlreadyExistsException { final Properties properties = pageService.readPageZip(content); if (checkIfItAlreadyExists) { final String name = properties.getProperty(PageService.PROPERTIES_NAME); final SPage pageByName = pageService.getPageByName(name); if (pageByName != null) { throw new AlreadyExistsException("A page with name " + name + " already exists"); } } return properties; }
private Properties getProperties(final byte[] content, final boolean checkIfItAlreadyExists, final PageService pageService) throws SInvalidPageZipMissingIndexException, SInvalidPageZipMissingAPropertyException, SInvalidPageZipInconsistentException, SInvalidPageZipMissingPropertiesException, SInvalidPageTokenException, SBonitaReadException, AlreadyExistsException { final Properties properties = pageService.readPageZip(content); if (checkIfItAlreadyExists) { final String name = properties.getProperty(PageService.PROPERTIES_NAME); final SPage pageByName = pageService.getPageByName(name); if (pageByName != null) { throw new AlreadyExistsException("A page with name " + name + " already exists"); } } return properties; }
@Override public void whenApplicationExists(SApplication existing, SApplication toBeImported) throws AlreadyExistsException { throw new AlreadyExistsException("An application with token '" + existing.getToken() + "' already exists", existing.getToken()); }
@Override public void whenApplicationExists(SApplication existing, SApplication toBeImported) throws AlreadyExistsException { throw new AlreadyExistsException("An application with token '" + existing.getToken() + "' already exists", existing.getToken()); }
private void checkPathUnicity(long groupId, GroupUpdater updater, IdentityService identityService) throws SGroupNotFoundException, AlreadyExistsException { final Serializable updatedName = updater.getFields().get(GroupField.NAME); SGroup sGroupToBeUpdated = identityService.getGroup(groupId); String name = updatedName != null ? updatedName.toString() : sGroupToBeUpdated.getName(); StringBuilder sb = new StringBuilder(); String parentPath = updater.getFields().get(GroupField.PARENT_PATH) != null ? updater.getFields().get(GroupField.PARENT_PATH).toString() : ""; sb.append(parentPath).append("/").append(name); try { if (updatedName != null) { SGroup group = identityService.getGroupByPath(sb.toString()); if (group.getId() != groupId) { throw new AlreadyExistsException("Group named \"" + name + "\" already exists"); } } } catch (final SGroupNotFoundException e) { } }
private void checkPathUnicity(long groupId, GroupUpdater updater, IdentityService identityService) throws SGroupNotFoundException, AlreadyExistsException { final Serializable updatedName = updater.getFields().get(GroupField.NAME); SGroup sGroupToBeUpdated = identityService.getGroup(groupId); String name = updatedName != null ? updatedName.toString() : sGroupToBeUpdated.getName(); StringBuilder sb = new StringBuilder(); String parentPath = updater.getFields().get(GroupField.PARENT_PATH) != null ? updater.getFields().get(GroupField.PARENT_PATH).toString() : ""; sb.append(parentPath).append("/").append(name); try { if (updatedName != null) { SGroup group = identityService.getGroupByPath(sb.toString()); if (group.getId() != groupId) { throw new AlreadyExistsException("Group named \"" + name + "\" already exists"); } } } catch (final SGroupNotFoundException e) { } }
private void checkIfActorMappingForRoleAlreadyExists(final long actorId, final long roleId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, -1, -1, roleId); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the role id = <" + roleId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForRoleAlreadyExists(final long actorId, final long roleId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, -1, -1, roleId); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the role id = <" + roleId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForUserAlreadyExists(final long actorId, final long userId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, userId, -1, -1); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the user id = <" + userId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForUserAlreadyExists(final long actorId, final long userId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, userId, -1, -1); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the user id = <" + userId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForGroupAlreadyExists(final long actorId, final long groupId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, -1, groupId, -1); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the group id = <" + groupId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForMembershipAlreadyExists(final long actorId, final long roleId, final long groupId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, -1, groupId, roleId); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the role id = <" + roleId + ">, the group id = <" + groupId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForGroupAlreadyExists(final long actorId, final long groupId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, -1, groupId, -1); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the group id = <" + groupId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
private void checkIfActorMappingForMembershipAlreadyExists(final long actorId, final long roleId, final long groupId) throws AlreadyExistsException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActorMappingService actorMappingService = tenantAccessor.getActorMappingService(); try { final SActorMember sActorMember = actorMappingService.getActorMember(actorId, -1, groupId, roleId); if (sActorMember != null) { throw new AlreadyExistsException("The mapping already exists for the actor id = <" + actorId + ">, the role id = <" + roleId + ">, the group id = <" + groupId + ">"); } } catch (final SBonitaReadException e) { // Do nothing } }
public Application createApplication(final ApplicationCreator applicationCreator) throws AlreadyExistsException, CreationException { try { validateCreator(applicationCreator); final SApplication sApplication = applicationService.createApplication(converter.buildSApplication(applicationCreator, loggedUserId)); return converter.toApplication(sApplication); } catch (final SObjectAlreadyExistsException e) { throw new AlreadyExistsException(e.getMessage()); } catch (final SBonitaException e) { throw new CreationException(e); } }
public Application createApplication(final ApplicationCreator applicationCreator) throws AlreadyExistsException, CreationException { try { validateCreator(applicationCreator); final SApplication sApplication = applicationService.createApplication(converter.buildSApplication(applicationCreator, loggedUserId)); return converter.toApplication(sApplication); } catch (final SObjectAlreadyExistsException e) { throw new AlreadyExistsException(e.getMessage()); } catch (final SBonitaException e) { throw new CreationException(e); } }
public Page createPage(final String contentName, final byte[] content) throws AlreadyExistsException, CreationException, InvalidPageTokenException, InvalidPageZipContentException { try { return convertToPage(pageService.addPage(content, contentName, userIdFromSession)); } catch (final SObjectAlreadyExistsException e) { throw new AlreadyExistsException("A page already exists with the name defined in page zip content"); } catch (final SInvalidPageTokenException e) { throw new InvalidPageTokenException(e.getMessage(), e); } catch (final SInvalidPageZipException e) { throw convertException(e); } catch (final SBonitaException e) { throw new CreationException(e); } }
public Page createPage(final String contentName, final byte[] content) throws AlreadyExistsException, CreationException, InvalidPageTokenException, InvalidPageZipContentException { try { return convertToPage(pageService.addPage(content, contentName, userIdFromSession)); } catch (final SObjectAlreadyExistsException e) { throw new AlreadyExistsException("A page already exists with the name defined in page zip content"); } catch (final SInvalidPageTokenException e) { throw new InvalidPageTokenException(e.getMessage(), e); } catch (final SInvalidPageZipException e) { throw convertException(e); } catch (final SBonitaException e) { throw new CreationException(e); } }