123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- //
- // IBM Confidential
- // OCO Source Materials
- // BI and PM: Mobile
- // (C) Copyright IBM Corp. 2013
- // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- //
- dojo.provide('mobileAdmin.serverConfig.model.MobileConfigurationModel');
- // dojo dependencies
- dojo.require('dojo.store.Memory');
- dojo.require('dojo.data.ObjectStore');
- dojo.declare('mobileAdmin.serverConfig.model.MobileConfigurationModel', null, {
- constructor: function(args){
- dojo.mixin(this, args);
- this.setCognosExpressMode(this.cognosExpressMode);
- this.setDataObjectKey(this.dataObjectKey);
- this.setDataObject(this.dataObject);
- this.setObjectStore(this.objectStore);
- this.setDojoData(this.dojoData);
- },
- cognosExpressMode:false,
- dataObjectKey:null,
- dataObject:null,
- objectStore:null,
- dojoData:null,
-
- setCognosExpressMode: function(expressMode) {
- if(typeof expressMode != "boolean") {
- this.cognosExpressMode = false;
- } else {
- this.cognosExpressMode = expressMode;
- }
- },
- setDataObjectKey: function(dataObjectKey) {
- if(!dataObjectKey) {
- this.dataObjectKey = "";
- }
- },
- setDataObject: function(dataObject) {
- if(!dataObject) {
- this.dataObject = [];
- }
- },
- setObjectStore: function(objectStore) {
- if(!objectStore) {
- this.objectStore = new dojo.store.Memory({data:this.dataObject, idProperty:this.dataObjectKey});
- }
- },
- setDojoData: function(dojoData) {
- if(!dojoData) {
- this.dojoData = new dojo.data.ObjectStore({objectStore:this.objectStore});
- }
- },
-
- queryProperties: function() {
- var configProperties = [];
- this.objectStore.query({})
- .forEach( function(property) {
- configProperties.push(property);
- });
- return configProperties;
- },
- queryGroupLabels: function() {
- var configPropertyGroups = [];
- this.objectStore.query({}, {
- sort:[{attribute:'parentID', descending:false}]
- }).map( function(property) {
- return property;
- }).forEach( dojo.hitch(this, function(property) {
- var parentLabel = property.parentLabel;
- var index = dojo.indexOf(configPropertyGroups, parentLabel);
- if(-1 == index) {
- if(this.cognosExpressMode) {
- if(property.displayInExpressMode) {
- configPropertyGroups.push(parentLabel);
- }
- } else {
- configPropertyGroups.push(parentLabel);
- }
- }
- }));
- return configPropertyGroups;
- },
- queryGroupProperties: function(propertyGroupLabel) {
- var configProperties = [];
- this.objectStore.query({parentLabel:propertyGroupLabel}, {
- sort:[{attribute:'propertyID', descending:false}]
- }).map( function(property) {
- return property;
- }).forEach( dojo.hitch(this, function(property) {
- if(this.cognosExpressMode) {
- if(property.displayInExpressMode) {
- configProperties.push(property);
- }
- } else {
- configProperties.push(property);
- }
- }));
- return configProperties;
- }
- });
|