AddEditManagedView.js revision d831a02394471cdc7111c67ebe5c0ed27b9b1219
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * Copyright (c) 2014-2015 ForgeRock AS. All rights reserved.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * The contents of this file are subject to the terms
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * of the Common Development and Distribution License
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * (the License). You may not use this file except in
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * compliance with the License.
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * You can obtain a copy of the License at
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * See the License for the specific language governing
82bcaaf8077ba892f39afb721dca149353c63d2cvboxsync * permission and limitations under the License.
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * When distributing Covered Code, include this CDDL
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * Header Notice in each file and include the License file
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * If applicable, add the following below the CDDL Header,
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync * with the fields enclosed by brackets [] replaced by
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * your own identifying information:
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync * "Portions Copyrighted [year] [name of copyright owner]"
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync/*global define */
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsyncdefine("org/forgerock/openidm/ui/admin/managed/AddEditManagedView", [
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync "underscore",
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync "jsonEditor",
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync "org/forgerock/openidm/ui/admin/util/AdminAbstractView",
2622c26c6b4105d944a29c5e2c77b6ef26e10101vboxsync "org/forgerock/commons/ui/common/main/EventManager",
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync "org/forgerock/commons/ui/common/main/ValidatorsManager",
e2843ed205192b88e54eef60ad541d00bbbc932avboxsync "org/forgerock/openidm/ui/common/delegates/ConfigDelegate",
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync "org/forgerock/commons/ui/common/util/ModuleLoader",
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync], function($, _,
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync var AddEditManagedView = AdminAbstractView.extend({
d1a00c93378091ef28db9d959b2d692cc8143a07vboxsync template: "templates/admin/managed/AddEditManagedTemplate.html",
var managedPromise,
eventList = ["onCreate", "postCreate", "onRead", "onUpdate", "postUpdate", "onDelete", "postDelete", "onValidate", "onRetrieve", "onStore", "onSync"],
this.data = {
selectEvents: [],
addedEvents: [],
this.eventHooks = [];
this.propertyHooks = [];
$.when(managedPromise, repoCheckPromise, ModuleLoader.load("faiconpicker")).then(_.bind(function(managedObjects, configFiles, faiconpicker){
.keys()
.value();
.keys()
.value();
}, this).pid;
loadSchema: function() {
disable_edit_json: true,
disable_array_delete_all: true,
disable_array_reorder: false,
disable_collapse: true,
disable_properties: true,
no_additional_properties: true,
additionalItems: false,
required_by_default: true
this.refreshValue();
schema: {
this.setDefaultData();
setDefaultData: function() {
jsonSchema = {};
if (managedSchema) {
jsonSchema = {
properties: []
jsonSchema.properties = this.translateSubProperties(managedSchema.properties, managedSchema.order, managedSchema.required);
var jsonEditorProperties = [];
jsonEditorProperties.push(this.getType(properties[propertyName], propertyName, required, forArray));
return jsonEditorProperties;
var tempProperty = {},
_.extend(tempProperty, _.omit(property, ["type", "order", "required", "items", "resourceCollection", "properties"]));
if (forArray) {
if (forArray) {
if (forArray) {
forArray = false;
if (forArray) {
forArray = false;
var refProps = [];
return property;
var policyParams = [];
return property;
* @param node (root.properties.0.type or root.properties.0.type.itemType)
* @param property (schema.properties.myPropertyName or schema.properties.myPropertyName.items
switch (nodeType) {
this.addType(node + ".itemType", property.items, this.data.managedObjectSchema.editors[node + ".itemType"].value);
var refProps = {};
return props;
var data = {
var policyParams = {};
var val;
return policies;
if (!node) {
this.addType("root.properties."+ index +".type", data.properties[property.propertyName], property.type);
return data;
getManagedSchema: function() {
return _.extend({
this.loadSchema();
hideOnSelect: true
hasWorkflow: true,
_.each(this.$el.find("#managedPropertyWrapper .small-field-block:visible"), function(managedProperty, index) {
hasWorkflow: true,
//hide "Return by Default" (under relationship type), "Reverse Relationship", and "Reverse Property Name"
if (callback) {
callback();
if(!nameCheck) {
if (managedObject.name === this.data.managedObjects.objects[this.data.currentManagedObjectIndex].name) {
if(!nameCheck) {
found = false;
found = true;
return found;
var promises = [];
promises.push(ConfigDelegate.updateEntity("managed", {"objects" : this.data.managedObjects.objects}));
_.delay(function () {
eventManager.sendEvent(constants.EVENT_CHANGE_VIEW, {route: router.configuration.routes.managedListView});
var promises = [];
if(this.data.repoObject.dbStructure.orientdbClass["managed_"+this.data.currentManagedObject.name] !== undefined){
delete this.data.repoObject.dbStructure.orientdbClass["managed_"+this.data.currentManagedObject.name];
promises.push(ConfigDelegate.updateEntity("managed", {"objects" : this.data.managedObjects.objects}));
eventManager.sendEvent(constants.EVENT_CHANGE_VIEW, {route: router.configuration.routes.managedListView});
return managedObject;
var checkboxes,
addedEvents:[],
currentObject: {},
hasWorkflow: true
customValidate: function() {
return new AddEditManagedView();