001/*
002 * Copyright 2012-2016 UnboundID Corp.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License (GPLv2 only)
006 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
007 * as published by the Free Software Foundation.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program; if not, see <http://www.gnu.org/licenses>.
016 */
017
018package com.unboundid.scim.sdk;
019
020/**
021 * This class represents the response status of an individual operation within
022 * a bulk operation.
023 */
024public class Status
025{
026  /**
027   * The HTTP response code that would have been returned if a single HTTP
028   * request had been used.
029   */
030  private final String code;
031
032  /**
033   * A human readable error message, required if the operation was unsuccessful.
034   */
035  private final String description;
036
037
038
039  /**
040   * Construct a new Status value.
041   *
042   * @param code         The HTTP response code that would have been returned
043   *                     if a single HTTP request had been used.
044   * @param description  A human readable error message, or {@code null} if
045   *                     the operation was successful and there is no additional
046   *                     information.
047   */
048  public Status(final String code, final String description)
049  {
050    this.code = code;
051    this.description = description;
052  }
053
054
055
056  /**
057   * Retrieve the HTTP response code that would have been returned if a
058   * single HTTP request had been used.
059   *
060   * @return  The HTTP response code that would have been returned if a
061   *          single HTTP request had been used.
062   */
063  public String getCode()
064  {
065    return code;
066  }
067
068
069
070  /**
071   * Retrieve the human readable error message, or {@code null} if the
072   * operation was successful and there is no additional information.
073   *
074   * @return  The human readable error message, or {@code null} if the
075   *          operation was successful and there is no additional information.
076   */
077  public String getDescription()
078  {
079    return description;
080  }
081
082
083
084  /**
085   * {@inheritDoc}
086   */
087  @Override
088  public String toString()
089  {
090    final StringBuilder sb = new StringBuilder();
091    sb.append("Status");
092    sb.append("{code='").append(code).append('\'');
093    sb.append(", description='").append(description).append('\'');
094    sb.append('}');
095    return sb.toString();
096  }
097}