Class Ozone.pref.PrefServer
Defined in: preference.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Ozone.pref.PrefServer(_url)
This object is used to create, retrieve, update and delete user preferences.
|
| Method Attributes | Method Name and Description |
|---|---|
|
cloneDashboard(cfg)
Copies an existing dashboard and saves it as new
|
|
|
Saves changes to a new or existing dashboard
|
|
|
deleteDashboard(cfg)
Deletes the dashboard with the specified id
|
|
|
deleteUserPreference(cfg)
Deletes a user preference with the provided namespace and name.
|
|
|
Checks for the existence of a user preference for a given namespace and name
|
|
|
findDashboards(cfg)
Returns all dashboards for the logged in user.
|
|
|
findDashboardsByType(cfg)
Returns all dashboards for the logged in user filtered by the type of dashboard.
|
|
|
findWidgets(cfg)
Gets all widgets for a given user.
|
|
|
getCurrentUser(cfg)
retrieves the current user logged into the system
|
|
|
getDashboard(cfg)
Gets the dashboard with the specified id
|
|
|
getDefaultDashboard(cfg)
Gets the user's default dashboard
|
|
|
getServerVersion(cfg)
For retrieving the OWF system server version
|
|
|
getUrl()
Get the url for the Preference Server
|
|
|
getUserPreference(cfg)
Retrieves the user preference for the provided name and namespace
|
|
|
getWidget(cfg)
Gets the widget with the specified id
|
|
|
setDefaultDashboard(cfg)
Sets the user's default dashboard
|
|
|
setUrl(url)
Sets the url for the Preference Server
|
|
|
setUserPreference(cfg)
Creates or updates a user preference for the provided namespace and name.
|
|
|
Saves changes to existing dashboards
|
|
|
Saves changes to existing widgets
|
Class Detail
Ozone.pref.PrefServer(_url)
This object is used to create, retrieve, update and delete user preferences. A user preference is simply a string
stored in OWF that is uniquely mapped to a user, namespace, and name combination.
All public methods of this class accept an onSuccess function. This function is executed upon successful completion of the requested operation and is passed a copy of the preference object.
All public methods of this class accept an onSuccess function. This function is executed upon successful completion of the requested operation and is passed a copy of the preference object.
The following is an example of a preference object passed to the onSuccess
function:
{
"value":"true",
"path":"militaryTime",
"user":
{
"userId":"testAdmin1"
},
"namespace":"com.mycompany.AnnouncingClock"
}
Where:
value: The preference value that is stored in the database. This can be any string
including JSON.
path: The name of the user preference.
user: The user object. The only user information returned at this time is the user
ID.
namespace: The namespace of the requested user preference.
- Parameters:
- _url
- Requires:
- Ozone.util.Transport
Method Detail
cloneDashboard(cfg)
Copies an existing dashboard and saves it as new
var onSuccess = function(dashboard) {
alert(dashboard.name);
};
var onFailure = function(error) {
alert(error);
};
var dashboard = {
alteredByAdmin: 'false',
createdDate: '04/18/2012 11:29 AM EDT',
isGroupDashboard: false,
layout: 'desktop',
isdefault: false,
name: 'My Dashboard',
columnCount: 0,
user: {
userId: 'testAdmin1',
},
EDashboardLayoutList: ['accordion', 'desktop', 'portal', 'tabbed'],
defaultSettings: {},
createdBy: {
userId: 'testAdmin1',
userRealName: 'Test Admin 1'
},
editedDate: '04/18/2012 11:29 AM EDT',
groups: [],
description: 'This is my dashboard',
guid: guid.util.guid(),
state: [],
showLaunchMenu: false
};
Ozone.pref.PrefServer.cloneDashboard({
json: dashboard,
onSuccess: onSuccess,
onFailure: onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Object} cfg.json
- The encoded JSON object representing the dashboard.
The dashboard object has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
This method will be passed the dashboard object which has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
createOrUpdateDashboard(cfg)
Saves changes to a new or existing dashboard
var onSuccess = function(dashboard) {
alert(dashboard.name);
};
var onFailure = function(error) {
alert(error);
};
var dashboard = {
alteredByAdmin: 'false',
createdDate: '04/18/2012 11:29 AM EDT',
isGroupDashboard: false,
layout: 'desktop',
isdefault: false,
name: 'My Dashboard',
columnCount: 0,
user: {
userId: 'testAdmin1',
},
EDashboardLayoutList: ['accordion', 'desktop', 'portal', 'tabbed'],
defaultSettings: {},
createdBy: {
userId: 'testAdmin1',
userRealName: 'Test Admin 1'
},
editedDate: '04/18/2012 11:29 AM EDT',
groups: [],
description: 'This is my dashboard',
guid: guid.util.guid(),
state: [],
showLaunchMenu: false
};
Ozone.pref.PrefServer.createOrUpdateDashboard({
json: dashboard,
saveAsNew: true,
onSuccess: onSuccess,
onFailure: onFailure,
async: true
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Object} cfg.json
- The encoded JSON object representing the dashboard.
The dashboard object has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Boolean} cfg.saveAsNew
- A Boolean indicating whether the entity being saved is new.
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
This method will be passed the dashboard object which has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
- {Boolean} cfg.async Optional
- Async true or false defaults to true
deleteDashboard(cfg)
Deletes the dashboard with the specified id
var onSuccess = function(dashboard) {
alert(dashboard.name);
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.deleteDashboard({
dashboardId:'917b4cd0-ecbd-410b-afd9-42d150c26426',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.dashboardId
- Unigue dashbard identifier
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
This method will be passed the dashboard object which has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
deleteUserPreference(cfg)
Deletes a user preference with the provided namespace and name.
The following is an example of a complete preference object passed to the onSuccess
function:
{
"value":"true",
"path":"militaryTime",
"user":
{
"userId":"testAdmin1"
},
"namespace":"com.mycompany.AnnouncingClock"
}
function onSuccess(pref){
alert(pref.value);
}
function onFailure(error,status){
alert('Error ' + error);
alert(status);
}
Ozone.pref.PrefServer.deleteUserPreference({
namespace:'com.company.widget',
name:'First President',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.namespace
- The namespace of the user preference
- {String} cfg.name
- The name of the user preference
- {Function} cfg.onSuccess
- The function to be called if the user preference is successfully deleted from the database.
- {Function} cfg.onFailure Optional
- The function to be called if the user preference cannot be deleted from the
database or if the preference does not exist. If this function is not specified a default error message will be
displayed. This function is passed back the following parameters:
error: String
The error message
Status: The HTTP Status code
401: You are not authorized to access this entity.
500: An unexpected error occurred.
404: The user preference was not found.
400: The requested entity failed to pass validation.
doesUserPreferenceExist(cfg)
Checks for the existence of a user preference for a given namespace and name
var onSuccess = function(obj) {
if (obj.statusCode = 200) {
alert(obj.preferenceExist);
}
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.doesUserPreferenceExist({
namespace:'foo.bar.0',
name:'test path entry 0',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.namespace
- The namespace of the requested user
- {String} cfg.name
- The name of the requested user
- {Function} cfg.onSuccess
- The callback function that is called if a preference successfully return from the database.
This method is passed an object having the following properties:
{Number} statusCode: status code
{Boolean} preferenceExist: true if preference exists
- {Function} cfg.onFailure Optional
- The callback function that is called if the preference could not be found in the database. Callback parameter is an error string.
findDashboards(cfg)
Returns all dashboards for the logged in user.
var onSuccess = function(obj) {
alert(obj.results);
if (obj.results > 0) {
for (var i = 0; i < obj.results; i++) {
alert(obj.data[i].name);
}
}
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.findDashboards({
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Function} cfg.onSuccess
- Callback function to capture the success result.
This method is passed an object having the following properties:
{Boolean} success: true if dashboards found
{Number} results: number of dashboards found
{Array} data: array of dashboards objects found. Dashboard object has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
findDashboardsByType(cfg)
Returns all dashboards for the logged in user filtered by the type of dashboard.
var onSuccess = function(obj) {
alert(obj.results);
if (obj.results > 0) {
for (var i = 0; i < obj.results; i++) {
alert(obj.data[i].name);
}
}
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.findDashboardsByType({
type:'desktop',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.type
- A string representing the type of dashboard. If using built in dashboard types, this would include desktop, tabbed, portal, and accordion.
- {Function} cfg.onSuccess
- Callback function to capture the success result.
This method is passed an object having the following properties:
{Boolean} success: true if dashboards found
{Number} results: number of dashboards found
{Array} data: array of dashboards objects found. Dashboard object has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
findWidgets(cfg)
Gets all widgets for a given user.
var onSuccess = function(widgets) {
if (widgets.length > 0) {
alert(widgets[0].value.namespace);
}
};
var onFailure = function(error, status) {
alert(error);
};
Ozone.pref.PrefServer.findWidgets({
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Boolean} cfg.userOnly Optional
- boolean flag that determines whether to only return widgets assigned to the user (excluding widgets to which the user only has access via their assigned groups)
- {Object} cfg.searchParams Optional
- object containing search parameters
- {String} cfg.searchParams.widgetName Optional
- name of widget '%' are wildcards
- {String} cfg.searchParams.widgetNameExactMatch Optional
- true or false to match the name exactly. defaults to false
- {String} cfg.searchParams.widgetVersion Optional
- version of widget '%' are wildcards
- {String} cfg.searchParams.widgetGuid Optional
- Guid of widget '%' are wildcards
- {String} cfg.searchParams.universalName Optional
- Universal name of widget '%' are wildcards
- {Function} cfg.onSuccess
- callback function to capture the success result.
This method is passed an array of objects having the following properties:
{Number} id: database pk identifier
{String} namespace: "widget"
{Object} value: widget object having the following properties:
{Boolean} editable: true if widget can be edited
{Boolean} visible: true if widget is visible
{Number} position
{String} userId: widget owner identifier
{String} userRealName: widget owner name
{String} namespace: widget name
{String} url: url of widget application
{String} headerIcon: url of widget header icon
{String} image: url of widget image
{String} smallIconUrl: url of widget's small icon
{String} largeIconUrl: url of widget's large icon
{Number} width: width of the widget in pixels
{Number} height: height of the widget in pixels
{Number} x: x-axis position
{Number} y: y-axis position
{Boolean} minimized: true if widget is minimized
{Boolean} maximized: true if widget is maximized
{String} widgetVersion: widget version
{Array} tags: array of tag strings
{Boolean} definitionVisible: true if definition is visible
{Boolean} singleton: true if widget is a singleton
{Boolean} background: true if widget runs in the background
{Array} allRequired: array of all widgets required by this widget
{Array} directRequired: array of all widgets directly required by this widget
{Array} widgetTypes: array of widget types this widget belongs to
{String} path: The guid of the widget.
- {Function} cfg.onFailure Optional
- callback to execute if there is an error (optional, a default alert provided). This callback is called with two parameters: a error message string, and optionally a status code
getCurrentUser(cfg)
retrieves the current user logged into the system
var onSuccess = function(obj) {
if (obj) {
alert(obj.currentUser);
}
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.getCurrentUser({
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Function} cfg.onSuccess
- The callback function that is called for a successful retrieval of the user logged in.
This method is passed an object having the following properties:
{String} currentUserName: user name
{String} currentUser: user real name
{Date} currentUserPrevLogin: previous login date
{Number} currentId: database pk index
- {Function} cfg.[onFailure]
- The callback function that is called when the system is unable to retrieve the current user logged in. Callback parameter is an error string.
getDashboard(cfg)
Gets the dashboard with the specified id
var onSuccess = function(dashboard) {
alert(dashboard.name);
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.getDashboard({
dashboardId:'917b4cd0-ecbd-410b-afd9-42d150c26426',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.dashboardId
- Unigue dashbard identifier
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback parameter is json representation of a dashboard.
This method will be passed the dashboard object which has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
getDefaultDashboard(cfg)
Gets the user's default dashboard
var onSuccess = function(dashboard) {
alert(dashboard.name);
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.getDefaultDashboard({
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
This method will be passed the dashboard object which has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
getServerVersion(cfg)
For retrieving the OWF system server version
var onSuccess = function(obj) {
if (obj) {
alert(obj.serverVersion);
}
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.getServerVersion({
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {Function} cfg.onSuccess
- The callback function that is called for successfully retrieving the server version of the OWF system.
This method is passed an object having the following properties:
{String} {serverVersion: server version
- {Function} cfg.onFailure Optional
- The callback function that is called when the system fails to retrieve the server version of the OWF system. Callback parameter is an error string.
{String}
getUrl()
Get the url for the Preference Server
- Returns:
- {String} url
getUserPreference(cfg)
Retrieves the user preference for the provided name and namespace
The following is an example of a complete preference object passed to the onSuccess
function:
{
"value":"true",
"path":"militaryTime",
"user":
{
"userId":"testAdmin1"
},
"namespace":"com.mycompany.AnnouncingClock"
}
The following shows how to make a call to getUserPreference:
function onSuccess(pref){
alert(Ozone.util.toString(pref.value));
}
function onFailure(error,status){
alert('Error ' + error);
alert(status);
}
// The following code calls getUserPreference with the above defined onSuccess and
// onFailure callbacks.
Ozone.pref.PrefServer.getUserPreference({
namespace:'com.company.widget',
name:'First President',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.namespace
- The namespace of the requested user preference
- {String} cfg.name
- The name of the requested user preference
- {Function} cfg.onSuccess
- The function to be called if the user preference is successfully retrieved from the database. This function takes a single argument, which is a JSON object. If a preference is found, the complete JSON structure as shown below will be returned. If it is not found this function be passed an empty JSON object.
- {Function} cfg.onFailure Optional
- This parameter is optional. If this function is not specified a default error
message will be displayed.This function is called if an error occurs on preference retrieval. It is not
called if the preference is simply missing.
This function should accept two arguments:
error: String
The error message
Status: The numeric HTTP Status code (if applicable)
401: You are not authorized to access this entity.
500: An unexpected error occurred.
404: The user preference was not found.
400: The requested entity failed to pass validation.
getWidget(cfg)
Gets the widget with the specified id
var onSuccess = function(obj) {
if (obj.value) {
alert(obj.value.namespace);
}
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.getWidget({
widgetId:'ea5435cf-4021-4f2a-ba69-dde451d12551',
widgetUuid: 'com.company.widget.name',
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.widgetId
- The guid of the widget.
- {String} cfg.universalName
- The universal name for the widget.
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback is passed the following object as a parameter: {id:Number, namespace:String, value:Object, path:String}
This method is passed an object having the following properties:
{Number} id: database pk identifier
{String} namespace: "widget"
{Object} value: widget object having the following properties:
{Boolean} editable: true if widget can be edited
{Boolean} visible: true if widget is visible
{Number} position
{String} userId: widget owner identifier
{String} userRealName: widget owner name
{String} namespace: widget name
{String} url: url of widget application
{String} headerIcon: url of widget header icon
{String} image: url of widget image
{String} smallIconUrl: url of widget's small icon
{String} largeIconUrl: url of widget's large icon
{Number} width: width of the widget in pixels
{Number} height: height of the widget in pixels
{Number} x: x-axis position
{Number} y: y-axis position
{Boolean} minimized: true if widget is minimized
{Boolean} maximized: true if widget is maximized
{String} widgetVersion: widget version
{Array} tags: array of tag strings
{Boolean} definitionVisible: true if definition is visible
{Boolean} singleton: true if widget is a singleton
{Boolean} background: true if widget runs in the background
{Array} allRequired: array of all widgets required by this widget
{Array} directRequired: array of all widgets directly required by this widget
{Array} widgetTypes: array of widget types this widget belongs to
{String} path: The guid of the widget.
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
setDefaultDashboard(cfg)
Sets the user's default dashboard
var onSuccess = function(dashboard) {
alert(dashboard.name);
};
var onFailure = function(error) {
alert(error);
};
Ozone.pref.PrefServer.setDefaultDashboard({
dashboardId:'917b4cd0-ecbd-410b-afd9-42d150c26426',
isDefault:true,
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.dashboardId
- Unigue dashbard identifier
- {Boolean} cfg.isDefault
- true to set as default dashboard
- {Function} cfg.onSuccess
- Callback function to capture the success result. Callback parameter is json representation of a Dashboard.
This method will be passed the dashboard object which has the following properties:
{Boolean} alteredByAdmin: true if altered by an administrator
{Date} createdDate: date dashboard was created
{Boolean} isGroupDashboard: true if dashboard is a group dashboard
{String} layout: layout of dashboard
{Boolean} isdefault: true if this is a default dashboard
{String} name: name of dashboard
{Number} columnCount: number of columns if dashboard is a portal type
{Object} user: the dashoard owner. Has the following properties:
{String} userId: unique user identifier
{List} EDashboardLayoutList: list of dashboard types
{String} defaultSettings: JSON string of default settings which varies by dashboard type
{Object} createdBy: dashboard creator. Has the following properties:
{String} userId: unique user identifier
{String} userRealName: user's name
{Date} editedDate: date dashboard was last edited
{Array} groups: groups dashboard is assigned to
{String} description: description of dashboard
{String} guid: uniqued dashboard identifier
{Array} state: array of widget state objects. Has the following properties:
{String} widgetGuid: unique widget identifier
{Number} width: width of widget in pixels
{Number} zIndex: in pixels
{String} region: containing region on dashboard. Dashboard type specific.
{Boolean} pinned: true if widget is pinned open
{String} buttonId: identifier of button that opens widget
{Number} height: height of widget in pixels
{Number} columnPos: position of widget in a column
{String} name: widget name
{Number} statePosition
{Boolean} active: true if this widget is the active (has focus) widget
{String} uniqueId: unique widget identifier on dashboard
{Boolean} minimized: true if widget is minimized
{Boolean} buttonOpened: true if button launched widget is opened
{Boolean} collapsed: true if widget is collapsed
{Number} y: y-axis position in pixels
{Number} x: x-axis position in pixels
{Boolean} maximized: true if widget is maximized
{Boolean} showLaunchMenu: true if launch menu is opened on dashboard
- {Function} cfg.onFailure Optional
- Callback to execute if there is an error (optional, a default alert provided). Callback parameter is an error string.
setUrl(url)
Sets the url for the Preference Server
- Parameters:
- {String} url
- Returns:
- void
setUserPreference(cfg)
Creates or updates a user preference for the provided namespace and name.
The following is an example of a complete preference object passed to the onSuccess
function:
{
"value":"true",
"path":"militaryTime",
"user":
{
"userId":"testAdmin1"
},
"namespace":"com.mycompany.AnnouncingClock"
}
function onSuccess(pref){
alert(pref.value);
}
function onFailure(error,status){
alert('Error ' + error);
alert(status);
}
var text = 'George Washington';
Ozone.pref.PrefServer.setUserPreference({
namespace:'com.company.widget',
name:'First President',
value:text,
onSuccess:onSuccess,
onFailure:onFailure
});
- Parameters:
- {Object} cfg
- config object see below for properties
- {String} cfg.namespace
- The namespace of the user preference
- {String} cfg.name
- The name of the user preference
- {String} cfg.value
- The value of the user preference. The value can be any string including JSON.
- {Function} cfg.onSuccess
- The function to be called if the user preference is successfully updated in the database.
- {Function} cfg.onFailure Optional
- The function to be called if the user preference cannot be stored in the database.
If this function is not specified a default error message will be displayed. This function is passed
back the following parameters:
error: String
The error message
Status: The HTTP Status code
401: You are not authorized to access this entity.
500: An unexpected error occurred.
404: The requested entity was not found.
400: The requested entity failed to pass validation.
updateAndDeleteDashboards(cfg)
Saves changes to existing dashboards
- Parameters:
- {Object} cfg
- config object see below for properties
- {Array} cfg.viewsToUpdate
- array of JSON objects containing the view guid and data to be updated
- {Array} cfg.viewGuidsToDelete
- array of guids of views to be deleted
- {Boolean} cfg.updateOrder
- flag to update order
- {Function} cfg.onSuccess
- callback function to capture the success result
- {Function} cfg.onFailure Optional
- callback to execute if there is an error (optional, a default alert provided)
updateAndDeleteWidgets(cfg)
Saves changes to existing widgets
- Parameters:
- {Object} cfg
- config object see below for properties
- {Array} cfg.widgetsToUpdate
- array of JSON objects containing the widget guid and data to be updated
- {Array} cfg.widgetGuidsToDelete
- array of guids of widgets to be deleted
- {Boolean} cfg.updateOrder
- flag to update order
- {Function} cfg.onSuccess
- callback function to capture the success result
- {Function} cfg.onFailure Optional
- callback to execute if there is an error (optional, a default alert provided)