private void validateDisplayName(final ApplicationUpdater updater) throws UpdateException { if (updater.getFields().keySet().contains(ApplicationField.DISPLAY_NAME)) { final String displayName = (String) updater.getFields().get(ApplicationField.DISPLAY_NAME); if (displayName == null || displayName.trim().isEmpty()) { throw new UpdateException("The application display name can not be null or empty"); } } }
private void validateDisplayName(final ApplicationUpdater updater) throws UpdateException { if (updater.getFields().keySet().contains(ApplicationField.DISPLAY_NAME)) { final String displayName = (String) updater.getFields().get(ApplicationField.DISPLAY_NAME); if (displayName == null || displayName.trim().isEmpty()) { throw new UpdateException("The application display name can not be null or empty"); } } }
private void handleResult(final Map<String, TaskResult<Void>> result) throws UpdateException { for (final Entry<String, TaskResult<Void>> entry : result.entrySet()) { if (entry.getValue().isError()) { throw new UpdateException("There is at least one exception on the node " + entry.getKey(), entry.getValue().getThrowable()); } if (entry.getValue().isTimeout()) { throw new UpdateException("There is at least one timeout after " + entry.getValue().getTimeout() + " " + entry.getValue().getTimeunit() + " on the node " + entry.getKey()); } } }
private void handleResult(final Map<String, TaskResult<Void>> result) throws UpdateException { for (final Entry<String, TaskResult<Void>> entry : result.entrySet()) { if (entry.getValue().isError()) { throw new UpdateException("There is at least one exception on the node " + entry.getKey(), entry.getValue().getThrowable()); } if (entry.getValue().isTimeout()) { throw new UpdateException("There is at least one timeout after " + entry.getValue().getTimeout() + " " + entry.getValue().getTimeunit() + " on the node " + entry.getKey()); } } }
@Override public void updateDueDateOfTask(final long userTaskId, final Date dueDate) throws UpdateException { final ActivityInstanceService activityInstanceService = getTenantAccessor().getActivityInstanceService(); try { final SetExpectedEndDate updateProcessInstance = new SetExpectedEndDate(activityInstanceService, userTaskId, dueDate); updateProcessInstance.execute(); } catch (final SFlowNodeNotFoundException e) { throw new UpdateException(e); } catch (final SBonitaException e) { throw new UpdateException(e); } }
protected void updateTenant(final PlatformService platformService, final STenantUpdateBuilder descriptor, final STenant tenant) throws UpdateException { try { platformService.updateTenant(tenant, descriptor.done()); } catch (final SBonitaException e) { throw new UpdateException("Could not update the tenant pause mode", e); } }
protected void updateTenant(final PlatformService platformService, final STenantUpdateBuilder descriptor, final STenant tenant) throws UpdateException { try { platformService.updateTenant(tenant, descriptor.done()); } catch (final SBonitaException e) { throw new UpdateException("Could not update the tenant pause mode", e); } }
@Override public void updateDueDateOfTask(final long userTaskId, final Date dueDate) throws UpdateException { final ActivityInstanceService activityInstanceService = getTenantAccessor().getActivityInstanceService(); try { final SetExpectedEndDate updateProcessInstance = new SetExpectedEndDate(activityInstanceService, userTaskId, dueDate); updateProcessInstance.execute(); } catch (final SFlowNodeNotFoundException e) { throw new UpdateException(e); } catch (final SBonitaException e) { throw new UpdateException(e); } }
private void validateToken(final ApplicationUpdater updater) throws UpdateException { if (updater.getFields().keySet().contains(ApplicationField.TOKEN)) { final String token = (String) updater.getFields().get(ApplicationField.TOKEN); ValidationStatus validationStatus = tokenValidator.validate(token); if (!validationStatus.isValid()) { throw new UpdateException(validationStatus.getMessage()); } } }
private SHumanTaskInstance getSHumanTaskInstance(final long userTaskId) throws SFlowNodeNotFoundException, SFlowNodeReadException, UpdateException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final SFlowNodeInstance flowNodeInstance = tenantAccessor.getActivityInstanceService().getFlowNodeInstance(userTaskId); if (!(flowNodeInstance instanceof SHumanTaskInstance)) { throw new UpdateException("The identifier does not refer to a human task"); } return (SHumanTaskInstance) flowNodeInstance; }
@Override public void setActivityStateById(final long activityInstanceId, final int stateId) throws UpdateException { try { getTenantAccessor().getFlowNodeExecutor().setStateByStateId(activityInstanceId, stateId); } catch (final SBonitaException e) { throw new UpdateException(e); } }
@Override public CustomUserInfoValue setCustomUserInfoValue(final long definitionId, final long userId, final String value) throws UpdateException { try { return ModelConvertor.convert(createCustomUserInfoValueAPI().set(definitionId, userId, value)); } catch (final SBonitaException e) { throw new UpdateException(e); } }
@Override public CustomUserInfoValue setCustomUserInfoValue(final long definitionId, final long userId, final String value) throws UpdateException { try { return ModelConvertor.convert(createCustomUserInfoValueAPI().set(definitionId, userId, value)); } catch (final SBonitaException e) { throw new UpdateException(e); } }
@Override public void rescheduleErroneousTriggers() throws UpdateException { try { final PlatformServiceAccessor platformAccessor = getPlatformAccessor(); platformAccessor.getSchedulerService().rescheduleErroneousTriggers(); } catch (final Exception e) { throw new UpdateException(e); } }
@Override public void setActivityStateById(final long activityInstanceId, final int stateId) throws UpdateException { try { getTenantAccessor().getFlowNodeExecutor().setStateByStateId(activityInstanceId, stateId); } catch (final SBonitaException e) { throw new UpdateException(e); } }
private SHumanTaskInstance getSHumanTaskInstance(final long userTaskId) throws SFlowNodeNotFoundException, SFlowNodeReadException, UpdateException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final SFlowNodeInstance flowNodeInstance = tenantAccessor.getActivityInstanceService().getFlowNodeInstance(userTaskId); if (!(flowNodeInstance instanceof SHumanTaskInstance)) { throw new UpdateException("The identifier does not refer to a human task"); } return (SHumanTaskInstance) flowNodeInstance; }
public void updateTenantPortalConfigurationFile(long tenantId, String file, byte[] content) throws UpdateException { List<BonitaConfiguration> tenantPortalConf = getConfigurationService().getTenantPortalConf(tenantId); for (BonitaConfiguration bonitaConfiguration : tenantPortalConf) { if (bonitaConfiguration.getResourceName().equals(file)) { bonitaConfiguration.setResourceContent(content); getConfigurationService().storeTenantPortalConf(Collections.singletonList(bonitaConfiguration), tenantId); return; } } throw new UpdateException("unable to update the configuration file " + file + " because it does not exists"); }
public void setApplicationHomePage(final long applicationId, final long applicationPageId) throws UpdateException, ApplicationNotFoundException { final SApplicationUpdateBuilder sApplicationUpdateBuilder = BuilderFactory.get(SApplicationUpdateBuilderFactory.class).createNewInstance(loggedUserId) .updateHomePageId(applicationPageId); try { applicationService.updateApplication(applicationId, sApplicationUpdateBuilder.done()); } catch (final SObjectNotFoundException e) { throw new ApplicationNotFoundException(applicationId); } catch (final SBonitaException e) { throw new UpdateException(e); } }
public void setApplicationHomePage(final long applicationId, final long applicationPageId) throws UpdateException, ApplicationNotFoundException { final SApplicationUpdateBuilder sApplicationUpdateBuilder = BuilderFactory.get(SApplicationUpdateBuilderFactory.class).createNewInstance(loggedUserId) .updateHomePageId(applicationPageId); try { applicationService.updateApplication(applicationId, sApplicationUpdateBuilder.done()); } catch (final SObjectNotFoundException e) { throw new ApplicationNotFoundException(applicationId); } catch (final SBonitaException e) { throw new UpdateException(e); } }
@Override public void setTaskPriority(final long humanTaskInstanceId, final TaskPriority priority) throws UpdateException { final TenantServiceAccessor tenantAccessor = getTenantAccessor(); final ActivityInstanceService activityInstanceService = tenantAccessor.getActivityInstanceService(); try { final SetTaskPriority transactionContent = new SetTaskPriority(activityInstanceService, humanTaskInstanceId, STaskPriority.valueOf(priority.name())); transactionContent.execute(); } catch (final SBonitaException e) { throw new UpdateException(e); } }