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(); }
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(); }
public Page getPageByNameAndProcessDefinition(String name, long processDefinitionId) throws PageNotFoundException { try { final SPage sPage = pageService.getPageByNameAndProcessDefinitionId(name, processDefinitionId); if (sPage == null) { throw new PageNotFoundException(name, PageAttribute.NAME); } return convertToPage(sPage); } catch (final SBonitaReadException e) { throw new PageNotFoundException(e); } }
public Page getPageByNameAndProcessDefinition(String name, long processDefinitionId) throws PageNotFoundException { try { final SPage sPage = pageService.getPageByNameAndProcessDefinitionId(name, processDefinitionId); if (sPage == null) { throw new PageNotFoundException(name, PageAttribute.NAME); } return convertToPage(sPage); } catch (final SBonitaReadException e) { throw new PageNotFoundException(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); } } }