@Override public ImportError getError() { if (getName() == null) { return new ImportError(getName(), Type.PAGE); } return null; }
public List<String> toWarnings(final List<ImportStatus> importProfiles) { final ArrayList<String> warns = new ArrayList<>(); for (final ImportStatus importStatus : importProfiles) { for (final ImportError error : importStatus.getErrors()) { warns.add("Unable to find the " + error.getType().name().toLowerCase() + " " + error.getName() + " on " + importStatus.getName()); } } return warns; }
@Override public ImportError getError() { if (getName() == null) { return new ImportError(getName(), Type.PAGE); } return null; }
public List<String> toWarnings(final List<ImportStatus> importProfiles) { final ArrayList<String> warns = new ArrayList<>(); for (final ImportStatus importStatus : importProfiles) { for (final ImportError error : importStatus.getErrors()) { warns.add("Unable to find the " + error.getType().name().toLowerCase() + " " + error.getName() + " on " + importStatus.getName()); } } return warns; }
public ImportError getError() { if (getName() == null) { return new ImportError(getName(), Type.PAGE); } if (getPage() == null || getPage().isEmpty()) { return new ImportError(getName(), Type.PAGE); } return null; }
public ImportError getError() { if (getName() == null) { return new ImportError(getName(), Type.PAGE); } if (getPage() == null || getPage().isEmpty()) { return new ImportError(getName(), Type.PAGE); } return null; }
private ImportError setProfile(final ApplicationNode applicationNode, final SApplicationBuilder builder) { ImportError importError = null; if (applicationNode.getProfile() != null) { try { final SProfile profile = profileService.getProfileByName(applicationNode.getProfile()); builder.setProfileId(profile.getId()); } catch (final SProfileNotFoundException | SBonitaReadException e) { importError = new ImportError(applicationNode.getProfile(), ImportError.Type.PROFILE); } } return importError; }
private ImportError setProfile(final ApplicationNode applicationNode, final SApplicationBuilder builder) { ImportError importError = null; if (applicationNode.getProfile() != null) { try { final SProfile profile = profileService.getProfileByName(applicationNode.getProfile()); builder.setProfileId(profile.getId()); } catch (final SProfileNotFoundException | SBonitaReadException e) { importError = new ImportError(applicationNode.getProfile(), ImportError.Type.PROFILE); } } return importError; }
user = identityService.getUserByUserName(userName); } catch (final SUserNotFoundException e) { errors.add(new ImportError(userName, Type.USER)); continue; group = identityService.getGroupByPath(groupPath); } catch (final SGroupNotFoundException e) { errors.add(new ImportError(groupPath, Type.GROUP)); continue; role = identityService.getRoleByName(roleName); } catch (final SRoleNotFoundException e) { errors.add(new ImportError(roleName, Type.ROLE)); continue; group = identityService.getGroupByPath(membership.getGroup()); } catch (final SGroupNotFoundException e) { errors.add(new ImportError(membership.getGroup(), Type.GROUP)); role = identityService.getRoleByName(membership.getRole()); } catch (final SRoleNotFoundException e) { errors.add(new ImportError(membership.getRole(), Type.ROLE));
user = identityService.getUserByUserName(userName); } catch (final SUserNotFoundException e) { errors.add(new ImportError(userName, Type.USER)); continue; group = identityService.getGroupByPath(groupPath); } catch (final SGroupNotFoundException e) { errors.add(new ImportError(groupPath, Type.GROUP)); continue; role = identityService.getRoleByName(roleName); } catch (final SRoleNotFoundException e) { errors.add(new ImportError(roleName, Type.ROLE)); continue; group = identityService.getGroupByPath(membership.getGroup()); } catch (final SGroupNotFoundException e) { errors.add(new ImportError(membership.getGroup(), Type.GROUP)); role = identityService.getRoleByName(membership.getRole()); } catch (final SRoleNotFoundException e) { errors.add(new ImportError(membership.getRole(), Type.ROLE));
/** * Convert an {@link ApplicationMenuNode} to * {@link SApplicationMenu} * * @param applicationMenuNode the XML node to convert * @param application the application where the menu will be attached to * @param parentMenu the parent menu. Null if no parent * @return the application where the menu will be attached to * @throws SBonitaReadException */ public ApplicationMenuImportResult toSApplicationMenu(ApplicationMenuNode applicationMenuNode, SApplication application, SApplicationMenu parentMenu) throws SBonitaReadException { Long appPageId = null; ImportError error = null; if (applicationMenuNode.getApplicationPage() != null) { try { SApplicationPage applicationPage = applicationService.getApplicationPage(application.getToken(), applicationMenuNode.getApplicationPage()); appPageId = applicationPage.getId(); } catch (SObjectNotFoundException e) { error = new ImportError(applicationMenuNode.getApplicationPage(), ImportError.Type.APPLICATION_PAGE); } } int index = getIndex(parentMenu); SApplicationMenu applicationMenu = buildApplicationMenu(applicationMenuNode, application, parentMenu, appPageId, index); return new ApplicationMenuImportResult(error, applicationMenu); }
/** * Convert an {@link ApplicationMenuNode} to * {@link SApplicationMenu} * * @param applicationMenuNode the XML node to convert * @param application the application where the menu will be attached to * @param parentMenu the parent menu. Null if no parent * @return the application where the menu will be attached to * @throws SBonitaReadException */ public ApplicationMenuImportResult toSApplicationMenu(ApplicationMenuNode applicationMenuNode, SApplication application, SApplicationMenu parentMenu) throws SBonitaReadException { Long appPageId = null; ImportError error = null; if (applicationMenuNode.getApplicationPage() != null) { try { SApplicationPage applicationPage = applicationService.getApplicationPage(application.getToken(), applicationMenuNode.getApplicationPage()); appPageId = applicationPage.getId(); } catch (SObjectNotFoundException e) { error = new ImportError(applicationMenuNode.getApplicationPage(), ImportError.Type.APPLICATION_PAGE); } } int index = getIndex(parentMenu); SApplicationMenu applicationMenu = buildApplicationMenu(applicationMenuNode, application, parentMenu, appPageId, index); return new ApplicationMenuImportResult(error, applicationMenu); }
private void updateHomePage(final SApplication application, final ApplicationNode applicationNode, final long createdBy, final ImportResult importResult) throws SBonitaException { if (applicationNode.getHomePage() != null) { try { SApplicationPage homePage = applicationService.getApplicationPage(applicationNode.getToken(), applicationNode.getHomePage()); SApplicationUpdateBuilder updateBuilder = BuilderFactory.get(SApplicationUpdateBuilderFactory.class).createNewInstance(createdBy); updateBuilder.updateHomePageId(homePage.getId()); applicationService.updateApplication(application, updateBuilder.done()); } catch (SObjectNotFoundException e) { addError(importResult.getImportStatus(), new ImportError(applicationNode.getHomePage(), ImportError.Type.APPLICATION_PAGE)); } } }
private void updateHomePage(final SApplication application, final ApplicationNode applicationNode, final long createdBy, final ImportResult importResult) throws SBonitaException { if (applicationNode.getHomePage() != null) { try { SApplicationPage homePage = applicationService.getApplicationPage(applicationNode.getToken(), applicationNode.getHomePage()); SApplicationUpdateBuilder updateBuilder = BuilderFactory.get(SApplicationUpdateBuilderFactory.class).createNewInstance(createdBy); updateBuilder.updateHomePageId(homePage.getId()); applicationService.updateApplication(application, updateBuilder.done()); } catch (SObjectNotFoundException e) { addError(importResult.getImportStatus(), new ImportError(applicationNode.getHomePage(), ImportError.Type.APPLICATION_PAGE)); } } }
/** * @param applicationPageNode the XML node to convert to {@link SApplicationPage} * @param application the {@link SApplication} where the {@code SApplicationPage} will be attached * @return an ApplicationPageImportResult containing the converted {@code SApplicationPage} and an error (if any) */ public ApplicationPageImportResult toSApplicationPage(ApplicationPageNode applicationPageNode, SApplication application) throws SBonitaReadException, ImportException { String token = applicationPageNode.getToken(); importValidator.validate(token); long pageId = 0; ImportError importError = null; SPage page = pageService.getPageByName(applicationPageNode.getCustomPage()); if (page != null) { pageId = page.getId(); } else { importError = new ImportError(applicationPageNode.getCustomPage(), ImportError.Type.PAGE); } SApplicationPageBuilderFactory factory = BuilderFactory.get(SApplicationPageBuilderFactory.class); SApplicationPageBuilder builder = factory.createNewInstance(application.getId(), pageId, token); return new ApplicationPageImportResult(builder.done(), importError); }
/** * @param applicationPageNode the XML node to convert to {@link SApplicationPage} * @param application the {@link SApplication} where the {@code SApplicationPage} will be attached * @return an ApplicationPageImportResult containing the converted {@code SApplicationPage} and an error (if any) */ public ApplicationPageImportResult toSApplicationPage(ApplicationPageNode applicationPageNode, SApplication application) throws SBonitaReadException, ImportException { String token = applicationPageNode.getToken(); importValidator.validate(token); long pageId = 0; ImportError importError = null; SPage page = pageService.getPageByName(applicationPageNode.getCustomPage()); if (page != null) { pageId = page.getId(); } else { importError = new ImportError(applicationPageNode.getCustomPage(), ImportError.Type.PAGE); } SApplicationPageBuilderFactory factory = BuilderFactory.get(SApplicationPageBuilderFactory.class); SApplicationPageBuilder builder = factory.createNewInstance(application.getId(), pageId, token); return new ApplicationPageImportResult(builder.done(), importError); }