com.att.research.xacmlatt.pdp.policy.CombinerParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xacml-pdp Show documentation
Show all versions of xacml-pdp Show documentation
ATT reference implementation of XACML PDP engine
/*
*
* Copyright (c) 2013,2019 AT&T Knowledge Ventures
* SPDX-License-Identifier: MIT
*/
package com.att.research.xacmlatt.pdp.policy;
import com.att.research.xacml.api.AttributeValue;
import com.att.research.xacml.api.StatusCode;
import com.att.research.xacml.std.StdStatusCode;
/**
* CombinerParameter extends {@link com.att.research.xacmlatt.pdp.policy.PolicyComponent} to represent a XACML CombinerParameter element.
*
* @author car
* @version $Revision: 1.1 $
*/
public class CombinerParameter extends PolicyComponent {
private String name;
private AttributeValue> attributeValue;
@Override
protected boolean validateComponent() {
if (this.getName() == null) {
this.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, "Missing parameter name");
return false;
} else if (this.getAttributeValue() == null) {
this.setStatus(StdStatusCode.STATUS_CODE_SYNTAX_ERROR, "Missing attribute value");
return false;
} else {
this.setStatus(StdStatusCode.STATUS_CODE_OK, null);
return true;
}
}
/**
* Creates a new CombinerParameter
with the given String
name, AttributeValue
,
* {@link com.att.research.xacml.api.StatusCode} and String
status message.
*
* @param nameIn the String
name of the CombinerParameter
* @param attributeValueIn the AttributeValue
of the CombinerParameter
* @param statusCodeIn the StatusCode
of the CombinerParameter
* @param statusMessageIn the String
status message of the CombinerParameter
*/
public CombinerParameter(String nameIn, AttributeValue> attributeValueIn, StatusCode statusCodeIn, String statusMessageIn) {
super(statusCodeIn, statusMessageIn);
this.name = nameIn;
this.attributeValue = attributeValueIn;
}
/**
* Creates a new CombinerParameter
for an error condition with the given StatusCode
and
* String
status message.
*
* @param statusCodeIn the StatusCode
of the CombinerParameter
* @param statusMessageIn the String
status message of the CombinerParameter
*/
public CombinerParameter(StatusCode statusCodeIn, String statusMessageIn) {
super(statusCodeIn, statusMessageIn);
}
/**
* Creates a new CombinerParameter
for an error condition with the given StatusCode
and
* null status message.
*
* @param statusCodeIn the StatusCode
of the CombinerParameter
*/
public CombinerParameter(StatusCode statusCodeIn) {
super(statusCodeIn);
}
/**
* Creates a new CombinerParameter
with a default StatusCode
, null status message, and the given
* String
name and AttributeValue
>
*
* @param nameIn the String
name of the CombinerParameter
* @param attributeValueIn the AttributeValue
of the CombinerParameter
*/
public CombinerParameter(String nameIn, AttributeValue> attributeValueIn) {
super();
this.name = nameIn;
this.attributeValue = attributeValueIn;
}
public CombinerParameter() {
}
/**
* Gets the String
name of this CombinerParameter
.
*
* @return the String
name of this CombinerParameter
*/
public String getName() {
return this.name;
}
/**
* Sets the name of this CombinerParameter
to the given String
.
*
* @param nameIn the String
name for this CombinerParameter
.
*/
public void setName(String nameIn) {
this.name = nameIn;
}
/**
* Gets the AttributeValue
of this CombinerParameter
.
*
* @return the AttributeValue
of this CombinerParameter
*/
public AttributeValue> getAttributeValue() {
return this.attributeValue;
}
/**
* Sets the AttributeValue
for this CombinerParameter
>
*
* @param attributeValueIn the AttributeValue
for this CombinerParameter
>
*/
public void setAttributeValue(AttributeValue> attributeValueIn) {
this.attributeValue = attributeValueIn;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder("{");
stringBuilder.append("super=");
stringBuilder.append(super.toString());
Object objectToDump;
if ((objectToDump = this.getName()) != null) {
stringBuilder.append(",name=");
stringBuilder.append((String)objectToDump);
}
if ((objectToDump = this.getAttributeValue()) != null) {
stringBuilder.append(",attributeValue=");
stringBuilder.append(objectToDump.toString());
}
stringBuilder.append('}');
return stringBuilder.toString();
}
}