protected void checkThatInternalPageExists(Long pageId) throws SObjectModificationException { if (pageId != null) { try { pageService.getPage(pageId); } catch (SBonitaReadException | SObjectNotFoundException e) { throw new SObjectModificationException("the page with id " + pageId + " does not exists"); } } }
protected void checkThatInternalPageExists(Long pageId) throws SObjectModificationException { if (pageId != null) { try { pageService.getPage(pageId); } catch (SBonitaReadException | SObjectNotFoundException e) { throw new SObjectModificationException("the page with id " + pageId + " does not exists"); } } }
public Page getPage(final long pageId) throws PageNotFoundException { try { return convertToPage(pageService.getPage(pageId)); } catch (final SBonitaReadException e) { throw new PageNotFoundException(e); } catch (final SObjectNotFoundException e) { throw new PageNotFoundException(e); } }
public Page getPage(final long pageId) throws PageNotFoundException { try { return convertToPage(pageService.getPage(pageId)); } catch (final SBonitaReadException e) { throw new PageNotFoundException(e); } catch (final SObjectNotFoundException e) { throw new PageNotFoundException(e); } }
private void setLayout(final SApplication application, final ApplicationNode applicationNode) throws SBonitaReadException, SObjectNotFoundException { if (application.getLayoutId() != null) { SPage page = pageService.getPage(application.getLayoutId()); applicationNode.setLayout(page.getName()); } }
private void setLayout(final SApplication application, final ApplicationNode applicationNode) throws SBonitaReadException, SObjectNotFoundException { if (application.getLayoutId() != null) { SPage page = pageService.getPage(application.getLayoutId()); applicationNode.setLayout(page.getName()); } }
private void setTheme(final SApplication application, final ApplicationNode applicationNode) throws SBonitaReadException, SObjectNotFoundException { if (application.getThemeId() != null) { SPage page = pageService.getPage(application.getThemeId()); applicationNode.setTheme(page.getName()); } }
private void setTheme(final SApplication application, final ApplicationNode applicationNode) throws SBonitaReadException, SObjectNotFoundException { if (application.getThemeId() != null) { SPage page = pageService.getPage(application.getThemeId()); applicationNode.setTheme(page.getName()); } }
/** * @param page the application page to convert to xml node. * @return the converted page. * @throws SObjectNotFoundException if the referenced page does not exist. * @throws SBonitaReadException if the referenced page cannot be retrieved. */ public ApplicationPageNode toPage(final SApplicationPage page) throws SBonitaReadException, SObjectNotFoundException { if (page == null) { throw new IllegalArgumentException("Application page to convert cannot be null"); } final ApplicationPageNode pageNode = new ApplicationPageNode(); pageNode.setToken(page.getToken()); pageNode.setCustomPage(pageService.getPage(page.getPageId()).getName()); return pageNode; }
/** * @param page the application page to convert to xml node. * @return the converted page. * @throws SObjectNotFoundException if the referenced page does not exist. * @throws SBonitaReadException if the referenced page cannot be retrieved. */ public ApplicationPageNode toPage(final SApplicationPage page) throws SBonitaReadException, SObjectNotFoundException { if (page == null) { throw new IllegalArgumentException("Application page to convert cannot be null"); } final ApplicationPageNode pageNode = new ApplicationPageNode(); pageNode.setToken(page.getToken()); pageNode.setCustomPage(pageService.getPage(page.getPageId()).getName()); return pageNode; }
protected void checkFormMappingResolution(SFormMapping formMapping, List<Problem> problems) throws SBonitaReadException, SObjectNotFoundException { String errorMessage; if (isMappingRelatedToCustomPage(formMapping)) { SPageMapping pageMapping = formMapping.getPageMapping(); if (pageMapping == null) { errorMessage = String.format(ERROR_MESSAGE_FORM_NOT_SET, formMapping.getProcessDefinitionId(), formMapping.getTask()); addProblem(formMapping, problems, errorMessage); return; } final Long pageId = pageMapping.getPageId(); if (pageId == null || pageService.getPage(pageId) == null) { errorMessage = String.format(ERROR_MESSAGE_FORM_NOT_FOUND, pageMapping.getKey(), pageId); addProblem(formMapping, problems, errorMessage); } } else if (isUndefined(formMapping)) { errorMessage = String.format(ERROR_MESSAGE_FORM_UNDEFINED, formMapping.getProcessDefinitionId(), formMapping.getTask()); addProblem(formMapping, problems, errorMessage); } }
protected void checkFormMappingResolution(SFormMapping formMapping, List<Problem> problems) throws SBonitaReadException, SObjectNotFoundException { String errorMessage; if (isMappingRelatedToCustomPage(formMapping)) { SPageMapping pageMapping = formMapping.getPageMapping(); if (pageMapping == null) { errorMessage = String.format(ERROR_MESSAGE_FORM_NOT_SET, formMapping.getProcessDefinitionId(), formMapping.getTask()); addProblem(formMapping, problems, errorMessage); return; } final Long pageId = pageMapping.getPageId(); if (pageId == null || pageService.getPage(pageId) == null) { errorMessage = String.format(ERROR_MESSAGE_FORM_NOT_FOUND, pageMapping.getKey(), pageId); addProblem(formMapping, problems, errorMessage); } } else if (isUndefined(formMapping)) { errorMessage = String.format(ERROR_MESSAGE_FORM_UNDEFINED, formMapping.getProcessDefinitionId(), formMapping.getTask()); addProblem(formMapping, problems, errorMessage); } }
public void updatePageContent(final long pageId, final byte[] content) throws UpdateException, UpdatingWithInvalidPageTokenException, UpdatingWithInvalidPageZipContentException { final SPageUpdateBuilder pageUpdateBuilder = getPageUpdateBuilder(); pageUpdateBuilder.updateLastModificationDate(System.currentTimeMillis()); pageUpdateBuilder.updateLastUpdatedBy(userIdFromSession); try { final SPage page = pageService.getPage(pageId); pageService.updatePageContent(pageId, content, page.getContentName()); pageService.updatePage(pageId, pageUpdateBuilder.done()); } catch (final SInvalidPageTokenException e) { throw new UpdatingWithInvalidPageTokenException(e.getMessage(), e); } catch (final SInvalidPageZipException e) { throw new UpdatingWithInvalidPageZipContentException(e.getMessage(), e); } catch (final SBonitaException sBonitaException) { throw new UpdateException(sBonitaException); } }
public void updatePageContent(final long pageId, final byte[] content) throws UpdateException, UpdatingWithInvalidPageTokenException, UpdatingWithInvalidPageZipContentException { final SPageUpdateBuilder pageUpdateBuilder = getPageUpdateBuilder(); pageUpdateBuilder.updateLastModificationDate(System.currentTimeMillis()); pageUpdateBuilder.updateLastUpdatedBy(userIdFromSession); try { final SPage page = pageService.getPage(pageId); pageService.updatePageContent(pageId, content, page.getContentName()); pageService.updatePage(pageId, pageUpdateBuilder.done()); } catch (final SInvalidPageTokenException e) { throw new UpdatingWithInvalidPageTokenException(e.getMessage(), e); } catch (final SInvalidPageZipException e) { throw new UpdatingWithInvalidPageZipContentException(e.getMessage(), e); } catch (final SBonitaException sBonitaException) { throw new UpdateException(sBonitaException); } }
@Override public void exportToBusinessArchive(long processDefinitionId, BusinessArchiveBuilder businessArchiveBuilder) throws SBonitaException { // TODO: when custom pages stop being external resources, add them here: final FormMappingModel formMappingModel = new FormMappingModel(); final List<SFormMapping> formMappings = formMappingService.list(processDefinitionId, 0, Integer.MAX_VALUE); for (SFormMapping sFormMapping : formMappings) { final FormMapping formMapping = ModelConvertor.toFormMapping(sFormMapping, new FormRequiredAnalyzer(processDefinitionService)); String form = null; switch (formMapping.getTarget()) { case INTERNAL: if (formMapping.getPageId() != null) { final SPage page = pageService.getPage(formMapping.getPageId()); form = page.getName(); } break; case URL: form = formMapping.getURL(); break; } final FormMappingDefinition mapping = new FormMappingDefinition(form, formMapping.getType(), formMapping.getTarget(), formMapping.getTask()); formMappingModel.addFormMapping(mapping); } businessArchiveBuilder.setFormMappings(formMappingModel); }
@Override public void exportToBusinessArchive(long processDefinitionId, BusinessArchiveBuilder businessArchiveBuilder) throws SBonitaException { // TODO: when custom pages stop being external resources, add them here: final FormMappingModel formMappingModel = new FormMappingModel(); final List<SFormMapping> formMappings = formMappingService.list(processDefinitionId, 0, Integer.MAX_VALUE); for (SFormMapping sFormMapping : formMappings) { final FormMapping formMapping = ModelConvertor.toFormMapping(sFormMapping, new FormRequiredAnalyzer(processDefinitionService)); String form = null; switch (formMapping.getTarget()) { case INTERNAL: if (formMapping.getPageId() != null) { final SPage page = pageService.getPage(formMapping.getPageId()); form = page.getName(); } break; case URL: form = formMapping.getURL(); break; } final FormMappingDefinition mapping = new FormMappingDefinition(form, formMapping.getType(), formMapping.getTarget(), formMapping.getTask()); formMappingModel.addFormMapping(mapping); } businessArchiveBuilder.setFormMappings(formMappingModel); }