001 /*
002 * Copyright 2012 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
018 package com.unboundid.scim.sdk;
019
020
021
022 import com.unboundid.scim.schema.ResourceDescriptor;
023
024
025
026 /**
027 * This class must be extended to handle the content of a bulk operation.
028 */
029 public abstract class BulkContentHandler
030 {
031 /**
032 * Handles the value of failOnErrors.
033 *
034 * @param failOnErrors The number of errors that the Service Provider will
035 * accept before the operation is terminated and an
036 * error response is returned.
037 */
038 public void handleFailOnErrors(final int failOnErrors)
039 {
040 // No implementation by default.
041 }
042
043
044
045 /**
046 * Handle an individual operation.
047 *
048 * @param opIndex The index of the operation.
049 * @param bulkOperation The individual operation within the bulk operation.
050 *
051 * @return {@code true} if operations should continue to be provided,
052 * or {@code false} if the remaining operations are of no interest.
053 *
054 * @throws SCIMException If an error occurs that prevents processing of the
055 * entire bulk content.
056 */
057 public boolean handleOperation(final int opIndex,
058 final BulkOperation bulkOperation)
059 throws SCIMException
060 {
061 // No implementation by default.
062 return true;
063 }
064
065
066
067 /**
068 * Retrieve the resource descriptor for a given endpoint.
069 *
070 * @param endpoint A SCIM resource endpoint.
071 *
072 * @return The resource descriptor for this endpoint, or {@code null} if the
073 * endpoint is unknown.
074 */
075 public ResourceDescriptor getResourceDescriptor(final String endpoint)
076 {
077 // Null implementation by default.
078 return null;
079 }
080
081
082
083 /**
084 * Transform a data value. This method may be used to resolve bulkId
085 * references to resource IDs.
086 *
087 * @param opIndex The index of the bulk operation containing the data value.
088 * @param value The value to be transformed.
089 *
090 * @return The transformed value.
091 */
092 public String transformValue(final int opIndex, final String value)
093 {
094 // No-op by default.
095 return value;
096 }
097 }