Quantcast
Channel: PTC Community : Unanswered Discussions - Windchill
Viewing all articles
Browse latest Browse all 3592

Run IE task trough API with current logged user

$
0
0

Hello,

 

I'm trying to run an IE task trough a java method. But Windchill ran the task as WCadmin .

The task run fine but it retrieves info that user shouldn't have access.

If I run the IE task in the browser with the user it run fine too.

 

here is the code:

publicstatic String ieTaskRun(String Task1, String Name1, String Group1, String userNa) throws WTException, IOException, IEException {

String obid1 = "";

String obType = "";

try{

IeService ieService = new IeService();

Task objtask = new Task(Task1);

objtask.setService(ieService);

//>>>> Here is where I'm trying to set username who will run the task <<<

objtask.setUsername(userNa);

String groupOutName = Group1;

objtask.setParam("name", Name1);

objtask.setParam("GROUP_OUT", Group1);

System.out.println("**** ieTaskRun Check entering task **** " + userNa);

 

objtask.invoke();

Group prlnks = ieService.getGroup(groupOutName);

System.out.println("ieTaskRun element: " + prlnks.getElementCount());

 

if (prlnks.getElementCount() > 0){

 

for (intp = 0; p< prlnks.getElementCount(); p++)

{

obid1 = (String) prlnks.getAttributeValue(p, "number");

obType = (String) prlnks.getAttributeValue(p, "type");

if (obType.equalsIgnoreCase("CAD Document")){

obid1 = obid1 + ":" + (String) prlnks.getAttributeValue(p, "version");

}else{

obid1 = obid1 + ":" + (String) prlnks.getAttributeValue(p, "revision");

}

System.out.println("ieTaskRun obid Task: " + obid1 + " Object Type: " + obType);

 

if(obType.equalsIgnoreCase("CAD Document"))

{

returnobid1;

}

}

}

} catch(Exception e) {

   //e.printStackTrace(System.err);

 

   returnobid1;

  }

 

returnobid1;

 

}//end of method ieTaskRun


Viewing all articles
Browse latest Browse all 3592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>