[Common UI] Add JSDoc, remove UUIDService

Add JSDoc to Create-related classes and remove the
UUIDService (replaced by third-party lib) to reduce
amount of code to cover and prepare for code review,
as part of ongoing transition of common user interface
elements, WTD-574.
This commit is contained in:
Victor Woeltjen
2014-11-25 16:14:09 -08:00
parent 242d40fab2
commit b97e2d0324
5 changed files with 65 additions and 39 deletions

View File

@@ -24,6 +24,14 @@ define(
properties = type.getProperties();
return {
/**
* Get the form model for this wizard; this is a description
* that will be rendered to an HTML form. See the
* platform/forms bundle
*
* @return {FormModel} formModel the form model to
* show in the create dialog
*/
getFormModel: function () {
var parentRow = Object.create(parent),
sections = [];
@@ -51,9 +59,19 @@ define(
name: "Create a New " + type.getName()
};
},
/**
* Based on a populated form, get the domain object which
* should be used as a parent for the newly-created object.
* @return {DomainObject}
*/
getLocation: function (formValue) {
return formValue.createParent || parent;
},
/**
* Create the domain object model for a newly-created object,
* based on user input read from a formModel.
* @return {object} the domain object' model
*/
createModel: function (formValue) {
// Clone
var newModel = JSON.parse(JSON.stringify(model));

View File

@@ -4,8 +4,8 @@
* Module defining CreateService. Created by vwoeltje on 11/10/14.
*/
define(
[],
function () {
["../../lib/uuid"],
function (uuid) {
"use strict";
var NON_PERSISTENT_WARNING =
@@ -14,10 +14,11 @@ define(
"Could not add to composition; no composition in ";
/**
*
* The creation service is responsible for instantiating and
* persisting new domain objects. This is
* @constructor
*/
function CreationService(persistenceService, uuidService, $q, $log) {
function CreationService(persistenceService, $q, $log) {
function doPersist(space, id, model) {
return persistenceService.createObject(
@@ -66,7 +67,7 @@ define(
if (persistence) {
space = persistence.getSpace();
return $q.when(
uuidService.getUUID()
uuid()
).then(function (id) {
return doPersist(space, id, model);
}).then(function (id) {

View File

@@ -1,29 +0,0 @@
/*global define,Promise*/
/**
* Module defining UUIDService. Created by vwoeltje on 11/12/14.
*/
define(
[],
function () {
"use strict";
/**
*
* @constructor
*/
function UUIDService() {
var counter = Date.now();
return {
getUUID: function () {
counter += 1;
return counter.toString(36);
}
};
}
return UUIDService;
}
);