<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Initiating a Translation Package Creation from a Java workflow expression robot in Windchill Customization</title>
    <link>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980984#M8940</link>
    <description>&lt;P&gt;Thanks! I will look into this and mark it as the solution if it pans out.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Oct 2024 17:29:50 GMT</pubDate>
    <dc:creator>AdamElkins</dc:creator>
    <dc:date>2024-10-30T17:29:50Z</dc:date>
    <item>
      <title>Initiating a Translation Package Creation from a Java workflow expression robot</title>
      <link>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980422#M8923</link>
      <description>&lt;P&gt;Version: Windchill 12.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use Case: I am looking for a way to initiate the creation of a translation package from a workflow. Is that possible? Are there any Java API's I can use to potentially do this in an expression robot?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;Description: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I am looking for a way to initiate the creation of a translation package from a workflow. Is that possible? Are there any Java API's I can use to potentially do this in an expression robot?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 19:38:41 GMT</pubDate>
      <guid>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980422#M8923</guid>
      <dc:creator>AdamElkins</dc:creator>
      <dc:date>2024-10-28T19:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Initiating a Translation Package Creation from a Java workflow expression robot</title>
      <link>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980983#M8939</link>
      <description>&lt;P&gt;There is a public class called TranslationProcess which includes public methods for initiating a translation.&amp;nbsp; The general idea is that you would need to first call an api to create the objects and the baseline, and then call an api "exportTranslationPackage"&lt;/P&gt;
&lt;P&gt;com.ptc.tml.utils.TranslationProcess&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 17:28:04 GMT</pubDate>
      <guid>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980983#M8939</guid>
      <dc:creator>plutsky</dc:creator>
      <dc:date>2024-10-30T17:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Initiating a Translation Package Creation from a Java workflow expression robot</title>
      <link>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980984#M8940</link>
      <description>&lt;P&gt;Thanks! I will look into this and mark it as the solution if it pans out.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 17:29:50 GMT</pubDate>
      <guid>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/980984#M8940</guid>
      <dc:creator>AdamElkins</dc:creator>
      <dc:date>2024-10-30T17:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Initiating a Translation Package Creation from a Java workflow expression robot</title>
      <link>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/982810#M8976</link>
      <description>&lt;P&gt;There is an OTB workflow that does this already. A custom process can be implemented that initiates a translation package as follows.&lt;/P&gt;&lt;LI-CODE lang="java"&gt;org.apache.logging.log4j.Logger logger  = org.apache.logging.log4j.LogManager.getLogger("com.ptc.tml.workflow.CoreWorkflow");
logger.trace("Build Translation Package - entered");

String oldUser = null;
wt.inf.container.WTContainer container = null;
String targetLang = "";
com.ptc.tml.collection.TranslationCollection collection = com.ptc.tml.collection.TranslationCollection.fromOidString(collectionOid);

try {
  wt.workflow.engine.WfProcess main = (wt.workflow.engine.WfProcess)self.getObject();
  final String wfCreator =  com.ptc.tml.utils.TMLUtils.getUserName(main.getCreator());
  oldUser = com.ptc.tml.utils.TMLUtils.switchSessionPrincipal(wfCreator);

  userName = collection.getUserName();
  outputDir = collection.getOutputDirectory();
  container = collection.getContainer();
  targetLang = collection.getTargetLanguage();
  containerOid = collection.getContainerRef().getKey().toString();
  final String sourceLang = collection.getSourceLanguage();

  wt.vc.baseline.ManagedBaseline baseline = com.ptc.tml.utils.WorkflowAdapter.createBaseline(collection, log);
  if (baseline == null) {
    baselineOid = null;
    log.addErrorNoDocsToTranslate();

    logger.trace("Collection " + collection.getName() + ": " + errorMsg);
  } else {
    log = new com.ptc.tml.log.TmlPackageLog(baseline, collection.getSourceLanguage(), targetLang, log);
    baselineOid = com.ptc.tml.utils.TMLUtils.getReference(baseline);
    logger.trace("Collection " + collection.getName() + " -&amp;gt; Baseline " + baselineOid);

    newTranslationPackageName = com.ptc.tml.utils.WorkflowAdapter.
          createTranslationPackage(baseline, collection.getSourceOid(), sourceLang, targetLang, userName, outputDir, container, log).getAbsolutePath();

    if (log.numErrors() == 0) {
      //Store notification messages
      successMessage = new StringBuilder(log.toHtmlSummaryString());
      warningMessage = new StringBuilder(log.toHtmlWarningString());
    }

    logger.trace("Baseline " + baselineOid + " -&amp;gt; Package " + newTranslationPackageName);
  }
} catch(java.lang.Throwable t) {
  log.addError("Build Translation Package", t);
} finally {
  if (log.numErrors() &amp;gt; 0) {
    log.writeErrorLog();
    errorMsg = log.toHtmlSummaryString();
  }
  com.ptc.tml.utils.TMLUtils.switchSessionPrincipal(oldUser);
}
logger.trace("Build Translation Package - exiting");&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Nov 2024 19:23:30 GMT</pubDate>
      <guid>https://sejnu66972.lithium.com/t5/Windchill-Customization/Initiating-a-Translation-Package-Creation-from-a-Java-workflow/m-p/982810#M8976</guid>
      <dc:creator>AdamElkins</dc:creator>
      <dc:date>2024-11-08T19:23:30Z</dc:date>
    </item>
  </channel>
</rss>

