Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Creating custom scheduled jobs


Creating custom scheduled jobs

I am looking to fill in a couple gaps in my knowledge how to create a custom scheduled job that will appear in WVS Job Scheduler Administration. I have been using the Windchill Customizer's Guide 9.1 for the initial set of steps.

I see I have to add some entries to the file as shown below from the guide.

Add the following to your file (edit as needed):

<Property default="MyCustomJob" name="myJob.description"/>

<Property default="ext.wvs.CustomJobs" name=" myJob.class"/>

<Property default="myCustomJob" name=" myJob.method"/>

<Property default="true" name=" myJob.enableOnContainers"/>

<Property default="myJob" name="schedulejobs<N>"/>

I have to create the java class ( and then compile it to create the myJob.class.

I have two areas I am having difficulties getting through succesfully.

  1. How to correctly create the SearchCondition in the java class. Below is an exerpt from the Customizer's Guide. What I want to search for are all representations that were created in a date range. For example, I want to republish all representations (thumbnails) that were created between 2013-06-01 and 2013-09-01 and in a specific context and folder. I am not sure what the correct syntax.


qs.appendWhere(new SearchCondition(WTDocument.class,




2. actually compiling the file. I included the import statements as shown below. I receive a lot of errors when I try to use 'javac' to compile the routine. As I write this, I am wondering if my path variable is not set correctly to compile the routine cleanly. Any hints are greatly appreciated.


package provisur.wvs.CustomJobs;

import java.util.Iterator;

import org.apache.log4j.Level;

import org.apache.log4j.Logger;

import wt.doc.WTDocument;

import wt.epm.EPMDocument;


import wt.fc.ObjectIdentifier;

import wt.fc.ObjectReference;

import wt.fc.ObjectVector;

import wt.fc.ObjectVectorIfc;

import wt.fc.Persistable;

import wt.fc.PersistenceHelper;

import wt.fc.QueryResult;

import wt.fc.collections.WTArrayList;

import wt.fc.collections.WTList;

import wt.inf.container.ContainerSpec;

import wt.inf.container.WTContained;

import wt.inf.container.WTContainerHelper;

import wt.inf.container.WTContainerRef;

import wt.log4j.LogR;

import wt.part.WTPart;

import wt.pds.StatementSpec;

import wt.pom.PersistenceException;

import wt.query.ClassAttribute;

import wt.query.QuerySpec;

import wt.query.SearchCondition;

import wt.query.SubSelectExpression;

import wt.representation.Representable;

import wt.representation.RepresentationHelper;

import wt.util.WTAttributeNameIfc;

import wt.util.WTException;





import wt.viewmarkup.DerivedImage;

import com.ptc.wvs.common.util.WVSProperties;

import com.ptc.wvs.server.util.PublishUtils;



Re: Creating custom scheduled jobs

On Point 1)

You can get many examples just search the customizer guides, I am pasting the code to search Organization container based on the Name attribute.

QuerySpec queryref = new QuerySpec(WTOrganization.class);

SearchCondition srchGroups = new SearchCondition(WTOrganization.class, WTOrganization.NAME, SearchCondition.EQUAL, "<Give Organization Name>");

int [] fromParentIndicies = { 0 };

queryref.appendWhere(srchGroups, fromParentIndicies);

QueryResult resultingGroups = PersistenceHelper.manager.find((StatementSpec) queryref);


if (resultingGroups.size() == 1) {

org = (WTOrganization) resultingGroups.nextElement();


Re: Creating custom scheduled jobs

On Point 2) For compiling the java files in which you have used Windchill OOTB classes you have to add jars on your class path i.e from where you are compiling the java files.

So add jar sfrom \Windchill\Codebase\WEB-INF\lib and \Windchill\srclib to your class path.

Re: Creating custom scheduled jobs

Thanks for the helpful hints.

In addition to your hint, I also found the following in another discussion answer from PTC-167919.

ant -f bin/tools.xml class -Dclass.includes=*.java -Dclass.source=C:\LoadECR

I used this syntax using my folder structure to complete the compile.

My Java and class skills are not good. As I was looking at the examples in the Customizer guide, I found references to fields like 'Default_Representation' in DerivedImage. Since I was looking to use the DerivedImage table and the field Last Modified field, I was expecting to use the syntax 'Last_Modified' but keep getting 'cannot find symbol' in reference to using 'Last_Modified' during the compile.

I can't believe how difficult it seems to be to find references to the field names for use in the queryspecs. I obviously am still missing where to find this info. In the report management tool, Last Modified field is in the DerivedImage table.

*** Last_Modified as a date field - I did see reference to ModifyStampA2 ***

SearchCondition sc2 =

new SearchCondition(DerivedImage.class,


SearchCondition.LESS_THAN, DateExpression.newExpression("2012-01-01"),


There must be some other documentation that is worth reading that I haven't come across.



LiveWorx Call For Papers Happening Now!