IBM Tivoli Software IBM Tivoli Software

[ Bottom of Page | Previous Page | Next Page | Contents ]


Examples: working with objects in the plan

The following examples indicate how you use the classes to work with objects in the plan:

Example 4: submitting a job stream instance into the current plan

This procedure requires several actions:

  1. Obtain the required job stream definition from the database and transform it into a JobStreamInPlan:
    ConnPlan myPlan;
    //Get an instance of ConnPlan interface...
    ...
    
    String alias = "SBJBF1_1";
    JobStream js = null;
    JobStreamInPlan jsip = null;
    //If you already have a JobStream in the DB with Identifier jsDbID...
    try 
    {		 
    		 //get it from the DB
    		 js = (JobStream)(myPlan.getTWSObject(JobStream.class,jsDbID,false,null));
    
    //Transform it in a JobStreamInPlan. TODAY is a variable representing the scheduled time
    		 jsip = myPlan.makeJobStreamInPlan(jsDbID, TODAY, alias, null);
    }
    catch (ConnException e) 
    {
            		 		 //Something went wrong...
    }
    catch (ConnEngineNotMasterException e)
    {
    		 //Since the makeJobStreamInPlan is available also on FTAs (it's on the Plan interface), an exception must be thrown if it is called on an engine that is not the master 
    }
  2. Add the JobStreamInPlan to the plan:
    List idList = new ArrayList();
    try 
    {
    		 //Add the job stream to the plan.
    		 //This method returns a list of Identifiers because the job stream can be defined on a Workstation class, so you have an ID for each workstation of the class
    		 idList = (ArrayList)myPlan.addJobStreamInstance(jsip, null);		 		 		 		 
    }
    catch (ConnException e) 
    {
    		 //...
    }
    catch (ConnEngineNotMasterException e)
    {
    		 //...
    }

Example 5: Make a query on the plan

The following example lists the first five jobs that begin with the letter "A":

String nameFilter = "A*";
int howMany = 5;			
		
QueryFilter qf = new QueryFilter();
qf.setFilter(JobInPlanFilters.JOB_NAME, nameFilter);
		 		 
QueryResult qr = null;
 try 
{
       		 qr = myPlan.queryPlanObject(JobInPlan.class, qf, howMany, null);
}
catch (ConnException e) 
{
		 //...
}

[ Top of Page | Previous Page | Next Page | Contents ]