Skip to main content
1-Visitor
March 31, 2022
Question

Change folder domain using Javacode (knowing that the domain already exists in windchill)

  • March 31, 2022
  • 2 replies
  • 2685 views

I am using Windchill PDMLink Release 11.2 and Datecode with CPS 11.2.1.14

I am trying to change the domain to some folders that were created automatically with a script was created using java code.

I found a method from the class AdministrativeDomainManager called changeAdministrativeDomain(DomainAdministered obj, AdminDomainRef domain_ref) that it says :Changes the domain to which the object belongs and sets domain inheritence to false.

So when I try to get the AdminDomainRef using AdminDomainRef (see code below) I get an exception that says I am out of context(see error messages or warning) String newDomain="Default//Test//XDomain//"; AdminDomainRef admDom = AdministrativeDomainHelper.getAdminDomainRef(newDomain);

Please I need help on that I could not get any clear documentation or example about it , if you have some java code example to move a folder to another domain ( knowing that that domain already exists in windchill ) will be great if you share it.



Here are the errors that I faced

Status Code: 500
Exception: (wt.inf.container.containerResource/26) wt.inf.container.ClassicContainerNotFoundException: Context not found: "Windchill PDM"

2 replies

18-Opal
April 1, 2022

Hi Selene,

I'm Charles from PTC Technical Support in Europe, I will provide you assistance on this question.

Is it possible to activate below logger:

windchill wt.util.jmx.SetLogLevel wt.admin ALL

Reproduce the use-case with the error message, then send me the MethodServer log and pinpoint the timestamp and the login used.

You can send log file to cgautier@ptc.com.

I remain at your disposal for any questions or concerns.

Kind Regards,

Charles Gautier.

18-Opal
April 5, 2022

I thank you for your email and the provided logs.

I'm able to reproduce the error message and I'd guess this is due to the format being passed for the path.

Could you try something e.g.

admDom=AdministrativeDomainHelper.getAdminDomainRef("/Default");

and

admDom=AdministrativeDomainHelper.getAdminDomainRef("/Default/TEST/XDomain");

Does it work?

KR,

Charles.

Selene1-VisitorAuthor
1-Visitor
April 5, 2022

Hi Charles, thank you for your help. 

 

I just tested the solution you suggested but for this  admDom=AdministrativeDomainHelper.getAdminDomainRef("/Default/TEST/XDomain"); is not working I received the same exception : Exception: (wt.inf.container.containerResource/26) wt.inf.container.ClassicContainerNotFoundException: Context not found: "Windchill PDM".

 

Thanks,

-Selene

18-Opal
April 5, 2022

thanks.

Does it mean for "/Default" it works?

KR,

Charles.