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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

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

Selene
4-Participant

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

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"

9 REPLIES 9
cgautier
17-Peridot
(To:Selene)

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.

cgautier
17-Peridot
(To:Selene)

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.

Selene
4-Participant
(To:cgautier)

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

cgautier
17-Peridot
(To:Selene)

thanks.

Does it mean for "/Default" it works?

KR,

Charles.

Selene
4-Participant
(To:cgautier)

Yes for  "/Default" it works but for the path I need does not work.

Selene
4-Participant
(To:Selene)

If I do soemthing  like this it works:  
 
AdminDomainRef domain_ref =(AdminDomainRef) AdministrativeDomainHelper.getAdminDomainRef("[/wt.inf.container.OrgContainer=ReplcaewithyourOrgName/wt.inf.library.WTLibrary=LibraryNameyouwanttoAccess]/Default/testx/XDomain");
 
AdminDomainRef Domobj=(AdminDomainRef) AdministrativeDomainHelper.getAdminDomainRef("[/wt.inf.container.OrgContainer=ReplcaewithyourOrgName/wt.inf.library.WTLibrary=LibraryNameyouwanttoAccess]/Default/testx/");
 
In theory I am applying the context so I get the domin_ref and the domain administered obj to apply those as arguments in changeAdministrativeDomain method but when I try to execute it like this wt.admin.AdministrativeDomainManager.changeAdministrativeDomain(domain_ref ,Domobj,false);    it says:
 
The method changeAdministrativeDomain(DomainAdministered, AdminDomainRef, boolean) in the type AdministrativeDomainManager is not applicable for the arguments.
 
-Selene
 
 
 
HelesicPetr
21-Topaz II
(To:Selene)

Hi @Selene 

 

I just guess but first object shouldn't be AdminDomainRef there is DomainAdministered which is parent class of Subfolder or  RootFolder.

I would put there a object type SubFolder

 

PetrH

cgautier
17-Peridot
(To:Selene)

Hi Selene,

Can you try:

changeAdministrativeDomain( DomainAdministered obj, AdminDomainRef domain_ref, boolean inheritedDomain )

KR,

Charles.

cgautier
17-Peridot
(To:Selene)

Hi Selene,

Did you get a chance to review my message?

KR,

Charles.

Top Tags