cancel
Showing results for 
Search instead for 
Did you mean: 

Get the details of JobChain which has multiple steps (sequentially and parallel)

former_member587730
Participant
0 Kudos
{		  
      
 String ident=" | ";
    JobDefinition jDef = jcsSession.getJobDefinitionByName("Test_chain_NN");
	if (jDef.getJobDefinitionType().getName().equals(JobDefinitionType.JOB_CHAIN))
		{
		  jcsOut.println(jDef.getName());
		  JobChain jc = jcsSession.getJobChainByJobDefinition(jDef); 
			for (Iterator it1 = jc.getJobChainSteps(); it1.hasNext();)
			     { 
				   JobChainStep js = (JobChainStep) it1.next(); 
				   jcsOut.println(js.getName());
				   jcsOut.println(ident + " | "); 
         for (Iterator it2 = js.getJobChainCalls(); it2.hasNext();)         
                                
				{
                  JobChainCall ja = (JobChainCall) it2.next(); 
			     //JobChain jcc = jcsSession.getJobChainByJobDefinition(ja.getJobDefinition());
				   jcsOut.print(" +- " + ja.getJobDefinition().getName());
				   JobChainCallSchedulingParameter jccsp = ja.getJobChainCallSchedulingParameterByName(SchedulingParameterName.SubmitDisabled);
				   String exp=jccsp.getExpression();
				   jcsOut.println("  " +exp);				
                        
				 }      
				                    
                }                     
					  
	}
}			
	



former_member587730
Participant
0 Kudos

Hello Blob,

I have written above code it works for sequential job chain, I mean a job chain has steps in sequence but as soon as I add any process definition in parallel within same step it gives runtime exception(I think I am missing some logic here).

Why I am doing this ? Answer is:

We have complex jobchain structure and for testing the Jobchains in test environment they enable submit disable option.(as they want to step sub chains or Steps while testing the job chain)

Can you please help.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member587730
Participant
0 Kudos

jobsteps.pngHello Gerben,

Yes it is not throwing any exception now but it goes only up level 1.

I have subchins within that I have again steps are there but it does do check on that.

Please refer Attached screen shot, I have further steps in Test_Script1 but this code does not go inside and check those steps.

gmblom
Active Contributor
0 Kudos
JobChainCallSchedulingParameter jccsp = ja.getJobChainCallSchedulingParameterByName(SchedulingParameterName.SubmitDisabled);
String exp = "No";
if (jccsp != null)
{ exp = jccsp.getExpression(); } jcsOut.println(" " + exp);
gmblom
Active Contributor
0 Kudos

Hello,

I am not sure what you are trying to achieve, but I think this line

JobChainCallSchedulingParameter jccsp = ja.getJobChainCallSchedulingParameterByName(SchedulingParameterName.SubmitDisabled);

is not always returning an object, so the next line will throw an exception.

What are you trying to fetch here?

Regards Gerben

former_member587730
Participant
0 Kudos

Hello Gerben,

I want all the process definition from job chain which has submit disabled.

I have to fetch all process definition from chain and their submit disabled( value are yes or No. )

Because we have lot of job chains and it won't be good idea to check each and every step of the job chain.

How can I catch the exception ?