process_parameter = {
application : ''
};
function process_query() {
var str = '
';
$('#content').html(str);
$('#query').click(function() {
process_listWithApplication($('#id').val());
});
}
function process_create() {
str = '';
str += '| post |
';
str += '| json: |
';
str += ' |
';
str += '
';
$('#content').html(str);
$('#post').click(function() {
process_post();
});
}
function process_post() {
$.ajax({
type : 'post',
dataType : 'json',
url : '../jaxrs/process',
contentType : 'application/json; charset=utf-8',
data : $('#json').val(),
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function process_edit(id) {
var str = '';
$('#content').html(str);
$('#put').click(function() {
process_put(id);
});
// 装载流程数据
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/process/' + id,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
if (json.type == 'success') {
$('#id').html(json.data.id);
$('#createTime').html(json.data.createTime);
$('#updateTime').html(json.data.updateTime);
$('#creatorPerson').html(json.data.creatorPerson);
$('#lastUpdatePerson').html(json.data.lastUpdatePerson);
$('#lastUpdateTime').html(json.data.lastUpdateTime);
$('#name').val(json.data.name);
$('#alias').val(json.data.alias);
$('#description').val(json.data.description);
$('#application').val(json.data.application);
$('#managerIdentityList').val(joinValue(joinValue(json.data.managerIdentityList)));
$('#reviewIdentityList').val(joinValue(joinValue(json.data.reviewIdentityList)));
$('#beforeBeginScript').val(json.data.beforeBeginScript);
$('#beforeBeginScriptText').val(json.data.beforeBeginScriptText);
$('#afterBeginScript').val(json.data.afterBeginScript);
$('#afterBeginScriptText').val(json.data.afterBeginScriptText);
$('#beginEndScript').val(json.data.beginEndScript);
$('#beginEndScriptText').val(json.data.beginEndScriptText);
$('#afterEndScript').val(json.data.afterEndScript);
$('#afterEndScriptText').val(json.data.afterEndScriptText);
$('#startableIdentityList').val(joinValue(joinValue(json.data.startableIdentityList)));
$('#startableDepartmentList').val(joinValue(joinValue(json.data.startableDepartmentList)));
$('#startableCompanyList').val(joinValue(joinValue(json.data.startableCompanyList)));
$('#serialTexture').val(json.data.serialTexture);
$('#serialActivity').val(json.data.serialActivity);
$('#agentList').val(JSON.stringify(json.data.agentList, null, '\t'));
$('#begin').val(JSON.stringify(json.data.begin, null, '\t'));
$('#cancelList').val(JSON.stringify(json.data.cancelList, null, '\t'));
$('#choiceList').val(JSON.stringify(json.data.cancelList, null, '\t'));
$('#conditionList').val(JSON.stringify(json.data.choiceList, null, '\t'));
$('#delayList').val(JSON.stringify(json.data.delayList, null, '\t'));
$('#embedList').val(JSON.stringify(json.data.embedList, null, '\t'));
$('#endList').val(JSON.stringify(json.data.endList, null, '\t'));
$('#invokeList').val(JSON.stringify(json.data.invokeList, null, '\t'));
$('#manualList').val(JSON.stringify(json.data.manualList, null, '\t'));
$('#mergeList').val(JSON.stringify(json.data.mergeList, null, '\t'));
$('#messageList').val(JSON.stringify(json.data.messageList, null, '\t'));
$('#parallelList').val(JSON.stringify(json.data.parallelList, null, '\t'));
$('#serviceList').val(JSON.stringify(json.data.serviceList, null, '\t'));
$('#splitList').val(JSON.stringify(json.data.splitList, null, '\t'));
$('#routeList').val(JSON.stringify(json.data.routeList, null, '\t'));
} else {
failure(data);
}
});
}
function process_put(id) {
$.ajax({
type : 'put',
dataType : 'json',
url : '../jaxrs/process/' + id,
contentType : 'application/json; charset=utf-8',
data : JSON.stringify({
// name : String
// alias : String
// description : String
// creatorPerson : String
// lastUpdatePerson : String
// lastUpdateTime : Date
// application : String
// managerIdentityList : List
// reviewIdentityList : List
// beforeBeginScript : String
// beforeBeginScriptText : String
// afterBeginScript : String
// afterBeginScriptText : String
// beforeEndScript : String
// beforeEndScriptText : String
// afterEndScript : String
// afterEndScriptText : String
// startableIdentityList : List
// startableDepartmentList : List
// startableCompanyList : List
// serialTexture : String
// serialActivity : String
name : $('#name').val(),
alias : $('#alias').val(),
description : $('#description').val(),
application : $('#application').val(),
managerIdentityList : $('#managerIdentityList').val().split(','),
reviewIdentityList : $('#reviewIdentityList').val().split(','),
beforeBeginScript : $('#beforeBeginScript').val(),
beforeBeginScriptText : $('#beforeBeginScriptText').val(),
afterBeginScript : $('#afterBeginScript').val(),
afterBeginScriptText : $('#afterBeginScriptText').val(),
beforeEndScript : $('#beforeEndScript').val(),
beforeEndScriptText : $('#beforeEndScriptText').val(),
afterEndScript : $('#afterEndScript').val(),
afterEndScriptText : $('#afterEndScriptText').val(),
startableIdentityList : $('#startableIdentityList').val().split(','),
startableDepartmentList : $('#startableDepartmentList').val().split(','),
startableCompanyList : $('#startableCompanyList').val().split(','),
serialTexture : $('#serialTexture').val(),
serialActivity : $('#serialActivity').val(),
agentList : jQuery.parseJSON($('#agentList').val()),
begin : jQuery.parseJSON($('#begin').val()),
cancelList : jQuery.parseJSON($('#cancelList').val()),
choiceList : jQuery.parseJSON($('#choiceList').val()),
delayList : jQuery.parseJSON($('#delayList').val()),
embedList : jQuery.parseJSON($('#embedList').val()),
endList : jQuery.parseJSON($('#endList').val()),
invokeList : jQuery.parseJSON($('#invokeList').val()),
manualList : jQuery.parseJSON($('#manualList').val()),
mergeList : jQuery.parseJSON($('#mergeList').val()),
messageList : jQuery.parseJSON($('#messageList').val()),
parallelList : jQuery.parseJSON($('#parallelList').val()),
serviceList : jQuery.parseJSON($('#serviceList').val()),
splitList : jQuery.parseJSON($('#splitList').val()),
routeList : jQuery.parseJSON($('#routeList').val())
}),
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function process_delete(id, onlyRemoveNotCompleted) {
$.ajax({
type : 'delete',
dataType : 'json',
url : '../jaxrs/process/' + id + '/' + onlyRemoveNotCompleted,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function process_listWithApplication(id) {
process_parameter.application = id;
$.ajax({
type : 'get',
dataType : 'json',
url : '../jaxrs/process/application/' + id,
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
if (json.type == 'success') {
var str = '';
str += '| id | name | alias | operate |
';
$.each(json.data, function(index, item) {
str += '';
str += '| ' + item.id + ' | ';
str += '' + item.name + ' | ';
str += '' + item.alias + ' | ';
str += '';
str += 'edit ';
str += 'delete ';
str += 'delete all';
str += ' | ';
str += '
';
});
str += '
';
$('#content').html(str);
}
});
}
function process_demo_simple_create() {
str = '';
$('#content').html(str);
$('#post').click(function() {
process_demo_simple_post();
});
}
function process_demo_simple_post() {
$.ajax({
type : 'post',
dataType : 'json',
url : '../jaxrs/process/demo/simple',
contentType : 'application/json; charset=utf-8',
data : JSON.stringify({
name : $('#name').val(),
application : $('#application').val()
}),
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}
function process_demo_split_create() {
str = '';
$('#content').html(str);
$('#post').click(function() {
process_demo_split_post();
});
}
function process_demo_split_post() {
$.ajax({
type : 'post',
dataType : 'json',
url : '../jaxrs/process/demo/split',
contentType : 'application/json; charset=utf-8',
data : JSON.stringify({
name : $('#name').val(),
application : $('#application').val()
}),
xhrFields : {
'withCredentials' : true
},
crossDomain : true
}).done(function(json) {
$('#result').html(JSON.stringify(json, null, 4));
});
}