Commit 25912b37 authored by Suvi Automation for Talend Components's avatar Suvi Automation for Talend Components
Browse files

bc87397

parents
/*
Talend® Components for enaio® von ECMind GmbH ist lizenziert unter einer
Creative Commons Namensnennung - Keine Bearbeitungen 4.0 International Lizenz.
Über diese Lizenz hinausgehende Erlaubnisse können Sie unter
http://www.ecmind.ch/solutions/tos-components/extend.html erhalten.
Achtung: Achten Sie darüber hinaus in jedem Fall die Schutzrechte von
OPTIMAL SYSTEMS und sorgen Sie für eine korrekte Lizenzierung der enaio®-API
zur Nutzung der Komponenten wo zutreffend.
Gleichfalls obligt die korrekte Verwendung und Lizenzierung von Talend Open
Studio Ihrer Verantwortung.
*/
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String connectionType = ElementParameterParser.getValue(node, "__CONNECTION_TYPE__");
String endpoint = ElementParameterParser.getValue(node, "__ENDPOINT__");
String connectionString = ElementParameterParser.getValue(node, "__CONNECTION_STRING__");
String user = ElementParameterParser.getValue(node, "__USER__");
String password = ElementParameterParser.getValue(node, "__PASSWORD__");
boolean persistent = Boolean.valueOf(ElementParameterParser.getValue(node, "__PERSISTENT__"));
boolean checkConnection = Boolean.valueOf(ElementParameterParser.getValue(node, "__CHECK_CONNECTION__"));
String tempfolder = ElementParameterParser.getValue(node, "__TEMPFOLDER__");
String timeout = ElementParameterParser.getValue(node, "__TIMEOUT__");
%>
try{
ch.ecmind.enaio.blueline.EnaioConnection <%=cid%>_connection = null;
if(<%=persistent%> && GlobalResource.resourceMap.containsKey("<%=cid%>_connection")){
<%=cid%>_connection = (ch.ecmind.enaio.blueline.EnaioConnection) GlobalResource.resourceMap.get("<%=cid%>_connection");
}else{
<%
if(connectionType.equals("WS")){
%>
<%=cid%>_connection = new ch.ecmind.enaio.blueline.ws.WSEnaioConnection(<%=endpoint%>, <%=user%>, <%=password%>);
<%
}else{
%>
<%=cid%>_connection = new ch.ecmind.enaio.blueline.direct.DirectEnaioConnection(<%=connectionString%>, <%=user%>, <%=password%>, jobName);
<%
}
if(!timeout.isEmpty()){
%>
<%=cid%>_connection.setTimeout(<%=timeout%>);
<%
}
if(!tempfolder.isEmpty()){
%>
<%=cid%>_connection.setTemporaryFolder(new java.io.File(<%=tempfolder%>));
<%
}
%>
}
<%if(checkConnection){%>
ch.ecmind.enaio.blueline.EnaioJob <%=cid%>_job = new ch.ecmind.enaio.blueline.EnaioJob("krn.CheckServerConnection");
<%=cid%>_job.addParameter("Flags", 0);
<%=cid%>_connection.execute(<%=cid%>_job);
<%}%>
<%if(persistent){%>
GlobalResource.resourceMap.put("<%=cid%>_connection", <%=cid%>_connection);
<%}%>
globalMap.put("<%=cid%>_connection", <%=cid%>_connection);
}catch(Exception e){
throw new TalendException(e, currentComponent, globalMap);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<COMPONENT>
<HEADER AUTHOR="Ulrich Wohlfeil" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="true" IS_MULTIPLYING_OUTPUTS="false" PLATEFORM="ALL"
SCHEMA_AUTO_PROPAGATE="true" SERIAL="" SHORTNAME="ECon" STARTABLE="true" STATUS="RELEASE" VERSION="1.1" RELEASE_DATE="20191127">
<SIGNATURE />
</HEADER>
<FAMILIES>
<FAMILY>ECMind/enaio</FAMILY>
<FAMILY>enaio/blueline</FAMILY>
</FAMILIES>
<DOCUMENTATION>
<URL>http://ecmind.ch/solutions/tos-components/</URL>
</DOCUMENTATION>
<CONNECTORS>
<CONNECTOR CTYPE="SUBJOB_OK" MAX_INPUT="1" />
<CONNECTOR CTYPE="SUBJOB_ERROR" MAX_INPUT="1" />
<CONNECTOR CTYPE="COMPONENT_OK" />
<CONNECTOR CTYPE="COMPONENT_ERROR" />
<CONNECTOR CTYPE="RUN_IF" />
<CONNECTOR CTYPE="ITERATE" MAX_INPUT="0" MAX_OUTPUT="1" />
<CONNECTOR CTYPE="FLOW" MIN_INPUT="0" MAX_INPUT="1" />
</CONNECTORS>
<PARAMETERS>
<PARAMETER NAME="CONNECTION_TYPE" FIELD="CLOSED_LIST" NUM_ROW="1">
<ITEMS DEFAULT="WS">
<ITEM NAME="WS" VALUE="WS" />
<ITEM NAME="RPC" VALUE="RPC" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="ENDPOINT" FIELD="TEXT" NB_LINES="1" NUM_ROW="1" REQUIRED="true" SHOW_IF="CONNECTION_TYPE == 'WS'">
<DEFAULT>"http://localhost:8050/osws/services/EcmWsMtom"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CONNECTION_STRING" FIELD="TEXT" NB_LINES="1" NUM_ROW="1" REQUIRED="true" SHOW_IF="CONNECTION_TYPE == 'RPC'">
<DEFAULT>"localhost:4000:1"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="USER" FIELD="TEXT" NUM_ROW="2" REQUIRED="true">
<DEFAULT>"root"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="PASSWORD" FIELD="TEXT" NUM_ROW="3" REQUIRED="true">
<DEFAULT>"optimal"</DEFAULT>
</PARAMETER>
<PARAMETER NAME="TIMEOUT" FIELD="TEXT" NUM_ROW="4" REQUIRED="false">
<DEFAULT></DEFAULT>
</PARAMETER>
<PARAMETER NAME="TEMPFOLDER" FIELD="TEXT" NUM_ROW="5" REQUIRED="false">
<DEFAULT></DEFAULT>
</PARAMETER>
<PARAMETER NAME="PERSISTENT" FIELD="CHECK" NUM_ROW="6" REQUIRED="true" />
<PARAMETER NAME="CHECK_CONNECTION" FIELD="CHECK" NUM_ROW="7" REQUIRED="true">
<DEFAULT>true</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER FIELD="LABEL" NAME="VERSION_20191127" NUM_ROW="1">
<DEFAULT>Version 20191127</DEFAULT>
</PARAMETER>
<PARAMETER FIELD="LABEL" NAME="COPYRIGHT" NUM_ROW="2">
<DEFAULT>
Talend® Components (http://www.ecmind.ch/solutions/tos-components/) for enaio®
von ECMind GmbH ist lizenziert unter einer Creative Commons Namensnennung -
Keine Bearbeitungen 4.0 International Lizenz. Über diese Lizenz hinausgehende
Erlaubnisse können Sie unter
http://www.ecmind.ch/solutions/tos-components/ erhalten.
Achtung: Achten Sie darüber hinaus in jedem Fall die Schutzrechte von
OPTIMAL SYSTEMS und sorgen Sie für eine korrekte Lizenzierung der enaio®-API
zur Nutzung der Komponenten wo zutreffend. Gleichfalls obligt die korrekte
Verwendung und Lizenzierung von Talend Open Studio Ihrer Verantwortung.
</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="EnaioClientLib-9.10" MODULE="EnaioClientLib-9.10.0.jar" MVN="mvn:org.talend.libraries/EnaioClientLib-9.10.0/20191127" REQUIRED="true"/>
<IMPORT NAME="commons-pool2" MODULE="commons-pool2-2.4.2.jar" MVN="mvn:org.talend.libraries/commons-pool2-2.4.2/20191127" REQUIRED="true"/>
<IMPORT NAME="enaio-rpc-2.8" MODULE="enaio-rpc-2.8.jar" MVN="mvn:org.talend.libraries/enaio-rpc-2.8/20191127" REQUIRED="true"/>
<IMPORT NAME="commons-logging-1.2" MODULE="commons-logging-1.2.jar" MVN="mvn:org.talend.libraries/commons-logging-1.2/20191127" REQUIRED="true"/>
<IMPORT NAME="commons-io-2.5" MODULE="commons-io-2.5.jar" MVN="mvn:org.talend.libraries/commons-io-2.5/20191127" REQUIRED="true"/>
<IMPORT NAME="commons-codec-1.10" MODULE="commons-codec-1.10.jar" MVN="mvn:org.talend.libraries/commons-codec-1.10/20191127" REQUIRED="true"/>
<IMPORT NAME="geronimo-activation-1.1.1" MODULE="geronimo-activation-1.1.1.jar" MVN="mvn:org.talend.libraries/geronimo-activation-1.1.1/20191127" REQUIRED="true"/>
<IMPORT NAME="bcprov-jdk16-1.46" MODULE="bcprov-jdk16-1.46.jar" MVN="mvn:org.talend.libraries/bcprov-jdk16-1.46/20191127" REQUIRED="true"/>
<IMPORT NAME="slf4j-api-1.7.21" MODULE="slf4j-api-1.7.21.jar" MVN="mvn:org.talend.libraries/slf4j-api-1.7.21/20191127" REQUIRED="true"/>
</IMPORTS>
</CODEGENERATION>
<RETURNS></RETURNS>
</COMPONENT>
#
# Talend� Components for enaio� von ECMind GmbH ist lizenziert unter einer
# Creative Commons Namensnennung - Keine Bearbeitungen 4.0 International Lizenz.
# �ber diese Lizenz hinausgehende Erlaubnisse k�nnen Sie unter
# http://www.ecmind.ch/solutions/tos-components/extend.html erhalten.
#
# Achtung: Achten Sie dar�ber hinaus in jedem Fall die Schutzrechte von
# OPTIMAL SYSTEMS und sorgen Sie f�r eine korrekte Lizenzierung der enaio�-API
# zur Nutzung der Komponenten wo zutreffend.
#
# Gleichfalls obligt die korrekte Verwendung und Lizenzierung von Talend Open
# Studio Ihrer Verantwortung.
#
LONG_NAME=Webservice Connection to Enaio
HELP=org.talend.help.EnaioConnection
ENDPOINT.NAME=Webservice Endpoint
USER.NAME=Username
PASSWORD.NAME=Password
PERSISTENT.NAME=persistent connection
CHECK_CONNECTION.NAME=check connection
CONNECTION_TYPE.NAME=Connection Type
CONNECTION_TYPE.ITEM.WS=enaio Webservice
CONNECTION_TYPE.ITEM.RPC=enaio Native API
CONNECTION_STRING.NAME=Connection String
TIMEOUT.NAME=Socket Timeout (ms)
TEMPFOLDER.NAME=Temporary File Folder
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<COMPONENT>
<HEADER AUTHOR="Ulrich Wohlfeil" COMPATIBILITY="ALL" DATA_AUTO_PROPAGATE="false" PLATEFORM="ALL"
SCHEMA_AUTO_PROPAGATE="true" SERIAL="" STARTABLE="true" STATUS="RELEASE" VERSION="1.0" RELEASE_DATE="20180914">
<SIGNATURE />
</HEADER>
<FAMILIES>
<FAMILY>ECMind/enaio</FAMILY>
<FAMILY>enaio/blueline</FAMILY>
</FAMILIES>
<DOCUMENTATION>
<URL>http://ecmind.ch/solutions/tos-components/</URL>
</DOCUMENTATION>
<CONNECTORS>
<CONNECTOR CTYPE="FLOW" MAX_INPUT="1" MAX_OUTPUT="1" />
<CONNECTOR CTYPE="ITERATE" />
<CONNECTOR CTYPE="SUBJOB_OK" />
<CONNECTOR CTYPE="SUBJOB_ERROR" />
<CONNECTOR CTYPE="COMPONENT_OK" />
<CONNECTOR CTYPE="COMPONENT_ERROR" />
<CONNECTOR CTYPE="RUN_IF" />
</CONNECTORS>
<PARAMETERS>
<PARAMETER NAME="SCHEMA" FIELD="SCHEMA_TYPE" REQUIRED="true" NUM_ROW="1">
<TABLE>
<COLUMN NAME="objectId" TYPE="id_Integer" READONLY="true" CUSTOM="true"/>
<COLUMN NAME="hasError" TYPE="id_Boolean" READONLY="true" CUSTOM="true"/>
<COLUMN NAME="errorText" TYPE="id_String" LENGTH="255" READONLY="true" CUSTOM="true"/>
</TABLE>
</PARAMETER>
<PARAMETER NAME="CONNECTION" FIELD="COMPONENT_LIST" FILTER="EnaioConnection" NUM_ROW="1" DYNAMIC_SETTINGS="true">
<DEFAULT>EnaioConnection_1</DEFAULT>
</PARAMETER>
<PARAMETER NAME="COPY_OR_MOVE" FIELD="CLOSED_LIST" NUM_ROW="2">
<ITEMS DEFAULT="COPY">
<ITEM NAME="COPY" VALUE="COPY" />
<ITEM NAME="MOVE" VALUE="MOVE" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="OBJECT_ID" FIELD="TEXT" NUM_ROW="3" REQUIRED="true"/>
<PARAMETER NAME="OBJECT_INTERNAL_NAME" FIELD="TEXT" NUM_ROW="4" REQUIRED="true" SHOW_IF="INTERNAL_OR_ID == 'INTERNAL'"/>
<PARAMETER NAME="OBJECT_TYPE_ID" FIELD="TEXT" NUM_ROW="4" REQUIRED="true" SHOW_IF="INTERNAL_OR_ID == 'ID'"/>
<PARAMETER NAME="INTERNAL_OR_ID" FIELD="CLOSED_LIST" NUM_ROW="4">
<ITEMS DEFAULT="INTERNAL">
<ITEM NAME="INTERNAL" VALUE="INTERNAL" />
<ITEM NAME="ID" VALUE="ID" />
</ITEMS>
</PARAMETER>
<PARAMETER NAME="REGISTER_ID" FIELD="TEXT" NUM_ROW="5" REQUIRED="false"/>
<PARAMETER NAME="REGISTER_TYPE" FIELD="TEXT" NUM_ROW="5" REQUIRED="false"/>
<PARAMETER NAME="FOLDER_ID" FIELD="TEXT" NUM_ROW="6" REQUIRED="false"/>
<PARAMETER NAME="SOURCE_PARENT_ID" FIELD="TEXT" NUM_ROW="7" REQUIRED="false" SHOW_IF="COPY_OR_MOVE == 'MOVE'"/>
<PARAMETER FIELD="LABEL" NAME="OPTIONAL" NUM_ROW="7">
<DEFAULT>Options:</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_ARCHIVABLE" FIELD="CHECK" NUM_ROW="8" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'COPY'" >
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_CHECKACCESS" FIELD="CHECK" NUM_ROW="9" REQUIRED="false" DYNAMIC_SETTINGS="true" >
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_CHECKEXISTENCE" FIELD="CHECK" NUM_ROW="10" REQUIRED="false" DYNAMIC_SETTINGS="true" >
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_CHECKPOSITION" FIELD="CHECK" NUM_ROW="11" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'COPY'">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_COPYCASCADING" FIELD="CHECK" NUM_ROW="12" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'COPY'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_INWFTRAY" FIELD="CHECK" NUM_ROW="13" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'MOVE'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_LINKDOCUMENT" FIELD="CHECK" NUM_ROW="14" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'COPY'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_WFTOUSERTRAY" FIELD="CHECK" NUM_ROW="15" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'MOVE'" >
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="OPTION_KEEPLINKWHENEXISTS" FIELD="CHECK" NUM_ROW="16" REQUIRED="false" DYNAMIC_SETTINGS="true" SHOW_IF="COPY_OR_MOVE == 'COPY'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
<PARAMETER NAME="DIE_ON_ERROR" FIELD="CHECK" NUM_ROW="1" REQUIRED="true" >
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DEBUG" FIELD="CHECK" NUM_ROW="2" REQUIRED="true" DYNAMIC_SETTINGS="true">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="STATIC_PARAMETER" FIELD="TABLE" NUM_ROW="3" NB_LINES="4">
<ITEMS>
<ITEM NAME="NAME" FIELD="Text" />
<ITEM NAME="VALUE" FIELD="Text" />
<ITEM NAME="TYPE" FIELD="CLOSED_LIST">
<ITEMS DEFAULT="String">
<ITEM NAME="String" VALUE="string" />
<ITEM NAME="Integer" VALUE="integer" />
<ITEM NAME="Boolean" VALUE="boolean" />
<ITEM NAME="Base64" VALUE="base64" />
<ITEM NAME="Float" VALUE="float" />
<ITEM NAME="DateTime" VALUE="datetime" />
</ITEMS>
</ITEM>
</ITEMS>
</PARAMETER>
<PARAMETER FIELD="LABEL" NAME="VERSION_20180914" NUM_ROW="4">
<DEFAULT>Version 20180914</DEFAULT>
</PARAMETER>
<PARAMETER FIELD="LABEL" NAME="COPYRIGHT" NUM_ROW="5">
<DEFAULT>
Talend® Components (http://www.ecmind.ch/solutions/tos-components/) for enaio®
von ECMind GmbH ist lizenziert unter einer Creative Commons Namensnennung -
Keine Bearbeitungen 4.0 International Lizenz. Über diese Lizenz hinausgehende
Erlaubnisse können Sie unter
http://www.ecmind.ch/solutions/tos-components/ erhalten.
Achtung: Achten Sie darüber hinaus in jedem Fall die Schutzrechte von
OPTIMAL SYSTEMS und sorgen Sie für eine korrekte Lizenzierung der enaio®-API
zur Nutzung der Komponenten wo zutreffend. Gleichfalls obligt die korrekte
Verwendung und Lizenzierung von Talend Open Studio Ihrer Verantwortung.
</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION></CODEGENERATION>
<RETURNS>
<RETURN NAME="OBJECT_ID" TYPE="id_Integer" AVAILABILITY="FLOW" />
<RETURN NAME="HAS_ERROR" TYPE="id_Boolean" AVAILABILITY="FLOW" />
<RETURN NAME="ERROR_TEXT" TYPE="id_String" AVAILABILITY="FLOW" />
</RETURNS>
</COMPONENT>
/*
Talend® Components for enaio® von ECMind GmbH ist lizenziert unter einer
Creative Commons Namensnennung - Keine Bearbeitungen 4.0 International Lizenz.
Über diese Lizenz hinausgehende Erlaubnisse können Sie unter
http://www.ecmind.ch/solutions/tos-components/extend.html erhalten.
Achtung: Achten Sie darüber hinaus in jedem Fall die Schutzrechte von
OPTIMAL SYSTEMS und sorgen Sie für eine korrekte Lizenzierung der enaio®-API
zur Nutzung der Komponenten wo zutreffend.
Gleichfalls obligt die korrekte Verwendung und Lizenzierung von Talend Open
Studio Ihrer Verantwortung.
*/
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map
java.util.HashMap
"
%>
<%
Map<String, Boolean> options = new HashMap<String, Boolean>();
options.put("ARCHIVABLE", false);
options.put("CHECKACCESS", true);
options.put("CHECKEXISTENCE", true);
options.put("CHECKPOSITION", true);
options.put("COPYCASCADING", false);
options.put("INWFTRAY", false);
options.put("LINKDOCUMENT", false);
options.put("WFTOUSERTRAY", false);
options.put("KEEPLINKWHENEXISTS", false);
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String copyOrMove = ElementParameterParser.getValue(node, "__COPY_OR_MOVE__");
String objectId = ElementParameterParser.getValue(node, "__OBJECT_ID__");
String registerId = ElementParameterParser.getValue(node, "__REGISTER_ID__");
String registerType = ElementParameterParser.getValue(node, "__REGISTER_TYPE__");
String folderId = ElementParameterParser.getValue(node, "__FOLDER_ID__");
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
Boolean dieOnError = Boolean.valueOf(ElementParameterParser.getValue(node, "__DIE_ON_ERROR__"));
Boolean debug = Boolean.valueOf(ElementParameterParser.getValue(node, "__DEBUG__"));
String internalOrId = ElementParameterParser.getValue(node, "__INTERNAL_OR_ID__");
String objectInternalName = ElementParameterParser.getValue(node, "__OBJECT_INTERNAL_NAME__");
String objectTypeId = ElementParameterParser.getValue(node, "__OBJECT_TYPE_ID__");
String sourceParentId = ElementParameterParser.getValue(node, "__SOURCE_PARENT_ID__");
List<Map<String, String>> staticParameters = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__STATIC_PARAMETER__");
%>
try{
ch.ecmind.enaio.blueline.EnaioConnection <%=cid%>_connection = (ch.ecmind.enaio.blueline.EnaioConnection) globalMap.get("<%=connection%>_connection");
// Create delete XML
org.dom4j.Document <%=cid%>_document = org.dom4j.DocumentHelper.createDocument();
org.dom4j.Element <%=cid%>_dmsData = <%=cid%>_document.addElement( "DMSData" );
org.dom4j.Element <%=cid%>_archive = <%=cid%>_dmsData.addElement( "Archive" );
org.dom4j.Element <%=cid%>_objectType = <%=cid%>_archive.addElement( "ObjectType" );
<%if(internalOrId.equals("ID")){%>
<%=cid%>_objectType.addAttribute( "id", <%=objectTypeId%> + "" );
<%}else{%>
<%=cid%>_objectType.addAttribute( "internal_name", <%=objectInternalName%> + "");
<%}%>
org.dom4j.Element <%=cid%>_object = <%=cid%>_objectType.addElement( "Object" );
<%=cid%>_object.addAttribute( "object_id", <%=objectId%> + "");
<%if(registerId.length() > 0){%>
<%=cid%>_object.addAttribute( "register_id", <%=registerId%> + "");
<%}%>
<%if(registerType.length() > 0){%>
<%=cid%>_object.addAttribute( "register_type", <%=registerType%> + "");
<%}%>
<%if(folderId.length() > 0){%>
<%=cid%>_object.addAttribute( "folder_id", <%=folderId%> + "");
<%}%>
<%if(sourceParentId.length() > 0){%>
<%=cid%>_object.addAttribute( "sourceparent_id", <%=sourceParentId%> + "");
<%}%>
<% if(debug){ %>
System.err.println(<%=cid%>_document.asXML());
<%}%>
// Data propagation
<%
List<? extends IConnection> inConns = node.getIncomingConnections();
for (IConnection inConn : inConns) {
if (inConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
IMetadataTable inMetadata = inConn.getMetadataTable();
for(IMetadataColumn inMetadataColumn: inMetadata.getListColumns()){
List<? extends IConnection> outConns = node.getOutgoingSortedConnections();
for (IConnection outConn : outConns) {
if (outConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
IMetadataTable outMetadata = outConn.getMetadataTable();
for(IMetadataColumn outMetadataColumn: outMetadata.getListColumns()){
if(inMetadataColumn.getLabel().equals(outMetadataColumn.getLabel())){
%>
<%=outConn.getName()%>.<%=outMetadataColumn.getLabel()%> = <%=inConn.getName()%>.<%=inMetadataColumn.getLabel()%>;
<%
}
}
}
}
}
}
}
%>
<%if(copyOrMove.equals("COPY")){%>
ch.ecmind.enaio.blueline.EnaioJob <%=cid%>_job = new ch.ecmind.enaio.blueline.EnaioJob("dms.XMLCopy");
<%}else{%>
ch.ecmind.enaio.blueline.EnaioJob <%=cid%>_job = new ch.ecmind.enaio.blueline.EnaioJob("dms.XMLMove");
<%}%>
<%=cid%>_job.addParameter("XML", <%=cid%>_document.asXML().getBytes());
<%=cid%>_job.addParameter("Flags", 0);
String optionsString = "";
<%
for(String option: options.keySet()){
Boolean value = Boolean.valueOf(ElementParameterParser.getValue(node, "__OPTION_" + option + "__"));
if(options.get(option) != value){
%>
if(optionsString.length() > 0){
optionsString += ";";
}
optionsString += "<%=option%>=<%=value?1:0%>";
<%
}
}
%>
<%=cid%>_job.addParameter("Options", optionsString);
<%
for(Map<String, String> field: staticParameters){
if(field.get("TYPE").equals("string")){
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, <%=field.get("VALUE")%>);
<%
}
else if(field.get("TYPE").equals("integer")){
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, <%=field.get("VALUE")%>);
<%
}
else if(field.get("TYPE").equals("boolean")){
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, <%=field.get("VALUE")%>);
<%
}
else if(field.get("TYPE").equals("base64")){
if(Boolean.valueOf(field.get("IS_FILEPATH"))){
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, org.apache.commons.io.FileUtils.readFileToString(new java.io.File(<%=field.get("VALUE")%>)).getBytes());
<%
}else{
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, <%=field.get("VALUE")%>);
<%
}
}
else if(field.get("TYPE").equals("float")){
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, <%=field.get("VALUE")%>);
<%
}
else if(field.get("TYPE").equals("datetime")){
%>
<%=cid%>_job.addParameter(<%=field.get("NAME")%>, <%=field.get("VALUE")%>);
<%
}
else{
%>
throw new RuntimeException("Unknown Type <%=field.get("TYPE")%>");
<%
}
}
%>
try{
ch.ecmind.enaio.blueline.EnaioJobResult <%=cid%>_jobResult = <%=cid%>_connection.execute(<%=cid%>_job);
globalMap.put("<%=cid%>_HAS_ERROR", false);
globalMap.put("<%=cid%>_ERROR_TEXT", null);
<%if(copyOrMove.equals("COPY")){%>
globalMap.put("<%=cid%>_OBJECT_ID", <%=cid%>_jobResult.getInteger("ObjectID"));
<%}else{%>
globalMap.put("<%=cid%>_OBJECT_ID", <%=objectId %>);
<%}%>
<%
List<? extends IConnection> outConnsGood = node.getOutgoingSortedConnections();
for (IConnection outConn : outConnsGood) {
if (outConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
%>
<%=outConn.getName()%>.hasError = false;
<%=outConn.getName()%>.errorText = null;
<%if(copyOrMove.equals("COPY")){%>
<%=outConn.getName()%>.objectId = <%=cid%>_jobResult.getInteger("ObjectID");
<%}else{%>
<%=outConn.getName()%>.objectId = <%=objectId %>;
<%}%>
<%
}
}
%>
}catch(Exception e){
globalMap.put("<%=cid%>_HAS_ERROR", true);
globalMap.put("<%=cid%>_ERROR_TEXT", e.getMessage());
<%
List<? extends IConnection> outConns = node.getOutgoingSortedConnections();
for (IConnection outConn : outConns) {
if (outConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
%>
<%=outConn.getName()%>.hasError = true;
<%=outConn.getName()%>.errorText = e.getMessage();
<%
}
}
%>
<%if(dieOnError){%>
throw new TalendException(e, currentComponent, globalMap);
<%}%>
}
}catch(Exception e){
throw new TalendException(e, currentComponent, globalMap);
}
\ No newline at end of file
#
#Mon Feb 13 18:33:03 CET 2017
HELP=org.talend.help.EnaioCopyMove
LONG_NAME=dms.XmlMove and dms.XmlCopy implementation
SCHEMA.NAME=Schema
CONNECTION.NAME=Enaio connection
OBJECT_ID.NAME=Object ID
REGISTER_ID.NAME=Register ID
REGISTER_TYPE.NAME=Register Type ID
FOLDER_ID.NAME=Folder ID