3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay/*
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay *
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * Copyright (c) 2014 ForgeRock AS. All Rights Reserved
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay *
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * The contents of this file are subject to the terms
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * of the Common Development and Distribution License
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * (the License). You may not use this file except in
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * compliance with the License.
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay *
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * You can obtain a copy of the License at
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * http://forgerock.org/license/CDDLv1.0.html
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * See the License for the specific language governing
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * permission and limitations under the License.
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay *
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * When distributing Covered Code, include this CDDL
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * Header Notice in each file and include the License file
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * at http://forgerock.org/license/CDDLv1.0.html
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * If applicable, add the following below the CDDL Header,
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * with the fields enclosed by brackets [] replaced by
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * your own identifying information:
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay * "Portions Copyrighted [year] [name of copyright owner]"
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay */
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.forgerock.json.resource.Connection
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.forgerock.openicf.connectors.scriptedcrest.ScriptedCRESTConfiguration
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.forgerock.openicf.misc.scriptedcommon.OperationType
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.identityconnectors.common.logging.Log
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.identityconnectors.common.security.GuardedString
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.identityconnectors.framework.common.objects.ObjectClass
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.identityconnectors.framework.common.objects.OperationOptions
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayimport org.identityconnectors.framework.common.objects.Uid
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef operation = operation as OperationType
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef configuration = configuration as ScriptedCRESTConfiguration
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef connection = connection as Connection
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef username = username as String
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef log = log as Log
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef objectClass = objectClass as ObjectClass
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef options = options as OperationOptions
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemaydef password = password as GuardedString;
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemayswitch (objectClass) {
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay case ObjectClass.ACCOUNT:
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay return new Uid(username)
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay default:
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay throw new UnsupportedOperationException(operation.name() + " operation of type:" +
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay objectClass.objectClassValue + " is not supported.")
3b9de50fdf0980762d6930a49e1a0f20b61a6f6bJason Lemay}