Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
Version: Windchill 12.0
Use Case: I am trying to automate creation of replication packages to synchronise two disconnected windchill instances with 500+ potential contexts to be synchronised. The code below is for a test with all the values hard coded. Windchill 12.0.2.11
Description:
This is the code but I either get a create or save error and an java.lang.instantiation exception. I have read in the API that the newReplicationPackage constructor should be used but not sure how to incorporate that,
<%@page language="java" access="internal|http"%>
%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%
<!--
https://xxxx/Windchill/servlet/IE/tasks/com/thalesuk/createPackage
Input file format: Current Name, New Name
-->
<%@ page import="java.util.*"%>
<%@ page import="wt.adapter.*"%>
<%@ page import="wt.part.*"%>
<%@ page import="wt.fc.*"%>
<%@ page import="wt.pdmlink.*"%>
<%@ page import="wt.vc.config.*"%>
<%@ page import="wt.vc.views.*"%>
<%@ page import="wt.type.*"%>
<%@ page import="java.io.*"%>
<%@ page import="wt.fc.collections.WTKeyedMap"%>
<%@ page import="wt.fc.collections.WTKeyedHashMap"%>
<%@ page import="wt.util.WTException"%>
<%@ page import="com.ptc.windchill.wp.rep.*"%>
<%
// PARAMS:
IeService ie = getService();
Element message = new Element("message");
Group rGroup = new Group("returningGroup");
%>
<ie:webject name="Get-Properties" type="MGT">
<ie:param name="ATTRIBUTE" data="wt.federation.ie.VMName"/>
<ie:param name="GROUP_OUT" data="properties"/>
</ie:webject>
<ie:webject name="Query-Objects" type="OBJ">
<ie:param name="INSTANCE" data="$(properties[0]wt.federation.ie.VMName[0])" />
<ie:param name="TYPE" data="wt.inf.container.WTContainer" />
<ie:param name="ATTRIBUTE" data="name" />
<ie:param name="WHERE" data="name='xxx'" />
<ie:param name="GROUP_OUT" data="org" />
</ie:webject>
<%
try {
%>
<ie:webject name="Create-Objects" type="ACT">
<ie:param name="INSTANCE" data="${properties[0]wt.federation.ie.VMName[0]}"/>
<ie:param name="CONTAINER_REF" data="OR:wt.pdmlink.PDMLinkProduct:380344479"/>
<ie:param name="TYPE" data="com.ptc.windchill.wp.rep.ReplicationPackage"/>
<ie:param name="METHOD" data="newReplicationPackage"/>
<ie:param name="FIELD" data="name=TEST_Webject"/>
<ie:param name="FIELD" data="orgid=$(org[]obid[])"/>
<ie:param name="FIELD" data="domainRef=$(org[]obid[])"/>
<ie:param name="FIELD" data="packageDomain=OR:wt.pdmlink.PDMLinkProduct:380344479)"/>
<ie:param name="GROUP_OUT" data="pack"/>
</ie:webject>
<%
} catch(Exception e) {
e.printStackTrace();
message.addAtt(new Att("failed", e.getMessage() ) );
}
rGroup.addElement(message);
addGroup(rGroup);
%>
<ie:webject name="Return-Groups" type="GRP">
<ie:param name="group_in" data="returningGroup"/>
</ie:webject>
<%
Any pointers to a solution would be very helpful
Hi @IT_10321741
Thank you for your question.
Your post appears well documented but has not yet received any response. I am replying to raise awareness. Hopefully, another community member will be able to help.
Also, feel free to add any additional information you think might be relevant. It sometimes helps to have screenshots to better understand what you are trying to do.
Best regards,