Working with objects in the plan
Provides examples of using the Java™ API to work 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 the following main steps:
- Obtain the required job stream definition from the database
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 into a JobStreamInPlan:
//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 }
- 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: Making 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)
{
//...
}