private void addPageMapping(final SPage page, final Properties apiProperties) throws SObjectCreationException, IOException, SInvalidPageZipMissingPropertiesException { final List<String> mappings = getKeysOfPageMappings(apiProperties); for (final String mapping : mappings) { pageMappingService.create(mapping, page.getId(), Collections.<String> emptyList()); } }
private void deleteProcessPages(Long processDefinitionId) throws SBonitaReadException, SObjectModificationException, SObjectNotFoundException { List<SPage> sPages; do { sPages = pageService.getPageByProcessDefinitionId(processDefinitionId, 0, NUMBER_OF_RESULTS); for (SPage sPage : sPages) { pageService.deletePage(sPage.getId()); } } while (sPages.size() == NUMBER_OF_RESULTS); }
private void deleteProcessPages(Long processDefinitionId) throws SBonitaReadException, SObjectModificationException, SObjectNotFoundException { List<SPage> sPages; do { sPages = pageService.getPageByProcessDefinitionId(processDefinitionId, 0, NUMBER_OF_RESULTS); for (SPage sPage : sPages) { pageService.deletePage(sPage.getId()); } } while (sPages.size() == NUMBER_OF_RESULTS); }
private void addPageMapping(final SPage page, final Properties apiProperties) throws SObjectCreationException, IOException, SInvalidPageZipMissingPropertiesException { final List<String> mappings = getKeysOfPageMappings(apiProperties); for (final String mapping : mappings) { pageMappingService.create(mapping, page.getId(), Collections.<String> emptyList()); } }
private Long getThemeId(final String themeName, final String applicationToken, final ImportStatus importStatus) throws SBonitaReadException, ImportException { SPage theme = pageService.getPageByName(themeName); if (theme == null) { return handleMissingTheme(themeName, applicationToken, importStatus); } return theme.getId(); }
Long getPageIdOrNull(String form, long processDefinitionId) throws SBonitaReadException { SPage pageByName = pageService.getPageByNameAndProcessDefinitionId(form, processDefinitionId); if (pageByName == null) { pageByName = pageService.getPageByName(form); } return pageByName == null ? null : pageByName.getId(); }
@Override public void pageDeleted(final SPage page) throws SBonitaReadException, SDeletionException { if (SContentType.API_EXTENSION.equals(page.getContentType())) { List<SPageMapping> mappings; do { mappings = pageMappingService.get(page.getId(), 0, MAX_RESULTS); for (final SPageMapping mapping : mappings) { pageMappingService.delete(mapping); } } while (mappings.size() == MAX_RESULTS); } }
@Override public void pageDeleted(final SPage page) throws SBonitaReadException, SDeletionException { if (SContentType.API_EXTENSION.equals(page.getContentType())) { List<SPageMapping> mappings; do { mappings = pageMappingService.get(page.getId(), 0, MAX_RESULTS); for (final SPageMapping mapping : mappings) { pageMappingService.delete(mapping); } } while (mappings.size() == MAX_RESULTS); } }
private Long getLayoutId(final String layoutName, final String applicationToken, final ImportStatus importStatus) throws SBonitaReadException, ImportException { SPage layout = pageService.getPageByName(layoutName); if (layout == null) { return handleMissingLayout(layoutName, applicationToken, importStatus); } return layout.getId(); }
private Long getLayoutId(final String layoutName, final String applicationToken, final ImportStatus importStatus) throws SBonitaReadException, ImportException { SPage layout = pageService.getPageByName(layoutName); if (layout == null) { return handleMissingLayout(layoutName, applicationToken, importStatus); } return layout.getId(); }
Long getPageIdOrNull(String form, long processDefinitionId) throws SBonitaReadException { SPage pageByName = pageService.getPageByNameAndProcessDefinitionId(form, processDefinitionId); if (pageByName == null) { pageByName = pageService.getPageByName(form); } return pageByName == null ? null : pageByName.getId(); }
private Long getThemeId(final String themeName, final String applicationToken, final ImportStatus importStatus) throws SBonitaReadException, ImportException { SPage theme = pageService.getPageByName(themeName); if (theme == null) { return handleMissingTheme(themeName, applicationToken, importStatus); } return theme.getId(); }
private Long getPageId(final String applicationToken, final String pageName) throws CreationException { try { SPage defaultLayout = pageService.getPageByName(pageName); if (defaultLayout == null) { throw new CreationException(String.format("Unable to created application with token '%s' because the page '%s' was not found.", applicationToken, pageName)); } return defaultLayout.getId(); } catch (SBonitaReadException e) { throw new CreationException(e); } }
private Long getPageId(final String applicationToken, final String pageName) throws CreationException { try { SPage defaultLayout = pageService.getPageByName(pageName); if (defaultLayout == null) { throw new CreationException(String.format("Unable to created application with token '%s' because the page '%s' was not found.", applicationToken, pageName)); } return defaultLayout.getId(); } catch (SBonitaReadException e) { throw new CreationException(e); } }
private void deployPage(String resourcePath, byte[] pageContent, Long processDefinitionId, long userId, PageService pageService) throws SBonitaException { final Matcher pathMatcher = getPathMatcher(resourcePath); if (pathMatcher.matches()) { final String pageName = pathMatcher.group(1); final String extension = pathMatcher.group(2); String contentName = pageName + "." + extension; final SPage sPage = pageService.getPageByNameAndProcessDefinitionId(pageName, processDefinitionId); if (sPage != null) { pageService.updatePageContent(sPage.getId(), pageContent, contentName); } else { final Properties pageProperties = pageService.readPageZip(pageContent); final PageCreator pageCreator = new PageCreator(pageName, contentName, ContentType.FORM, processDefinitionId) .setDisplayName(pageProperties.getProperty(PageService.PROPERTIES_DISPLAY_NAME)) .setDescription(pageProperties.getProperty(PageService.PROPERTIES_DESCRIPTION)); final SPage newPage = new PageModelConverter().constructSPage(pageCreator, userId); pageService.addPage(newPage, pageContent); } } }
private void deployPage(String resourcePath, byte[] pageContent, Long processDefinitionId, long userId, PageService pageService) throws SBonitaException { final Matcher pathMatcher = getPathMatcher(resourcePath); if (pathMatcher.matches()) { final String pageName = pathMatcher.group(1); final String extension = pathMatcher.group(2); String contentName = pageName + "." + extension; final SPage sPage = pageService.getPageByNameAndProcessDefinitionId(pageName, processDefinitionId); if (sPage != null) { pageService.updatePageContent(sPage.getId(), pageContent, contentName); } else { final Properties pageProperties = pageService.readPageZip(pageContent); final PageCreator pageCreator = new PageCreator(pageName, contentName, ContentType.FORM, processDefinitionId) .setDisplayName(pageProperties.getProperty(PageService.PROPERTIES_DISPLAY_NAME)) .setDescription(pageProperties.getProperty(PageService.PROPERTIES_DESCRIPTION)); final SPage newPage = new PageModelConverter().constructSPage(pageCreator, userId); pageService.addPage(newPage, pageContent); } } }
private void deletePage(final SPage sPage) throws SObjectModificationException { final SPageLogBuilder logBuilder = getPageLog(ActionType.DELETED, "Deleting page named: " + sPage.getName()); try { deleteProfileEntry(sPage); for (final PageServiceListener pageServiceListener : pageServiceListeners) { pageServiceListener.pageDeleted(sPage); } recorder.recordDelete(new DeleteRecord(sPage), PAGE); initiateLogBuilder(sPage.getId(), SQueriableLog.STATUS_OK, logBuilder, METHOD_DELETE_PAGE); } catch (SRecorderException | SBonitaReadException | SProfileEntryNotFoundException | SProfileEntryDeletionException | SDeletionException re) { initiateLogBuilder(sPage.getId(), SQueriableLog.STATUS_FAIL, logBuilder, METHOD_DELETE_PAGE); throw new SObjectModificationException(re); } }
private void deletePage(final SPage sPage) throws SObjectModificationException { final SPageLogBuilder logBuilder = getPageLog(ActionType.DELETED, "Deleting page named: " + sPage.getName()); try { deleteProfileEntry(sPage); for (final PageServiceListener pageServiceListener : pageServiceListeners) { pageServiceListener.pageDeleted(sPage); } recorder.recordDelete(new DeleteRecord(sPage), PAGE); initiateLogBuilder(sPage.getId(), SQueriableLog.STATUS_OK, logBuilder, METHOD_DELETE_PAGE); } catch (SRecorderException | SBonitaReadException | SProfileEntryNotFoundException | SProfileEntryDeletionException | SDeletionException re) { initiateLogBuilder(sPage.getId(), SQueriableLog.STATUS_FAIL, logBuilder, METHOD_DELETE_PAGE); throw new SObjectModificationException(re); } }
public Page toPage(final SPage sPage) { Long processDefinitionId = sPage.getProcessDefinitionId() > 0 ? sPage.getProcessDefinitionId() : null; return new PageImpl(sPage.getId(), sPage.getName(), sPage.getDisplayName(), sPage.isProvided(), sPage.isHidden(), sPage.getDescription(), sPage.getInstallationDate(), sPage.getInstalledBy(), sPage.getLastModificationDate(), sPage.getLastUpdatedBy(), sPage.getContentName(), sPage.getContentType(), processDefinitionId); }
public Page toPage(final SPage sPage) { Long processDefinitionId = sPage.getProcessDefinitionId() > 0 ? sPage.getProcessDefinitionId() : null; return new PageImpl(sPage.getId(), sPage.getName(), sPage.getDisplayName(), sPage.isProvided(), sPage.isHidden(), sPage.getDescription(), sPage.getInstallationDate(), sPage.getInstalledBy(), sPage.getLastModificationDate(), sPage.getLastUpdatedBy(), sPage.getContentName(), sPage.getContentType(), processDefinitionId); }