RemoveElementValidationCommandExpander

Expands:


    $componentRoot.directory$/$artifactSubFolders$/$dataElement.packageName;format="toPath"$/command/$dataElement.name;format="firstToLower"$
  /Remove$dataElement.name$ValidationCommand.java

if:

dataElement.component.getOption('enableValidation').defined and
    dataElement.component.getOption('enableJaxrs').defined and
    dataElement.getOption('includeJaxrsConnector').defined and
    dataElement.getOption('exposeDeleteEndpoint').defined and
    !dataElement.dataCommands.{^ #this.name.equals('remove' + dataElement.name) }.empty
property value
element type DataElement
qualified name net.democritus.expander.rest.logic.command.validation.RemoveElementValidationCommandExpander
layer LOGIC_LAYER
technology EJB3
sourceType JAVA
phase expansion
features  

Example

Some example of the content generated by the expander:

// expanded with nsx-expanders:4.16.3, expansionResource net.democritus:rest-expanders:2.4.2
package net.animals.command.catBreed;

import animals.command.CustomCommandResult;
import animals.validation.ValidationResult;

import net.animals.CatBreedCommand;
import net.animals.validation.catBreed.CatBreedRemoveDataValidator;

import net.democritus.sys.Context;
import net.democritus.sys.ParameterContext;

// @anchor:imports:start
// @anchor:imports:end
// anchor:custom-imports:start
// anchor:custom-imports:end

public class RemoveCatBreedValidationCommand {

  // @anchor:fields:start
  // @anchor:fields:end
  // anchor:custom-fields:start
  // anchor:custom-fields:end

  public CustomCommandResult validate(ParameterContext<CatBreedCommand.RemoveCatBreed> commandParameter) {
    Context context = commandParameter.getContext();
    CatBreedCommand.RemoveCatBreed command = commandParameter.getValue();
    CustomCommandResult result = CustomCommandResult.success(command.getCommandId());

    // @anchor:before-validate:start
    // @anchor:before-validate:end
    // anchor:custom-before-validate:start
    // anchor:custom-before-validate:end

    ValidationResult validateData = new CatBreedRemoveDataValidator(context).validate(command);
    if (validateData.isSuccess() && validateData.isValidationFailed()) {
      return CustomCommandResult.fieldError(command.getCommandId(), validateData.getErrors());
    }

    // @anchor:validate:start
    // @anchor:validate:end
    // anchor:custom-validate:start
    // anchor:custom-validate:end

    return result;
  }

  // @anchor:methods:start
  // @anchor:methods:end
  // anchor:custom-methods:start
  // anchor:custom-methods:end

}

These features have the same condition as RemoveElementValidationCommandExpander.