private SPage checkIfPageAlreadyExists(final SPage page) throws SBonitaReadException { SPage existingPage; if (page.getProcessDefinitionId() > 0) { existingPage = getPageByNameAndProcessDefinitionId(page.getName(), page.getProcessDefinitionId()); } else { existingPage = getPageByName(page.getName()); } return existingPage; }
private SPage checkIfPageAlreadyExists(final SPage page) throws SBonitaReadException { SPage existingPage; if (page.getProcessDefinitionId() > 0) { existingPage = getPageByNameAndProcessDefinitionId(page.getName(), page.getProcessDefinitionId()); } else { existingPage = getPageByName(page.getName()); } return existingPage; }
private void deleteProfileEntry(final SPage sPage) throws SBonitaReadException, SProfileEntryNotFoundException, SProfileEntryDeletionException { final List<OrderByOption> orderByOptions = Collections .singletonList(new OrderByOption(SProfileEntry.class, SProfileEntryBuilderFactory.INDEX, OrderByType.ASC)); final List<FilterOption> filters = new ArrayList<>(); filters.add(new FilterOption(SProfileEntry.class, SProfileEntryBuilderFactory.PAGE, sPage.getName())); filters.add(new FilterOption(SProfileEntry.class, SProfileEntryBuilderFactory.CUSTOM, new Boolean(true))); final QueryOptions queryOptions = new QueryOptions(0, QueryOptions.UNLIMITED_NUMBER_OF_RESULTS, orderByOptions, filters, null); final List<SProfileEntry> searchProfileEntries = profileService.searchProfileEntries(queryOptions); for (final SProfileEntry sProfileEntry : searchProfileEntries) { profileService.deleteProfileEntry(sProfileEntry.getId()); if (sProfileEntry.getParentId() > 0) { deleteParentIfNoMoreChildren(sProfileEntry); } } }
private void deleteProfileEntry(final SPage sPage) throws SBonitaReadException, SProfileEntryNotFoundException, SProfileEntryDeletionException { final List<OrderByOption> orderByOptions = Collections .singletonList(new OrderByOption(SProfileEntry.class, SProfileEntryBuilderFactory.INDEX, OrderByType.ASC)); final List<FilterOption> filters = new ArrayList<>(); filters.add(new FilterOption(SProfileEntry.class, SProfileEntryBuilderFactory.PAGE, sPage.getName())); filters.add(new FilterOption(SProfileEntry.class, SProfileEntryBuilderFactory.CUSTOM, new Boolean(true))); final QueryOptions queryOptions = new QueryOptions(0, QueryOptions.UNLIMITED_NUMBER_OF_RESULTS, orderByOptions, filters, null); final List<SProfileEntry> searchProfileEntries = profileService.searchProfileEntries(queryOptions); for (final SProfileEntry sProfileEntry : searchProfileEntries) { profileService.deleteProfileEntry(sProfileEntry.getId()); if (sProfileEntry.getParentId() > 0) { deleteParentIfNoMoreChildren(sProfileEntry); } } }
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; }
SPage insertPage(final SPage page, final byte[] content) throws SObjectAlreadyExistsException, SObjectCreationException { final SPageLogBuilder logBuilder = getPageLog(ActionType.CREATED, "Adding a new page with name " + page.getName()); try { final SPageWithContent pageContent = new SPageWithContentImpl(page, content); final SPage pageByName = checkIfPageAlreadyExists(page); if (null != pageByName) { initiateLogBuilder(page.getId(), SQueriableLog.STATUS_FAIL, logBuilder, METHOD_NAME_ADD_PAGE); throwAlreadyExistsException(pageByName.getName()); } recorder.recordInsert(new InsertRecord(pageContent), PAGE); page.setId(pageContent.getId()); notifyPageInsert(page, content); return page; } catch (final SObjectCreationException ce) { throw ce; } catch (SRecorderException | SBonitaReadException re) { throw new SObjectCreationException(re); } }
@Override public SPage addPage(final SPage page, final byte[] content) throws SObjectCreationException, SObjectAlreadyExistsException, SInvalidPageZipException, SInvalidPageTokenException { try { checkZipContainsRequiredEntries(unzip(content)); checkPageNameIsValid(page.getName(), page.isProvided()); checkPageDisplayNameIsValid(page.getDisplayName()); return insertPage(page, content); } catch (final IOException e) { throw new SInvalidPageZipInconsistentException("Error while reading zip file", e); } }
@Override public SPage addPage(final SPage page, final byte[] content) throws SObjectCreationException, SObjectAlreadyExistsException, SInvalidPageZipException, SInvalidPageTokenException { try { checkZipContainsRequiredEntries(unzip(content)); checkPageNameIsValid(page.getName(), page.isProvided()); checkPageDisplayNameIsValid(page.getDisplayName()); return insertPage(page, content); } catch (final IOException e) { throw new SInvalidPageZipInconsistentException("Error while reading zip file", e); } }
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); } }
@Override public SPage updatePage(final long pageId, final EntityUpdateDescriptor entityUpdateDescriptor) throws SObjectModificationException, SObjectAlreadyExistsException, SInvalidPageTokenException { final SPageLogBuilder logBuilder = getPageLog(ActionType.UPDATED, "Update a page with id " + pageId); final String logMethodName = METHOD_UPDATE_PAGE; try { final SPage sPage = persistenceService.selectById(new SelectByIdDescriptor<>(SPage.class, pageId)); checkPageDuplicate(sPage, entityUpdateDescriptor, logBuilder, logMethodName); final String oldPageName = sPage.getName(); recorder.recordUpdate(UpdateRecord.buildSetFields(sPage, entityUpdateDescriptor), PAGE); updatePageNameInProfileEntry(entityUpdateDescriptor, oldPageName); initiateLogBuilder(pageId, SQueriableLog.STATUS_OK, logBuilder, logMethodName); return sPage; } catch (SRecorderException | SBonitaReadException | SProfileEntryUpdateException e) { initiateLogBuilder(pageId, SQueriableLog.STATUS_FAIL, logBuilder, logMethodName); throw new SObjectModificationException(e); } }
/** * @param sPage */ public SPageImpl(final SPage sPage) { this(sPage.getName(), sPage.getDescription(), sPage.getDisplayName(), sPage.getInstallationDate(), sPage.getInstalledBy(), sPage.isProvided(), sPage.isHidden(), sPage .getLastModificationDate(), sPage.getLastUpdatedBy(), sPage.getContentName()); setContentType(sPage.getContentType()); setProcessDefinitionId(sPage.getProcessDefinitionId()); }
/** * @param sPage */ public SPageImpl(final SPage sPage) { this(sPage.getName(), sPage.getDescription(), sPage.getDisplayName(), sPage.getInstallationDate(), sPage.getInstalledBy(), sPage.isProvided(), sPage.isHidden(), sPage .getLastModificationDate(), sPage.getLastUpdatedBy(), sPage.getContentName()); setContentType(sPage.getContentType()); setProcessDefinitionId(sPage.getProcessDefinitionId()); }
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); }