Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
2e9008ed
Commit
2e9008ed
authored
4 years ago
by
Sebastian Listl
Browse files
Options
Downloads
Patches
Plain Diff
#1065237 Trigger workflows with link
parent
cb98a0d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
process/Workflow_lib/process.js
+54
-0
54 additions, 0 deletions
process/Workflow_lib/process.js
process/redirect_rest/process.js
+23
-0
23 additions, 0 deletions
process/redirect_rest/process.js
process/redirect_rest/redirect_rest.aod
+12
-0
12 additions, 0 deletions
process/redirect_rest/redirect_rest.aod
with
89 additions
and
0 deletions
process/Workflow_lib/process.js
+
54
−
0
View file @
2e9008ed
import
(
"
Util_lib
"
);
import
(
"
system.text
"
);
import
(
"
system.logging
"
);
import
(
"
system.project
"
);
...
...
@@ -601,3 +602,56 @@ WorkflowModelerApiCall.prototype.importModel = function ()
}
function
WorkflowLinkActions
()
{}
WorkflowLinkActions
.
types
=
{
RECEIVE_TASK
:
function
()
{
return
"
receive
"
;}
};
WorkflowLinkActions
.
types
.
RECEIVE_TASK
.
execute
=
function
(
pParameters
)
{
if
(
!
pParameters
.
piId
||
!
pParameters
.
recId
)
return
;
workflow
.
triggerReceiveTask
(
pParameters
.
piId
,
pParameters
.
recId
);
}
WorkflowLinkActions
.
encodeAction
=
function
(
pType
,
pLink
,
pParams
)
{
var
actionObj
=
pParams
||
{};
actionObj
.
type
=
pType
;
actionObj
.
link
=
pLink
;
var
actionString
=
JSON
.
stringify
(
actionObj
);
return
encodeURIComponent
(
util
.
encodeBase64String
(
actionString
));
}
WorkflowLinkActions
.
parseAction
=
function
(
pEncodedAction
)
{
try
{
var
decodedAction
=
decodeURIComponent
(
util
.
decodeBase64String
(
pEncodedAction
))
var
parsedAction
=
JSON
.
parse
(
decodedAction
);
}
catch
(
err
)
{
parsedAction
=
{};
}
return
{
type
:
parsedAction
.
type
||
null
,
redirectLink
:
parsedAction
.
link
||
null
,
params
:
parsedAction
,
run
:
function
()
{
for
(
let
typeName
in
WorkflowLinkActions
.
types
)
{
let
actionType
=
WorkflowLinkActions
.
types
[
typeName
];
if
(
this
.
type
==
actionType
())
return
actionType
.
execute
.
call
(
this
,
this
.
params
);
}
return
null
;
}
};
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
process/redirect_rest/process.js
0 → 100644
+
23
−
0
View file @
2e9008ed
import
(
"
Workflow_lib
"
);
import
(
"
system.util
"
);
import
(
"
system.logging
"
);
function
restget
(
pRequest
)
{
var
request
=
JSON
.
parse
(
pRequest
);
var
action
=
WorkflowLinkActions
.
parseAction
(
request
.
query
.
act
);
action
.
run
();
if
(
action
.
redirectLink
)
{
request
.
response
.
httpStatusCode
=
302
;
//found, redirect
request
.
response
.
header
.
Location
=
action
.
redirectLink
;
}
else
{
request
.
response
.
httpStatusCode
=
204
;
//no content
}
return
JSON
.
stringify
(
request
);
}
This diff is collapsed.
Click to expand it.
process/redirect_rest/redirect_rest.aod
0 → 100644
+
12
−
0
View file @
2e9008ed
<?xml version="1.0" encoding="UTF-8"?>
<process
xmlns=
"http://www.adito.de/2018/ao/Model"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
VERSION=
"1.2.1"
xsi:schemaLocation=
"http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"
>
<name>
redirect_rest
</name>
<majorModelMode>
DISTRIBUTED
</majorModelMode>
<process>
%aditoprj%/process/redirect_rest/process.js
</process>
<publishAsWebservice
v=
"true"
/>
<style>
REST
</style>
<loginTypeId>
internal.none
</loginTypeId>
<variants>
<element>
EXECUTABLE
</element>
</variants>
</process>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment