org.eclipse.core.databinding.validation.ValidationStatus Java Examples
The following examples show how to use
org.eclipse.core.databinding.validation.ValidationStatus.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectJarsDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Control control = super.createDialogArea(parent); UpdateValueStrategy selectionStartegy = new UpdateValueStrategy() ; selectionStartegy.setAfterGetValidator(new IValidator() { @Override public IStatus validate(Object value) { if( value == null){ return ValidationStatus.error("Selection is empty") ; } return Status.OK_STATUS; } }) ; context.bindList(ViewersObservables.observeMultiSelection(tableViewer), PojoProperties.list(SelectJarsDialog.class,"selectedJars").observe(this)) ; context.bindValue(ViewersObservables.observeSingleSelection(tableViewer), PojoProperties.value(SelectJarsDialog.class,"selectedJar").observe(this), selectionStartegy, null) ; return control ; }
Example #2
Source File: DeployCustomPageOperation.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected boolean checkUploadResponse(String uploadedFileToken) { String[] parsedResult = uploadedFileToken.split("::"); if(parsedResult.length == 3 ) { String permissions = parsedResult[2].substring(1,parsedResult[2].length()-1); List<String> missingAPIExtensions = Stream.of(permissions.split(",")) .map(String::trim) .filter(entry -> entry.startsWith("<")) .collect(Collectors.toList()); if(!missingAPIExtensions.isEmpty()) { status = ValidationStatus.error(String.format(Messages.missingRestAPIStatus, getCustomPageLabel(), missingAPIExtensions.stream() .collect(Collectors.joining(", ")))); return false; } } return true; }
Example #3
Source File: OrganizationValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private IStatus checkManagerCycles(final Organization organization, final User u) { String managerUsername = u.getManager(); final List<String> managers = new ArrayList<String>(); managers.add(u.getUserName()); managers.add(managerUsername); while (managerUsername != null) { managerUsername = getManagerOf(organization, managerUsername); if (managerUsername != null) { if (!managers.contains(managerUsername)) { managers.add(managerUsername); } else { managers.add(managerUsername); return new Status(IStatus.ERROR, ActorsPlugin.PLUGIN_ID, Messages.bind(Messages.managerCycleDetected, managers.toString())); } } } return ValidationStatus.ok(); }
Example #4
Source File: HeadlessDiagramValidationHandler.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Execute public IStatus execute(RepositoryAccessor repositoryAccessor, @Named("fileName") String fileName) { DiagramFileStore diagramFileStore = repositoryAccessor.getRepositoryStore(DiagramRepositoryStore.class) .getChild(fileName, true); if (diagramFileStore != null) { RunProcessesValidationOperation validationAction = new RunProcessesValidationOperation( new BatchValidationOperation( new OffscreenEditPartFactory( org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance()), new ValidationMarkerProvider())); validationAction.addProcess(diagramFileStore.getContent()); try { validationAction.run(new NullProgressMonitor()); return validationAction.getStatus(); } catch (InvocationTargetException | InterruptedException e) { return ValidationStatus.error(String.format("An error occured while validating diagram %s", fileName), e); } } throw new IllegalArgumentException(String.format("The diagram `%s` doesn't exist", fileName)); }
Example #5
Source File: BusinessObjectNameValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public IStatus validate(BusinessObject businessObject) { String name = businessObject.getSimpleName(); if (name == null || name.isEmpty()) { return ValidationStatus.error(Messages.boNameRequired); } MultiStatus status = new MultiStatus(BusinessObjectPlugin.PLUGIN_ID, 0, "", null); status.add(validateNameLength(name)); status.add(validateUniqueness((businessObject), name)); status.add(validateWhiteSpaceCharacter(name)); status.add(validateUnderscoreCharacter(name)); status.add(validateSqlValidity(name)); status.add(validateJavaConvention(name)); return status; }
Example #6
Source File: ConversionConfigBean.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * 逆向转换验证 * @return ; */ public IStatus validateReverseConversion() { if (target == null || target.trim().equals("")) { return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg9")); } else { if (!replaceTarget) { // 如果未选择覆盖,判断并提示目标文件是否存在 String localTarget = ConverterUtil.toLocalPath(target); File file = new File(localTarget); if (file.exists()) { return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg10")); } } } if (targetEncoding == null || targetEncoding.trim().equals("")) { return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg11")); } return Status.OK_STATUS; }
Example #7
Source File: DeployApplicationHandler.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected IStatus openDeployWizard(RepositoryAccessor repositoryAccessor, Shell shell, DeployApplicationAction action, String application, DependencyResolver<ApplicationFileStore> dependencyResolver) { Optional<ApplicationFileStore> applicationFileStore = findApplicationToDeploy(repositoryAccessor, application); if (applicationFileStore.isPresent()) { DeployArtifactsHandler deployArtifactsHandler = new DeployArtifactsHandler(); List<IRepositoryFileStore> defaultSelection = new ArrayList<>(); ApplicationFileStore fileStore = applicationFileStore.get(); defaultSelection.add(fileStore); defaultSelection.addAll(dependencyResolver.findDependencies(fileStore)); deployArtifactsHandler.setDefaultSelection(defaultSelection); try { deployArtifactsHandler.deploy(shell, repositoryAccessor, PlatformUI.getWorkbench().getProgressService()); } catch (InvocationTargetException | InterruptedException e) { BonitaStudioLog.error(e); } } else { action.selectAndDeploy(shell); } return ValidationStatus.ok(); }
Example #8
Source File: ProcessesNameVersionUnicityValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected IStatus validate() { final String poolName = (String) nameObservable.getValue(); final String poolVersion = (String) versionObservable.getValue(); processeIdentifiers.remove(new Identifier(process.getName(), process.getVersion())); for (final ProcessesNameVersion poolNameAndVersion : processesNameVersion) { if (!process.equals(poolNameAndVersion.getAbstractProcess())) { processeIdentifiers.add(new Identifier(poolNameAndVersion.getNewName(), poolNameAndVersion.getNewVersion())); } } if (processeIdentifiers.contains(new Identifier(poolName, poolVersion))) { return ValidationStatus.error(Messages.bind(Messages.differentCaseSameNameError, Messages.Pool_title.toLowerCase())); } return ValidationStatus.ok(); }
Example #9
Source File: BuildProcessContributionItem.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void displayOperatonStatus(ExportBarOperation exportBarOperation, String path, String processName) { IStatus status = exportBarOperation.getStatus(); Shell shell = Display.getDefault().getActiveShell(); switch (status.getSeverity()) { case ValidationStatus.CANCEL: break; case ValidationStatus.OK: MessageDialog.openInformation(shell, Messages.buildDoneTitle, String.format(Messages.buildDoneMessage, processName, path)); break; case ValidationStatus.WARNING: MessageDialog.openWarning(shell, Messages.buildDoneTitle, status.getMessage()); break; default: MessageDialog.openError(shell, Messages.buildFailedTitle, status.getMessage()); } }
Example #10
Source File: ImportWorkspaceModel.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public String buildReport() { if (status.isOK()) { final StringBuilder sb = new StringBuilder(); repositories.stream() .map(ImportRepositoryModel::getStatus) .forEach(repoStatus -> { if (repoStatus.isMultiStatus()) { Stream.of(repoStatus.getChildren()) .forEach(cStatus -> appendMessage(sb, cStatus)); } else { appendMessage(sb, repoStatus); } }); if (repositories.stream().anyMatch(repo -> ProductVersion.isBefore780Version(repo.getVersion()))) { appendMessage(sb, ValidationStatus.info(Messages.legacyFormsNotImportedFromWorkspace)); } return sb.toString(); } return CROSS_SYMBOL + status.getMessage(); }
Example #11
Source File: ConversionConfigBean.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 逆向转换验证 * @return ; */ public IStatus validateReverseConversion() { if (target == null || target.trim().equals("")) { return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg9")); } else { if (!replaceTarget) { // 如果未选择覆盖,判断并提示目标文件是否存在 String localTarget = ConverterUtil.toLocalPath(target); File file = new File(localTarget); if (file.exists()) { return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg10")); } } } if (targetEncoding == null || targetEncoding.trim().equals("")) { return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg11")); } return Status.OK_STATUS; }
Example #12
Source File: DefaultValueEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected Binding createBinding(IObservableValue target,final IObservableValue model) { UpdateValueStrategy targetToModel = new UpdateValueStrategy() ; targetToModel.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object input) { if(input != null && !input.toString().isEmpty()){ Input observed = (Input) ((EObjectObservableValue)model).getObserved(); if(!defaultValueTypes.contains(observed.getType())){ return ValidationStatus.error(Messages.bind(Messages.cantSetDefaultValueForType,observed.getType())) ; } } return Status.OK_STATUS; } }) ; return context.bindValue(target, model,targetToModel, null); }
Example #13
Source File: ComparisonExpressionValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public IStatus validate(final Object value) { if(value == null || value.toString().isEmpty() || !ExpressionConstants.CONDITION_TYPE.equals(inputExpression.getType())){ return ValidationStatus.ok(); } final Injector injector = ConditionModelActivator.getInstance().getInjector(ConditionModelActivator.ORG_BONITASOFT_STUDIO_CONDITION_CONDITIONMODEL); final XtextComparisonExpressionLoader xtextComparisonExpressionLoader = getXtextExpressionLoader(injector, new ModelSearch(Collections::emptyList)); Resource resource = null; try { resource = xtextComparisonExpressionLoader.loadResource(value.toString(), context); } catch (final ComparisonExpressionLoadException e) { BonitaStudioLog.error(e); return ValidationStatus.error(e.getMessage()); } return validateXtextResource(injector, resource, getContextResourceSet()); }
Example #14
Source File: FieldNameValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public IStatus validate(Field field) { String name = field.getName(); if (name == null || name.isEmpty()) { return ValidationStatus.error(Messages.attributeNameRequired); } MultiStatus status = new MultiStatus(BusinessObjectPlugin.PLUGIN_ID, 0, "", null); status.add(validateJavaConvention(name)); status.add(validateNameLength(name)); status.add(validateSqlValidity(name)); status.add(validateReservedFieldNames(name)); status.add(validateUniqueness(field)); status.add(validateFirstCharacter(name)); return status; }
Example #15
Source File: ExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
protected void validateExternalDatabindingContextTargets(final DataBindingContext dbc) { if (dbc != null) { final IObservableList validationStatusProviders = dbc.getValidationStatusProviders(); final Iterator iterator = validationStatusProviders.iterator(); while (iterator.hasNext()) { final ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) iterator.next(); final IObservableValue validationStatus = validationStatusProvider.getValidationStatus(); if (!(validationStatus instanceof UnmodifiableObservableValue)) { final IStatus status = (IStatus) validationStatus.getValue(); if (status != null) { if (status.getSeverity() == IStatus.OK) { validationStatus.setValue(ValidationStatus.ok()); } else if (status.getSeverity() == IStatus.WARNING) { validationStatus.setValue(ValidationStatus.warning(status.getMessage())); } else if (status.getSeverity() == IStatus.INFO) { validationStatus.setValue(ValidationStatus.info(status.getMessage())); } else if (status.getSeverity() == IStatus.ERROR) { validationStatus.setValue(ValidationStatus.error(status.getMessage())); } else if (status.getSeverity() == IStatus.CANCEL) { validationStatus.setValue(ValidationStatus.cancel(status.getMessage())); } } } } } }
Example #16
Source File: ParametersWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createName(final Composite parent) { final Label nameLabel = new Label(parent, SWT.NONE); nameLabel.setText(Messages.name); nameLabel.setLayoutData(GridDataFactory.fillDefaults() .align(SWT.END, SWT.CENTER).create()); nameText = new Text(parent, SWT.BORDER); nameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false) .create()); final UpdateValueStrategy nameStrategy = new UpdateValueStrategy(); nameStrategy.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(final Object value) { final String errorMessage = isNameValid((String) value); if (errorMessage != null) { return ValidationStatus.error(errorMessage); } return Status.OK_STATUS; } }); dataBindingContext.bindValue(WidgetProperties.text(SWT.Modify).observe(nameText), EMFObservables.observeValue(parameterWorkingCopy, ParameterPackage.Literals.PARAMETER__NAME), nameStrategy, null); }
Example #17
Source File: EmptySelectionMultivalidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected IStatus validate() { if (selectedDataObservable.getValue() instanceof BusinessObjectData) { if (checkedElements.isEmpty()) { return ValidationStatus.error(Messages.atLeastOneAttributeShouldBeSelectedError); } else if(editModeObservable.getValue() == EditMode.CREATE){ final StringBuilder sb = new StringBuilder(); validateMandatoryFieldsNotSelected(sb, mappings, checkedElements); if (sb.length() > 0) { int lastIndexOf = sb.lastIndexOf(","); if (sb.indexOf(",") == lastIndexOf) { sb.replace(lastIndexOf, lastIndexOf + 1, ""); } final String message = container instanceof Task ? Messages.mandatoryFieldsNotSelectedStepWarning : Messages.mandatoryFieldsNotSelectedWarning; return ValidationStatus.warning(Messages.bind(message, sb.toString())); } } } return ValidationStatus.ok(); }
Example #18
Source File: ValidateContributionItem.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void validate() { MultiStatus status = new MultiStatus(BusinessObjectPlugin.PLUGIN_ID, 0, "", null); if (formPage.observeWorkingCopy().getValue().getPackages().stream() .map(Package::getBusinessObjects) .flatMap(Collection::stream).count() == 0) { status.add(ValidationStatus.error(Messages.emptyBdm)); } else { BusinessObjectListValidator validator = new BusinessObjectListValidator(formPage.observeWorkingCopy()); formPage.observeWorkingCopy().getValue().getPackages().stream() .map(validator::validate) .forEach(status::add); } if (!status.isOK()) { new MultiStatusDialog(Display.getDefault().getActiveShell(), Messages.validationStatus, Messages.validatioNStatusDesc, new String[] { IDialogConstants.OK_LABEL }, status).open(); } else { MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.validationStatus, Messages.bdmValidMessage); } }
Example #19
Source File: ConversionConfigBean.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * 逆向转换验证 * @return ; */ public IStatus validateReverseConversion() { if (target == null || target.trim().equals("")) { return ValidationStatus.error("请选择已转换的文件。"); } else { if (!replaceTarget) { // 如果未选择覆盖,判断并提示目标文件是否存在 String localTarget = ConverterUtil.toLocalPath(target); File file = new File(localTarget); if (file.exists()) { return ValidationStatus.error("已转换的文件已存在。"); } } } if (targetEncoding == null || targetEncoding.trim().equals("")) { return ValidationStatus.error("请选择已转换文件的编码。"); } return Status.OK_STATUS; }
Example #20
Source File: OpenApplicationPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public Control createControl(Composite parent, IWizardContainer wizardContainer, DataBindingContext ctx) { Composite mainComposite = new Composite(parent, SWT.NONE); mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); mainComposite.setLayout(GridLayoutFactory.fillDefaults().create()); TableViewer applicationsTableViewer = new TableViewer(mainComposite); applicationsTableViewer.getControl().setLayoutData( GridDataFactory.fillDefaults().grab(true, true).hint(TABLE_WIDTH_HINT, SWT.DEFAULT).create()); applicationsTableViewer.setContentProvider(ArrayContentProvider.getInstance()); applicationsTableViewer.setLabelProvider(new ApplicationFileStoreLabelProvider()); applicationsTableViewer .setInput(repositoryAccessor.getRepositoryStore(ApplicationRepositoryStore.class).getChildren()); ColumnViewerToolTipSupport.enableFor(applicationsTableViewer); ctx.bindList(ViewersObservables.observeMultiSelection(applicationsTableViewer), applicationFileStoreObservable); ctx.addValidationStatusProvider(new org.eclipse.core.databinding.validation.MultiValidator() { @Override protected IStatus validate() { return applicationFileStoreObservable.isEmpty() ? ValidationStatus.error("No selection") : ValidationStatus.ok(); } }); return mainComposite; }
Example #21
Source File: OperationReturnTypesValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected IStatus validateDeletionOperation(final Expression expression, final String expressionName, final Operation operation) { if (!dataExpression.getReferencedElements().isEmpty() && !(dataExpression.getReferencedElements().get(0) instanceof BusinessObjectData)) { return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator, typeLabelProvider.getText(dataExpression.getType()), operatorLabelProvider.getText(operation.getOperator()))); } return null; }
Example #22
Source File: InputNameEditingSupport.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Binding createBinding(IObservableValue target, final IObservableValue model) { UpdateValueStrategy targetToModel = new UpdateValueStrategy(); targetToModel.setConverter(new Converter(String.class, String.class) { @Override public Object convert(Object from) { return from != null ? NamingUtils.toJavaIdentifier(from.toString(), false) : null; } }); targetToModel.setBeforeSetValidator(new IValidator() { @Override public IStatus validate(Object input) { if (input == null || input.toString().isEmpty()) { return ValidationStatus.error(Messages.nameIsEmpty); } for (Input i : definition.getInput()) { EObject observed = (EObject) ((EObjectObservableValue) model).getObserved(); if (!i.equals(observed) && i.getName() != null && i.getName().equals(input.toString())) { return ValidationStatus.error(Messages.nameAlreadyExists); } } return Status.OK_STATUS; } }); return context.bindValue(target, model, targetToModel, null); }
Example #23
Source File: CategorySelectionDialog.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Control createDialogArea(Composite parent) { final Composite mainComposite = new Composite(parent, SWT.NONE) ; mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).create()) ; mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(10,10).create()) ; context = new DataBindingContext() ; categoryViewer = new TreeViewer(mainComposite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION) ; categoryViewer.getTree().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()) ; categoryViewer.setContentProvider(new DefinitionCategoryContentProvider()) ; categoryViewer.setLabelProvider(new ConnectorDefinitionTreeLabelProvider(messageProvider)) ; categoryViewer.setInput(getAllCategories()) ; final IViewerObservableList observeSelection = ViewerProperties.multipleSelection().observe(categoryViewer); MultiValidator validator = new MultiValidator() { @Override protected IStatus validate() { if(observeSelection.isEmpty()){ return ValidationStatus.error(""); } return ValidationStatus.ok(); } }; context.addValidationStatusProvider(validator); context.bindList(observeSelection, validator.observeValidatedList(PojoProperties.list("categories").observe(this)), null,new UpdateListStrategy()) ; DialogSupport.create(this,context); return mainComposite ; }
Example #24
Source File: DeployDiagramHandler.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Execute public IStatus execute(RepositoryAccessor repositoryAccessor, @Named(FILENAME_PARAMETER) String fileName, @Optional @Named(DISABLE_POPUP_PARAMETER) String disablePopup, @Optional @Named(VALIDATE_DIAGRAM_PARAMETER) String validateDiagram, @Optional @Named(PROCESS_UUID_PARAMETER) String processUUID) { boolean shouldDisablePopup = shouldDisablePopup(disablePopup); String configurationId = retrieveDefaultConfiguration(); DiagramFileStore diagramFileStore = retrieveDiagram(repositoryAccessor, fileName); List<AbstractProcess> processes = processUUID != null ? diagramFileStore.getProcesses().stream() .filter(process -> Objects.equals(processUUID, ModelHelper.getEObjectID(process))) .collect(Collectors.toList()) : diagramFileStore.getProcesses(); IStatus validationStatus = ValidationStatus.ok(); if (validateDiagram == null || Boolean.valueOf(validateDiagram)) { validationStatus = validateDiagram(processes); } if (validationStatus.isOK()) { DeployProcessOperation deployOperation = createDeployProcessOperation(); deployOperation.setConfigurationId(configurationId); deployOperation.setDisablePopup(shouldDisablePopup); processes.forEach(deployOperation::addProcessToDeploy); if (!shouldDisablePopup) { runInJob(diagramFileStore, deployOperation); } else { deployOperation.run(Repository.NULL_PROGRESS_MONITOR); return deployOperation.getStatus(); } } return Status.OK_STATUS; }
Example #25
Source File: UserEmptyInputValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public IStatus validate(final Object input) { if (isUserNotSelected()) { return ValidationStatus.ok(); } if(input == null || input.toString().isEmpty()){ return ValidationStatus.error(Messages.bind(Messages.emptyField,inputName)) ; } return ValidationStatus.ok() ; }
Example #26
Source File: MultiValidatorTest.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Test public void should_fails_validation_if_one_of_the_validator_fail() throws Exception { final MultiValidator multiValidator = new MultiValidator.Builder() .havingValidators(v -> ValidationStatus.ok(), v -> ValidationStatus.error("oups")) .create(); final IStatus status = multiValidator.validate("Hello"); StatusAssert.assertThat(status).isNotOK(); }
Example #27
Source File: ScanWorkspaceOperation.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected IStatus isEditionValid(final String repoName, final String repoEdition) { if (!"Community".equals(repoEdition)) { return ValidationStatus .error(String.format(Messages.cannotImportWorkspaceWithEdition, repoName, repoEdition)); } return ValidationStatus.ok(); }
Example #28
Source File: GroupsWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public IStatus validate(final Object value) { for (final org.bonitasoft.studio.actors.model.organization.Group g : groupList) { final org.bonitasoft.studio.actors.model.organization.Group selectedGroup = (org.bonitasoft.studio.actors.model.organization.Group) groupSingleSelectionObservable .getValue(); if (!g.equals(selectedGroup)) { if (g.getName().equals(value) && (g.getParentPath() != null && g.getParentPath().equals(selectedGroup.getParentPath()) || g.getParentPath() == null && selectedGroup.getParentPath() == null)) { return ValidationStatus.error(Messages.groupNameAlreadyExistsForLevel); } } } return Status.OK_STATUS; }
Example #29
Source File: ApplicationXMLContentValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public IStatus validate(String value) { try { applicationNodeContainerConverter.unmarshallFromXML(Files.readAllBytes(Paths.get(value))); } catch (JAXBException | IOException | SAXException e) { return ValidationStatus.error(Messages.notAnApplicationError); } return ValidationStatus.ok(); }
Example #30
Source File: IndexFieldsValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private IStatus validateUnknownFields(Index index) { BusinessObject bo = (BusinessObject) index.eContainer(); List<String> unkownFields = index.getFieldNames().stream() .filter(fieldName -> bo.getFields().stream().map(Field::getName).noneMatch(fieldName::equals)) .collect(Collectors.toList()); return unkownFields.isEmpty() ? ValidationStatus.ok() : ValidationStatus.error(String.format(Messages.indexReferencesUnknownAttributes, index.getName(), unkownFields.toString())); }