Skip to content
This repository was archived by the owner on Jan 22, 2024. It is now read-only.

Commit 2dfa716

Browse files
committed
updates to add workflow items
1 parent fd87ceb commit 2dfa716

4 files changed

Lines changed: 93 additions & 11 deletions

File tree

digexp-wcm-design/lib/wcmOperations.js

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ baseUrl = '/wcmrest/',
1919
cEditmedia = "edit-media",
2020
cElements = "elements",
2121
cAlternate = "alternate",
22+
cAuthoringTemplates = 'Authoring Templates',
23+
cPresentationTemplates = 'Presentation Templates',
24+
cComponents = 'Components',
25+
cWorkflowItems = 'Workflow Items',
26+
cWorkflowStages = 'Workflow Stages',
27+
cWorkflowActions = 'Workflow Actions',
2228
wcmExts = {
2329
LibraryHTMLComponent: ".html",
2430
HTMLComponent: "_html.html",
@@ -46,6 +52,10 @@ wcmExts = {
4652
NumericComponent: "_number.txt",
4753
OptionSelectionComponent: "_optionselection.txt",
4854
UserSelectionComponent: "_userselecttion.txt",
55+
TaxonomyComponent: "_taxonomy.txt",
56+
CustomWorkflowAction: "_customworkflowaction.txt",
57+
WorkflowAction: "_workflowaction.txt",
58+
WorkflowStage: "_workflowstage.txt",
4959
FileComponent: "_file.txt"
5060
},
5161
wcmTypes = {
@@ -69,6 +79,10 @@ wcmTypes = {
6979
,listPresetationComponent: "LibraryListPresentationComponent"
7080
,navigatorComponent: "LibraryNavigatorComponent"
7181
,menuComponent: "LibraryMenuComponent"
82+
,taxonomyComponent: "TaxonomyComponent"
83+
,customWorkflowAction: "CustomWorkflowAction"
84+
,workflowAction: "WorkflowAction"
85+
,workflowStage: "WorkflowStage"
7286
,folder: "Folder"
7387
,library: "Library"
7488
};
@@ -786,6 +800,8 @@ function updateWcmItem(type, item, fileName){
786800
if(wcmTypes.referenceComponent == type ||
787801
wcmTypes.linkComponent == type ||
788802
wcmTypes.dateComponent == type||
803+
wcmTypes.customWorkflowAction == type||
804+
wcmTypes.workflowStage == type||
789805
wcmTypes.numericComponent == type ||
790806
wcmTypes.jspComponent == type
791807
){
@@ -1026,11 +1042,19 @@ function getFolderForType(type){
10261042
var rVal = "";
10271043
switch(type){
10281044
case wcmTypes.presentationTemplate:{
1029-
rVal = "Presentation Templates";
1045+
rVal = cPresentationTemplates;
10301046
break;
10311047
}
10321048
case wcmTypes.contentTemplate:{
1033-
rVal = "Authoring Templates";
1049+
rVal = cAuthoringTemplates;
1050+
break;
1051+
}
1052+
case wcmTypes.workflowAction:{
1053+
rVal = cWorkflowItems + Path.sep + cWorkflowActions;
1054+
break;
1055+
}
1056+
case wcmTypes.workflowStage:{
1057+
rVal = cWorkflowItems + Path.sep + cWorkflowStages;
10341058
break;
10351059
}
10361060
default: {
@@ -1088,6 +1112,16 @@ function setUpDataForType(item, type, fileName){
10881112
rVal = {value: {entry:{content: {type: 'application/vnd.ibm.wcm+xml', date: JSON.parse(data)}}}};
10891113
break;
10901114
}
1115+
case wcmTypes.customWorkflowAction:{
1116+
var data = fs.readFileSync(fileName, "utf8");
1117+
rVal = {value: {entry:{content: {type: 'application/vnd.ibm.wcm+xml', customAction: JSON.parse(data)}}}};
1118+
break;
1119+
}
1120+
case wcmTypes.workflowStage:{
1121+
var data = fs.readFileSync(fileName, "utf8");
1122+
rVal = {value: {entry:{content: {type: 'application/vnd.ibm.wcm+xml', workflowStage: JSON.parse(data)}}}};
1123+
break;
1124+
}
10911125
case wcmTypes.numericComponent:{
10921126
var data = fs.readFileSync(fileName, "utf8");
10931127
rVal = {value: {entry:{content: {type: 'application/vnd.ibm.wcm+xml', double: data}}}};
@@ -1113,7 +1147,6 @@ function setUpDataForType(item, type, fileName){
11131147
}
11141148
case wcmTypes.imageComponent:{
11151149
var binaraydata = fs.readFileSync(fileName);
1116-
11171150
var ext = Path.extname(fileName).slice(1);
11181151
rVal = { type: 'image/' + ext, value: binaraydata };
11191152
break;
@@ -1348,6 +1381,16 @@ function clearFolderMap(){
13481381
folderMapMap = new HashMap();
13491382
}
13501383

1384+
exports.cAuthoringTemplates= cAuthoringTemplates;
1385+
exports.cPresentationTemplates= cPresentationTemplates;
1386+
exports.cComponents= cComponents;
1387+
exports.cWorkflowItems= cWorkflowItems;
1388+
exports.cWorkflowActions= cWorkflowActions;
1389+
exports.cWorkflowStages= cWorkflowStages;
1390+
exports.cAuthoringTemplates= cAuthoringTemplates;
1391+
exports.cAuthoringTemplates= cAuthoringTemplates;
1392+
exports.cAuthoringTemplates= cAuthoringTemplates;
1393+
exports.cAuthoringTemplates= cAuthoringTemplates;
13511394
exports.wcmTypes= wcmTypes;
13521395
exports.wcmExts= wcmExts;
13531396
exports.clearFolderMap = clearFolderMap;exports.getWcmItemsOfType = getWcmItemsOfType;

digexp-wcm-design/test/wcmHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const TEST_PORT = 10039;
1919
const TEST_CONTENT_HANDLER = "/wps/mycontenthandler";
2020
const TEST_NOT_SECURE = false;
2121
const TEST_SECURE = true;
22-
const TEST_SECURE_PORT = 10041;
22+
const TEST_SECURE_PORT = 10042;
2323

2424
const BAD_USERNAME = "justfortesting";
2525
const BAD_PASSWORD = "alsorgangrpgaasgoijgoah842948aofwehffortesting";

digexp-wcm-design/wcmHelper.js

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ var authRequest = require('./lib/wcm-authenticated-request'),
4747
curSecure = false,
4848
curPullLibrary = undefined,
4949
cElementsDir = '-elements',
50-
cFile = '-file',
51-
cAuthoringTemplates = 'Authoring Templates';
50+
cFile = '-file';
51+
5252

5353
/**
5454
* progGoal: the number of steps in progress (if more than one operation is being
@@ -134,11 +134,15 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
134134
var libSettings = utils.getSettings(wcmCwd + libTitle + Path.sep);
135135
options = utils.getMergerdOptions(options || {}, libSettings);
136136
createFolder(wcmCwd + libTitle);
137-
createFolder(wcmCwd + libTitle + Path.sep + 'Presentation Templates');
138-
createFolder(wcmCwd + libTitle + Path.sep + 'Components');
137+
createFolder(wcmCwd + libTitle + Path.sep + wcmRequests.cPresentationTemplates);
138+
createFolder(wcmCwd + libTitle + Path.sep + wcmRequests.cComponents);
139139
// only do content template components if the user turns on trial code
140-
if(options.trial && options.trial == true)
141-
createFolder(wcmCwd + libTitle + Path.sep + cAuthoringTemplates);
140+
if(options.trial && options.trial == true){
141+
createFolder(wcmCwd + libTitle + Path.sep + wcmRequests.cAuthoringTemplates);
142+
createFolder(wcmCwd + libTitle + Path.sep + wcmRequests.cWorkflowItems);
143+
createFolder(wcmCwd + libTitle + Path.sep + wcmRequests.cWorkflowItems + Path.sep + wcmRequests.cWorkflowStages);
144+
createFolder(wcmCwd + libTitle + Path.sep + wcmRequests.cWorkflowItems + Path.sep + wcmRequests.cWorkflowActions);
145+
}
142146
progGoal++;
143147
eventEmitter.emit("pullingLib", libTitle);
144148
wcmRequests.getFolderMap(libTitle).then(function(map) {
@@ -197,7 +201,13 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
197201
eventEmitter.emit("pullingType", libTitle, wcmRequests.wcmTypes.linkComponent);
198202
pullType(options, wcmRequests.wcmTypes.linkComponent, libTitle, ".link", map).then(function(count) {
199203
totalCount += count;
200-
204+
eventEmitter.emit("pullingType", libTitle, wcmRequests.wcmTypes.customWorkflowAction);
205+
pullType(options, wcmRequests.wcmTypes.customWorkflowAction, libTitle, ".link", map).then(function(count) {
206+
totalCount += count;
207+
eventEmitter.emit("pullingType", libTitle, wcmRequests.wcmTypes.workflowStage);
208+
pullType(options, wcmRequests.wcmTypes.workflowStage, libTitle, ".link", map).then(function(count) {
209+
totalCount += count;
210+
201211
eventEmitter.emit("pullingType", libTitle, wcmRequests.wcmTypes.richTextComponent);
202212
pullType(options, wcmRequests.wcmTypes.richTextComponent, libTitle, ".rtf", map).then(function(count) {
203213
totalCount += count;
@@ -222,6 +232,16 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
222232
deferred.reject(err);
223233
eventEmitter.emit("error", err, "pullLibrary::richTextComponent::err::"+err);
224234
});
235+
}, function(err) {
236+
debugLogger.error("pullLibrary::workflowStage::err::"+err);
237+
deferred.reject(err);
238+
eventEmitter.emit("error", err, "pullLibrary::workflowStage::err::"+err);
239+
});
240+
}, function(err) {
241+
debugLogger.error("pullLibrary::customWorkflowAction::err::"+err);
242+
deferred.reject(err);
243+
eventEmitter.emit("error", err, "pullLibrary::customWorkflowAction::err::"+err);
244+
});
225245
}, function(err) {
226246
debugLogger.error("pullLibrary::linkComponent::err::"+err);
227247
deferred.reject(err);
@@ -384,6 +404,16 @@ init = function(host, port, contentPath, user, password, secure, wcmDir) {
384404
name = name.substring(0, name.indexOf(wcmRequests.wcmExts.LibraryNumericComponent.substr(0,wcmRequests.wcmExts.LibraryNumericComponent.indexOf('.'))));
385405
itemType = wcmRequests.wcmTypes.numericComponent;
386406
}
407+
else
408+
if(file.indexOf(wcmRequests.wcmExts.CustomWorkflowAction) != -1){
409+
name = name.substring(0, name.indexOf(wcmRequests.wcmExts.CustomWorkflowAction.substr(0,wcmRequests.wcmExts.CustomWorkflowAction.indexOf('.'))));
410+
itemType = wcmRequests.wcmTypes.customWorkflowAction;
411+
}
412+
else
413+
if(file.indexOf(wcmRequests.wcmExts.WorkflowStage) != -1){
414+
name = name.substring(0, name.indexOf(wcmRequests.wcmExts.WorkflowStage.substr(0,wcmRequests.wcmExts.WorkflowStage.indexOf('.'))));
415+
itemType = wcmRequests.wcmTypes.workflowStage;
416+
}
387417
else
388418
itemType = wcmRequests.wcmTypes.textComponent;
389419
} else if (ext == ".rtf") {
@@ -515,6 +545,9 @@ function isTrialComponent(type){
515545
type == wcmRequests.wcmTypes.jspComponent ||
516546
type == wcmRequests.wcmTypes.linkComponent ||
517547
type == wcmRequests.wcmTypes.numericComponent ||
548+
type == wcmRequests.wcmTypes.numericComponent ||
549+
type == wcmRequests.wcmTypes.customWorkflowAction ||
550+
type == wcmRequests.wcmTypes.workflowStage ||
518551
type == wcmRequests.wcmTypes.dateComponent );
519552
}
520553

@@ -689,6 +722,12 @@ function updateLocalFile(options, libTitle, data, extension, map){
689722
else if(wcmRequests.wcmTypes.linkComponent == wtype){
690723
fs.writeFileSync(path + wcmRequests.wcmExts[wtype], JSON.stringify(cData.linkElement));
691724
}
725+
else if(wcmRequests.wcmTypes.customWorkflowAction == wtype){
726+
fs.writeFileSync(path + wcmRequests.wcmExts[wtype], JSON.stringify(cData.customAction));
727+
}
728+
else if(wcmRequests.wcmTypes.workflowStage == wtype){
729+
fs.writeFileSync(path + wcmRequests.wcmExts[wtype], JSON.stringify(cData.workflowStage));
730+
}
692731
else if(cData != undefined) // check there is data to write
693732
fs.writeFileSync(path + extension, cData.value);
694733
if(options == undefined || options.includeMeta == undefined || options.includeMeta == true) {

wcm-design.tar.gz

6.44 KB
Binary file not shown.

0 commit comments

Comments
 (0)