Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
I have custoom wizard in which I implemented MVC table. This table is having objects which are belonging to a custom POJO class. I want to retrieve values for each column (each column is aa POJO attribute). Once I get those all column values, I want to create an object of WTDocument type.I tried with objHandle but not succeeded. Can anyone help me with process of this implementation ?
Solved! Go to Solution.
Hi @AKC
Your Windchill should use just one methodserver without bacground.
If you use BG and MS then the configuration is more complicated that you have to set different ports to each method
in InteliJ create new RemoteJVM Debug configuration set the address and port
Copy the Command line arguments for remote
in my case
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
,
set this arguments in the windchill wt.properties file by Windchill shell command.
wt.manager.cmd.MethodServer.debug.args=-agentlib\:jdwp\=transport\=dt_socket,server\=y,suspend\=n,address\=5005
restart the method server.
Then you should be able to connect to the Windchill with debug mode from InteliJ.
PetrH
Hi @AKC
What is your question? What API is used to create WTDocument?
Or you do not know how to use NmComandBean object to get the row informations in the processor that process the wizard?
If you can get all information from POJO objects then just create the WTDocument based on that information.
code to create WTDocument
WTContainer container = getFolderByName(); // own function to search the folder to store
String typeDefstr = "wt.doc.WTDocument";
WTDocument retDocument = WTDocument.newWTDocument();
retDocument.setNumber(number);
retDocument.setName(name);
setDocType(retDocument, typeDefstr);
WTPrincipal currentuser = SessionHelper.getPrincipal();
WTOrganization org = currentuser.getOrganization();
if (org != null)
{
retDocument.setOrganization(org);
}
if (container != null)
{
retDocument.setContainer(container);
}
if (folder != null)
{
FolderHelper.assignLocation(retDocument, folder);
}
//save ....
try
{
retDocument = (WTDocument) PersistenceHelper.manager.store(retDocument);
} catch (WTException uni)
{
uni.printStackTrace();
}
PS> Knowledge base contains information that the NmCommandBean.getSelectedXXX returns only WTObject class if the POJO class is not set in the table definition
CS345786 - NmCommandBean.getSelectedXXX APIs don't work with POJO objects in Windchill PDMLink
PetrH
Thanks for the reply Petr. I know the process for new WTDocument. My challenge is that I am not sure how to use NmComandBean object to get the row informations in the processor that process the wizard.
For your information I am getting POJO data as below in my MVC table
From the above table, I can able to fetch value for Comments entered which is text area (column 5) , attached file (column 6) and selected action (combo box which is column 7). However I am not able to fetch columns 1 and 2 which are specific document's number and description respectively.
Thanks for sharing the article https://www.ptc.com/en/support/article/CS345786?_gl=1*1tbg1t4*_gcl_au*MTMzNTI5MjQ4LjE3MjE1NjU5NDE.*_ga*MTIxMDI2ODU2OC4xNjc3NjYyNzc3*_ga_7NMP2MSYPM*MTcyMTg5NzQ1Ny4xMDguMC4xNzIxODk3NDU3LjYwLjAuMA.. I will go through it.
Regards,
AKC
Hi @AKC
It depends what object it is.
For example if the row is an object that is identified by number try to get the row object and use getter to get that information..
I guess that the object is just virtual and is not stored anywhere so
try to check the values of all getters from command bean in debug mode when you can stop the operation in IDE and check the actual real variables and data that are pushed to the commandbean object.
getText
getComboBox
getTextArea
getChecked
PetrH
@HelesicPetr .. separate question regarding screenshot you provided above. Is it netbeans IDE as I can't find in eclipse? How to get this information in UI? .. also can you provide some details around following .. "..try to check the values of all getters from command bean in debug mode when you can stop the operation in IDE "
Hi @SW_10910352
Actually I use the IntelliJ IDEA :D.
The debug mode you can use in the eclipse also in the netbeans.
Here is a case that describes how to set the eclipse for remote debugging
CS96048 -How to build a development environment and perform remote debug using Eclipse in Windchill
Then you start and connect the debug mode in IDE with your Windchill server and you can stop the process in any row of your code with real variable values in your code.
PS> CS357647 - [Knowledge Hub] Windchill PLM - Customization with Eclipse IDE
PetrH
Now I am able to fetch data in my MVC table. I removed all POJO related stuff and tried with custom columns added to builder with Data Utilities. So in this way for Document Number and Desc (for first two columns) , I returned selected documents list in getComponentData() of builder and respective columns are showing data sing DU which worked for me.
Related to IDE, even I am using Intellij Idea, can I get some info on how to set Intellij in debug mode ? I tried earlier on it but not succeeded. Thanks 🙂
Hi @AKC
Your Windchill should use just one methodserver without bacground.
If you use BG and MS then the configuration is more complicated that you have to set different ports to each method
in InteliJ create new RemoteJVM Debug configuration set the address and port
Copy the Command line arguments for remote
in my case
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005
,
set this arguments in the windchill wt.properties file by Windchill shell command.
wt.manager.cmd.MethodServer.debug.args=-agentlib\:jdwp\=transport\=dt_socket,server\=y,suspend\=n,address\=5005
restart the method server.
Then you should be able to connect to the Windchill with debug mode from InteliJ.
PetrH