001/*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License").  You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * docs/licenses/cddl.txt
011 * or http://www.opensource.org/licenses/cddl1.php.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * docs/licenses/cddl.txt.  If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 *      Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 *      Copyright 2013-2016 UnboundID Corp.
026 */
027
028package com.unboundid.directory.sdk.broker.types;
029
030
031import com.unboundid.util.NotMutable;
032import com.unboundid.util.ThreadSafety;
033import com.unboundid.util.ThreadSafetyLevel;
034import com.unboundid.util.Validator;
035
036import java.util.List;
037
038/**
039 * This bean object may be used to return a XACML attribute from the Identity
040 * Broker's Policy Information Point (PIP).
041 */
042@NotMutable()
043@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
044public final class RequestAttribute
045{
046
047  private final List<String> values;
048  private final String dataType;
049
050  /**
051   * Construct a RequestAttribute object with the specified data type
052   * and values.
053   * @param dataType XACML data type URI string, must not be null  Must be
054   *                 a value from the set of data types described in Appendix
055   *                 A.2 of the specification "OASIS Extensible Access Control
056   *                 Markup Language (XACML) Version 3.0" Example:
057   *                 "http://www.w3.org/2001/XMLSchema#string".
058   * @param values list of values, may be empty but not null.  Each string
059   *               must be formatted according to its XML data type.
060   */
061  public RequestAttribute(final String dataType, final List<String> values)
062  {
063    Validator.ensureNotNull(dataType, values);
064    this.values = values;
065    this.dataType = dataType;
066  }
067
068  /**
069   * Get the values of this request attribute.
070   * @return values as a list of strings
071   */
072  public List<String> getValues()
073  {
074    return values;
075  }
076
077  /**
078   * Get the XACML data type of the values of this request attribute.
079   * @return XACML data type URI
080   */
081  public String getDataType()
082  {
083    return dataType;
084  }
085}