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 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); } }
@Override public void addDependency(final String name, final byte[] jar) throws AlreadyExistsException, CreationException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final DependencyService dependencyService = tenantAccessor.getDependencyService(); try { dependencyService.createMappedDependency(name, jar, name + ".jar", tenantAccessor.getTenantId(), ScopeType.TENANT); dependencyService.refreshClassLoaderAfterUpdate(ScopeType.TENANT, tenantAccessor.getTenantId()); } catch (final SDependencyAlreadyExistsException e) { throw new AlreadyExistsException(e); } catch (final SDependencyException sbe) { throw new CreationException(sbe); } }
@Override public void addDependency(final String name, final byte[] jar) throws AlreadyExistsException, CreationException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final DependencyService dependencyService = tenantAccessor.getDependencyService(); try { dependencyService.createMappedDependency(name, jar, name + ".jar", tenantAccessor.getTenantId(), ScopeType.TENANT); dependencyService.refreshClassLoaderAfterUpdate(ScopeType.TENANT, tenantAccessor.getTenantId()); } catch (final SDependencyAlreadyExistsException e) { throw new AlreadyExistsException(e); } catch (final SDependencyException sbe) { throw new CreationException(sbe); } }
public CustomUserInfoDefinition create(final SCustomUserInfoDefinitionBuilderFactory factory, final CustomUserInfoDefinitionCreator creator) throws CreationException { checkParameter(creator); final SCustomUserInfoDefinitionBuilder builder = factory.createNewInstance(); builder.setName(creator.getName()); builder.setDescription(creator.getDescription()); try { return ModelConvertor.convert(service.createCustomUserInfoDefinition(builder.done())); } catch (SCustomUserInfoDefinitionAlreadyExistsException e) { throw new AlreadyExistsException(e.getMessage()); } catch (SIdentityException e) { throw new CreationException(e); } }