use of org.wildfly.extension.picketlink.common.model.validator.AlternativeAttributeValidationStepHandler in project wildfly by wildfly.
the class AbstractFederationResourceDefinition method createAttributeWriterHandler.
@Override
protected OperationStepHandler createAttributeWriterHandler() {
List<SimpleAttributeDefinition> attributes = getAttributes();
final List<AttributeDefinition> alternativeAttributes = getAlternativesAttributes();
return new ReloadRequiredWriteAttributeHandler(attributes.toArray(new AttributeDefinition[attributes.size()])) {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (!alternativeAttributes.isEmpty()) {
context.addStep(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()])), OperationContext.Stage.MODEL);
}
doRegisterModelWriteAttributeHandler(context, operation);
super.execute(context, operation);
}
};
}
use of org.wildfly.extension.picketlink.common.model.validator.AlternativeAttributeValidationStepHandler in project wildfly by wildfly.
the class AbstractIDMResourceDefinition method createAttributeWriterHandler.
@Override
protected OperationStepHandler createAttributeWriterHandler() {
List<SimpleAttributeDefinition> attributes = getAttributes();
final List<AttributeDefinition> alternativeAttributes = getAlternativesAttributes();
return new IDMConfigWriteAttributeHandler(attributes.toArray(new AttributeDefinition[attributes.size()])) {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
if (!alternativeAttributes.isEmpty()) {
context.addStep(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()])), OperationContext.Stage.MODEL);
}
doRegisterModelWriteAttributeHandler(context, operation);
super.execute(context, operation);
}
};
}
use of org.wildfly.extension.picketlink.common.model.validator.AlternativeAttributeValidationStepHandler in project wildfly by wildfly.
the class IDMConfigAddStepHandler method configureModelValidators.
private void configureModelValidators(ModelValidationStepHandler[] modelValidators) {
List<AttributeDefinition> alternativeAttributes = new ArrayList<AttributeDefinition>();
for (AttributeDefinition attribute : this.attributes) {
if (attribute.getAlternatives() != null && attribute.getAlternatives().length > 0) {
alternativeAttributes.add(attribute);
}
}
if (!alternativeAttributes.isEmpty()) {
this.modelValidators.add(new AlternativeAttributeValidationStepHandler(alternativeAttributes.toArray(new AttributeDefinition[alternativeAttributes.size()]), isAlternativesRequired()));
}
if (modelValidators != null) {
this.modelValidators.addAll(Arrays.asList(modelValidators));
}
this.modelValidators.add(new ModelValidationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
final PathAddress address = getParentAddress(PathAddress.pathAddress(operation.require(OP_ADDR)));
Resource resource = context.readResourceFromRoot(address);
final ModelNode parentModel = Resource.Tools.readModel(resource);
PartitionManagerAddHandler.INSTANCE.validateModel(context, address.getLastElement().getValue(), parentModel);
context.stepCompleted();
}
});
}
Aggregations