Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
7 replies
Subscribers
8 subscribers
Views
2364 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Finding out whether process model instance is completed from java code
surendrab
over 7 years ago
Hello All,
I am writing a java plugin and this plugins starts a process instance but I am unable to get information on whether this process instance is completed or not. I am using Process controller concludeProcess() method but this is throwing exception and not reliable to get that information. Any help on pointers would be appreciated
OriginalPostID-234691
Discussion posts and replies are publicly visible
Parents
0
Eduardo Fuentes
Appian Employee
over 7 years ago
No. Plug-ins can use injected services in their constructor that are automatically injected by Appian by simply having them as arguments in your constructor. Check the examples under Shared Components. They have the source code, they will be good training.
For example: "Process Management Services" has ResumeProcesses.java which in its constructor states that Appian should inject ProcessExecutionService automatically, so all the creator needed was to put that in the constructor and store that reference in a variable.
The author designed a slightly more complex architecture than what you normally need but what she did basically translates into this (see how she can use the "pes" variable in her run method just because she declared it as a variable that'll be populated automatically by Appian in the constructor)
@ProcessManagement
public class ResumeProcesses extends extends AppianSmartService{
private ProcessExecutionService pes;
public ResumeProcesses(ProcessExecutionService pes) {
this.pes = pes
}
@Override
public void run() throws SmartServiceException {
Integer[] resultCodeIds;
if (dryRun) {
resultCodeIds = new ProcessManagerDryRun(pes).resumeProcesses(processIds);
} else {
resultCodeIds = pes.resumeProcesses(processIds);
}
setResultCodeList(resultCodeIds);
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Eduardo Fuentes
Appian Employee
over 7 years ago
No. Plug-ins can use injected services in their constructor that are automatically injected by Appian by simply having them as arguments in your constructor. Check the examples under Shared Components. They have the source code, they will be good training.
For example: "Process Management Services" has ResumeProcesses.java which in its constructor states that Appian should inject ProcessExecutionService automatically, so all the creator needed was to put that in the constructor and store that reference in a variable.
The author designed a slightly more complex architecture than what you normally need but what she did basically translates into this (see how she can use the "pes" variable in her run method just because she declared it as a variable that'll be populated automatically by Appian in the constructor)
@ProcessManagement
public class ResumeProcesses extends extends AppianSmartService{
private ProcessExecutionService pes;
public ResumeProcesses(ProcessExecutionService pes) {
this.pes = pes
}
@Override
public void run() throws SmartServiceException {
Integer[] resultCodeIds;
if (dryRun) {
resultCodeIds = new ProcessManagerDryRun(pes).resumeProcesses(processIds);
} else {
resultCodeIds = pes.resumeProcesses(processIds);
}
setResultCodeList(resultCodeIds);
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data