90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * The contents of this file are subject to the terms of the Common Development and
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * Distribution License (the License). You may not use this file except in compliance with the
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * specific language governing permission and limitations under the License.
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * When distributing Covered Software, include this CDDL Header Notice in each file and include
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * Header, with the fields enclosed by brackets [] replaced by your own identifying
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * information: "Portions copyright [year] [name of copyright owner]".
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley * Copyright 2011-2015 ForgeRock AS.
e26e5073e1266868172d72453c97f413fe2fb603Jake Feasel/*global define */
42be21a8d046897a4a36b1cb023e686131046985Elizabeth Brownedefine("org/forgerock/openidm/ui/admin/mapping/util/MappingUtils", [
e26e5073e1266868172d72453c97f413fe2fb603Jake Feasel "underscore",
e26e5073e1266868172d72453c97f413fe2fb603Jake Feasel "handlebars",
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne "org/forgerock/openidm/ui/common/delegates/SearchDelegate",
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne function($, _,
42be21a8d046897a4a36b1cb023e686131046985Elizabeth Browne obj.buildObjectRepresentation = function(objToRep, props){
42be21a8d046897a4a36b1cb023e686131046985Elizabeth Browne objRepEl.text(Handlebars.Utils.escapeExpression(objToRep[prop])).attr("title", prop);
42be21a8d046897a4a36b1cb023e686131046985Elizabeth Browne objRepEl.addClass("objectRepresentationHeader");
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne obj.setupSampleSearch = function(el, mapping, autocompleteProps, selectSuccessCallback){
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne onChange: function() {
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne element = $('<div class="fr-search-option"></div>'),
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne $(element).append('<div class="fr-search-primary">' +selectizeEscape(value) +'</div>');
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne $(element).append('<div class="fr-search-secondary text-muted">' +selectizeEscape(value) +'</div>');
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne return "<div>" +escape(item[autocompleteProps[0]]) +"</div>";
adedab0d6503654c1aac5635769496bfbb75f3fcjason.browne searchDelegate.searchResults(mapping.source, autocompleteProps, query).then(function(response) {
42be21a8d046897a4a36b1cb023e686131046985Elizabeth Browne obj.readOnlySituationalPolicy = function(policies){
42be21a8d046897a4a36b1cb023e686131046985Elizabeth Browne return _.reduce(policies, function(memo, val){