Skip to Content
0
Mar 25, 2013 at 03:40 PM

Unable to change the Job parameter, which is a directory path using import action

22 Views

Hi,

We have CPS version M33.69-61130.

Few of our Windows batch job definitions have directory paths as parameters(Custom defined).

Now, i am using the following code to change the substring of the directory, but to no avail.

//Changing the Job definition prefixes{  for (java.util.Iterator it = jcsImportRuleSet.getObjects().iterator(); it.hasNext(); )  {    Object o = (Object) it.next();    if (o instanceof JobDefinition)    {      JobDefinition jd = (JobDefinition) o;      //Changing the Src path parameters      JobDefinitionParameter jp2 = jd.getJobDefinitionParameterByName("Src_Path");      if (jp2 != null && jp2.getDefaultExpression() != null && jp2.getDefaultExpression().indexOf("x_qa_sap") >= 0)      {        jp2.setDefaultExpression(jp2.getDefaultExpression().replaceFirst("x_qa_sap","x_dev_sap"));      }    }  }}

I parameter Src_Path will have the following Default Expression.
\\somedrive\x_qa_sap\ABC\XYZ\Out\ZDI_016\

After import, i always get a NULL string for the parameter.

I tried the following considering the escape char '\'

replaceFirst("\\x_qa_sap\\","\\x_dev_sap\\")
replaceFirst("(.*)\\x_qa_sap\\(.*)","\\x_dev_sap\\")

I'm wondering whether getdefaultExpression() itself is returning a NULL value.

Please let me know what am i doing wrong.

Thanks

Nanda