355e5661379644c081271b23fa8b966a098a42d2Jon Branch/*
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Copyright (c) 2015 ForgeRock AS. All Rights Reserved
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * The contents of this file are subject to the terms
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * of the Common Development and Distribution License
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * (the License). You may not use this file except in
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * compliance with the License.
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * You can obtain a copy of the License at
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * http://forgerock.org/license/CDDLv1.0.html
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * See the License for the specific language governing
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * permission and limitations under the License.
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * When distributing Covered Code, include this CDDL
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Header Notice in each file and include the License file
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * at http://forgerock.org/license/CDDLv1.0.html
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * If applicable, add the following below the CDDL Header,
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * with the fields enclosed by brackets [] replaced by
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * your own identifying information:
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * "Portions Copyrighted [year] [name of copyright owner]"
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Version {{version}}
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Author {{author}}
355e5661379644c081271b23fa8b966a098a42d2Jon Branch */
355e5661379644c081271b23fa8b966a098a42d2Jon Branchpackage org.forgerock.openicf.connectors.{{lower packageName}}
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.forgerock.openicf.connectors.{{lower packageName}}.{{packageName}}Configuration
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.forgerock.openicf.misc.scriptedcommon.OperationType
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.common.logging.Log
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.framework.common.objects.Uid
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.forgerock.openicf.misc.scriptedcommon.MapFilterVisitor
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.framework.common.objects.AttributeBuilder
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.framework.common.objects.ObjectClass
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.framework.common.objects.OperationOptions
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.framework.common.objects.SearchResult
355e5661379644c081271b23fa8b966a098a42d2Jon Branchimport org.identityconnectors.framework.common.objects.filter.Filter
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch/**
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Built-in accessible objects
355e5661379644c081271b23fa8b966a098a42d2Jon Branch **/
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch// OperationType is SEARCH for this script
355e5661379644c081271b23fa8b966a098a42d2Jon Branchdef operation = operation as OperationType
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch// The configuration class created specifically for this connector
355e5661379644c081271b23fa8b966a098a42d2Jon Branchdef configuration = configuration as {{packageName}}Configuration
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch// Default logging facility
355e5661379644c081271b23fa8b966a098a42d2Jon Branchdef log = log as Log
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch// The objectClass of the object to be searched, e.g. ACCOUNT or GROUP
355e5661379644c081271b23fa8b966a098a42d2Jon Branchdef objectClass = objectClass as ObjectClass
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch// The search filter for this operation
355e5661379644c081271b23fa8b966a098a42d2Jon Branchdef filter = filter as Filter
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch// Additional options for this operation
355e5661379644c081271b23fa8b966a098a42d2Jon Branchdef options = options as OperationOptions
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
5478b1943fbf08b87ba05fb6bf14117049ed20e6Jon Branch// The handler for the result set is named 'handler' and does not need to be defined. Its formal type
5478b1943fbf08b87ba05fb6bf14117049ed20e6Jon Branch// is Closure<Boolean>.
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch/**
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Script action - Customizable
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * Search for one or more objects in the external source. Connectors that do not support this should
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * throw an UnsupportedOperationException.
355e5661379644c081271b23fa8b966a098a42d2Jon Branch *
355e5661379644c081271b23fa8b966a098a42d2Jon Branch * This script should use the handler to process the result set
355e5661379644c081271b23fa8b966a098a42d2Jon Branch **/
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branch/* Log something to demonstrate this script executed */
355e5661379644c081271b23fa8b966a098a42d2Jon Branchlog.info("Search script, operation = " + operation.toString());
355e5661379644c081271b23fa8b966a098a42d2Jon Branch
355e5661379644c081271b23fa8b966a098a42d2Jon Branchreturn new SearchResult();