Compare commits

...

38 Commits

Author SHA1 Message Date
Chao MENG
b07356abbc fix(TUP-20391): Migration tasks are re-executed and encrypting passwords
https://jira.talendforge.org/browse/TUP-20391

Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/model/migration/EncryptPasswordInComponentsMigrationTask.java
2018-08-06 14:23:45 +08:00
Chao MENG
a8b74ff7c4 fix(TUP-20391): Migration tasks are re-executed and encrypting passwords
(#2492)

fix(TUP-20391): Migration tasks are re-executed and encrypting passwords
https://jira.talendforge.org/browse/TUP-20391

Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/model/migration/UnifyPasswordEncryption4ContextMigrationTask.java
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/model/migration/UnifyPasswordEncryption4ParametersInJobMigrationTask.java
2018-08-06 14:21:55 +08:00
Pingwen Lin
cf68bcbf60 TPS-2061 [5.6.1][tMDMConnection] "OnComponentError" and "On SubjobError" not triggered when an error occurs(TMDM-11214) (#1576) 2017-08-03 17:51:00 +08:00
Pingwen Lin
e056a04c45 TPS-1927 : [5.6.1]Too slow when tMDMoutput rejects a bad data(TMDM-10814) (#1304)
TMDM-10814 : Too slow when tMDMoutput rejects a bad data
2017-05-24 02:52:21 -05:00
Pingwen Lin
0418ab9a11 TPS-1404 [5.6.1]MDM Transaction handling is wrong in multithreaded environment(TMDM-9530) (#1302)
* TPS-1404 : [5.6.1]MDM Transaction handling is wrong in multithreaded environment(TMDM-9530)
TMDM-9111 : MDM transaction handling is wrong in multithreaded environment
TMDM-9530 : throw error 'Failed to acquire lock within 30 seconds' while using mdm transaction in the
2017-05-24 01:22:46 -05:00
wchen-talend
4b1efc9807 TPS-1502:[5.6.1] Can't export and import empty folder (TUP-2716) 2016-09-06 17:41:04 +08:00
wchen-talend
7a65fb5567 TPS-1452:fix the migration version 2016-07-14 12:02:05 +08:00
zwxue
ec0386351e TDI-35820: job using joblet displays wrong contexts. 2016-07-06 10:48:22 +08:00
zwxue
d57261d72a TDI-35820: job using joblet displays wrong contexts. 2016-07-05 18:34:06 +08:00
hcyi
0cbaae18b5 TPS-1259:[5.6.1]tMap Auto Map FAILS to update last output column
properly(TDI-34655)
2016-03-09 18:48:09 +08:00
wchen-talend
1988d96e28 TPS-1216:[5.6.1]joblet cannot be updated(TDI-34914) 2016-01-20 11:07:32 +08:00
hwang
40513495da TPS-1042:[5.6.1]tHashOutput's not linking properly 2015-11-02 14:49:20 +08:00
Mike Yan
067a307829 TESB-15680: Add Bundle-NativeCode in manifest 2015-10-19 14:53:19 +08:00
ycbai
8abd62b836 [TDI-32419] Impossible to use a new library across several tLibraryLoad 2015-07-21 17:07:14 +08:00
wchen-talend
0935844d99 TDI-32768:tSAPBapi with wrong generated code in joblet with TPS-913 2015-07-08 16:50:28 +08:00
CHEN Bin
3cd5ba25f7 TDI-31266: OutputFIleDelimited having issues with records over 8K when used with other components
https://jira.talendforge.org/browse/TDI-31266
use @Deprecated instead of remove subTreeContainsParallelIterate
2015-06-03 16:06:44 +03:00
I.Melnik
a2dbc1e49f TESB-15339 [5.6.1] ctalendjob does not list the jobs in Mediation
perspective.
2015-06-02 13:05:42 +02:00
amarkevich
8ee6062cab context variable at new line 2015-06-02 13:55:42 +03:00
amarkevich
53ae623548 TESB-15200 Config properies on ESB Conductor do not handle 2 byte
caracter context values
2015-06-02 13:55:15 +03:00
xhkong
d42ff63cc1 TPS-942 [5.6.1] Routines don't saves sometime in 5.4.2 Version (
TDI-32401 ) 
https://jira.talendforge.org/browse/TPS-942
2015-05-27 15:44:40 +08:00
wchen-talend
625537b46b TPS-913:[5.6.1] tSAPBapi in a lookup with wrong generated code 2015-05-06 13:17:03 +08:00
wchen-talend
fa67de1575 TPS-894 :routine content become empty if commit failed. 2015-04-21 14:17:14 +08:00
wchen-talend
10d1675541 TPS-894 : add TUP-2694 Sometimes it's impossible to save the routines to
patch
2015-04-20 17:16:44 +08:00
wchen-talend
89d57a88fe TPS-886:[5.6.1]Joblets from reference project are editable from
referencing projects(TDI-32079)
2015-04-14 13:52:59 +08:00
wchen-talend
ca7da04bf1 TUP-2761:Need some SVN preference setup in the studio to limit the
number of access to svn
2015-03-30 16:41:14 +08:00
wchen-talend
cde2076b9c TUP-2761:Need some SVN preference setup in the studio to limit the
number of access to svn
2015-03-30 15:01:19 +08:00
hcyi
cbd8e38b4a TPS-859:[5.6.1]Missing Schema Definition for Database(TDI-31980) 2015-03-23 19:44:40 +08:00
CHEN Bin
c6ecfa1714 TDI-31266: OutputFIleDelimited having issues with records over 8K when
used with other components
2015-01-29 16:18:27 +08:00
Wu Liu
7f14a4cf1b TDI-31393 : lookup in tMap will be executed the same times as
tPartitioner splits threads
2014-12-03 19:31:12 +08:00
nrousseau
04a7b6d2de TUP-2278: fix a problem of lost icon when the job was modified outside
of the process class.
2014-12-03 18:27:02 +08:00
rdubois
50fbbb6cb2 TBD-1329 fixed: Add the distribution in the virtual component 2014-12-03 18:20:26 +08:00
wchen-talend
a5a928e33f TUP-2452:ClassNotFoundException while using Product demo 2014-12-02 15:30:29 +08:00
hwang
2900b474e4 revert TDI-31258:Need some simple way to setup the jdbc needed for audit
in
2014-12-02 13:52:50 +08:00
hwang
d23810bab2 TDI-31361:Issues about URL for json wizard 2014-11-28 20:14:02 +08:00
hwang
77d0cf119d TDI-31361:Issues about URL for json wizard 2014-11-28 20:13:56 +08:00
wchen-talend
adfb6724cb TDI-31324:tSAPBapi doesn't support joblet 2014-11-28 20:08:06 +08:00
wchen-talend
f8f1aefc14 TDI-31324:tSAPBapi doesn't support joblet 2014-11-28 20:07:52 +08:00
Sebastien Gandon
f49fa77655 TDI-31358 : made TOS switch workspace work and persists the last cexecuted workspace 2014-11-28 12:21:35 +01:00
95 changed files with 3214 additions and 2182 deletions

View File

@@ -57,16 +57,8 @@
%>
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
<%
if(!hasParallelIterate){
hasParallelIterate = true;
%>
final Object[] lockWrite_<%=iterateNodeName%> = new Object[0];
int threadIdCounter_<%=iterateNodeName%> =0;
<%
}
%>
globalMap.put("lockWrite_<%=iterateNodeName%>", new Object[0]);
int threadIdCounter_<%=iterateNodeName%> =0;
<%
}
%>

View File

@@ -112,7 +112,6 @@
}
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter_<%=node.getUniqueName()%>++);
bt_<%=node.getUniqueName()%>.assignLock(lockWrite_<%=node.getUniqueName()%>);
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
<%

View File

@@ -888,7 +888,6 @@ public class CodeGenerator implements ICodeGenerator {
CodeGeneratorArgument argument = new CodeGeneratorArgument();
argument.setNode(node);
argument.setAllMainSubTreeConnections(subProcess.getAllMainSubTreeConnections());
argument.setSubTreeContainsParallelIterate(subProcess.subTreeContainsParallelIterate());
argument.setCodePart(part);
argument.setStatistics(statistics);
argument.setTrace(trace);

View File

@@ -60,6 +60,7 @@ public class CodeGeneratorArgument {
private int pauseTime;
@Deprecated
private boolean subTreeContainsParallelIterate;
/**
@@ -277,10 +278,15 @@ public class CodeGeneratorArgument {
this.subTree = subTree;
}
@Deprecated
/*
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
*/
public boolean subTreeContainsParallelIterate() {
return subTreeContainsParallelIterate;
}
@Deprecated
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
this.subTreeContainsParallelIterate = subTreeContainsParallelIterate;
}

View File

@@ -22,7 +22,6 @@ import java.util.Map;
import org.talend.core.model.process.AbstractNode;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.INode;
@@ -61,6 +60,7 @@ public class NodesSubTree {
List<IConnection> allMainSubTreeConnections = null;
@Deprecated
boolean subTreeContainsParallelIterate = false;
List<INode> mergeBranchStarts;
@@ -280,11 +280,7 @@ public class NodesSubTree {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
allMainSubTreeConnections.add(connection);
} else {
if (Boolean.TRUE.toString().equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) { //$NON-NLS-1$
subTreeContainsParallelIterate = true;
}
}
}
if (DEBUG) {
System.out.print(" -> "); //$NON-NLS-1$
}
@@ -537,6 +533,10 @@ public class NodesSubTree {
this.allMainSubTreeConnections = allMainSubTreeConnections;
}
@Deprecated
/*
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
*/
public boolean subTreeContainsParallelIterate() {
return subTreeContainsParallelIterate;
}

View File

@@ -0,0 +1,5 @@
# IntelliJ IDEA
.idea/
*.ipr
*.iml
*.iws

View File

@@ -1,86 +0,0 @@
package com.talend.mdm.transaction.client;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.PostMethod;
public class MDMTransaction {
private String url;
private String id;
private String username;
private String password;
public void commit() throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
HttpMethod method = new PostMethod(url + "/" + id);
method.setDoAuthentication(true);
try {
client.executeMethod(method);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
method.releaseConnection();
}
int statuscode = method.getStatusCode();
if (statuscode >= 400) {
throw new MDMTransactionException("Commit failed. The commit operation has returned the code " + statuscode + ".");
}
}
public void rollback() throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
HttpMethod method = new DeleteMethod(url + "/" + id);
method.setDoAuthentication(true);
try {
client.executeMethod(method);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
method.releaseConnection();
}
int statuscode = method.getStatusCode();
if (statuscode >= 400) {
throw new MDMTransactionException("Rollback failed. The rollback operation has returned the code " + statuscode + ".");
}
}
public void setUrl(String url) {
this.url = url;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
}

View File

@@ -1,75 +0,0 @@
package com.talend.mdm.transaction.client;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.PutMethod;
public class MDMTransactionClient {
public static MDMTransaction newTransaction(String url, String username, String password) throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
PutMethod put = new PutMethod(url);
put.setDoAuthentication(true);
String tid = "";
try {
client.executeMethod(put);
tid = put.getResponseBodyAsString();
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
put.releaseConnection();
}
MDMTransaction result = new MDMTransaction();
result.setUrl(url);
result.setId(tid);
result.setUsername(username);
result.setPassword(password);
return result;
}
public static String getMDMTransactionURL(String url) {
if(url == null || "".equals(url)) {
return "";
}
int count = 3;
int i=0;
for(;i<url.length();i++) {
char c = url.charAt(i);
if('/' == c) {
count--;
}
if(count == 0) {
break;
}
}
String result = url.substring(0, i);
result += "/datamanager/services/transactions";
return result;
}
public static void main(String[] args) throws IOException {
MDMTransaction mt = MDMTransactionClient.newTransaction("http://localhost:8080/datamanager/services/transactions", "administrator", "administrator");
mt.commit();
MDMTransaction mt1 = MDMTransactionClient.newTransaction("http://localhost:8080/datamanager/services/transactions", "administrator", "administrator");
mt1.rollback();
String url = "http://localhost:8080/talend/TalendPort";
String mdmurl = MDMTransactionClient.getMDMTransactionURL(url);
System.out.println(mdmurl);
}
}

View File

@@ -0,0 +1,50 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.talend</groupId>
<artifactId>mdm_transaction</artifactId>
<name>mdm_transaction</name>
<version>1</version>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
<build>
<finalName>${project.name}</finalName>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,109 @@
package com.talend.mdm.transaction.client;
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.PostMethod;
public class MDMTransaction {
public static final String JVM_STICKY_SESSION = "sticky_session"; //$NON-NLS-1$
public static final String DEFAULT_STICKY_SESSION = "JSESSIONID"; //$NON-NLS-1$
private String url;
private String id;
private String username;
private String password;
private String sessionId;
public void commit() throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
client.getParams().setAuthenticationPreemptive(true);
HttpMethod method = new PostMethod(url + "/" + id);
method.setDoAuthentication(true);
try {
method.setRequestHeader("Cookie", getStickySession() + "=" + sessionId); //$NON-NLS-1$ //$NON-NLS-2$
client.executeMethod(method);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
method.releaseConnection();
}
int statuscode = method.getStatusCode();
if (statuscode >= 400) {
throw new MDMTransactionException("Commit failed. The commit operation has returned the code " + statuscode + ".");
}
}
public void rollback() throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
client.getParams().setAuthenticationPreemptive(true);
HttpMethod method = new DeleteMethod(url + "/" + id);
method.setDoAuthentication(true);
try {
method.setRequestHeader("Cookie", getStickySession() + "=" + sessionId); //$NON-NLS-1$ //$NON-NLS-2$
client.executeMethod(method);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
method.releaseConnection();
}
int statuscode = method.getStatusCode();
if (statuscode >= 400) {
throw new MDMTransactionException("Rollback failed. The rollback operation has returned the code " + statuscode + ".");
}
}
public void setUrl(String url) {
this.url = url;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setUsername(String username) {
this.username = username;
}
public void setPassword(String password) {
this.password = password;
}
public String getSessionId() {
return sessionId;
}
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
public static String getStickySession() {
String stickySession = System.getProperty(JVM_STICKY_SESSION);
if(stickySession == null) {
stickySession = DEFAULT_STICKY_SESSION;
}
return stickySession;
}
}

View File

@@ -0,0 +1,132 @@
package com.talend.mdm.transaction.client;
import java.io.IOException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MDMTransactionClient {
private static final Log LOG = LogFactory.getLog(MDMTransactionClient.class);
public static MDMTransaction newTransaction(String url, String username, String password) throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
client.getParams().setAuthenticationPreemptive(true);
PutMethod put = new PutMethod(url);
put.setDoAuthentication(true);
String tid;
String sessionID;
try {
client.executeMethod(put);
tid = put.getResponseBodyAsString();
sessionID = parseSessionID(put);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
put.releaseConnection();
}
MDMTransaction result = new MDMTransaction();
result.setUrl(url);
result.setId(tid);
result.setUsername(username);
result.setPassword(password);
result.setSessionId(sessionID);
return result;
}
public static String getSessionID(String url, String username, String password) throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
client.getParams().setAuthenticationPreemptive(true);
GetMethod get = new GetMethod(url);
get.setDoAuthentication(true);
String sessionID;
try {
client.executeMethod(get);
sessionID = parseSessionID(get);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
throw e;
} finally {
get.releaseConnection();
}
return sessionID;
}
private static String parseSessionID(HttpMethod method) {
String sessionID = null;
String stickySession = MDMTransaction.getStickySession();
Header[] setCookie = method.getResponseHeaders("Set-Cookie"); //$NON-NLS-1$
for(Header header : setCookie) {
String headerValue = header.getValue();
if(headerValue.startsWith(stickySession + "=")) { //$NON-NLS-1$
int beginIndex = (stickySession + "=").length(); //$NON-NLS-1$
int endIndex = headerValue.indexOf(";", beginIndex); //$NON-NLS-1$
sessionID = headerValue.substring(beginIndex, endIndex);
break;
}
}
if(sessionID == null) {
if(LOG.isDebugEnabled()) {
LOG.warn("Cookie for sticky session not found!"); //$NON-NLS-1$
}
sessionID = ""; //$NON-NLS-1$
}
return sessionID;
}
public static String getMDMTransactionURL(String url) {
if(url == null || "".equals(url)) {
return "";
}
int count = 3;
int i=0;
for(;i<url.length();i++) {
char c = url.charAt(i);
if('/' == c) {
count--;
}
if(count == 0) {
break;
}
}
String result = url.substring(0, i);
result += "/datamanager/services/transactions"; //$NON-NLS-1$
return result;
}
@SuppressWarnings("nls")
public static void main(String[] args) throws IOException {
String sessionID = MDMTransactionClient.getSessionID("http://localhost:8000/datamanager/services/transactions", "administrator", "administrator");
System.out.println(sessionID);
MDMTransaction mt = MDMTransactionClient.newTransaction("http://localhost:8000/datamanager/services/transactions", "administrator", "administrator");
mt.commit();
MDMTransaction mt1 = MDMTransactionClient.newTransaction("http://localhost:8000/datamanager/services/transactions", "administrator", "administrator");
mt1.rollback();
String url = "http://localhost:8000/talend/TalendPort";
String mdmurl = MDMTransactionClient.getMDMTransactionURL(url);
System.out.println(mdmurl);
}
}

View File

@@ -95,10 +95,10 @@
boolean isAllRows = "ALL_ROWS".equals(matchingModeStr);
boolean includeParallelComps = false;
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
if (listPartitions!=null && listPartitions.size() > 0 ) {
includeParallelComps = true;
}
INode collectorNode = validTarget.getDesignSubjobStartNode();
if ("tCollector".equals(collectorNode.getComponent().getName())) {
includeParallelComps = true;
}
%>
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_<%=connectionName%> =
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.<%= matchingModeStr %>;

View File

@@ -5,6 +5,7 @@
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
java.util.List
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.IHashableInputConnections
org.talend.core.model.process.IHashConfiguration
org.talend.core.model.process.IDataConnection
@@ -49,12 +50,12 @@
}
}
memoryStorage = !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk);
}
boolean includeParallelComps = false;
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
if (listPartitions!=null && listPartitions.size() > 0 ) {
INode partitionNode = validTarget.getDesignSubjobStartNode();
if ("tCollector".equals(partitionNode.getComponent().getName())) {
includeParallelComps = true;
partitionNode = partitionNode.getIncomingConnections(EConnectionType.STARTS).get(0).getSource();
}
%>
tHash_Lookup_<%=connectionName%>.endPut();
@@ -62,7 +63,7 @@ tHash_Lookup_<%=connectionName%>.endPut();
if (includeParallelComps && memoryStorage && !isOneOfReloadLookupMode) {
%>
java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> =
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_"+jobName);
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_<%=partitionNode.getUniqueName()%>_"+jobName);
if (mapsList_<%=cid%> != null) {
@@ -101,6 +102,8 @@ java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<
<%
}
}
}
}
%>

View File

@@ -13,6 +13,7 @@ imports="
java.util.List
org.talend.core.model.process.IProcess
org.talend.core.model.process.IElementParameter
org.talend.core.model.process.AbstractNode
"
%>
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
@@ -456,9 +457,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -507,7 +508,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%
@@ -879,9 +880,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -930,7 +931,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%

View File

@@ -7,6 +7,7 @@
java.util.List
org.talend.core.model.process.IProcess
org.talend.core.model.utils.NodeUtil
org.talend.core.model.process.AbstractNode
"
%>
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
@@ -44,9 +45,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -139,7 +140,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%

View File

@@ -7,6 +7,7 @@
java.util.List
org.talend.core.model.process.IProcess
org.talend.core.model.utils.NodeUtil
org.talend.core.model.process.AbstractNode
"
%>
@@ -43,9 +44,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -140,7 +141,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%

View File

@@ -11,6 +11,7 @@ imports="
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.utils.NodeUtil
org.talend.core.model.process.AbstractNode
"
%>
@@ -81,9 +82,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -136,7 +137,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%
@@ -227,9 +228,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -349,7 +350,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%
@@ -426,9 +427,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -497,7 +498,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%
@@ -585,9 +586,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -746,7 +747,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%

View File

@@ -6,6 +6,7 @@
org.talend.core.model.process.ElementParameterParser
java.util.List
org.talend.core.model.utils.NodeUtil
org.talend.core.model.process.AbstractNode
"
%>
@@ -34,9 +35,9 @@
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -61,7 +62,7 @@
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%

View File

@@ -10,6 +10,7 @@
org.talend.core.model.utils.NodeUtil
java.util.List
java.util.Map
org.talend.core.model.process.AbstractNode
"
%>
@@ -74,9 +75,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
synchronized (multiThreadLockWrite) {
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
synchronized (lockWrite) {
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
<%
}
if (isParallelize) {
@@ -100,7 +101,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
}
<%
}
if (NodeUtil.subBranchContainsParallelIterate(node)) {
if (((AbstractNode)node).getParallelIterator() != null) {
%>
}
<%

View File

@@ -87,6 +87,9 @@
REPOSITORY_VALUE="SID" REQUIRED="true">
<DEFAULT>""</DEFAULT>
</PARAMETER>
<PARAMETER NAME="DISTRIBUTION" FIELD="TEXT" NUM_ROW="14">
<DEFAULT>""</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS>
@@ -125,35 +128,36 @@
<CODEGENERATION>
<IMPORTS>
<!-- MICROSOFT HD INSIGHT 3.1 -->
<IMPORT NAME="talend-webhcat-launcher-1.0.0" MODULE="talend-webhcat-launcher-1.0.0.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="cxf-api-2.7.7" MODULE="cxf-api-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-api-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="cxf-rt-bindings-xml-2.7.7" MODULE="cxf-rt-bindings-xml-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-bindings-xml-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="cxf-rt-core-2.7.7" MODULE="cxf-rt-core-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-core-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="cxf-rt-frontend-jaxrs-2.7.7" MODULE="cxf-rt-frontend-jaxrs-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-frontend-jaxrs-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="cxf-rt-transports-http-2.7.7" MODULE="cxf-rt-transports-http-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-transports-http-2.7.7.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="json-simple" MODULE="json_simple-1.1.jar"
UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/json_simple-1.1.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="javax.ws.rs-api-2.0-m10" MODULE="javax.ws.rs-api-2.0-m10.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="WSDL4J-1_6_2" MODULE="wsdl4j-1.6.2.jar"
BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED="true" />
<IMPORT NAME="azure-storage-1.2.0" MODULE="azure-storage-1.2.0.jar"
REQUIRED_IF="USE_EXISTING_CONNECTION=='false'" />
<IMPORT NAME="talend-webhcat-launcher-1.0.0" MODULE="talend-webhcat-launcher-1.0.0.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-api-2.7.7" MODULE="cxf-api-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-api-2.7.7.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-bindings-xml-2.7.7" MODULE="cxf-rt-bindings-xml-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-bindings-xml-2.7.7.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-core-2.7.7" MODULE="cxf-rt-core-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-core-2.7.7.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-frontend-jaxrs-2.7.7" MODULE="cxf-rt-frontend-jaxrs-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-frontend-jaxrs-2.7.7.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="cxf-rt-transports-http-2.7.7" MODULE="cxf-rt-transports-http-2.7.7.jar"
UrlPath="platform:/plugin/org.talend.libraries.apache.cxf/lib/cxf-rt-transports-http-2.7.7.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="json-simple" MODULE="json_simple-1.1.jar"
UrlPath="platform:/plugin/org.talend.libraries.jackson/lib/json_simple-1.1.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="javax.ws.rs-api-2.0-m10" MODULE="javax.ws.rs-api-2.0-m10.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="WSDL4J-1_6_2" MODULE="wsdl4j-1.6.2.jar"
BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED="false"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<IMPORT NAME="azure-storage-1.2.0" MODULE="azure-storage-1.2.0.jar"
REQUIRED_IF="(USE_EXISTING_CONNECTION=='false') AND (DISTRIBUTION=='MICROSOFT_HD_INSIGHT')" />
<!-- #################### -->
</IMPORTS>
</CODEGENERATION>
<RETURNS />
</COMPONENT>
</COMPONENT>

View File

@@ -1,48 +1,63 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String version = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__DATAMODEL__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
String dataEntity = ElementParameterParser.getValue(node, "__DATACONCEPT__");
String arraySize = ElementParameterParser.getValue(node,"__MASS_LEVEL__");
boolean validate = ("true").equals(ElementParameterParser.getValue(node,"__VALIDATE__"));
boolean isGenerateId = ("true").equals(ElementParameterParser.getValue(node,"__GENERATE_ID__"));
boolean useTransaction = ("true").equals(ElementParameterParser.getValue(node,"__USE_TRANSACTION__"));
String transactionProvider = ElementParameterParser.getValue(node,"__TRANSACTION_PROVIDER__");
String mdmTransaction = "mdmTransaction_" + transactionProvider;
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
String passwordFieldName = "__PASSWORD__";
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String version = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__DATAMODEL__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
String dataEntity = ElementParameterParser.getValue(node, "__DATACONCEPT__");
String arraySize = ElementParameterParser.getValue(node,"__MASS_LEVEL__");
boolean validate = ("true").equals(ElementParameterParser.getValue(node,"__VALIDATE__"));
boolean isGenerateId = ("true").equals(ElementParameterParser.getValue(node,"__GENERATE_ID__"));
boolean useTransaction = ("true").equals(ElementParameterParser.getValue(node,"__USE_TRANSACTION__"));
String connection = ElementParameterParser.getValue(node,"__TRANSACTION_PROVIDER__");
String trans = "mdmTrans_" + connection;
%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
org.talend.mdm.bulkload.client.BulkloadClient bulkloadClient_<%=cid %> = new org.talend.mdm.bulkload.client.BulkloadClient(<%=mdmUrl%>, <%=username %>, decryptedPassword_<%=cid%>, <%=version==null || "".equals(version)? "null":version%>, <%=dataCluster %> + "<%=isStaging?"#STAGING":""%>", <%=dataEntity %>, <%=dataModule%>);
<%if(useTransaction) {%>
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=mdmTransaction%>");
if(mdmTransaction_<%=cid%>!=null) {
bulkloadClient_<%=cid %>.setTransactionId(mdmTransaction_<%=cid%>.getId());
}
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
String murl_<%=cid%> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
bulkloadClient_<%=cid %>.setSessionId(mdmTransaction_<%=cid%>.getSessionId());
bulkloadClient_<%=cid %>.setTransactionId(mdmTransaction_<%=cid%>.getId());
<%}%>
bulkloadClient_<%=cid %>.startThreadCount();
bulkloadClient_<%=cid %>.setOptions(new org.talend.mdm.bulkload.client.BulkloadOptions(<%=isGenerateId %>, <%=validate %>, <%=arraySize%>));
int count_<%=cid%> = 0;
org.talend.mdm.bulkload.client.InputStreamMerger inputStreamMerger_<%=cid%> = null;
org.talend.mdm.bulkload.client.InputStreamMerger inputStreamMerger_<%=cid%> = null;

View File

@@ -1,21 +1,23 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
//for bug TDI-22445
%>
if (inputStreamMerger_<%=cid%>!=null) {
inputStreamMerger_<%=cid%>.close();
}
inputStreamMerger_<%=cid%>.close();
}
bulkloadClient_<%=cid %>.waitForEndOfQueue();
bulkloadClient_<%=cid %> = null;
<%//TDI-26145%>
if(inputStreamMerger_<%=cid%>!=null && inputStreamMerger_<%=cid%>.getLastReportedFailure()!=null){
throw new Exception(inputStreamMerger_<%=cid%>.getLastReportedFailure());
throw new Exception(inputStreamMerger_<%=cid%>.getLastReportedFailure());
}

View File

@@ -29,6 +29,7 @@ if (count_<%=cid%> % <%=arraySize%> == 0) {
if(inputStreamMerger_<%=cid%> != null)
inputStreamMerger_<%=cid%>.close();
inputStreamMerger_<%=cid%> = bulkloadClient_<%=cid %>.load();
resourceMap.put("mdmBulkStream<%=cid %>", inputStreamMerger_<%=cid%>);
}
if(<%=conn.getName()%>.<%=xmlField %>!=null){

View File

@@ -1,23 +1,27 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String cid = node.getUniqueName();
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
if(xtentisWS_<%=cid %> != null)
{
xtentisWS_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
}
java.util.Iterator it_<%=cid %> = globalMap.keySet().iterator();
while (it_<%=cid %>.hasNext()) {
String key_<%=cid %> = it_<%=cid %>.next().toString();
if (key_<%=cid %>.startsWith("<%=conn %>_")) {
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get(key_<%=cid %>);
if(xtentisWS_<%=cid %> != null) {
xtentisWS_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
}
}
}

View File

@@ -1,33 +1,30 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String cid = node.getUniqueName();
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
boolean close = ("true").equals(ElementParameterParser.getValue(node,"__CLOSE__"));
String conn = "xtentisWS_" + connection;
String mdmTransaction = "mdmTransaction_" + connection;
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
boolean close = ("true").equals(ElementParameterParser.getValue(node,"__CLOSE__"));
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
%>
org.talend.mdm.webservice.XtentisPort_PortType conn_<%=cid%> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
if(conn_<%=cid%> != null)
{
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=mdmTransaction%>");
if(mdmTransaction_<%=cid%>!=null) {
mdmTransaction_<%=cid%>.commit();
}
<% if(close){%>
conn_<%=cid%>.logout(new org.talend.mdm.webservice.WSLogout());
<% }%>
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> != null) {
mdmTransaction_<%=cid%>.commit();
}
<% if(close){%>
org.talend.mdm.webservice.XtentisPort_PortType conn_<%=cid%> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(conn_<%=cid%> != null) {
conn_<%=cid%>.logout(new org.talend.mdm.webservice.WSLogout());
}
<% }%>

View File

@@ -1,11 +1,11 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -16,35 +16,29 @@ String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
boolean useTransaction = "false".equals(ElementParameterParser.getValue(node, "__AUTO_COMMIT__"));
boolean useClientTranId = "true".equals(ElementParameterParser.getValue(node, "__GEN_TRANSACTION_ID__"));
%>
<%if(universe == null || ("").equals(universe.trim())){%>
String username_<%=cid %> = <%=username %>;
<%}else{%>
String username_<%=cid %> = <%=universe%> + "/" + <%=username %>;
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
globalMap.put("mdmUrl_<%=cid %>", <%=mdmUrl %>);
globalMap.put("username_<%=cid %>", username_<%=cid %>);
globalMap.put("password_<%=cid %>", decryptedPassword_<%=cid %>);
globalMap.put("useTransaction_<%=cid %>", <%=useTransaction %>);
globalMap.put("useClientTranId_<%=cid %>", <%=useClientTranId %>);
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%if(useTransaction) {%>
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(<%=mdmUrl %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
globalMap.put("mdmTransaction_<%=cid %>", mdmTransaction_<%=cid%>);
<%}%>
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("xtentisWS_<%=cid %>", xtentisWS_<%=cid %>);
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());
xtentisWS_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());

View File

@@ -61,6 +61,15 @@
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER
NAME="GEN_TRANSACTION_ID"
FIELD="CHECK"
NUM_ROW="40"
SHOW_IF="AUTO_COMMIT=='false'"
>
<DEFAULT>false</DEFAULT>
</PARAMETER>
</PARAMETERS>
<ADVANCED_PARAMETERS/>

View File

@@ -6,4 +6,5 @@ UNIVERSE.NAME=Version
HELP=org.talend.help.tMDMConnection
LONG_NAME=Creates a connection to a MDM Server
AUTO_COMMIT.NAME=Auto Commit
AUTO_COMMIT.NAME=Auto Commit
GEN_TRANSACTION_ID.NAME=Use client side transaction id

View File

@@ -1,49 +1,81 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__CONCEPT__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__CONCEPT__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");

View File

@@ -1,18 +1,19 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
%>
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);

View File

@@ -1,15 +1,16 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
java.util.List
java.util.Map
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
java.util.List
java.util.Map
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -33,61 +34,61 @@ String sourceName = ElementParameterParser.getValue(node,"__SOURCE__");
String needCheck = ElementParameterParser.getValue(node,"__ISINVOKE__");
if(spellThrehold==null || ("").equals(spellThrehold)){
spellThrehold = "0";
}
spellThrehold = "0";
}
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null)&&(metadatas.size()>0)) {//1
IMetadataTable metadata = metadatas.get(0);
if (metadata!=null) {//2
List< ? extends IConnection> conns = node.getIncomingConnections();
for (IConnection conn : conns) {//3
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {//4
if(!useMultConditions){//5
List< ? extends IConnection> conns = node.getIncomingConnections();
for (IConnection conn : conns) {//3
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {//4
if(!useMultConditions){//5
%>
String[] wsIds_<%=cid %> = {
<%
for(int i=0;i<keyValues.size();i++){
String columnName=keyValues.get(i).get("KEY");
for(int i=0;i<keyValues.size();i++){
String columnName=keyValues.get(i).get("KEY");
%>
<%=i==0?"":","%><%=conn.getName()%>.<%=columnName %>
<%
}
}
%>};
org.talend.mdm.webservice.WSItemPK wsPK_<%=cid %> = new org.talend.mdm.webservice.WSItemPK(dataCluster_<%=cid %>,<%=dataModule %>,wsIds_<%=cid %>);
///////////////////////
///////////////////////
try{
<%
if(isDropItem){
%>
org.talend.mdm.webservice.WSDropItem item_<%=cid %> = new org.talend.mdm.webservice.WSDropItem();
item_<%=cid %>.setPartPath(<%=partPath %>);
<%
}else{
%>
org.talend.mdm.webservice.WSDeleteItem item_<%=cid %> = new org.talend.mdm.webservice.WSDeleteItem();
<%
}
%>
item_<%=cid %>.setWsItemPK(wsPK_<%=cid %>);
item_<%=cid %>.setOverride(false);
<%
if (!isStaging && withReport) {
%>
item_<%=cid %>.setWithReport(true);
item_<%=cid %>.setSource(<%=sourceName%>);
item_<%=cid %>.setInvokeBeforeDeleting(<%=needCheck%>);
<%
}
if(isDropItem){
%>
xtentisWS_<%=cid %>.dropItem(item_<%=cid %>);
<%
}else{
%>
xtentisWS_<%=cid %>.deleteItem(item_<%=cid %>);
<%
if(isDropItem){
%>
org.talend.mdm.webservice.WSDropItem item_<%=cid %> = new org.talend.mdm.webservice.WSDropItem();
item_<%=cid %>.setPartPath(<%=partPath %>);
<%
}else{
%>
org.talend.mdm.webservice.WSDeleteItem item_<%=cid %> = new org.talend.mdm.webservice.WSDeleteItem();
<%
}
%>
item_<%=cid %>.setWsItemPK(wsPK_<%=cid %>);
item_<%=cid %>.setOverride(false);
<%
if (!isStaging && withReport) {
%>
item_<%=cid %>.setWithReport(true);
item_<%=cid %>.setSource(<%=sourceName%>);
item_<%=cid %>.setInvokeBeforeDeleting(<%=needCheck%>);
<%
}
if(isDropItem){
%>
xtentisWS_<%=cid %>.dropItem(item_<%=cid %>);
<%
}else{
%>
xtentisWS_<%=cid %>.deleteItem(item_<%=cid %>);
<%
}
%>
@@ -95,78 +96,78 @@ try{
<%
if(dieOnError){
%>
throw(e);
throw(e);
<%
}else{
%>
System.err.println(e.getMessage());
System.err.println(e.getMessage());
<%
}
%>
}
nb_line_<%=cid %>++;
nb_line_<%=cid %>++;
///////////////////////
///////////////////////
<%
}
}//4
}//3
}
}//4
}//3
}//2
}//1
%>
<%
if(useMultConditions){
if(useMultConditions){
%>
org.talend.mdm.webservice.WSWhereCondition wc_<%=cid %> = null;
java.util.List<org.talend.mdm.webservice.WSWhereItem> conditions_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSWhereItem>();
org.talend.mdm.webservice.WSWhereCondition wc_<%=cid %> = null;
java.util.List<org.talend.mdm.webservice.WSWhereItem> conditions_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSWhereItem>();
<%
boolean isOnlyOrPredicate=true;
for(int i=0; i < operations.size(); i++){
Map<String, String> map= operations.get(i);
String xpath=map.get("XPATH");
String operator=map.get("FUNCTION");
String value = map.get("VALUE");
String predicate = map.get("PREDICATE");
if((i < operations.size()-1) && (!"OR".equals(predicate))){
isOnlyOrPredicate = false;
}
boolean isOnlyOrPredicate=true;
for(int i=0; i < operations.size(); i++){
Map<String, String> map= operations.get(i);
String xpath=map.get("XPATH");
String operator=map.get("FUNCTION");
String value = map.get("VALUE");
String predicate = map.get("PREDICATE");
if((i < operations.size()-1) && (!"OR".equals(predicate))){
isOnlyOrPredicate = false;
}
%>
wc_<%=cid %> =new org.talend.mdm.webservice.WSWhereCondition(<%=xpath %>,org.talend.mdm.webservice.WSWhereOperator.<%=operator %>, <%="EMPTY_NULL".equals(operator)? null:value %>, org.talend.mdm.webservice.WSStringPredicate.<%=predicate %>,false);
org.talend.mdm.webservice.WSWhereItem wsItem_<%=i %>_<%=cid %>=new org.talend.mdm.webservice.WSWhereItem(wc_<%=cid %>,null,null);
conditions_<%=cid %>.add(wsItem_<%=i %>_<%=cid %>);
wc_<%=cid %> =new org.talend.mdm.webservice.WSWhereCondition(<%=xpath %>,org.talend.mdm.webservice.WSWhereOperator.<%=operator %>, <%="EMPTY_NULL".equals(operator)? null:value %>, org.talend.mdm.webservice.WSStringPredicate.<%=predicate %>,false);
org.talend.mdm.webservice.WSWhereItem wsItem_<%=i %>_<%=cid %>=new org.talend.mdm.webservice.WSWhereItem(wc_<%=cid %>,null,null);
conditions_<%=cid %>.add(wsItem_<%=i %>_<%=cid %>);
<%
}//for
}//for
%>
org.talend.mdm.webservice.WSWhereItem wsItem_<%=cid %> = null;
if(conditions_<%=cid %>.size() > 0){
org.talend.mdm.webservice.WSWhereItem wsItem_<%=cid %> = null;
if(conditions_<%=cid %>.size() > 0){
<%
if(!isOnlyOrPredicate){
if(!isOnlyOrPredicate){
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]),null);
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]),null);
<%
}else{
}else{
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]));
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]));
<%
}
}
%>
}
try{
org.talend.mdm.webservice.WSDeleteItems items_<%=cid %> = new org.talend.mdm.webservice.WSDeleteItems(dataCluster_<%=cid %>,<%=dataModule %>,wsItem_<%=cid %>,<%=spellThrehold%>,false);
xtentisWS_<%=cid %>.deleteItems(items_<%=cid %>);
}catch(java.lang.Exception e_<%=cid%>){
}
try{
org.talend.mdm.webservice.WSDeleteItems items_<%=cid %> = new org.talend.mdm.webservice.WSDeleteItems(dataCluster_<%=cid %>,<%=dataModule %>,wsItem_<%=cid %>,<%=spellThrehold%>,false);
xtentisWS_<%=cid %>.deleteItems(items_<%=cid %>);
}catch(java.lang.Exception e_<%=cid%>){
<%
if(dieOnError){
if(dieOnError){
%>
throw(e_<%=cid%>);
throw(e_<%=cid%>);
<%
}else{
}else{
%>
System.err.println(e_<%=cid%>.getMessage());
System.err.println(e_<%=cid%>.getMessage());
<%
}
}
%>
}
}
<%
}
}
%>

View File

@@ -1,97 +1,139 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__DATAMODEL__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean isProvisioning = "\"PROVISIONING\"".equalsIgnoreCase(dataCluster);
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
%>
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__DATAMODEL__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
%>
int nb_line_<%=cid %> = 0;
int nb_line_rejected_<%=cid%> = 0;
<%if(!usePartialUpdate){%>
<%if(addTaskID){%>
class Util_<%=cid%>{
public org.talend.mdm.webservice.WSUpdateMetadataItem makeUpdateMeteItm(String taskID,org.talend.mdm.webservice.WSItemPK wspk){
org.talend.mdm.webservice.WSUpdateMetadataItem wsUpdateMetadataItem = new org.talend.mdm.webservice.WSUpdateMetadataItem();
wsUpdateMetadataItem.setTaskId(taskID);
wsUpdateMetadataItem.setWsItemPK(wspk);
return wsUpdateMetadataItem;
}
public org.talend.mdm.webservice.WSUpdateMetadataItem[] makeUpdateMeteItms(java.util.List<String> taskIDs,org.talend.mdm.webservice.WSItemPK[] wspks){
java.util.List<org.talend.mdm.webservice.WSUpdateMetadataItem> wsUpdateMetadataItems = new java.util.ArrayList<org.talend.mdm.webservice.WSUpdateMetadataItem>();
int i = 0;
for(org.talend.mdm.webservice.WSItemPK wspk : wspks){
wsUpdateMetadataItems.add(makeUpdateMeteItm(taskIDs.get(i),wspk));
i++;
}
return wsUpdateMetadataItems.toArray(new org.talend.mdm.webservice.WSUpdateMetadataItem[wsUpdateMetadataItems.size()]);
}
}
Util_<%=cid%> util_<%=cid%> = new Util_<%=cid%>();
<%}%>
<%if(isMassInsert){
if(!isStaging && withReport){%>
java.util.List <org.talend.mdm.webservice.WSPutItemWithReport> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItemWithReport>();
<% }else{%>
java.util.List <org.talend.mdm.webservice.WSPutItem> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItem>();
<%
}
if(addTaskID){
%>
java.util.List<String> taskIDs_<%=cid%> = new java.util.ArrayList<String>();
<%
}
}
<%if(addTaskID){%>
class Util_<%=cid%>{
public org.talend.mdm.webservice.WSUpdateMetadataItem makeUpdateMeteItm(String taskID,org.talend.mdm.webservice.WSItemPK wspk){
org.talend.mdm.webservice.WSUpdateMetadataItem wsUpdateMetadataItem = new org.talend.mdm.webservice.WSUpdateMetadataItem();
wsUpdateMetadataItem.setTaskId(taskID);
wsUpdateMetadataItem.setWsItemPK(wspk);
return wsUpdateMetadataItem;
}
public org.talend.mdm.webservice.WSUpdateMetadataItem[] makeUpdateMeteItms(java.util.List<String> taskIDs,org.talend.mdm.webservice.WSItemPK[] wspks){
java.util.List<org.talend.mdm.webservice.WSUpdateMetadataItem> wsUpdateMetadataItems = new java.util.ArrayList<org.talend.mdm.webservice.WSUpdateMetadataItem>();
int i = 0;
for(org.talend.mdm.webservice.WSItemPK wspk : wspks){
wsUpdateMetadataItems.add(makeUpdateMeteItm(taskIDs.get(i),wspk));
i++;
}
return wsUpdateMetadataItems.toArray(new org.talend.mdm.webservice.WSUpdateMetadataItem[wsUpdateMetadataItems.size()]);
}
}
Util_<%=cid%> util_<%=cid%> = new Util_<%=cid%>();
<%}%>
<%if(isMassInsert){
if(!isStaging && withReport){%>
java.util.List <org.talend.mdm.webservice.WSPutItemWithReport> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItemWithReport>();
<% }else{%>
java.util.List <org.talend.mdm.webservice.WSPutItem> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItem>();
<%
}
if(addTaskID){
%>
java.util.List<String> taskIDs_<%=cid%> = new java.util.ArrayList<String>();
<%
}
}
}%>
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else if(isProvisioning){%>
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername((String)globalMap.get("username_<%=connection %>"));
stub_<%=cid %>.setPassword((String)globalMap.get("password_<%=connection %>"));
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
@@ -100,4 +142,4 @@ org.talend.mdm.webservice.WSDataModelPK dataModel_<%=cid %> = new org.talend.mdm
String input_<%=cid %>;
org.talend.mdm.webservice.WSItemPK[] wspks_<%=cid %>;
org.talend.mdm.webservice.WSItemPK wspk_<%=cid %>;
org.talend.mdm.webservice.WSItemPK wspk_<%=cid %>;

View File

@@ -1,63 +1,64 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
String taskID = ElementParameterParser.getValue(node,"__TASKID__");
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
String taskID = ElementParameterParser.getValue(node,"__TASKID__");
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
%>
<%
if(!usePartialUpdate){
if(isMassInsert){
if(!isStaging && withReport){
if(isMassInsert){
if(!isStaging && withReport){
%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
}
<%
}else{%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
}else{%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
}
<%
}
}
}
}
}%>
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
globalMap.put("<%=cid %>_NB_LINE_REJECTED",nb_line_rejected_<%=cid%>);
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
globalMap.put("<%=cid %>_NB_LINE_REJECTED",nb_line_rejected_<%=cid%>);

View File

@@ -1,17 +1,18 @@
<%@ 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.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.EConnectionType
java.util.List
java.util.Map
"
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.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.EConnectionType
java.util.List
java.util.Map
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -51,177 +52,186 @@ if (destination != null && !"".equals(destination)) {
}
if (metadatas != null && metadatas.size()>0) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<? extends IConnection> outputConns = node.getOutgoingConnections(EConnectionType.FLOW_MAIN);
List<IMetadataColumn> inputColumnList = null;
List<IMetadataColumn> outputColumnList = null;
List<IMetadataColumn> columnList =metadata.getListColumns();
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<? extends IConnection> outputConns = node.getOutgoingConnections(EConnectionType.FLOW_MAIN);
List<IMetadataColumn> inputColumnList = null;
List<IMetadataColumn> outputColumnList = null;
List<IMetadataColumn> columnList =metadata.getListColumns();
String rejectConnName = null;
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
List<IMetadataColumn> rejectColumnList = null;
if (rejectConns != null && rejectConns.size() > 0) {
IConnection rejectConn = rejectConns.get(0);
if(rejectConn!=null){
rejectConnName = rejectConn.getName();
IMetadataTable metadataTable = rejectConn.getMetadataTable();
if(metadataTable!=null){
rejectColumnList = metadataTable.getListColumns();
}
rejectConnName = rejectConn.getName();
IMetadataTable metadataTable = rejectConn.getMetadataTable();
if(metadataTable!=null){
rejectColumnList = metadataTable.getListColumns();
}
}
}
String outConnName = null;
String inputConnName = null;
String inputConnName = null;
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
for(IConnection tmpconn : outgoingConns) {
if (tmpconn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
if(rejectConnName==null || !rejectConnName.equals(tmpconn.getName())){
outConnName=tmpconn.getName();
IMetadataTable outputMetadata = tmpconn.getMetadataTable();
if(outputMetadata!=null){
outputColumnList = outputMetadata.getListColumns();
}
IMetadataTable outputMetadata = tmpconn.getMetadataTable();
if(outputMetadata!=null){
outputColumnList = outputMetadata.getListColumns();
}
}%>
<%=tmpconn.getName() %> = null;
<%
}
}
List<? extends IConnection> inputConns = node.getIncomingConnections();
List<? extends IConnection> inputConns = node.getIncomingConnections();
if (inputConns != null && inputConns.size() > 0) {
IConnection inputConn = inputConns.get(0);
if(inputConn!=null){
inputConnName = inputConn.getName();
IMetadataTable inputMetadata = inputConn.getMetadataTable();
if(inputMetadata!=null) {
inputColumnList = inputMetadata.getListColumns();
}
}
}
inputConnName = inputConn.getName();
IMetadataTable inputMetadata = inputConn.getMetadataTable();
if(inputMetadata!=null) {
inputColumnList = inputMetadata.getListColumns();
}
}
}
if (outConnName != null && inputConnName!=null) {
%>
<%=outConnName %> = new <%=outConnName %>Struct();
<%
for(IMetadataColumn outputColumn : outputColumnList) {
for(IMetadataColumn inputColumn : inputColumnList) {
if (outputColumn.getLabel().equals(inputColumn.getLabel())) {
if(doc!=null && doc.equals(outputColumn.getLabel())) {
if("id_Document".equals(outputColumn.getTalendType())) {
for(IMetadataColumn inputColumn : inputColumnList) {
if (outputColumn.getLabel().equals(inputColumn.getLabel())) {
if(doc!=null && doc.equals(outputColumn.getLabel())) {
if("id_Document".equals(outputColumn.getTalendType())) {
%>
<%=outConnName %>.<%=doc%> = <%=inputConnName%>.<%=doc%>;
<%
} else {
} else {
%>
<%=outConnName %>.<%=doc%> = <%=inputConnName%>.<%=doc%>.toString();
<%
}
} else { // to those which do not match doc columns
}
} else { // to those which do not match doc columns
%>
<%=outConnName %>.<%=outputColumn.getLabel()%> = <%=inputConnName%>.<%=inputColumn.getLabel()%>;
<%=outConnName %>.<%=outputColumn.getLabel()%> = <%=inputConnName%>.<%=inputColumn.getLabel()%>;
<%
}
} // if input column matches output column
} // for input column
} // for output column
}
} // if input column matches output column
} // for input column
} // for output column
}%>
input_<%=cid %> = <%=inputConnName%>.<%=doc%>.toString();
try {
<%if(usePartialUpdate){ // partial%>
org.talend.mdm.webservice.WSPartialPutItem wsPartialPutItem_<%=cid%> = new org.talend.mdm.webservice.WSPartialPutItem(input_<%=cid %>,<%=dataCluster %>,<%=pivot%>,<%=dataModule %>,<%=key.equals("")?null:key%>,<%=position.equals("")?null:position%>,<%=overwrite%>,<%= true==isStaging?false:withReport%>);
wspk_<%=cid %> = xtentisWS_<%=cid %>.partialPutItem(wsPartialPutItem_<%=cid%>);
<%if(usePartialUpdate){ // partial%>
<%
String stagingString = "";
if(isStaging){
stagingString = dataCluster + " + \"#STAGING\"";
} else {
stagingString = dataCluster;
}
%>
org.talend.mdm.webservice.WSPartialPutItem wsPartialPutItem_<%=cid%> = new org.talend.mdm.webservice.WSPartialPutItem(input_<%=cid %>,<%=stagingString %>,<%=pivot%>,<%=dataModule %>,<%=key.equals("")?null:key%>,<%=position.equals("")?null:position%>,<%=overwrite%>,<%= true==isStaging?false:withReport%>, <%=sourceName %>);
wspk_<%=cid %> = xtentisWS_<%=cid %>.partialPutItem(wsPartialPutItem_<%=cid%>);
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
%>
<%}else{// not partial %>
org.talend.mdm.webservice.WSPutItem item_<%=cid %> = new org.talend.mdm.webservice.WSPutItem(dataCluster_<%=cid %>,input_<%=cid %>,dataModel_<%=cid %>, <%=isUpdate %>);
<%
if (!isStaging && withReport) {%>
org.talend.mdm.webservice.WSPutItemWithReport itemReport_<%=cid %> = new org.talend.mdm.webservice.WSPutItemWithReport(item_<%=cid %>,<%=sourceName %>,<%=needCheck %>);
<%if (isMassInsert) {%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:inputConnName + "." + prevColumn%>);
<%}%>
miList_<%=cid %>.add(itemReport_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReport(itemReport_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:inputConnName + "." + prevColumn%>,wspk_<%=cid %>));
<%}%>
<%
}
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
} else {
if (isMassInsert) {
%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:inputConnName + "." + prevColumn%>);
<%}%>
miList_<%=cid %>.add(item_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%
} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItem(item_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:inputConnName + "." + prevColumn%>,wspk_<%=cid %>));
<%}%>
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
}
}
%>
<%}//end partial%>
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
%>
<%}else{// not partial %>
org.talend.mdm.webservice.WSPutItem item_<%=cid %> = new org.talend.mdm.webservice.WSPutItem(dataCluster_<%=cid %>,input_<%=cid %>,dataModel_<%=cid %>, <%=isUpdate %>);
<%
if (!isStaging && withReport) {%>
org.talend.mdm.webservice.WSPutItemWithReport itemReport_<%=cid %> = new org.talend.mdm.webservice.WSPutItemWithReport(item_<%=cid %>,<%=sourceName %>,<%=needCheck %>);
<%if (isMassInsert) {%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:inputConnName + "." + prevColumn%>);
<%}%>
miList_<%=cid %>.add(itemReport_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReport(itemReport_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:inputConnName + "." + prevColumn%>,wspk_<%=cid %>));
<%}%>
<%
}
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
} else {
if (isMassInsert) {
%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:inputConnName + "." + prevColumn%>);
<%}%>
miList_<%=cid %>.add(item_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%
} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItem(item_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:inputConnName + "." + prevColumn%>,wspk_<%=cid %>));
<%}%>
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
}
}
%>
<%}//end partial%>
} catch (java.lang.Exception e) {
<%if (!usePartialUpdate && isMassInsert) {%>
miList_<%=cid %>.clear();
<%}%>
<%if (dieOnError) {%>
throw(e);
<%} else {
@@ -231,34 +241,34 @@ if (metadatas != null && metadatas.size()>0) {
<%=outConnName %> = null;
<%}%>
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
<%
<%
for(IMetadataColumn column : columnList) {
if (!"xml".equals(column.getLabel()) && !"errorCode".equals(column.getLabel()) && !"errorMessage".equals(column.getLabel())) {
if(column.getLabel().equals(doc) && "id_String".equals(column.getTalendType())) {
%>
<%=rejectConnName%>.<%=column.getLabel()%> = <%=inputConnName %>.<%=column.getLabel() %>.toString();
<%
} else {
%>
<%=rejectConnName%>.<%=column.getLabel()%> = <%=inputConnName %>.<%=column.getLabel() %>;
<%
}
}
if("xml".equals(column.getLabel())){
if("id_String".equals(column.getTalendType())){
%>
<%=rejectConnName%>.xml = input_<%=cid %>;
<%
}else{
%>
<%=rejectConnName%>.xml = <%=inputConnName %>.xml;
<%
}
}
}
%>
nb_line_rejected_<%=cid%>++;
if (!"xml".equals(column.getLabel()) && !"errorCode".equals(column.getLabel()) && !"errorMessage".equals(column.getLabel())) {
if(column.getLabel().equals(doc) && "id_String".equals(column.getTalendType())) {
%>
<%=rejectConnName%>.<%=column.getLabel()%> = <%=inputConnName %>.<%=column.getLabel() %>.toString();
<%
} else {
%>
<%=rejectConnName%>.<%=column.getLabel()%> = <%=inputConnName %>.<%=column.getLabel() %>;
<%
}
}
if("xml".equals(column.getLabel())){
if("id_String".equals(column.getTalendType())){
%>
<%=rejectConnName%>.xml = input_<%=cid %>;
<%
}else{
%>
<%=rejectConnName%>.xml = <%=inputConnName %>.xml;
<%
}
}
}
%>
nb_line_rejected_<%=cid%>++;
<%=rejectConnName %>.errorMessage = e.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
<%} else {%>
System.err.println(e.getMessage());
@@ -268,4 +278,4 @@ if (metadatas != null && metadatas.size()>0) {
nb_line_<%=cid %>++;
<%
}
}%>
}%>

View File

@@ -1,16 +1,17 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
java.util.List
java.util.Map
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -19,203 +20,234 @@ String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
String dieOnErrorStr = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
boolean dieOnError = (dieOnErrorStr!=null&&!("").equals(dieOnErrorStr))?("true").equals(dieOnErrorStr):false;
if(destination!=null && !"".equals(destination)){
cid = destination;
cid = destination;
}
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas != null) && (metadatas.size() > 0)) {//1
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {//2
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
IMetadataTable metadata = metadatas.get(0);
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){//3
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { //4
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
if (metadata != null) {//2
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String concept = ElementParameterParser.getValue(node, "__CONCEPT__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean isSingle = ("true").equals(ElementParameterParser.getValue(node, "__USE_ITEMS__"));
List<Map<String, String>> ids = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__IDS__");
List<Map<String, String>> operations = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__OPERATIONS__");
String spellThrehold = ElementParameterParser.getValue(node, "__SPELLTHREHOLD__");
String skip = ElementParameterParser.getValue(node, "__SKIP__");
String bufferSize = ElementParameterParser.getValue(node, "__FETCHSIZE__");
String limit = ElementParameterParser.getValue(node, "__MAXVALUE__");
if(spellThrehold==null || ("").equals(spellThrehold)){
spellThrehold = "0";
}
if(skip==null || ("").equals(skip)){
skip = "0";
}
if(limit==null || ("").equals(limit)){
limit = "0";
}
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){//3
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { //4
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String concept = ElementParameterParser.getValue(node, "__CONCEPT__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean isSingle = ("true").equals(ElementParameterParser.getValue(node, "__USE_ITEMS__"));
List<Map<String, String>> ids = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__IDS__");
List<Map<String, String>> operations = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__OPERATIONS__");
String spellThrehold = ElementParameterParser.getValue(node, "__SPELLTHREHOLD__");
String skip = ElementParameterParser.getValue(node, "__SKIP__");
String bufferSize = ElementParameterParser.getValue(node, "__FETCHSIZE__");
String limit = ElementParameterParser.getValue(node, "__MAXVALUE__");
if(spellThrehold==null || ("").equals(spellThrehold)){
spellThrehold = "0";
}
if(skip==null || ("").equals(skip)){
skip = "0";
}
if(limit==null || ("").equals(limit)){
limit = "0";
}
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
<%if(!isSingle){//item%>
String[] ids_<%=cid %> = {
<%
for(int i=0; i<ids.size(); i++){
Map<String, String> map = ids.get(i);
String idValue = map.get("IDVALUE");
%>
<%=(i==0? "":",")%><%=idValue %>
<%
}
%>
};
org.talend.mdm.webservice.WSGetItem wsitem_<%=cid %> =
new org.talend.mdm.webservice.WSGetItem(new org.talend.mdm.webservice.WSItemPK(dataCluster_<%=cid %>,<%=concept %>,ids_<%=cid %>));
String <%=outgoingConn.getName() %>_xml = "";
try {
org.talend.mdm.webservice.WSItem item_<%=cid %>=xtentisWS_<%=cid %>.getItem(wsitem_<%=cid %>);
<%=outgoingConn.getName() %>_xml = item_<%=cid %>.getContent();
} catch(java.lang.Exception e) {
<%if(dieOnError) {%>
throw e;
<% } else { %>
System.err.println(e.getMessage());
<% } %>
}
nb_line_<%=cid %> ++;
<%
}else{//items
%>
org.talend.mdm.webservice.WSWhereCondition wc_<%=cid %> = null;
java.util.List<org.talend.mdm.webservice.WSWhereItem> conditions_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSWhereItem>();
<%
boolean isOnlyOrPredicate=true;
for(int i=0; i < operations.size(); i++){
Map<String, String> map= operations.get(i);
String xpath=map.get("XPATH");
String operator=map.get("FUNCTION");
String value = map.get("VALUE");
String predicate = map.get("PREDICATE");
if((i < operations.size()-1) && (!"OR".equals(predicate))){
isOnlyOrPredicate = false;
}
%>
wc_<%=cid %> =new org.talend.mdm.webservice.WSWhereCondition(<%=xpath %>,org.talend.mdm.webservice.WSWhereOperator.<%=operator %>, <%="EMPTY_NULL".equals(operator)? null:value %>, org.talend.mdm.webservice.WSStringPredicate.<%=predicate %>,false);
org.talend.mdm.webservice.WSWhereItem wsItem_<%=i %>_<%=cid %>=new org.talend.mdm.webservice.WSWhereItem(wc_<%=cid %>,null,null);
conditions_<%=cid %>.add(wsItem_<%=i %>_<%=cid %>);
<%
}//for
%>
org.talend.mdm.webservice.WSWhereItem wsItem_<%=cid %> = null;
if(conditions_<%=cid %>.size() > 0){
<%
if(!isOnlyOrPredicate){
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]),null);
<%
}else{
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]));
<%
}
%>
}
int limit_<%=cid%> = <%=limit%>;
int recordsPerPage_<%=cid%> = <%=bufferSize%>;
int skip_<%=cid%> = <%=skip%>;
if (skip_<%=cid%> < 0)
skip_<%=cid%> = 0;
if (recordsPerPage_<%=cid%> <= 0)
recordsPerPage_<%=cid%> = -1;// read whole records in one time
if (limit_<%=cid%> <= 0)
limit_<%=cid%> = -1;// no limit
int retrievedCount_<%=cid%> = 0;
int readRecordsSize_<%=cid%> = limit_<%=cid%> == -1 ? recordsPerPage_<%=cid%> : (recordsPerPage_<%=cid%> == -1 ? limit_<%=cid%> : (recordsPerPage_<%=cid%> > limit_<%=cid%> ? limit_<%=cid%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
<%if(!isSingle){//item%>
String[] ids_<%=cid %> = {
<%
for(int i=0; i<ids.size(); i++){
Map<String, String> map = ids.get(i);
String idValue = map.get("IDVALUE");
%>
<%=(i==0? "":",")%><%=idValue %>
<%
}
%>
};
org.talend.mdm.webservice.WSGetItem wsitem_<%=cid %> = new org.talend.mdm.webservice.WSGetItem(new org.talend.mdm.webservice.WSItemPK(dataCluster_<%=cid %>,<%=concept %>,ids_<%=cid %>));
String <%=outgoingConn.getName() %>_xml = "";
try {
org.talend.mdm.webservice.WSItem item_<%=cid %>=xtentisWS_<%=cid %>.getItem(wsitem_<%=cid %>);
<%=outgoingConn.getName() %>_xml = item_<%=cid %>.getContent();
} catch(java.lang.Exception e) {
<%if(dieOnError) {%>
throw e;
<% } else { %>
System.err.println(e.getMessage());
<% } %>
}
nb_line_<%=cid %> ++;
<%
}else{//items
%>
org.talend.mdm.webservice.WSWhereCondition wc_<%=cid %> = null;
java.util.List<org.talend.mdm.webservice.WSWhereItem> conditions_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSWhereItem>();
<%
boolean isOnlyOrPredicate=true;
for(int i=0; i < operations.size(); i++){
Map<String, String> map= operations.get(i);
String xpath=map.get("XPATH");
String operator=map.get("FUNCTION");
String value = map.get("VALUE");
String predicate = map.get("PREDICATE");
if((i < operations.size()-1) && (!"OR".equals(predicate))){
isOnlyOrPredicate = false;
}
%>
wc_<%=cid %> =new org.talend.mdm.webservice.WSWhereCondition(<%=xpath %>,org.talend.mdm.webservice.WSWhereOperator.<%=operator %>, <%="EMPTY_NULL".equals(operator)? null:value %>, org.talend.mdm.webservice.WSStringPredicate.<%=predicate %>,false);
org.talend.mdm.webservice.WSWhereItem wsItem_<%=i %>_<%=cid %>=new org.talend.mdm.webservice.WSWhereItem(wc_<%=cid %>,null,null);
conditions_<%=cid %>.add(wsItem_<%=i %>_<%=cid %>);
<%
}//for
%>
org.talend.mdm.webservice.WSWhereItem wsItem_<%=cid %> = null;
if(conditions_<%=cid %>.size() > 0){
<%
if(!isOnlyOrPredicate){
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]),null);
<%
}else{
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]));
<%
}
%>
}
int limit_<%=cid%> = <%=limit%>;
int recordsPerPage_<%=cid%> = <%=bufferSize%>;
int skip_<%=cid%> = <%=skip%>;
if (skip_<%=cid%> < 0)
skip_<%=cid%> = 0;
if (recordsPerPage_<%=cid%> <= 0)
recordsPerPage_<%=cid%> = -1;// read whole records in one time
if (limit_<%=cid%> <= 0)
limit_<%=cid%> = -1;// no limit
int retrievedCount_<%=cid%> = 0;
int readRecordsSize_<%=cid%> = limit_<%=cid%> == -1 ? recordsPerPage_<%=cid%> : (recordsPerPage_<%=cid%> == -1 ? limit_<%=cid%> : (recordsPerPage_<%=cid%> > limit_<%=cid%> ? limit_<%=cid%>
: recordsPerPage_<%=cid%>));
org.talend.mdm.webservice.WSGetItems getitems_<%=cid %>=null;
boolean continueFlag_<%=cid%> = true;
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
while (continueFlag_<%=cid%>) {
getitems_<%=cid%>=new org.talend.mdm.webservice.WSGetItems(dataCluster_<%=cid%>, <%=concept%>, wsItem_<%=cid%>,
<%=spellThrehold%>, //spell Threshold
skip_<%=cid%> + retrievedCount_<%=cid%>,
readRecordsSize_<%=cid%>,true);
String[] items_<%=cid%> = {};
try {
items_<%=cid%> = xtentisWS_<%=cid%>.getItems(getitems_<%=cid%>);
if(totalCount_<%=cid%> < 0){
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
}
} catch(java.lang.Exception e) {
<%if(dieOnError) {%>
throw e;
<% } else { %>
System.err.println(e.getMessage());
<% } %>
}
retrievedCount_<%=cid%> += (items_<%=cid%>.length - 1);
if (totalCount_<%=cid%> == retrievedCount_<%=cid%> || recordsPerPage_<%=cid%> == -1 || (items_<%=cid%>.length - 1) < readRecordsSize_<%=cid%> || limit_<%=cid%> == retrievedCount_<%=cid%>) {
continueFlag_<%=cid%> = false;
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
readRecordsSize_<%=cid%> = limit_<%=cid%> - retrievedCount_<%=cid%>;
}
for(int i_<%=cid%> = 1, itemsLength_<%=cid%> = items_<%=cid%>.length; i_<%=cid%> < itemsLength_<%=cid%>; i_<%=cid%>++){
nb_line_<%=cid%> ++;
String <%=outgoingConn.getName()%>_xml = items_<%=cid%>[i_<%=cid%>];
<%
}//end items
%>
<%
}//4
}//3
}//2
org.talend.mdm.webservice.WSGetItems getitems_<%=cid %> = null;
boolean continueFlag_<%=cid%> = true;
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
while (continueFlag_<%=cid%>) {
getitems_<%=cid%>=new org.talend.mdm.webservice.WSGetItems(dataCluster_<%=cid%>, <%=concept%>, wsItem_<%=cid%>,
<%=spellThrehold%>, //spell Threshold
skip_<%=cid%> + retrievedCount_<%=cid%>,
readRecordsSize_<%=cid%>,true);
String[] items_<%=cid%> = {};
try {
items_<%=cid%> = xtentisWS_<%=cid%>.getItems(getitems_<%=cid%>);
if(totalCount_<%=cid%> < 0){
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
}
} catch(java.lang.Exception e) {
<%if(dieOnError) {%>
throw e;
<% } else { %>
System.err.println(e.getMessage());
<% } %>
}
retrievedCount_<%=cid%> += (items_<%=cid%>.length - 1);
if (totalCount_<%=cid%> == retrievedCount_<%=cid%> || recordsPerPage_<%=cid%> == -1 || (items_<%=cid%>.length - 1) < readRecordsSize_<%=cid%> || limit_<%=cid%> == retrievedCount_<%=cid%>) {
continueFlag_<%=cid%> = false;
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
readRecordsSize_<%=cid%> = limit_<%=cid%> - retrievedCount_<%=cid%>;
}
for(int i_<%=cid%> = 1, itemsLength_<%=cid%> = items_<%=cid%>.length; i_<%=cid%> < itemsLength_<%=cid%>; i_<%=cid%>++){
nb_line_<%=cid%> ++;
String <%=outgoingConn.getName()%>_xml = items_<%=cid%>[i_<%=cid%>];
<%
}//end items
%>
<%
}//4
}//3
}//2
}//1
%>

View File

@@ -1,67 +1,66 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
java.util.List
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
String dieOnErrorStr = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
boolean dieOnError = (dieOnErrorStr!=null&&!("").equals(dieOnErrorStr))?("true").equals(dieOnErrorStr):false;
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
String dieOnErrorStr = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
boolean dieOnError = (dieOnErrorStr!=null&&!("").equals(dieOnErrorStr))?("true").equals(dieOnErrorStr):false;
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas != null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
IMetadataTable metadata = metadatas.get(0);
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
boolean useWhere = ("true").equals(ElementParameterParser.getValue(node, "__USE_ITEMS__"));
if(useWhere){
%>
}
}
<%
}
%>
if (metadata != null) {
<%if(!useExistingConn){%>
try {
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
} catch(java.lang.Exception e) {
<%if(dieOnError) {%>
throw e;
<% } else { %>
System.err.println(e.getMessage());
<% } %>
}
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
<%
}
}
}
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
boolean useWhere = ("true").equals(ElementParameterParser.getValue(node, "__USE_ITEMS__"));
if(useWhere){
%>
}
}
<%
}
%>
<%if(!useExistingConn){%>
try {
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
} catch(java.lang.Exception e) {
<%if(dieOnError) {%>
throw e;
<% } else { %>
System.err.println(e.getMessage());
<% } %>
}
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
<%
}
}
}
}
%>
%>

View File

@@ -1,34 +1,30 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String cid = node.getUniqueName();
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
boolean close = ("true").equals(ElementParameterParser.getValue(node,"__CLOSE__"));
String conn = "xtentisWS_" + connection;
String mdmTransaction = "mdmTransaction_" + connection;
String connection = ElementParameterParser.getValue(node, "__CONNECTION__");
boolean close = ("true").equals(ElementParameterParser.getValue(node,"__CLOSE__"));
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
%>
org.talend.mdm.webservice.XtentisPort_PortType conn_<%=cid%> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
if(conn_<%=cid%> != null)
{
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=mdmTransaction%>");
if(mdmTransaction_<%=cid%>!=null) {
mdmTransaction_<%=cid%>.rollback();
}
<% if(close){%>
conn_<%=cid%>.logout(new org.talend.mdm.webservice.WSLogout());
<% }%>
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> != null) {
mdmTransaction_<%=cid%>.rollback();
}
<% if(close){%>
org.talend.mdm.webservice.XtentisPort_PortType conn_<%=cid%> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(conn_<%=cid%> != null) {
conn_<%=cid%>.logout(new org.talend.mdm.webservice.WSLogout());
}
<% }%>

View File

@@ -1,55 +1,88 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
java.util.Map
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String entity = ElementParameterParser.getValue(node, "__ENTITY__");
String keyField = ElementParameterParser.getValue(node, "__KEYFIELD__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
List<Map<String, String>> ids = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__IDS__");
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String entity = ElementParameterParser.getValue(node, "__ENTITY__");
String keyField = ElementParameterParser.getValue(node, "__KEYFIELD__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
List<Map<String, String>> ids = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__IDS__");
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
@@ -65,9 +98,9 @@ for(Map<String, String> map:ids){
%>
<%=isfirst?"":","%><%=map.get("ID")%>
<%
isfirst =false;
isfirst =false;
}
%>
});
wsRouteItem_<%=cid %>.setWsItemPK(wsItemPK_<%=cid %>);
org.talend.mdm.webservice.WSRoutingRulePK[] wsRoutingRulePKArray_<%=cid %> = xtentisWS_<%=cid %>.routeItemV2(wsRouteItem_<%=cid %>);
org.talend.mdm.webservice.WSRoutingRulePK[] wsRoutingRulePKArray_<%=cid %> = xtentisWS_<%=cid %>.routeItemV2(wsRouteItem_<%=cid %>);

View File

@@ -1,59 +1,87 @@
<%@ jet
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
String spName = ElementParameterParser.getValue(node, "__SPNAME__");
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%
}else{
%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
<%
}
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
org.talend.mdm.webservice.WSExecuteStoredProcedure wsExeProc_<%=cid %> = new org.talend.mdm.webservice.WSExecuteStoredProcedure();
wsExeProc_<%=cid %>.setWsDataClusterPK(dataCluster_<%=cid %>);
org.talend.mdm.webservice.WSStoredProcedurePK wsStoredProcPK_<%=cid %> = new org.talend.mdm.webservice.WSStoredProcedurePK();
wsStoredProcPK_<%=cid %>.setPk(<%=spName %>);
wsExeProc_<%=cid %>.setWsStoredProcedurePK(wsStoredProcPK_<%=cid %>);
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
String spName = ElementParameterParser.getValue(node, "__SPNAME__");
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
org.talend.mdm.webservice.WSExecuteStoredProcedure wsExeProc_<%=cid %> = new org.talend.mdm.webservice.WSExecuteStoredProcedure();
wsExeProc_<%=cid %>.setWsDataClusterPK(dataCluster_<%=cid %>);
org.talend.mdm.webservice.WSStoredProcedurePK wsStoredProcPK_<%=cid %> = new org.talend.mdm.webservice.WSStoredProcedurePK();
wsStoredProcPK_<%=cid %>.setPk(<%=spName %>);
wsExeProc_<%=cid %>.setWsStoredProcedurePK(wsStoredProcPK_<%=cid %>);

View File

@@ -1,20 +1,20 @@
<%@ jet
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConn){
%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%
}
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
if(!useExistingConn){
%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%
}
%>

View File

@@ -1,82 +1,81 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
java.util.List
java.util.Map
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String spName = ElementParameterParser.getValue(node, "__SPNAME__");
List<Map<String, String>> spArgs = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__SP_ARGS__");
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
List<? extends IConnection> inConnections = node.getIncomingConnections();
IConnection inConnection = null;
IMetadataTable metadata = null;
if (inConnections != null) {
for (int i = 0; i < inConnections.size(); i++) {
IConnection connection = inConnections.get(i);
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
inConnection = connection;
metadata=connection.getMetadataTable();
break;
}
}
}
String spName = ElementParameterParser.getValue(node, "__SPNAME__");
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
if(inConnection!=null){
if(spArgs.size()>0){
List<Map<String, String>> spArgs = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__SP_ARGS__");
List<? extends IConnection> inConnections = node.getIncomingConnections();
IConnection inConnection = null;
IMetadataTable metadata = null;
if (inConnections != null) {
for (int i = 0; i < inConnections.size(); i++) {
IConnection connection = inConnections.get(i);
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
inConnection = connection;
metadata=connection.getMetadataTable();
break;
}
}
}
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
if(inConnection!=null){
if(spArgs.size()>0){
%>
wsExeProc_<%=cid %>.setParameters(new String[]{
wsExeProc_<%=cid %>.setParameters(new String[]{
<%
}
for(int i=0;i<spArgs.size();i++){
Map<String, String> map = spArgs.get(i);
String clmName = map.get("COLUMN");
for(IMetadataColumn column:metadata.getListColumns()){
if(column.getLabel().equals(clmName)){
}
for(int i=0;i<spArgs.size();i++){
Map<String, String> map = spArgs.get(i);
String clmName = map.get("COLUMN");
for(IMetadataColumn column:metadata.getListColumns()){
if(column.getLabel().equals(clmName)){
%>
<%=i==0?"":","%><%=inConnection.getName()%>.<%=column.getLabel() %>
<%=i==0?"":","%><%=inConnection.getName()%>.<%=column.getLabel() %>
<%
}
}
}
if(spArgs.size()>0){
}
}
}
if(spArgs.size()>0){
%>
});
});
<%
}
}
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
String outputCol = null;
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
}
}
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
String outputCol = null;
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
%>
for(String xmlField_<%=cid %> : xtentisWS_<%=cid %>.executeStoredProcedure(wsExeProc_<%=cid %>)){
<%=outgoingConn.getName()%>.xmlField = xmlField_<%=cid %>;
for(String xmlField_<%=cid %> : xtentisWS_<%=cid %>.executeStoredProcedure(wsExeProc_<%=cid %>)){
<%=outgoingConn.getName()%>.xmlField = xmlField_<%=cid %>;
<%
} else {
} else {
%>
xtentisWS_<%=cid %>.executeStoredProcedure(wsExeProc_<%=cid %>);
xtentisWS_<%=cid %>.executeStoredProcedure(wsExeProc_<%=cid %>);
<%
}
} else {
}
} else {
%>
xtentisWS_<%=cid %>.executeStoredProcedure(wsExeProc_<%=cid %>);
xtentisWS_<%=cid %>.executeStoredProcedure(wsExeProc_<%=cid %>);
<%
}
%>
}
%>

View File

@@ -1,42 +1,42 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
java.util.List
"
imports="
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
java.util.List
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
%>
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
if (conns != null){
if (conns.size()>0){
IConnection conn =conns.get(0);
String connName = conn.getName();
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
%>
<%=connName%>.MDM_Message = MDMInputMessage;
<%
}
}
}
}
List< ? extends IConnection> conns = node.getOutgoingSortedConnections();
if (conns != null){
if (conns.size()>0){
IConnection conn =conns.get(0);
String connName = conn.getName();
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
%>
<%=connName%>.MDM_Message = MDMInputMessage;
<%
}
}
}
}
}
%>

View File

@@ -5,34 +5,30 @@ imports="
org.talend.core.model.process.IConnection
org.talend.core.model.process.INode
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List;
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas != null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
String incomingName = "";
List<? extends IConnection> inputConns = node.getIncomingConnections(EConnectionType.FLOW_MAIN);
if ((inputConns!=null)&&(inputConns.size()>0)) {
IConnection incomingConn = inputConns.get(0);
incomingName = incomingConn.getName();
}else{
return "";
}
%>
MDMOutputMessage = <%=incomingName %>.MDM_Message;
<%
}
}
%>
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas != null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
String incomingName = "";
List<? extends IConnection> inputConns = node.getIncomingConnections(EConnectionType.FLOW_MAIN);
if ((inputConns!=null)&&(inputConns.size()>0)) {
IConnection incomingConn = inputConns.get(0);
incomingName = incomingConn.getName();
}else{
return "";
}
%>
MDMOutputMessage = <%=incomingName %>.MDM_Message;
<%
}
}
%>

View File

@@ -1,192 +1,224 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
java.util.List
java.util.Map
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas != null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
IMetadataTable metadata = metadatas.get(0);
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
if (metadata != null) {
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
//String concept = ElementParameterParser.getValue(node, "__CONCEPT__");
String xmlField = ElementParameterParser.getValue(node, "__XMLFIELD__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
String viewName = ElementParameterParser.getValue(node, "__VIEWNAME__");
List<Map<String, String>> operations = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__OPERATIONS__");
List<Map<String, String>> orders = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__ORDER_TABLE__");
String spellThrehold = ElementParameterParser.getValue(node, "__SPELLTHREHOLD__");
String skip = ElementParameterParser.getValue(node, "__SKIP__");
String limit = ElementParameterParser.getValue(node, "__MAXVALUE__");
String bufferSize = ElementParameterParser.getValue(node, "__FETCHSIZE__");
if(spellThrehold==null || ("").equals(spellThrehold)){
spellThrehold = "-1";
}
if(skip==null || ("").equals(skip)){
skip = "0";
}
if(limit==null || ("").equals(limit)){
limit = "-1";
}
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
//String concept = ElementParameterParser.getValue(node, "__CONCEPT__");
String xmlField = ElementParameterParser.getValue(node, "__XMLFIELD__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
String viewName = ElementParameterParser.getValue(node, "__VIEWNAME__");
List<Map<String, String>> operations = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__OPERATIONS__");
List<Map<String, String>> orders = (List<Map<String,String>>)ElementParameterParser.getObjectValue(node, "__ORDER_TABLE__");
String spellThrehold = ElementParameterParser.getValue(node, "__SPELLTHREHOLD__");
String skip = ElementParameterParser.getValue(node, "__SKIP__");
String limit = ElementParameterParser.getValue(node, "__MAXVALUE__");
String bufferSize = ElementParameterParser.getValue(node, "__FETCHSIZE__");
if(spellThrehold==null || ("").equals(spellThrehold)){
spellThrehold = "-1";
}
if(skip==null || ("").equals(skip)){
skip = "0";
}
if(limit==null || ("").equals(limit)){
limit = "-1";
}
%>
int nb_line_<%=cid %> = 0;
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
org.talend.mdm.webservice.WSWhereCondition wc_<%=cid %> = null;
java.util.List<org.talend.mdm.webservice.WSWhereItem> conditions_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSWhereItem>();
<%
boolean isOnlyOrPredicate=true;
for(int i=0; i < operations.size(); i++){
Map<String, String> map= operations.get(i);
String xpath=map.get("XPATH");
String operator=map.get("FUNCTION");
String value = map.get("VALUE");
String predicate = map.get("PREDICATE");
if((i < operations.size()-1) && (!"OR".equals(predicate))){
isOnlyOrPredicate = false;
}
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
org.talend.mdm.webservice.WSWhereCondition wc_<%=cid %> = null;
java.util.List<org.talend.mdm.webservice.WSWhereItem> conditions_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSWhereItem>();
<%
boolean isOnlyOrPredicate=true;
for(int i=0; i < operations.size(); i++){
Map<String, String> map= operations.get(i);
String xpath=map.get("XPATH");
String operator=map.get("FUNCTION");
String value = map.get("VALUE");
String predicate = map.get("PREDICATE");
if((i < operations.size()-1) && (!"OR".equals(predicate))){
isOnlyOrPredicate = false;
}
%>
wc_<%=cid %> =new org.talend.mdm.webservice.WSWhereCondition(<%=xpath %>,org.talend.mdm.webservice.WSWhereOperator.<%=operator %>, <%="EMPTY_NULL".equals(operator)? null:value %>, org.talend.mdm.webservice.WSStringPredicate.<%=predicate %>,false);
org.talend.mdm.webservice.WSWhereItem wsItem_<%=i %>=new org.talend.mdm.webservice.WSWhereItem(wc_<%=cid %>,null,null);
conditions_<%=cid %>.add(wsItem_<%=i %>);
<%
}//for
%>
org.talend.mdm.webservice.WSWhereItem wsItem_<%=cid %> = null;
if(conditions_<%=cid %>.size() > 0){
<%
if(!isOnlyOrPredicate){
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]),null);
<%
}else{
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]));
<%
}
%>
}
org.talend.mdm.webservice.WSViewSearch wsViewSearch_<%=cid %> = null;
int limit_<%=cid%> = <%=limit%>;
int recordsPerPage_<%=cid%> = <%=bufferSize%>;
int skip_<%=cid%> = <%=skip%>;
if (skip_<%=cid%> < 0)
skip_<%=cid%> = 0;
if (recordsPerPage_<%=cid%> <= 0)
recordsPerPage_<%=cid%> = -1;// read whole records in one time
if (limit_<%=cid%> <= 0)
limit_<%=cid%> = -1;// no limit
int retrievedCount_<%=cid%> = 0;
int readRecordsSize_<%=cid%> = limit_<%=cid%> == -1 ? recordsPerPage_<%=cid%> : (recordsPerPage_<%=cid%> == -1 ? limit_<%=cid%> : (recordsPerPage_<%=cid%> > limit_<%=cid%> ? limit_<%=cid%>
wc_<%=cid %> =new org.talend.mdm.webservice.WSWhereCondition(<%=xpath %>,org.talend.mdm.webservice.WSWhereOperator.<%=operator %>, <%="EMPTY_NULL".equals(operator)? null:value %>, org.talend.mdm.webservice.WSStringPredicate.<%=predicate %>,false);
org.talend.mdm.webservice.WSWhereItem wsItem_<%=i %>=new org.talend.mdm.webservice.WSWhereItem(wc_<%=cid %>,null,null);
conditions_<%=cid %>.add(wsItem_<%=i %>);
<%
}//for
%>
org.talend.mdm.webservice.WSWhereItem wsItem_<%=cid %> = null;
if(conditions_<%=cid %>.size() > 0){
<%
if(!isOnlyOrPredicate){
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]),null);
<%
}else{
%>
wsItem_<%=cid %> =new org.talend.mdm.webservice.WSWhereItem(null,null,conditions_<%=cid %>.toArray(new org.talend.mdm.webservice.WSWhereItem[conditions_<%=cid %>.size()]));
<%
}
%>
}
org.talend.mdm.webservice.WSViewSearch wsViewSearch_<%=cid %> = null;
int limit_<%=cid%> = <%=limit%>;
int recordsPerPage_<%=cid%> = <%=bufferSize%>;
int skip_<%=cid%> = <%=skip%>;
if (skip_<%=cid%> < 0)
skip_<%=cid%> = 0;
if (recordsPerPage_<%=cid%> <= 0)
recordsPerPage_<%=cid%> = -1;// read whole records in one time
if (limit_<%=cid%> <= 0)
limit_<%=cid%> = -1;// no limit
int retrievedCount_<%=cid%> = 0;
int readRecordsSize_<%=cid%> = limit_<%=cid%> == -1 ? recordsPerPage_<%=cid%> : (recordsPerPage_<%=cid%> == -1 ? limit_<%=cid%> : (recordsPerPage_<%=cid%> > limit_<%=cid%> ? limit_<%=cid%>
: recordsPerPage_<%=cid%>));
org.talend.mdm.webservice.WSGetItems getitems_<%=cid %>=null;
boolean continueFlag_<%=cid%> = true;
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
while (continueFlag_<%=cid%>) {
wsViewSearch_<%=cid%> = new org.talend.mdm.webservice.WSViewSearch();
wsViewSearch_<%=cid%>.setWsDataClusterPK(dataCluster_<%=cid%>);
wsViewSearch_<%=cid%>.setWsViewPK(new org.talend.mdm.webservice.WSViewPK(<%=viewName%>));
wsViewSearch_<%=cid%>.setSpellTreshold(<%=spellThrehold%>);
wsViewSearch_<%=cid%>.setSkip(skip_<%=cid%> + retrievedCount_<%=cid%>);
wsViewSearch_<%=cid%>.setMaxItems(readRecordsSize_<%=cid%>);
<%
for(int i=0; i< orders.size(); i++){ // only the first one will be effective.
Map<String, String> map= orders.get(i);
%>
wsViewSearch_<%=cid%>.setOrderBy(<%=map.get("XPATH")%>); // OPTIONAL
wsViewSearch_<%=cid%>.setDirection("<%=map.get("ORDER")%>"); // OPTIONAL
<%
break;
}
%>
wsViewSearch_<%=cid%>.setWhereItem(wsItem_<%=cid%>); // OPTIONAL
String[] items_<%=cid%> = xtentisWS_<%=cid%>.viewSearch(wsViewSearch_<%=cid%>);
if(totalCount_<%=cid%> < 0){
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
}
retrievedCount_<%=cid%> += items_<%=cid%>.length - 1; // for header
if (totalCount_<%=cid%> == retrievedCount_<%=cid%> || recordsPerPage_<%=cid%> == -1 || items_<%=cid%>.length < readRecordsSize_<%=cid%> || limit_<%=cid%> == retrievedCount_<%=cid%>) {
continueFlag_<%=cid%> = false;
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
readRecordsSize_<%=cid%> = limit_<%=cid%> - retrievedCount_<%=cid%>;
}
for(int i_<%=cid %>=1;i_<%=cid %> < items_<%=cid %>.length; i_<%=cid %>++){
nb_line_<%=cid %> ++;
<%=outgoingConn.getName() %>.<%=xmlField %> = items_<%=cid %>[i_<%=cid %>];
<%
}
}
}
org.talend.mdm.webservice.WSGetItems getitems_<%=cid %>=null;
boolean continueFlag_<%=cid%> = true;
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
while (continueFlag_<%=cid%>) {
wsViewSearch_<%=cid%> = new org.talend.mdm.webservice.WSViewSearch();
wsViewSearch_<%=cid%>.setWsDataClusterPK(dataCluster_<%=cid%>);
wsViewSearch_<%=cid%>.setWsViewPK(new org.talend.mdm.webservice.WSViewPK(<%=viewName%>));
wsViewSearch_<%=cid%>.setSpellTreshold(<%=spellThrehold%>);
wsViewSearch_<%=cid%>.setSkip(skip_<%=cid%> + retrievedCount_<%=cid%>);
wsViewSearch_<%=cid%>.setMaxItems(readRecordsSize_<%=cid%>);
<%
for(int i=0; i< orders.size(); i++){ // only the first one will be effective.
Map<String, String> map= orders.get(i);
%>
wsViewSearch_<%=cid%>.setOrderBy(<%=map.get("XPATH")%>); // OPTIONAL
wsViewSearch_<%=cid%>.setDirection("<%=map.get("ORDER")%>"); // OPTIONAL
<%
break;
}
%>
wsViewSearch_<%=cid%>.setWhereItem(wsItem_<%=cid%>); // OPTIONAL
String[] items_<%=cid%> = xtentisWS_<%=cid%>.viewSearch(wsViewSearch_<%=cid%>);
if(totalCount_<%=cid%> < 0){
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
}
retrievedCount_<%=cid%> += items_<%=cid%>.length - 1; // for header
if (totalCount_<%=cid%> == retrievedCount_<%=cid%> || recordsPerPage_<%=cid%> == -1 || items_<%=cid%>.length < readRecordsSize_<%=cid%> || limit_<%=cid%> == retrievedCount_<%=cid%>) {
continueFlag_<%=cid%> = false;
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
readRecordsSize_<%=cid%> = limit_<%=cid%> - retrievedCount_<%=cid%>;
}
for(int i_<%=cid %>=1;i_<%=cid %> < items_<%=cid %>.length; i_<%=cid %>++){
nb_line_<%=cid %> ++;
<%=outgoingConn.getName() %>.<%=xmlField %> = items_<%=cid %>[i_<%=cid %>];
<%
}
}
}
}
%>

View File

@@ -1,48 +1,47 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
java.util.List
"
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas != null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
IMetadataTable metadata = metadatas.get(0);
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
%>
}
}
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
<%
}
}
}
if (metadata != null) {
List<IMetadataColumn> columnList = metadata.getListColumns();
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
// if output columns are defined
if (outgoingConns != null && outgoingConns.size() > 0){
IConnection outgoingConn = outgoingConns.get(0);
if(outgoingConn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) { // start 1
%>
}
}
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
<%
}
}
}
}
%>
%>

View File

@@ -1,103 +1,146 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.EConnectionType
org.talend.core.model.utils.NodeUtil
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.EConnectionType
org.talend.core.model.utils.NodeUtil
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String virtualcid = cid;
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String virtualcid = cid;
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
String connection = ElementParameterParser.getValue(node,"__CONNECTION__");
String conn = "xtentisWS_" + connection;
String trans = "mdmTrans_" + connection;
String mdmUrl = ElementParameterParser.getValue(node, "__MDMURL__");
String username = ElementParameterParser.getValue(node, "__USERNAME__");
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__DATAMODEL__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean isProvisioning = "\"PROVISIONING\"".equalsIgnoreCase(dataCluster);
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
boolean storeFlow = ("true").equals(ElementParameterParser.getValue(node, "__STORE_FLOW__"));
%>
String universe = ElementParameterParser.getValue(node, "__UNIVERSE__");
String dataModule = ElementParameterParser.getValue(node, "__DATAMODEL__");
String dataCluster = ElementParameterParser.getValue(node, "__DATACLUSTER__");
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
boolean storeFlow = ("true").equals(ElementParameterParser.getValue(node, "__STORE_FLOW__"));
%>
int nb_line_<%=cid %> = 0;
int nb_line_rejected_<%=cid%> = 0;
<%if(!usePartialUpdate){%>
<%if(addTaskID){%>
class Util_<%=cid%>{
public org.talend.mdm.webservice.WSUpdateMetadataItem makeUpdateMeteItm(String taskID,org.talend.mdm.webservice.WSItemPK wspk){
org.talend.mdm.webservice.WSUpdateMetadataItem wsUpdateMetadataItem = new org.talend.mdm.webservice.WSUpdateMetadataItem();
wsUpdateMetadataItem.setTaskId(taskID);
wsUpdateMetadataItem.setWsItemPK(wspk);
return wsUpdateMetadataItem;
}
public org.talend.mdm.webservice.WSUpdateMetadataItem[] makeUpdateMeteItms(java.util.List<String> taskIDs,org.talend.mdm.webservice.WSItemPK[] wspks){
java.util.List<org.talend.mdm.webservice.WSUpdateMetadataItem> wsUpdateMetadataItems = new java.util.ArrayList<org.talend.mdm.webservice.WSUpdateMetadataItem>();
int i = 0;
for(org.talend.mdm.webservice.WSItemPK wspk : wspks){
wsUpdateMetadataItems.add(makeUpdateMeteItm(taskIDs.get(i),wspk));
i++;
}
return wsUpdateMetadataItems.toArray(new org.talend.mdm.webservice.WSUpdateMetadataItem[wsUpdateMetadataItems.size()]);
}
}
Util_<%=cid%> util_<%=cid%> = new Util_<%=cid%>();
<%}%>
<%if(isMassInsert){
if(!isStaging && withReport){%>
java.util.List <org.talend.mdm.webservice.WSPutItemWithReport> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItemWithReport>();
<% }else{%>
java.util.List <org.talend.mdm.webservice.WSPutItem> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItem>();
<%
}
if(addTaskID){
%>
java.util.List<String> taskIDs_<%=cid%> = new java.util.ArrayList<String>();
<%
}
}
<%if(addTaskID){%>
class Util_<%=cid%>{
public org.talend.mdm.webservice.WSUpdateMetadataItem makeUpdateMeteItm(String taskID,org.talend.mdm.webservice.WSItemPK wspk){
org.talend.mdm.webservice.WSUpdateMetadataItem wsUpdateMetadataItem = new org.talend.mdm.webservice.WSUpdateMetadataItem();
wsUpdateMetadataItem.setTaskId(taskID);
wsUpdateMetadataItem.setWsItemPK(wspk);
return wsUpdateMetadataItem;
}
public org.talend.mdm.webservice.WSUpdateMetadataItem[] makeUpdateMeteItms(java.util.List<String> taskIDs,org.talend.mdm.webservice.WSItemPK[] wspks){
java.util.List<org.talend.mdm.webservice.WSUpdateMetadataItem> wsUpdateMetadataItems = new java.util.ArrayList<org.talend.mdm.webservice.WSUpdateMetadataItem>();
int i = 0;
for(org.talend.mdm.webservice.WSItemPK wspk : wspks){
wsUpdateMetadataItems.add(makeUpdateMeteItm(taskIDs.get(i),wspk));
i++;
}
return wsUpdateMetadataItems.toArray(new org.talend.mdm.webservice.WSUpdateMetadataItem[wsUpdateMetadataItems.size()]);
}
}
Util_<%=cid%> util_<%=cid%> = new Util_<%=cid%>();
<%}%>
<%if(isMassInsert){
if(!isStaging && withReport){%>
java.util.List <org.talend.mdm.webservice.WSPutItemWithReport> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItemWithReport>();
<% }else{%>
java.util.List <org.talend.mdm.webservice.WSPutItem> miList_<%=cid %> = new java.util.ArrayList<org.talend.mdm.webservice.WSPutItem>();
<%
}
if(addTaskID){
%>
java.util.List<String> taskIDs_<%=cid%> = new java.util.ArrayList<String>();
<%
}
}
}%>
<%if(!useExistingConn){%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<%
String passwordFieldName = "__PASSWORD__";
%>
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(<%=mdmUrl %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
// Authentification
<%if(universe==null || ("").equals(universe.trim())){%>
stub_<%=cid %>.setUsername(<%=username %>);
<%}else{%>
stub_<%=cid %>.setUsername(<%=universe%> + "/" + <%=username %>);
<%}%>
<% String passwordFieldName = "__PASSWORD__"; %>
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
stub_<%=cid %>.setPassword(decryptedPassword_<%=cid%>);
<%}else if(isProvisioning){%>
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername((String)globalMap.get("username_<%=connection %>"));
stub_<%=cid %>.setPassword((String)globalMap.get("password_<%=connection %>"));
<%}else{%>
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>");
org.talend.mdm.webservice.XtentisPort_PortType xtentisWS_<%=cid %> = (org.talend.mdm.webservice.XtentisPort_PortType)globalMap.get("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName());
if(xtentisWS_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
String username_<%=cid%> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid%> = (String)globalMap.get("password_<%=connection %>");
org.talend.mdm.webservice.XtentisServiceLocator xtentisService_<%=cid %> = new org.talend.mdm.webservice.XtentisServiceLocator();
xtentisService_<%=cid %>.setXtentisPortEndpointAddress(murl_<%=cid %>);
xtentisWS_<%=cid %> = xtentisService_<%=cid %>.getXtentisPort();
org.talend.mdm.webservice.XtentisBindingStub stub_<%=cid %> = (org.talend.mdm.webservice.XtentisBindingStub)xtentisWS_<%=cid %>;
stub_<%=cid %>.setUsername(username_<%=cid%>);
stub_<%=cid %>.setPassword(password_<%=cid%>);
if((Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String turl_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>);
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid%> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName());
if(mdmTransaction_<%=cid%> == null) {
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
String sessionID_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getSessionID(turl_<%=cid%>,username_<%=cid%>,password_<%=cid%>);
mdmTransaction_<%=cid%> = new com.talend.mdm.transaction.client.MDMTransaction();
mdmTransaction_<%=cid%>.setUrl(turl_<%=cid%>);
mdmTransaction_<%=cid%>.setId("<%=cid%>_" + java.util.UUID.randomUUID());
mdmTransaction_<%=cid%>.setUsername(username_<%=cid%>);
mdmTransaction_<%=cid%>.setPassword(password_<%=cid%>);
mdmTransaction_<%=cid%>.setSessionId(sessionID_<%=cid%>);
} else {
mdmTransaction_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid%>,stub_<%=cid %>.getUsername(),stub_<%=cid %>.getPassword());
}
globalMap.put("<%=trans%>_" + Thread.currentThread().getThreadGroup().getName(), mdmTransaction_<%=cid %>);
}
stub_<%=cid %>.setHeader(new org.apache.axis.message.SOAPHeaderElement("http://www.talend.com/mdm", "transaction-id", mdmTransaction_<%=cid%>.getId()));
stub_<%=cid %>._setProperty(org.apache.axis.client.Call.SESSION_MAINTAIN_PROPERTY, new Boolean(true));
stub_<%=cid %>._setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE, com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId());
}
stub_<%=cid %>.ping(new org.talend.mdm.webservice.WSPing());<%//For TDI-26109%>
globalMap.put("<%=conn%>_" + Thread.currentThread().getThreadGroup().getName(), xtentisWS_<%=cid %>);
}
<%}%>
org.talend.mdm.webservice.WSDataClusterPK dataCluster_<%=cid %> = new org.talend.mdm.webservice.WSDataClusterPK(<%=dataCluster %> + "<%=isStaging?"#STAGING":""%>");
@@ -114,77 +157,77 @@ String virtualSourceCid = sourceNode.getUniqueName();
INode startNode = NodeUtil.getSpecificStartNode(sourceNode);
String startNodeCid = null;
if(startNode != null){
startNodeCid = startNode.getUniqueName();
startNodeCid = startNode.getUniqueName();
}
IConnection nextMergeConn = NodeUtil.getNextMergeConnection(node);
if(nextMergeConn != null && nextMergeConn.getInputId()>1 && startNodeCid != null){
if(nextMergeConn != null && nextMergeConn.getInputId()>1 && startNodeCid != null) {
%>
java.util.Queue<String> queue_<%=cid%> = new java.util.concurrent.ConcurrentLinkedQueue<String>();
<%
if(storeFlow){
%>
java.util.List<java.util.Map<String,String>> xmlFlowList_<%=cid%> = java.util.Collections.synchronizedList(new java.util.ArrayList<java.util.Map<String,String>>());
int flowNum_<%=cid%> = 0;
<%
}
%>
class ThreadXMLField_<%=cid%> extends Thread {
java.util.Queue<String> queue;
java.util.List<java.util.Map<String,String>> flows;
java.lang.Exception lastException;
String currentComponent;
ThreadXMLField_<%=cid%>(java.util.Queue q) {
this.queue = q;
globalMap.put("queue_<%=virtualSourceCid%>", queue);
lastException = null;
}
ThreadXMLField_<%=cid%>(java.util.Queue q, java.util.List<java.util.Map<String,String>> l) {
this.queue = q;
this.flows = l;
lastException = null;
globalMap.put("queue_<%=virtualSourceCid%>", queue);
globalMap.put("flows_<%=virtualSourceCid%>", flows);
}
public java.lang.Exception getLastException() {
return this.lastException;
}
public String getCurrentComponent() {
return this.currentComponent;
}
@Override
public void run() {
try {
<%=startNodeCid%>Process(globalMap);
} catch (TalendException te) {
this.lastException = te.getException();
this.currentComponent = te.getCurrentComponent();
globalMap.put("<%=virtualcid%>_FINISH" + (this.queue==null?"":this.queue.hashCode()), "true");
}
}
}
<%if(storeFlow){%>
ThreadXMLField_<%=cid%> txf_<%=cid%> = new ThreadXMLField_<%=cid%>(queue_<%=cid%>, xmlFlowList_<%=cid%>);
<%}else{%>
ThreadXMLField_<%=cid%> txf_<%=cid%> = new ThreadXMLField_<%=cid%>(queue_<%=cid%>);
<%}%>
txf_<%=cid%>.start();
java.util.Queue<String> queue_<%=cid%> = new java.util.concurrent.ConcurrentLinkedQueue<String>();
<%
if(storeFlow){
%>
java.util.List<java.util.Map<String,String>> xmlFlowList_<%=cid%> = java.util.Collections.synchronizedList(new java.util.ArrayList<java.util.Map<String,String>>());
int flowNum_<%=cid%> = 0;
<%
}
%>
class ThreadXMLField_<%=cid%> extends Thread {
java.util.Queue<String> queue;
java.util.List<java.util.Map<String,String>> flows;
java.lang.Exception lastException;
String currentComponent;
ThreadXMLField_<%=cid%>(java.util.Queue q) {
this.queue = q;
globalMap.put("queue_<%=virtualSourceCid%>", queue);
lastException = null;
}
ThreadXMLField_<%=cid%>(java.util.Queue q, java.util.List<java.util.Map<String,String>> l) {
this.queue = q;
this.flows = l;
lastException = null;
globalMap.put("queue_<%=virtualSourceCid%>", queue);
globalMap.put("flows_<%=virtualSourceCid%>", flows);
}
public java.lang.Exception getLastException() {
return this.lastException;
}
public String getCurrentComponent() {
return this.currentComponent;
}
@Override
public void run() {
try {
<%=startNodeCid%>Process(globalMap);
} catch (TalendException te) {
this.lastException = te.getException();
this.currentComponent = te.getCurrentComponent();
globalMap.put("<%=virtualcid%>_FINISH" + (this.queue==null?"":this.queue.hashCode()), "true");
}
}
}
<%if(storeFlow){%>
ThreadXMLField_<%=cid%> txf_<%=cid%> = new ThreadXMLField_<%=cid%>(queue_<%=cid%>, xmlFlowList_<%=cid%>);
<%}else{%>
ThreadXMLField_<%=cid%> txf_<%=cid%> = new ThreadXMLField_<%=cid%>(queue_<%=cid%>);
<%}%>
txf_<%=cid%>.start();
<%
}else{
if(storeFlow){
%>
java.util.List<java.util.Map<String,String>> xmlFlowList_<%=cid%> = (java.util.List<java.util.Map<String,String>>)globalMap.get("flows_<%=virtualcid%>");
int flowNum_<%=cid%> = 0;
<%
}
%>
java.util.Queue<String> queue_<%=cid%> = (java.util.Queue<String>) globalMap.get("queue_<%=virtualcid%>");
if(storeFlow){
%>
java.util.List<java.util.Map<String,String>> xmlFlowList_<%=cid%> = (java.util.List<java.util.Map<String,String>>)globalMap.get("flows_<%=virtualcid%>");
int flowNum_<%=cid%> = 0;
<%
}
%>
java.util.Queue<String> queue_<%=cid%> = (java.util.Queue<String>) globalMap.get("queue_<%=virtualcid%>");
<%
}
%>
String readFinishMarkWithPipeId_<%=cid%> = "<%=virtualcid%>_FINISH"+(queue_<%=cid%>==null?"":queue_<%=cid%>.hashCode());
while(!globalMap.containsKey(readFinishMarkWithPipeId_<%=cid%>) || !queue_<%=cid%>.isEmpty()) {
if (!queue_<%=cid%>.isEmpty()) {
String readFinishMarkWithPipeId_<%=cid%> = "<%=virtualcid%>_FINISH"+(queue_<%=cid%>==null?"":queue_<%=cid%>.hashCode());
while(!globalMap.containsKey(readFinishMarkWithPipeId_<%=cid%>) || !queue_<%=cid%>.isEmpty()) {
if (!queue_<%=cid%>.isEmpty()) {

View File

@@ -1,36 +1,34 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.EConnectionType
org.talend.core.model.utils.NodeUtil
"
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.EConnectionType
org.talend.core.model.utils.NodeUtil
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String virtualcid = cid;
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
String taskID = ElementParameterParser.getValue(node,"__TASKID__");
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String virtualcid = cid;
String destination = ElementParameterParser.getValue(node, "__DESTINATION__");
if(destination!=null && !"".equals(destination)){
cid = destination;
}
boolean isStaging = "STAGING".equalsIgnoreCase(ElementParameterParser.getValue(node, "__CONTAINER_TYPE__"));
boolean useExistingConn = ("true").equals(ElementParameterParser.getValue(node,"__USE_EXISTING_CONNECTION__"));
boolean isMassInsert =("true").equals(ElementParameterParser.getValue(node,"__EXTENDINSERT__"));
boolean withReport = ("true").equals(ElementParameterParser.getValue(node,"__WITHREPORT__"));
boolean addTaskID = ("true").equals(ElementParameterParser.getValue(node,"__ADD_TASKID__"));
String taskID = ElementParameterParser.getValue(node,"__TASKID__");
boolean usePartialUpdate = ("true").equals(ElementParameterParser.getValue(node,"__USE_PARTIAL_UPDATE__"));
%>
}
}
}
<%
INode sourceNode = node.getIncomingConnections(EConnectionType.ON_COMPONENT_OK).get(0).getSource();
@@ -38,27 +36,27 @@ String virtualSourceCid = sourceNode.getUniqueName();
INode startNode = NodeUtil.getSpecificStartNode(sourceNode);
String startNodeCid = null;
if(startNode != null){
startNodeCid = startNode.getUniqueName();
startNodeCid = startNode.getUniqueName();
}
IConnection nextMergeConn = NodeUtil.getNextMergeConnection(node);
if(nextMergeConn != null && nextMergeConn.getInputId()>1 && startNodeCid != null){
%>
txf_<%=cid%>.join();
if(txf_<%=cid%>.getLastException()!=null) {
currentComponent = txf_<%=cid%>.getCurrentComponent();
throw txf_<%=cid%>.getLastException();
}
globalMap.remove("queue_<%=virtualSourceCid%>");
txf_<%=cid%>.join();
if(txf_<%=cid%>.getLastException()!=null) {
currentComponent = txf_<%=cid%>.getCurrentComponent();
throw txf_<%=cid%>.getLastException();
}
globalMap.remove("queue_<%=virtualSourceCid%>");
<%
}else{
%>
String readFinishWithExceptionMarkWithPipeId_<%=cid%> = "<%=cid%>_FINISH_WITH_EXCEPTION"+(queue_<%=cid%>==null?"":queue_<%=cid%>.hashCode());
if(globalMap.containsKey(readFinishWithExceptionMarkWithPipeId_<%=cid%>)){
globalMap.put(readFinishWithExceptionMarkWithPipeId_<%=cid%>, null);// syn
globalMap.remove(readFinishWithExceptionMarkWithPipeId_<%=cid%>);
return;
}
globalMap.remove("queue_<%=node.getUniqueName()%>");
String readFinishWithExceptionMarkWithPipeId_<%=cid%> = "<%=cid%>_FINISH_WITH_EXCEPTION"+(queue_<%=cid%>==null?"":queue_<%=cid%>.hashCode());
if(globalMap.containsKey(readFinishWithExceptionMarkWithPipeId_<%=cid%>)){
globalMap.put(readFinishWithExceptionMarkWithPipeId_<%=cid%>, null);// syn
globalMap.remove(readFinishWithExceptionMarkWithPipeId_<%=cid%>);
return;
}
globalMap.remove("queue_<%=node.getUniqueName()%>");
<%
}
%>
@@ -66,37 +64,37 @@ globalMap.put(readFinishMarkWithPipeId_<%=cid%>,null);//syn
globalMap.remove(readFinishMarkWithPipeId_<%=cid%>);
<%
if(!usePartialUpdate){
if(isMassInsert){
if(!isStaging && withReport){
%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
if(isMassInsert){
if(!isStaging && withReport){
%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
}
<%
}else{%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
}else{%>
if(miList_<%=cid %>.size() > 0){
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[miList_<%=cid %>.size()]));
miList_<%=cid %>.clear();
miList_<%=cid %> = null;
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
}
<%
}
}
}
}
}%>
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
globalMap.put("<%=cid %>_NB_LINE_REJECTED",nb_line_rejected_<%=cid%>);
<%if(!useExistingConn){%>
stub_<%=cid %>.logout(new org.talend.mdm.webservice.WSLogout());
<%}%>
globalMap.put("<%=cid %>_NB_LINE",nb_line_<%=cid %>);
globalMap.put("<%=cid %>_NB_LINE_REJECTED",nb_line_rejected_<%=cid%>);

View File

@@ -1,18 +1,19 @@
<%@ 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.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map
"
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.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
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();
@@ -55,7 +56,7 @@ if (destination != null && !"".equals(destination)) {
if (metadatas != null && metadatas.size()>0) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
String rejectConnName = null;
List<? extends IConnection> rejectConns = node.getOutgoingConnections("REJECT");
List<IMetadataColumn> rejectColumnList = null;
@@ -63,15 +64,13 @@ if (metadatas != null && metadatas.size()>0) {
if (rejectConns != null && rejectConns.size() > 0) {
IConnection rejectConn = rejectConns.get(0);
if(rejectConn!=null){
rejectConnName = rejectConn.getName();
IMetadataTable metadataTable = rejectConn.getMetadataTable();
if(metadataTable!=null){
rejectColumnList = metadataTable.getListColumns();
}
rejectConnName = rejectConn.getName();
IMetadataTable metadataTable = rejectConn.getMetadataTable();
if(metadataTable!=null){
rejectColumnList = metadataTable.getListColumns();
}
}
}
String outConnName = null;
List<? extends IConnection> outgoingConns = node.getOutgoingSortedConnections();
@@ -81,11 +80,11 @@ if (metadatas != null && metadatas.size()>0) {
if (tmpconn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
if(rejectConnName==null || !rejectConnName.equals(tmpconn.getName())){
outConnName=tmpconn.getName();
IMetadataTable outputMetadata = tmpconn.getMetadataTable();
if(outputMetadata!=null){
outputColumnList = outputMetadata.getListColumns();
}
}
IMetadataTable outputMetadata = tmpconn.getMetadataTable();
if(outputMetadata!=null){
outputColumnList = outputMetadata.getListColumns();
}
}
%>
<%=tmpconn.getName() %> = null;
<%
@@ -95,159 +94,170 @@ if (metadatas != null && metadatas.size()>0) {
if (outConnName != null) {
%>
<%=outConnName %> = new <%=outConnName %>Struct();
<%
if(outputColumnList!=null){
for(IMetadataColumn column:outputColumnList) {
if(column.getLabel().equals(xmlField) && "id_Document".equals(column.getTalendType())) {
xmlFieldDocType=true;
break;
}
}
}
if(xmlFieldDocType) {
%>
<%=outConnName %>.<%=xmlField %> = ParserUtils.parseTo_Document(queue_<%=cid %>.peek());
<%
}else{
%>
<%=outConnName %>.<%=xmlField %> = queue_<%=cid %>.peek();
<%
}
if(storeFlow){%>
java.util.Map<String,String> xmlFlow_<%=cid%> = xmlFlowList_<%=cid%>.get(flowNum_<%=cid%>);
String valueStr_<%=cid%>;
<%
if(outputColumnList!=null){
for( int i = 0; i < outputColumnList.size(); i++) {
IMetadataColumn column = outputColumnList.get(i);
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if(xmlField.equals(column.getLabel())){
continue;
}
%>
valueStr_<%=cid%> = xmlFlow_<%=cid%>.get("<%=column.getLabel()%>");
if (valueStr_<%=cid%> != null){
<%
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) { // String or Object
%>
<%=outConnName%>.<%=column.getLabel()%> = valueStr_<%=cid%>;
<%
} else if(javaType == JavaTypesManager.DATE) { // Date
%>
<%=outConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_Date(valueStr_<%=cid%>, <%= patternValue %>);
<%
} else if(javaType == JavaTypesManager.BYTE_ARRAY) { // byte[]
%>
<%=outConnName%>.<%=column.getLabel()%> = valueStr_<%=cid%>.getBytes();
<%
} else { // other
%>
<%=outConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_<%= typeToGenerate %>(valueStr_<%=cid%>);
<%
}
%>
} else {
<%=outConnName%>.<%=column.getLabel()%> = <%=JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate)%>;
}
<%}
}
<%
if(outputColumnList!=null){
for(IMetadataColumn column:outputColumnList) {
if(column.getLabel().equals(xmlField) && "id_Document".equals(column.getTalendType())) {
xmlFieldDocType=true;
break;
}
}
}
if(xmlFieldDocType) {
%>
<%=outConnName %>.<%=xmlField %> = ParserUtils.parseTo_Document(queue_<%=cid %>.peek());
<%
}else{
%>
<%=outConnName %>.<%=xmlField %> = queue_<%=cid %>.peek();
<%
}
if(storeFlow){%>
java.util.Map<String,String> xmlFlow_<%=cid%> = xmlFlowList_<%=cid%>.get(flowNum_<%=cid%>);
String valueStr_<%=cid%>;
<%
if(outputColumnList!=null){
for( int i = 0; i < outputColumnList.size(); i++) {
IMetadataColumn column = outputColumnList.get(i);
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if(xmlField.equals(column.getLabel())){
continue;
}
%>
valueStr_<%=cid%> = xmlFlow_<%=cid%>.get("<%=column.getLabel()%>");
if (valueStr_<%=cid%> != null){
<%
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) { // String or Object
%>
<%=outConnName%>.<%=column.getLabel()%> = valueStr_<%=cid%>;
<%
} else if(javaType == JavaTypesManager.DATE) { // Date
%>
<%=outConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_Date(valueStr_<%=cid%>, <%= patternValue %>);
<%
} else if(javaType == JavaTypesManager.BYTE_ARRAY) { // byte[]
%>
<%=outConnName%>.<%=column.getLabel()%> = valueStr_<%=cid%>.getBytes();
<%
} else { // other
%>
<%=outConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_<%= typeToGenerate %>(valueStr_<%=cid%>);
<%
}
%>
} else {
<%=outConnName%>.<%=column.getLabel()%> = <%=JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate)%>;
}
<%}
}
}%>
<%}%>
input_<%=cid %> = queue_<%=cid %>.peek();
try {
<%if(usePartialUpdate){ // partial%>
org.talend.mdm.webservice.WSPartialPutItem wsPartialPutItem_<%=cid%> = new org.talend.mdm.webservice.WSPartialPutItem(input_<%=cid %>,<%=dataCluster %>,<%=pivot%>,<%=dataModule %>,<%=key.equals("")?null:key%>,<%=position.equals("")?null:position%>,<%=overwrite%>,<%= true==isStaging?false:withReport%>);
wspk_<%=cid %> = xtentisWS_<%=cid %>.partialPutItem(wsPartialPutItem_<%=cid%>);
<%if(usePartialUpdate){ // partial%>
<%
String stagingString = "";
if(isStaging){
stagingString = dataCluster + " + \"#STAGING\"";
} else {
stagingString = dataCluster;
}
%>
org.talend.mdm.webservice.WSPartialPutItem wsPartialPutItem_<%=cid%> = new org.talend.mdm.webservice.WSPartialPutItem(input_<%=cid %>,<%=stagingString %>,<%=pivot%>,<%=dataModule %>,<%=key.equals("")?null:key%>,<%=position.equals("")?null:position%>,<%=overwrite%>,<%= true==isStaging?false:withReport%>, <%=sourceName %>);
wspk_<%=cid %> = xtentisWS_<%=cid %>.partialPutItem(wsPartialPutItem_<%=cid%>);
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
%>
<%}else{// not partial %>
org.talend.mdm.webservice.WSPutItem item_<%=cid %> = new org.talend.mdm.webservice.WSPutItem(dataCluster_<%=cid %>,input_<%=cid %>,dataModel_<%=cid %>, <%=isUpdate %>);
<%
if (!isStaging && withReport) {%>
org.talend.mdm.webservice.WSPutItemWithReport itemReport_<%=cid %> = new org.talend.mdm.webservice.WSPutItemWithReport(item_<%=cid %>,<%=sourceName %>,<%=needCheck %>);
<%if (isMassInsert) {%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>);
<%}%>
miList_<%=cid %>.add(itemReport_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReport(itemReport_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>,wspk_<%=cid %>));
<%}%>
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
%>
}
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
<%}else{// not partial %>
org.talend.mdm.webservice.WSPutItem item_<%=cid %> = new org.talend.mdm.webservice.WSPutItem(dataCluster_<%=cid %>,input_<%=cid %>,dataModel_<%=cid %>, <%=isUpdate %>);
<%
if (!isStaging && withReport) {%>
org.talend.mdm.webservice.WSPutItemWithReport itemReport_<%=cid %> = new org.talend.mdm.webservice.WSPutItemWithReport(item_<%=cid %>,<%=sourceName %>,<%=needCheck %>);
<%if (isMassInsert) {%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>);
<%}%>
miList_<%=cid %>.add(itemReport_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReportArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItemWithReport[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItemWithReport(itemReport_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>,wspk_<%=cid %>));
<%}%>
<%
}
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
} else {
if (isMassInsert) {
%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>);
<%}%>
miList_<%=cid %>.add(item_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%
} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItem(item_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>,wspk_<%=cid %>));
<%}%>
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
}
}
%>
<%}//end partial%>
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
} else {
if (isMassInsert) {
%>
<%if(addTaskID){%>
taskIDs_<%=cid%>.add(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>);
<%}%>
miList_<%=cid %>.add(item_<%=cid %>);
if (miList_<%=cid %>.size() >= <%=numMassInsert %>) {
wspks_<%=cid %> = xtentisWS_<%=cid %>.putItemArray(miList_<%=cid %>.toArray(new org.talend.mdm.webservice.WSPutItem[<%=numMassInsert %>]));
miList_<%=cid %>.clear();
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemArrayMetadata(util_<%=cid%>. makeUpdateMeteItms(taskIDs_<%=cid%>,wspks_<%=cid %>));
taskIDs_<%=cid%>.clear();
<%}%>
}
<%
} else {%>
wspk_<%=cid %> = xtentisWS_<%=cid %>.putItem(item_<%=cid %>);
<%if(addTaskID){%>
xtentisWS_<%=cid %>.updateItemMetadata(util_<%=cid%>. makeUpdateMeteItm(<%=isCustom?taskID:"xmlFlowList_" + cid + ".get(flowNum_" + cid + ").get(\"" + prevColumn + "\")"%>,wspk_<%=cid %>));
<%}%>
<%
if (outConnName !=null && !isMassInsert && keysReturn.size() > 0) {
for (int i = 0; i < keysReturn.size(); i++){
Map<String,String> map = keysReturn.get(i);
%>
<%=outConnName %>.<%=map.get("OUTPUT_COLUMN")%>= wspk_<%=cid%>.getIds(<%=i %>);
<%
}
}
}
}
%>
<%}//end partial%>
} catch (java.lang.Exception e) {
<%if (!usePartialUpdate && isMassInsert) {%>
miList_<%=cid %>.clear();
<%}%>
<%if (dieOnError) {%>
throw(e);
<%} else {
@@ -259,57 +269,57 @@ if (metadatas != null && metadatas.size()>0) {
<%=rejectConnName %> = new <%=rejectConnName %>Struct();
<%if(storeFlow){%>
java.util.Map<String,String> rejectXmlFlow_<%=cid%> = xmlFlowList_<%=cid%>.get(flowNum_<%=cid%>);
String rejectValueStr_<%=cid%>;
<%
if(rejectColumnList!=null){
for( int i = 0; i < rejectColumnList.size(); i++) {
IMetadataColumn column = rejectColumnList.get(i);
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if(xmlField.equals(column.getLabel())){
continue;
}
%>
rejectValueStr_<%=cid%> = rejectXmlFlow_<%=cid%>.get("<%=column.getLabel()%>");
if (rejectValueStr_<%=cid%> != null){
<%
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) { // String or Object
%>
<%=rejectConnName%>.<%=column.getLabel()%> = rejectValueStr_<%=cid%>;
<%
} else if(javaType == JavaTypesManager.DATE) { // Date
%>
<%=rejectConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_Date(rejectValueStr_<%=cid%>, <%= patternValue %>);
<%
} else if(javaType == JavaTypesManager.BYTE_ARRAY) { // byte[]
%>
<%=rejectConnName%>.<%=column.getLabel()%> = rejectValueStr_<%=cid%>.getBytes();
<%
} else { // other
%>
<%=rejectConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_<%= typeToGenerate %>(rejectValueStr_<%=cid%>);
<%
}
%>
} else {
<%=rejectConnName%>.<%=column.getLabel()%> = <%=JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate)%>;
}
<%}
}
}
if(xmlFieldDocType) {
%>
<%=rejectConnName %>.<%=xmlField %> = ParserUtils.parseTo_Document(queue_<%=cid %>.peek());
<%
}else{
%>
<%=rejectConnName %>.<%=xmlField %> = queue_<%=cid %>.peek();
<%
}
%>
nb_line_rejected_<%=cid%>++;
java.util.Map<String,String> rejectXmlFlow_<%=cid%> = xmlFlowList_<%=cid%>.get(flowNum_<%=cid%>);
String rejectValueStr_<%=cid%>;
<%
if(rejectColumnList!=null){
for( int i = 0; i < rejectColumnList.size(); i++) {
IMetadataColumn column = rejectColumnList.get(i);
String typeToGenerate = JavaTypesManager.getTypeToGenerate(column.getTalendType(), column.isNullable());
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String patternValue = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if(xmlField.equals(column.getLabel())){
continue;
}
%>
rejectValueStr_<%=cid%> = rejectXmlFlow_<%=cid%>.get("<%=column.getLabel()%>");
if (rejectValueStr_<%=cid%> != null){
<%
if (javaType == JavaTypesManager.STRING || javaType == JavaTypesManager.OBJECT) { // String or Object
%>
<%=rejectConnName%>.<%=column.getLabel()%> = rejectValueStr_<%=cid%>;
<%
} else if(javaType == JavaTypesManager.DATE) { // Date
%>
<%=rejectConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_Date(rejectValueStr_<%=cid%>, <%= patternValue %>);
<%
} else if(javaType == JavaTypesManager.BYTE_ARRAY) { // byte[]
%>
<%=rejectConnName%>.<%=column.getLabel()%> = rejectValueStr_<%=cid%>.getBytes();
<%
} else { // other
%>
<%=rejectConnName%>.<%=column.getLabel()%> = ParserUtils.parseTo_<%= typeToGenerate %>(rejectValueStr_<%=cid%>);
<%
}
%>
} else {
<%=rejectConnName%>.<%=column.getLabel()%> = <%=JavaTypesManager.getDefaultValueFromJavaType(typeToGenerate)%>;
}
<%}
}
}
if(xmlFieldDocType) {
%>
<%=rejectConnName %>.<%=xmlField %> = ParserUtils.parseTo_Document(queue_<%=cid %>.peek());
<%
}else{
%>
<%=rejectConnName %>.<%=xmlField %> = queue_<%=cid %>.peek();
<%
}
%>
nb_line_rejected_<%=cid%>++;
<%=rejectConnName %>.errorMessage = e.getMessage() + " - Line: " + tos_count_<%=node.getUniqueName() %>;
<%} else {%>
System.err.println(e.getMessage());
@@ -323,4 +333,4 @@ if (metadatas != null && metadatas.size()>0) {
<%
}
}%>
queue_<%=cid %>.remove();
queue_<%=cid %>.remove();

View File

@@ -642,13 +642,6 @@
uripath="platform:/plugin/org.talend.libraries.hadoop.hdp.2.0/lib/datanucleus-rdbms-3.2.1.jar">
</libraryNeeded>
<libraryNeeded
context="plugin:org.talend.libraries.jdbc.h2"
id="h2-1.3.160.jar"
name="h2-1.3.160.jar"
uripath="platform:/plugin/org.talend.libraries.jdbc.h2/lib/h2-1.3.160.jar">
</libraryNeeded>
<libraryNeeded
context="plugin:org.talend.libraries.jdbc.derby"
id="derby-10.4.2.0.jar"

View File

@@ -464,6 +464,7 @@ Node.onlyOneDynamicPerSchema=There should be only one Dynamic type in one schema
Node.output=outputs\:(
Node.outputNeedInputLink=If this component has output, there must be an input link to propagate the data.
Node.parameterEmpty=Parameter ({0}) is empty but is required.
Node.parameterWrong=The value of Parameter ({0}) is not exist.
Node.parameterNotExist=Parameter ({0}) has a value ({1}) that doesn't exist anymore.
Node.PatterErrorMessage=A value must be set for Date Pattern
Node.QueryLosed=XPath query lost
@@ -711,6 +712,8 @@ PerformancePreferencePage.RepositoryPreferencePage.RefreshCreated=Refresh when c
PerformancePreferencePage.RepositoryPreferencePage.ReferenceProjectMerged=Merge the reference project
PerformancePreferencePage.RepositoryPreferencePage.RefreshManually=Refresh Manually
PerformancePreferencePage.RepositoryPreferencePage.RefreshSaved=Refresh when saving an item
PerformancePreferencePage.autoCheckField=Auto check of svn to detect the update
PerformancePreferencePage.autoCheckTime=Detect update in each (seconds)
CamelPerformancePreferencePage.display.deactiveRepositoryUpdate=Deactivate auto detect/update after a modification in the repository
CamelPerformancePreferencePage.propertyCodeCheck=Check the property fields when generating code (disable will make the components properties faster)

View File

@@ -47,6 +47,7 @@ import org.talend.core.model.process.AbstractNode;
import org.talend.core.model.process.EComponentCategory;
import org.talend.core.model.process.EConnectionType;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.IElement;
@@ -880,7 +881,9 @@ public class DataProcess implements IGeneratingProcess {
}
// propagate metadataLists for output component. only apply to multi-input virtual component
if (multipleComponentManager.isSetConnector() && multipleComponentManager.getOutputName().equals(curItem.getName())) {
boolean isSAPBapi = graphicalNode.getComponent() != null && "tSAPBapi".equals(graphicalNode.getComponent().getName());//$NON-NLS-1$
if (multipleComponentManager.isSetConnector()
&& (multipleComponentManager.getOutputName().equals(curItem.getName()) || isSAPBapi)) {
// deactivate dummy component
if (curNode.getComponentName().equals("tDummyRow")) {// or use //$NON-NLS-1$
// "!multipleComponentManager.existsLinkTo()"
@@ -1772,6 +1775,19 @@ public class DataProcess implements IGeneratingProcess {
dataNodeList.add(0, preStaLogConNode);
}
// tag all the components after Iterator(Parallel)
// !iterator with parallel shouldn't work on merge!
for (INode node : dataNodeList) {
if (node.isSubProcessStart() && node.isActivate()) {
tagComponentAfterParallelIterator(node);
}
}
for (INode node : dataNodeList) {
if (node.isSubProcessStart() && node.isActivate()) {
tagSubProcessAfterParallelIterator(node);
}
}
checkRefList = null;
checkMultipleMap = null;
checktUniteMap = null;
@@ -1783,6 +1799,50 @@ public class DataProcess implements IGeneratingProcess {
}
/**
* DOC bchen Comment method "tagSubProcessAfterParallelIterator".
*
* @param node
*/
private void tagSubProcessAfterParallelIterator(INode node) {
if (node.getIncomingConnections() != null && node.getIncomingConnections().size() != 0) {
IConnection connection = node.getIncomingConnections().get(0);
if (connection.getLineStyle().equals(EConnectionType.ON_COMPONENT_OK)
|| connection.getLineStyle().equals(EConnectionType.ON_COMPONENT_ERROR)
|| connection.getLineStyle().equals(EConnectionType.ON_SUBJOB_OK)
|| connection.getLineStyle().equals(EConnectionType.ON_SUBJOB_ERROR)
|| connection.getLineStyle().equals(EConnectionType.RUN_IF)) {// add if you think it should be count
// for parallel Iterator
if (((AbstractNode) connection.getSource()).getParallelIterator() != null) {
((AbstractNode) node).setParallelIterator(((AbstractNode) connection.getSource()).getParallelIterator());
tagComponentAfterParallelIterator(node);
}
}
}
}
/**
* DOC bchen Comment method "tagComponentAfterParallelIterator".
*
* @param node
*/
private void tagComponentAfterParallelIterator(INode node) {
for (IConnection connection : node.getOutgoingSortedConnections()) {
if (connection.getTarget().isActivate()) {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN | IConnectionCategory.USE_ITERATE)) {
if (((AbstractNode) node).getParallelIterator() != null) {
((AbstractNode) connection.getTarget()).setParallelIterator(((AbstractNode) node).getParallelIterator());
} else if (connection.getLineStyle().equals(EConnectionType.ITERATE)
&& Boolean.TRUE.toString().equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) {
((AbstractNode) connection.getTarget()).setParallelIterator(connection.getTarget().getUniqueName());
}
tagComponentAfterParallelIterator(connection.getTarget());
}
}
}
}
private void checkPigLoadComponent() {
// if (PluginChecker.isPigudfPluginLoaded()) {
// for (INode dataNode : dataNodeList) {
@@ -2546,10 +2606,11 @@ public class DataProcess implements IGeneratingProcess {
}
}
for (IConnection connection : node.getOutgoingConnections()) {
if(connection.getLineStyle() == EConnectionType.ON_SUBJOB_OK || connection.getLineStyle() == EConnectionType.ON_SUBJOB_ERROR) {
if (connection.getLineStyle() == EConnectionType.ON_SUBJOB_OK
|| connection.getLineStyle() == EConnectionType.ON_SUBJOB_ERROR) {
continue;
}
if (connection.isActivate()) {
if (!hasSingleMergeComponent(connection.getTarget(), checkedNodes, mergeFound || merge)) {
return false;

View File

@@ -197,7 +197,7 @@ public class JobSettingsManager {
}
/**
*
*
* create parameter for extra tab.
*/
private static List<IElementParameter> getExtraParameters(IProcess process) {
@@ -641,7 +641,7 @@ public class JobSettingsManager {
final String schemaCondition = JobSettingsConstants
.addBrackets(dbTypeName
+ " =='OCLE' or " + dbTypeName //$NON-NLS-1$
+ " =='POSTGRESQL' or " + dbTypeName + " =='POSTGRESPLUS' or " + dbTypeName + " =='OCLE_OCI' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + " =='INFORMIX' or " + dbTypeName + " =='IBM_DB2' or " + dbTypeName + " =='SYBASE'"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$
+ " =='POSTGRESQL' or " + dbTypeName + " =='POSTGRESPLUS' or " + dbTypeName + " =='OCLE_OCI' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + " =='INFORMIX' or " + dbTypeName + " =='IBM_DB2' or " + dbTypeName + " =='SYBASE'"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$
param.setShowIf(schemaCondition + " and " + dbCondition); //$NON-NLS-1$
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
@@ -827,9 +827,9 @@ public class JobSettingsManager {
}
/**
*
*
* DOC ggu Comment method "isStatsAndLogsActivated".
*
*
* for stats & logs settings
*/
public static boolean isStatsAndLogsActivated(IProcess process) {
@@ -841,9 +841,9 @@ public class JobSettingsManager {
}
/**
*
*
* DOC ggu Comment method "isImplicittContextLoadActived".
*
*
* for implictit tContextLoad in extra settings
*/
public static boolean isImplicittContextLoadActived(IProcess process) {

View File

@@ -337,7 +337,7 @@ public abstract class AbstractMultiPageTalendEditor extends MultiPageEditorPart
return;
}
Property property = processEditorInput.getItem().getProperty();
if (!CollectionUtils.isEqualCollection(propertyInformation, property.getInformations())) {
if (propertyInformation != null && !CollectionUtils.isEqualCollection(propertyInformation, property.getInformations())) {
Problems.computePropertyMaxInformationLevel(property, true);
}
}

View File

@@ -88,7 +88,6 @@ public class ActiveProcessTracker implements IPartListener {
if (testedPart instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) testedPart;
mpte.setName();
Contexts.setTitle(mpte.getTitle());
IProcess2 process = mpte.getTalendEditor().getProcess();
return process;
} else {
@@ -127,6 +126,7 @@ public class ActiveProcessTracker implements IPartListener {
if (process != null && currentProcess != process) {
changedProcess = true;
currentProcess = process;
Contexts.setTitle(process.getLabel());
setContextsView(process);
// setStatsAndLogsView(process);
JobSettings.switchToCurJobSettingsView();

View File

@@ -16,9 +16,15 @@ import java.lang.reflect.InvocationTargetException;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.common.util.EList;
@@ -51,16 +57,19 @@ import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.utils.VersionUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.ByteArray;
import org.talend.core.model.properties.FileItem;
import org.talend.core.model.properties.Information;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Property;
import org.talend.core.model.properties.RoutineItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.Folder;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.utils.RepositoryManagerHelper;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.core.ui.ILastVersionChecker;
import org.talend.core.ui.IUIRefresher;
import org.talend.core.ui.branding.IBrandingService;
@@ -70,6 +79,7 @@ import org.talend.designer.core.ui.action.SaveAsRoutineAction;
import org.talend.designer.core.ui.action.SaveAsSQLPatternAction;
import org.talend.designer.core.ui.views.problems.Problems;
import org.talend.designer.core.utils.DesignerColorUtils;
import org.talend.repository.ProjectManager;
import org.talend.repository.RepositoryWorkUnit;
import org.talend.repository.editor.RepositoryEditorInput;
import org.talend.repository.model.ERepositoryStatus;
@@ -280,6 +290,27 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
}
public void resetItem() throws PersistenceException {
if (item.getProperty().eResource() == null || item.eResource() == null) {
IRepositoryService service = CoreRuntimePlugin.getInstance().getRepositoryService();
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
//
// Property updated = factory.getUptodateProperty(getItem().getProperty());
Property updatedProperty = null;
try {
factory.initialize();
IRepositoryViewObject repositoryViewObject = factory.getLastVersion(new Project(ProjectManager.getInstance()
.getProject(item.getProperty().getItem())), item.getProperty().getId());
if (repositoryViewObject != null) {
updatedProperty = repositoryViewObject.getProperty();
item = (FileItem) updatedProperty.getItem();
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
@Override
public void doSave(final IProgressMonitor monitor) {
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
@@ -306,6 +337,7 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
super.doSave(monitor);
try {
resetItem();
ByteArray byteArray = item.getContent();
byteArray.setInnerContentFromFile(((FileEditorInput) getEditorInput()).getFile());
try {
@@ -324,7 +356,10 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
refreshJobAndSave(repFactory);
}
};
repositoryWorkUnit.setAvoidSvnUpdate(true);
repositoryWorkUnit.setAvoidUnloadResources(true);
repFactory.executeRepositoryWorkUnit(repositoryWorkUnit);
repositoryWorkUnit.throwPersistenceExceptionIfAny();
// for bug 11930: Unable to save Routines.* in db project
@@ -338,13 +373,47 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
}
private void refreshJobAndSave(final IProxyRepositoryFactory repFactory) {
private void refreshJobAndSave(final IProxyRepositoryFactory repFactory) throws PersistenceException {
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
try {
repFactory.save(item);
} catch (PersistenceException e) {
throw new CoreException(new Status(IStatus.ERROR, DesignerPlugin.ID, "Save Routine failed!", e));
}
};
};
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
try {
ISchedulingRule schedulingRule = workspace.getRoot();
// the update the project files need to be done in the workspace runnable to avoid all
// notification
// of changes before the end of the modifications.
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
}
};
try {
// cause it to update MaxInformationLevel
repFactory.save(item);
} catch (Exception e) {
PlatformUI.getWorkbench().getProgressService().run(false, false, iRunnableWithProgress);
} catch (InvocationTargetException e) {
throw new PersistenceException(e);
} catch (InterruptedException e) {
throw new PersistenceException(e);
}
// update editor image
setTitleImage(getTitleImage());
}

View File

@@ -20,6 +20,7 @@ import org.eclipse.ui.PlatformUI;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IGraphicalNode;
import org.talend.core.model.process.INode;
import org.talend.core.model.update.IUpdateItemType;
import org.talend.core.model.update.UpdateManagerHelper;
import org.talend.core.model.update.extension.UpdateManagerProviderDetector;
@@ -27,6 +28,7 @@ import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.process.AbstractProcessProvider;
import org.talend.designer.core.ui.editor.nodecontainer.NodeContainer;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.designer.core.ui.views.problems.Problems;
@@ -93,6 +95,7 @@ public class CreateNodeContainerCommand extends CreateCommand {
process.checkStartNodes();
nodeContainer.getNode().checkAndRefreshNode();
refreshRelatedNodes();
// update joblet context.
// AbstractProcessProvider provider =
// AbstractProcessProvider.findProcessProviderFromPID(nodeContainer.getNode()
@@ -117,6 +120,21 @@ public class CreateNodeContainerCommand extends CreateCommand {
}
}
private void refreshRelatedNodes() {
Node node = nodeContainer.getNode();
for (INode inode : this.process.getGraphicalNodes()) {
if (inode.getUniqueName().equals(node.getUniqueName())) {
continue;
}
if (inode.getElementParameter("CONNECTION") != null) {
IElementParameter para = inode.getElementParameter("CONNECTION");
if (para.getFilter() != null && para.getFilter().equals(node.getComponent().getName())) {
((Node) inode).checkAndRefreshNode();
}
}
}
}
@Override
public void undo() {
this.process.removeNodeContainer(this.nodeContainer);

View File

@@ -477,11 +477,15 @@ public class NodesPasteCommand extends Command {
Map<String, Object> newMap = new HashMap<String, Object>();
newMap.putAll(map);
// rename schemas
if (EParameterName.SCHEMAS.name().equals(param.getName()) && !oldMetaToNewMeta.isEmpty()) {
String newSchemaName = oldMetaToNewMeta.get(pastedNode.getUniqueName() + ":"
+ map.get(EParameterName.SCHEMA.getName()));
if (newSchemaName != null) {
newMap.put(EParameterName.SCHEMA.getName(), newSchemaName);
if (!oldMetaToNewMeta.isEmpty()) {
boolean isSAPBapiInputSchema = "MAPPING_INPUT".equals(param.getName()) //$NON-NLS-1$
&& "tSAPBapi".equals(copiedNode.getComponent().getName()); //$NON-NLS-1$
if (EParameterName.SCHEMAS.name().equals(param.getName()) || isSAPBapiInputSchema) {
String newSchemaName = oldMetaToNewMeta.get(pastedNode.getUniqueName() + ":"
+ map.get(EParameterName.SCHEMA.getName()));
if (newSchemaName != null) {
newMap.put(EParameterName.SCHEMA.getName(), newSchemaName);
}
}
}

View File

@@ -245,7 +245,7 @@ public class JobletUtil {
}
nodePart.setModel(cloneNode);
cloneNode.setLabel(node.getLabel());
// if (lock == null) {
// cloneNode.setReadOnly(true);
// } else {
@@ -380,7 +380,8 @@ public class JobletUtil {
}
}
}
cloneNode.setLabel(node.getLabel());
cloneNode.setPropertyValue(EParameterName.LABEL.getName(), node.getLabel());
return cloneNode;
}

View File

@@ -65,6 +65,7 @@ import org.talend.core.model.process.Element;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.core.model.process.IElement;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IExternalData;
import org.talend.core.model.process.IExternalNode;
@@ -102,6 +103,7 @@ import org.talend.designer.core.ui.ActiveProcessTracker;
import org.talend.designer.core.ui.editor.AbstractTalendEditor;
import org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand;
import org.talend.designer.core.ui.editor.cmd.ConnectionCreateCommand;
import org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand;
import org.talend.designer.core.ui.editor.connections.Connection;
import org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer;
import org.talend.designer.core.ui.editor.nodecontainer.NodeContainer;
@@ -2716,6 +2718,44 @@ public class Node extends Element implements IGraphicalNode {
}
}
break;
case COMPONENT_LIST:
if (param != null) {
String errorMessage = Messages.getString("Node.parameterEmpty", param.getDisplayName()); //$NON-NLS-1$
if (isUseExistedConnetion(this)) {
List<INode> list = (List<INode>) this.getProcess().getNodesOfType(param.getFilter());
if (list == null || list.size() == 0 || list.isEmpty()) {
Problems.add(ProblemStatus.ERROR, this, errorMessage);
} else {
List<INode> nodeList = new ArrayList<INode>();
for (INode datanode : list) {
if (!datanode.isVirtualGenerateNode()) {
nodeList.add(datanode);
}
}
if (nodeList.size() == 0 || nodeList.isEmpty()) {
Problems.add(ProblemStatus.ERROR, this, errorMessage);
break;
}
boolean foundValue = false;
for (INode datanode : nodeList) {
if (datanode.getUniqueName().equals(param.getValue())) {
foundValue = true;
break;
}
}
errorMessage = Messages.getString("Node.parameterWrong", param.getDisplayName()); //$NON-NLS-1$
if (!foundValue) {
Problems.add(ProblemStatus.ERROR, this, errorMessage);
PropertyChangeCommand changeCommand = new PropertyChangeCommand(this, param.getName(),
nodeList.get(0).getUniqueName());
if (this.getCommandStack() != null) {
this.getCommandStack().execute(changeCommand);
}
}
}
}
}
break;
default:
if (param.getValue() != null && !(param.getValue() instanceof String)) {
break;
@@ -2765,6 +2805,19 @@ public class Node extends Element implements IGraphicalNode {
}
public boolean isUseExistedConnetion(IElement currentElem) {
IElementParameter param = currentElem.getElementParameter("USE_EXISTING_CONNECTION"); //$NON-NLS-1$
if (param != null) {
Object value = param.getValue();
if (value instanceof Boolean) {
return (Boolean) value;
} else if (value instanceof String) {
return Boolean.parseBoolean((String) value);
}
}
return false;
}
private List<String> getColumnLabels(IMetadataTable metadataTable) {
List<String> columnLabels = new ArrayList<String>();
if (metadataTable == null) {

View File

@@ -151,6 +151,7 @@ import org.talend.designer.core.ui.editor.nodecontainer.NodeContainer;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.notes.Note;
import org.talend.designer.core.ui.editor.properties.controllers.ColumnListController;
import org.talend.designer.core.ui.editor.properties.controllers.ComponentListController;
import org.talend.designer.core.ui.editor.properties.controllers.ConnectionListController;
import org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer;
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
@@ -182,6 +183,11 @@ import org.talend.repository.ui.utils.Log4jPrefsSettingManager;
*/
public class Process extends Element implements IProcess2, IGEFProcess, ILastVersionChecker {
/**
*
*/
private static final String PROCESS_SCREENSHOT_KEY = "process"; //$NON-NLS-1$
protected List<INode> nodes = new ArrayList<INode>();
protected List<Element> elem = new ArrayList<Element>();
@@ -1364,7 +1370,22 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
*/
processType.setDefaultContext(contextManager.getDefaultContext().getName());
if (getScreenshot() != null) {
processType.getScreenshots().put("process", getScreenshot());
processType.getScreenshots().put(PROCESS_SCREENSHOT_KEY, getScreenshot());
// fix a bug (TUP-2278) of synch between inner process item and newly created process item during save, this
// is very dirty but inherent to the current archi.
// copy all the screenshot items appart from the "process" one that is already handled here.
if (property != null && (property.getItem() != null) && (property.getItem() instanceof ProcessItem)) {
ProcessItem pi = (ProcessItem) property.getItem();
ProcessType pt = pi.getProcess();
if (pt != null) {
EMap delegateScreenshots = pt.getScreenshots();
for (Object objkey : delegateScreenshots.keySet()) {
if (!PROCESS_SCREENSHOT_KEY.equals(objkey)) {
processType.getScreenshots().put(objkey, delegateScreenshots.get(objkey));
}// else keep looking
}
}// else no process available so ignor
}// else not a type we can handle so ignor
}
setScreenshot(null); // once be saved, set the screenshot to null to free memory
contextManager.saveToEmf(processType.getContext());
@@ -1758,6 +1779,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
loadSubjobs(processType);
initExternalComponents();
initJobletComponents();
setActivate(true);
checkStartNodes();
// (bug 5365)
@@ -1867,6 +1889,22 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
private void initJobletComponents() {
for (INode node : nodes) {
if ((node instanceof Node) && ((Node) node).isJoblet()) {
List<? extends IElementParameter> parametersWithChildrens = node.getElementParametersWithChildrens();
for (IElementParameter param : parametersWithChildrens) {
if (param.getFieldType() == EParameterFieldType.COMPONENT_LIST) {
if (param.getValue() == null || ((String) param.getValue()).length() <= 0) {
ComponentListController.updateComponentList(node, param);
}
}
}
}
}
}
// private void checkProjectsettingParameters() {
// boolean statsLog = (Boolean) this.getElementParameter(EParameterName.STATANDLOG_USE_PROJECT_SETTINGS.getName())
// .getValue();

View File

@@ -43,6 +43,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IElement;
@@ -320,6 +321,30 @@ public class ConnectionListController extends AbstractElementPropertySectionCont
}
}
if (connectionName.equals(oldConnectionName)) {
if (elem instanceof INode) {
INode node = (INode) elem;
if (node.getComponent() != null && "tSAPBapi".equals(node.getComponent().getName())) {
// if SCHEMA_TYPE is renamed,rename the corresponding metadata table
// name and connection meta name
List<IMetadataTable> metadataList = node.getMetadataList();
for (IMetadataTable metadataTable : metadataList) {
if (metadataTable.getTableName() != null
&& metadataTable.getTableName().equals(oldConnectionName)) {
metadataTable.setTableName(newConnectionName);
break;
}
}
List<? extends IConnection> outgoingConnections = node.getOutgoingConnections();
for (IConnection connection : outgoingConnections) {
if (connection.getMetaName() != null
&& connection.getMetaName().equals(oldConnectionName)) {
connection.setMetaName(newConnectionName);
break;
}
}
}
}
curLine.put(param.getName(), newConnectionName);
}
}

View File

@@ -15,7 +15,6 @@ package org.talend.designer.core.ui.editor.properties.controllers;
import java.beans.PropertyChangeEvent;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -48,7 +47,8 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.utils.io.FilesUtils;
import org.talend.core.CorePlugin;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.IExternalNode;
@@ -61,7 +61,6 @@ import org.talend.designer.core.ui.dialog.BrmsDialog;
import org.talend.designer.core.ui.dialog.IBrmsExtension;
import org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.librariesmanager.model.ModulesNeededProvider;
/**
* DOC yzhang class global comment. Detailled comment <br/>
@@ -319,14 +318,14 @@ public class ModuleListController extends AbstractElementPropertySectionControll
}
public static void updateModuleList(Node node) {
List<ModuleNeeded> moduleNeededList = ModulesNeededProvider.getModulesNeeded();
ILibraryManagerService repositoryBundleService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
ILibraryManagerService.class);
Set<String> existLibraries = repositoryBundleService.list();
Set<String> moduleNameList = new TreeSet<String>();
Set<String> moduleValueList = new TreeSet<String>();
for (ModuleNeeded module : moduleNeededList) {
String moduleName = module.getModuleName();
moduleNameList.add(moduleName);
moduleValueList.add(TalendTextUtils.addQuotes(moduleName));
for (String lib : existLibraries) {
moduleNameList.add(lib);
moduleValueList.add(TalendTextUtils.addQuotes(lib));
}
Comparator<String> comprarator = new IgnoreCaseComparator();
String[] moduleNameArray = moduleNameList.toArray(new String[0]);

View File

@@ -22,6 +22,7 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.talend.commons.ui.swt.preferences.CheckBoxFieldEditor;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.designer.core.DesignerPlugin;
@@ -83,6 +84,7 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(dbConnTimeoutActive);
addField(dbConnTimeout);
addSVNInforAutoCheckFiled();
} else {
addField(new BooleanFieldEditor(ITalendCorePrefConstants.DEACTIVE_REPOSITORY_UPDATE,
Messages.getString("PerformancePreferencePage.display.deactiveRepositoryUpdate"),//$NON-NLS-1$
@@ -127,15 +129,46 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
// addField(new BooleanFieldEditor(ITalendCorePrefConstants.ADD_SYSTEM_ROUTINES, Messages
// .getString("PerformancePreferencePage.addAllSystemRoutines"),//$NON-NLS-1$
// getFieldEditorParent()));
addSVNInforAutoCheckFiled();
}
}
private void addSVNInforAutoCheckFiled() {
if (PluginChecker.isSVNProviderPluginLoaded()) {
final CheckBoxFieldEditor autoCheckField = new CheckBoxFieldEditor(
ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK,
Messages.getString("PerformancePreferencePage.autoCheckField"), getFieldEditorParent()); //$NON-NLS-1$
addField(autoCheckField);
final IntegerFieldEditor autoCheckTime = new IntegerFieldEditor(
ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK_TIME_INTERVAL,
Messages.getString("PerformancePreferencePage.autoCheckTime"), //$NON-NLS-1$
getFieldEditorParent());
autoCheckTime.setValidRange(1, 30);
autoCheckTime.setEnabled(getPreferenceStore().getBoolean(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK),
getFieldEditorParent());
addField(autoCheckTime);
autoCheckField.getButton().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (autoCheckField.getButton().getSelection()) {
autoCheckTime.setEnabled(true, getFieldEditorParent());
} else {
autoCheckTime.setEnabled(false, getFieldEditorParent());
}
}
});
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
}

View File

@@ -31,6 +31,7 @@ import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.CommonUIPlugin;
import org.talend.commons.ui.swt.colorstyledtext.ColorManager;
import org.talend.core.CorePlugin;
import org.talend.core.PluginChecker;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.repository.IRepositoryPrefConstants;
@@ -165,9 +166,12 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(IRepositoryPrefConstants.USE_EXPORT_SAVE, false);
store.setDefault(IRepositoryPrefConstants.ADD_CLASSPATH_JAR, false);
store.setDefault(
TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT,
false);
store.setDefault(TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT, false);
if (PluginChecker.isSVNProviderPluginLoaded()) {
store.setDefault(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK, true);
store.setDefault(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK_TIME_INTERVAL, 1);
}
if (!CommonUIPlugin.isFullyHeadless()) {
Display display = Display.getDefault();
@@ -175,7 +179,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
display = Display.getCurrent();
}
if (display != null) {
display.syncExec(new Runnable() {
display.asyncExec(new Runnable() {
@Override
public void run() {

View File

@@ -123,7 +123,7 @@ public class ProjectSettingManager extends Utils {
Element elem = (Element) pro.getInitialContextLoad();
if (elem == null) {
elem = new ImplicitContextLoadElement();
ProjectSettingManager.createImplicitContextLoadParameters((ImplicitContextLoadElement) elem);
ProjectSettingManager.createImplicitContextLoadParameters(elem);
pro.setInitialContextLoad(elem);
}
return elem;
@@ -151,7 +151,7 @@ public class ProjectSettingManager extends Utils {
Element elem = (Element) pro.getStatsAndLog();
if (elem == null) {
elem = new StatsAndLogsElement();
StatsAndLogsHelper.createStatsAndLogsParameters((StatsAndLogsElement) elem);
StatsAndLogsHelper.createStatsAndLogsParameters(elem);
pro.setStatsAndLog(elem);
}
return elem;
@@ -177,7 +177,7 @@ public class ProjectSettingManager extends Utils {
createStatsAndLogsElement(pro);
ParametersType stats = pro.getEmfProject().getStatAndLogsSettings().getParameters();
// load the project settings to process
ElementParameter2ParameterType.loadElementParameters(process, stats, EParameterName.PROPERTY_TYPE.getName() + ":" //$NON-NLS-N$
ElementParameter2ParameterType.loadElementParameters(process, stats, EParameterName.PROPERTY_TYPE.getName() + ":"
+ EParameterName.PROPERTY_TYPE.getName());
// change repository item
// TODO
@@ -263,8 +263,9 @@ public class ProjectSettingManager extends Utils {
* @param pItem
*/
public static void defaultUseProjectSetting(org.talend.designer.core.ui.editor.process.Process process) {
if (process == null)
if (process == null) {
return;
}
ImplicitContextSettings implicit = ProjectManager.getInstance().getCurrentProject().getEmfProject()
.getImplicitContextSettings();
Boolean bImplicit = false;
@@ -463,7 +464,7 @@ public class ProjectSettingManager extends Utils {
param.setListItemsValue(new String[] {});
param.setValue(preferenceStore.getString(getPreferenceName(EParameterName.REPOSITORY_PROPERTY_TYPE)// +
// CONNECTION_ITEM_LABEL
)); //$NON-NLS-1$
));
param.setCategory(EComponentCategory.EXTRA);
param.setFieldType(EParameterFieldType.TECHNICAL);
param.setShow(false);
@@ -514,7 +515,7 @@ public class ProjectSettingManager extends Utils {
// host
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.HOST.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.HOST)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.HOST))));
param.setDisplayName(EParameterName.HOST.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
@@ -529,7 +530,7 @@ public class ProjectSettingManager extends Utils {
// port
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PORT.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.PORT)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.PORT))));
param.setDisplayName(EParameterName.PORT.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
@@ -544,7 +545,7 @@ public class ProjectSettingManager extends Utils {
// dbName
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBNAME.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.DBNAME)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.DBNAME))));
param.setDisplayName(EParameterName.DBNAME.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
@@ -575,7 +576,7 @@ public class ProjectSettingManager extends Utils {
// additional parameters
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTIES.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.PROPERTIES)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.PROPERTIES))));
param.setDisplayName(EParameterName.PROPERTIES.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
@@ -592,7 +593,7 @@ public class ProjectSettingManager extends Utils {
// schema
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.SCHEMA_DB)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.SCHEMA_DB))));
param.setDisplayName(EParameterName.SCHEMA_DB.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
@@ -600,7 +601,7 @@ public class ProjectSettingManager extends Utils {
param.setRepositoryValue("SCHEMA"); //$NON-NLS-1$
final String schemaCondition = JobSettingsConstants
.addBrackets(dbTypeName
+ " =='OCLE' or " + dbTypeName + " =='OCLE_OCI' or " + dbTypeName + " =='POSTGRESQL' or " + dbTypeName + " =='POSTGRESPLUS' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + " =='INFORMIX'"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$
+ " =='OCLE' or " + dbTypeName + " =='OCLE_OCI' or " + dbTypeName + " =='POSTGRESQL' or " + dbTypeName + " =='POSTGRESPLUS' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + " =='INFORMIX' or " + dbTypeName + " =='IBM_DB2' or " + dbTypeName + " =='SYBASE'"); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$//$NON-NLS-5$//$NON-NLS-6$//$NON-NLS-7$//$NON-NLS-8$
param.setShowIf(schemaCondition + " and " + dbCondition); //$NON-NLS-1$
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
@@ -608,7 +609,7 @@ public class ProjectSettingManager extends Utils {
// username
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.USER.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.USER)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.USER))));
param.setDisplayName(EParameterName.USER.getDisplayName());
param.setFieldType(EParameterFieldType.TEXT);
param.setCategory(EComponentCategory.EXTRA);
@@ -623,7 +624,7 @@ public class ProjectSettingManager extends Utils {
// password
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.PASS.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.PASS)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.PASS))));
param.setDisplayName(EParameterName.PASS.getDisplayName());
param.setFieldType(EParameterFieldType.PASSWORD);
param.setCategory(EComponentCategory.EXTRA);
@@ -651,7 +652,7 @@ public class ProjectSettingManager extends Utils {
// table
param = new ElementParameter(elem);
param.setName(JobSettingsConstants.getExtraParameterName(EParameterName.DBTABLE.getName()));
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.DBTABLE)))); //$NON-NLS-1$
param.setValue(addQuotes(preferenceStore.getString(getPreferenceName(EParameterName.DBTABLE))));
param.setDisplayName(EParameterName.DBTABLE.getDisplayName());
param.setFieldType(EParameterFieldType.DBTABLE);
param.setCategory(EComponentCategory.EXTRA);

View File

@@ -232,8 +232,8 @@ public class StatsAndLogsHelper extends Utils {
// stats log encoding
ElementParameter encodingParam = new ElementParameter(elem);
encodingParam.setName(EParameterName.ENCODING.getName()); //$NON-NLS-1$
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());//$NON-NLS-1$
encodingParam.setName(EParameterName.ENCODING.getName());
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());
encodingParam.setCategory(EComponentCategory.STATSANDLOGS);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
encodingParam
@@ -368,7 +368,7 @@ public class StatsAndLogsHelper extends Utils {
// ProjectSettingManager
// .
// CONNECTION_ITEM_LABEL
)); //$NON-NLS-1$
));
param.setShow(false);
param.setRequired(true);
// paramList.add(param);
@@ -540,7 +540,7 @@ public class StatsAndLogsHelper extends Utils {
param.setCategory(EComponentCategory.STATSANDLOGS);
param.setNumRow(54);
param.setRepositoryValue("SCHEMA"); //$NON-NLS-1$
param.setShowIf("(DB_TYPE=='OCLE' or DB_TYPE=='OCLE_OCI' or DB_TYPE=='POSTGRESQL' or DB_TYPE=='POSTGRESPLUS' or DB_TYPE=='MSSQL' or DB_TYPE=='INFORMIX') and (ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')"); //$NON-NLS-1$
param.setShowIf("(DB_TYPE=='OCLE' or DB_TYPE=='OCLE_OCI' or DB_TYPE=='POSTGRESQL' or DB_TYPE=='POSTGRESPLUS' or DB_TYPE=='MSSQL' or DB_TYPE=='INFORMIX' or DB_TYPE=='IBM_DB2' or DB_TYPE=='SYBASE') and (ON_DATABASE_FLAG == 'true') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')"); //$NON-NLS-1$
paramList.add(param);
// username
@@ -603,7 +603,7 @@ public class StatsAndLogsHelper extends Utils {
// Metter table
param = new ElementParameter(elem);
param.setName(EParameterName.TABLE_METER.getName()); //$NON-NLS-1$
param.setName(EParameterName.TABLE_METER.getName());
param.setValue(addQuotes(preferenceStore.getString(languagePrefix + EParameterName.TABLE_METER.getName())));
param.setDisplayName(EParameterName.TABLE_METER.getDisplayName());
param.setFieldType(EParameterFieldType.DBTABLE);
@@ -615,6 +615,7 @@ public class StatsAndLogsHelper extends Utils {
private final static class IgnoreCaseComparator implements Comparator<String> {
@Override
public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2);
}

View File

@@ -12,21 +12,17 @@
// ============================================================================
package org.talend.designer.mapper.ui.visualmap.zone.toolbar;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ToolItem;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.core.model.process.IElementParameter;
import org.talend.designer.abstractmap.AbstractMapComponent;
import org.talend.designer.mapper.i18n.Messages;
import org.talend.designer.mapper.managers.MapperManager;
import org.talend.designer.mapper.ui.image.ImageInfo;
import org.talend.designer.mapper.ui.image.ImageProviderMapper;
import org.talend.designer.mapper.ui.visualmap.table.DataMapTableView;
import org.talend.designer.mapper.ui.visualmap.zone.Zone;
/**
@@ -133,48 +129,32 @@ public class ToolbarOutputZone extends ToolbarZone {
guessItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
List<DataMapTableView> outputsTablesView = getMapperManager().getUiManager().getOutputsTablesView();
for (DataMapTableView dataMapTableView : outputsTablesView) {
dataMapTableView.notifyFocusLost();
}
getMapperManager().mapAutomaticallly();
}
});
// dieOnError.addSelectionListener(new SelectionListener() {
//
// public void widgetDefaultSelected(SelectionEvent e) {
// }
//
// public void widgetSelected(SelectionEvent e) {
// Image image = null;
// if (dieOnError.getSelection()) {
// image = ImageProviderMapper.getImage(ImageInfo.CHECKED_ICON);
// getMapperManager().removeRejectOutput();
// } else {
// image = ImageProviderMapper.getImage(ImageInfo.UNCHECKED_ICON);
// if (!getMapperManager().hasRejectOutput(getMapperManager().getOutputTables())) {
// getMapperManager().addRejectOutput();
// }
// }
// dieOnError.setImage(image);
// getMapperManager().setDieOnError(dieOnError.getSelection());
// getMapperManager().setDieOnErrorValueChanged(true);
// }
//
// });
}
@Override
public String getMinimizeTooltipText() {
return MINIMIZE_TOOLTIP;
}
@Override
public String getRestoreTooltipText() {
return RESTORE_TOOLTIP;
}
@Override
public String getMoveUpTooltipText() {
return MOVE_UP_TOOLTIP;
}
@Override
public String getMoveDownTooltipText() {
return MOVE_DOWN_TOOLTIP;
}

View File

@@ -12,13 +12,22 @@
// ============================================================================
package org.talend.designer.publish.core.models;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import org.apache.commons.lang.StringEscapeUtils;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class FeaturesModel extends BaseModel {
@@ -34,7 +43,7 @@ public class FeaturesModel extends BaseModel {
private String configName;
private Collection<String> subFeatures = new HashSet<String>();
private Collection<FeatureModel> subFeatures = new HashSet<FeatureModel>();
private Collection<BundleModel> subBundles = new HashSet<BundleModel>();
@@ -51,13 +60,7 @@ public class FeaturesModel extends BaseModel {
}
public void addFeature(FeatureModel feature) {
StringBuilder sb = new StringBuilder();
sb.append("<feature version='");
sb.append(feature.getVersion());
sb.append("\'>");
sb.append(feature.getArtifactId());
sb.append("</feature>");
subFeatures.add(sb.toString());
subFeatures.add(feature);
}
public boolean addBundle(BundleModel model) {
@@ -90,87 +93,100 @@ public class FeaturesModel extends BaseModel {
}
private static String toBundleString(BundleModel model) {
StringBuilder sb = new StringBuilder();
sb.append("<bundle>mvn:");
StringBuilder sb = new StringBuilder("mvn:");
sb.append(model.getGroupId());
sb.append('/');
sb.append(model.getArtifactId());
sb.append('/');
sb.append(model.getVersion());
sb.append("</bundle>");
return sb.toString();
}
public String getContent() {
StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sb.append("<features name=\"").append(getArtifactId()).append("\" xmlns=\"http://karaf.apache.org/xmlns/features/v1.0.0\">\n");
sb.append("\t<feature name=\"");
sb.append(getArtifactId());
sb.append("\" version=\"");
sb.append(getVersion());
sb.append("\">\n");
// add sub features
for (String s : subFeatures) {
sb.append("\t\t");
sb.append(s);
sb.append("\n");
}
public String getContent() {
try {
return internalGetContent();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
// add sub bundles
for (BundleModel s : subBundles) {
sb.append("\t\t");
sb.append(toBundleString(s));
sb.append("\n");
}
private String internalGetContent() throws Exception {
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
if (null == contexts || contexts.isEmpty()) {
// add config
sb.append("\t\t<config name=\"");
sb.append(configName);
sb.append("\">\n");
sb.append("\t\t\ttalendcontext=\"");
for (int i = 0; i < contextList.length; i++) {
if (i != 0) {
sb.append(',');
}
sb.append(StringEscapeUtils.escapeXml(contextList[i]));
}
sb.append("\"\n");
sb.append("\t\t</config>\n");
} else {
// add contexts config
for (Map.Entry<String, Map<String, String>> context : contexts.entrySet()) {
sb.append("\t\t<config name=\"");
sb.append(name).append(".talendcontext.").append(StringEscapeUtils.escapeXml(context.getKey()));
sb.append("\">\n");
for (Map.Entry<String, String> property : context.getValue().entrySet()) {
sb.append("\t\t\t");
sb.append(StringEscapeUtils.escapeXml(property.getKey()));
sb.append('=');
sb.append(StringEscapeUtils.escapeXml(property.getValue()));
sb.append("\n");
}
sb.append("\t\t</config>\n");
}
}
sb.append("\t</feature>\n");
sb.append("</features>");
Element features = document.createElement("features");
features.setAttribute("xmlns", "http://karaf.apache.org/xmlns/features/v1.0.0");
features.setAttribute("name", getArtifactId());
document.appendChild(features);
return sb.toString();
Element feature = document.createElement("feature");
feature.setAttribute("name", getArtifactId());
feature.setAttribute("version", getVersion());
features.appendChild(feature);
// add sub features
for (FeatureModel fm : subFeatures) {
Element subFeature = document.createElement("feature");
if (null != fm.getVersion() && !fm.getVersion().isEmpty()) {
subFeature.setAttribute("version", fm.getVersion());
}
subFeature.appendChild(document.createTextNode(fm.getArtifactId()));
feature.appendChild(subFeature);
}
// add sub bundles
for (BundleModel bm : subBundles) {
Element bundle = document.createElement("bundle");
bundle.appendChild(document.createTextNode(toBundleString(bm)));
feature.appendChild(bundle);
}
if (null == contexts || contexts.isEmpty()) {
// add config
Element config = document.createElement("config");
config.setAttribute("name", configName);
StringBuilder sb = new StringBuilder("talendcontext=\"");
for (int i = 0; i < contextList.length; i++) {
if (i != 0) {
sb.append(',');
}
sb.append(contextList[i]);
}
sb.append('"');
config.appendChild(document.createTextNode(sb.toString()));
feature.appendChild(config);
} else {
// add contexts config
for (Map.Entry<String, Map<String, String>> context : contexts.entrySet()) {
Element config = document.createElement("config");
config.setAttribute("name", name +".talendcontext."+ context.getKey());
StringBuilder sb = new StringBuilder("\n");
for (Map.Entry<String, String> property : context.getValue().entrySet()) {
sb.append(property.getKey());
sb.append('=');
sb.append(property.getValue());
sb.append('\n');
}
config.appendChild(document.createTextNode(sb.toString()));
feature.appendChild(config);
}
}
Transformer transformer = TransformerFactory.newInstance().newTransformer();
DOMSource source = new DOMSource(document);
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.transform(source, result);
return writer.toString();
}
// public static void main(String[] args) {
// FeaturesModel featureModel = new FeaturesModel("aaa",
// "CustomService", "1.0.0");
// featureModel.addBundle(new BundleModel("talend", "job-control-bundle", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "ProviderJob", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "ESBProvider2", "1.0"));
// featureModel.addFeature(new FeatureModel("custom-feature", "2.0"));
// featureModel.setConfigName("aa.bb");
// featureModel
// .setContextList(new String[] { "Default", "Product", "Dev" });
// System.out.println(featureModel.getContent());
// }
// public static void main(String[] args) {
// FeaturesModel featureModel = new FeaturesModel("aaa", "CustomService", "1.0.0");
// featureModel.addBundle(new BundleModel("talend", "job-control-bundle", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "ProviderJob", "1.0"));
// featureModel.addBundle(new BundleModel("talend", "ESBProvider2", "1.0"));
// featureModel.addFeature(new FeatureModel("custom-feature", "2.0"));
// featureModel.setContexts(java.util.Collections.singletonMap("name", java.util.Collections.singletonMap("key", "開始")));
// System.out.println(featureModel.getContent());
// }
}

View File

@@ -87,7 +87,12 @@ public class JSONDragAndDropHandler extends AbstractDragAndDropServiceHandler {
return connection.getJSONFilePath();
} else {
Path p = new Path(connection.getJSONFilePath());
return TalendQuoteUtils.addQuotes(p.toPortableString());
if (p.toFile().isFile()) {
return TalendQuoteUtils.addQuotes(p.toPortableString());
} else {
return TalendQuoteUtils.addQuotes(p.toString());
}
}
}
if (value.equals("OUT_FILE_PATH")) {
@@ -98,7 +103,12 @@ public class JSONDragAndDropHandler extends AbstractDragAndDropServiceHandler {
return connection.getOutputFilePath();
} else {
Path p = new Path(connection.getOutputFilePath());
return TalendQuoteUtils.addQuotes(p.toPortableString());
if (p.toFile().isFile()) {
return TalendQuoteUtils.addQuotes(p.toPortableString());
} else {
return TalendQuoteUtils.addQuotes(p.toString());
}
}
}
if (value.equals("LIMIT")) { //$NON-NLS-1$

View File

@@ -358,7 +358,12 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
} else {
xsdPathChanged = false;
}
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonFilePath.getText()));
if (Path.fromOSString(jsonFilePath.getText()).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonFilePath.getText()));
} else {
getConnection().setJSONFilePath(jsonFilePath.getText());
}
// updateConnection(text);
StringBuilder fileContent = new StringBuilder();

View File

@@ -33,6 +33,7 @@ import org.apache.oro.text.regex.Perl5Compiler;
import org.apache.oro.text.regex.Perl5Matcher;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
@@ -171,8 +172,8 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
jsonFilePath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
fileFieldJSON.getText()));
}
if (!new File(jsonFilePath).exists() && getConnection().getFileContent() != null
&& getConnection().getFileContent().length > 0) {
File file = new File(jsonFilePath);
if (!file.exists() && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
initFileContent();
jsonFilePath = tempJSONXsdPath;
}
@@ -447,6 +448,11 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
}
// getConnection().setJSONFilePath(PathUtils.getPortablePath(JSONXsdFilePath.getText()));
File file = new File(text);
if (file.isDirectory()) {
valid = false;
checkFieldsValue();
return;
}
// if (file.exists()) {
// if (file.exists()) {
String tempxml = JSONUtil.changeJsonToXml(text);
@@ -472,7 +478,11 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
} else {
xsdPathChanged = false;
}
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonPath));
if (Path.fromOSString(jsonPath).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonPath));
} else {
getConnection().setJSONFilePath(jsonPath);
}
JSONWizard wizard = ((JSONWizard) getPage().getWizard());
wizard.setTreeRootNode(treeNode);
@@ -604,6 +614,12 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
updateStatus(IStatus.ERROR, ""); //$NON-NLS-1$
return false;
}
File file = new File(jsonFilePathText);
if (file.isFile() && !file.exists()) {
valid = false;
} else if (file.isDirectory()) {
valid = false;
}
if (!valid) {
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());

View File

@@ -19,6 +19,7 @@ import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.commons.io.IOUtils;
@@ -133,18 +134,37 @@ public class JSONUtil {
java.io.ByteArrayOutputStream outStream = new java.io.ByteArrayOutputStream();
InputStream inStream = null;
File file = new File(jsonPath);
// String filename = file.getName().replaceAll("\\.", "_");
// filename = "tempTest";
boolean isFromUrl = false;
try {
InputStream input = null;
if (file.exists()) {
input = new FileInputStream(file);
boolean illegalURL = false;
InputStream input = null;
} else {
isFromUrl = true;
input = new URL(jsonPath).openStream();
if (file.exists()) {
if (file.isDirectory()) {
return "";
}
try {
input = new FileInputStream(file);
} catch (FileNotFoundException e) {
ExceptionHandler.process(e);
}
} else {
isFromUrl = true;
try {
input = new URL(jsonPath).openStream();
} catch (MalformedURLException e) {
illegalURL = true;
} catch (IOException e) {
illegalURL = true;
}
if (illegalURL) {
return "";
}
}
try {
String jsonStr = IOUtils.toString(input);
convertJSON.setJsonString(jsonStr);
@@ -172,10 +192,6 @@ public class JSONUtil {
if (isFromUrl) {
tempJSONXsdPath = temPath;
}
} catch (FileNotFoundException e1) {
ExceptionHandler.process(e1);
} catch (IOException e1) {
ExceptionHandler.process(e1);
} catch (java.lang.Exception e) {
ExceptionHandler.process(e);
} finally {

View File

@@ -490,7 +490,7 @@
<importItemsProvider
id="org.talend.repository.view.di.importProvider.context"
name="Context importer"
priority="NORMAL">
priority="HIGH">
<importItemsHandler
class="org.talend.repository.view.di.viewer.handlers.ContextImportHandler">
<parameter

View File

@@ -2311,6 +2311,15 @@
name="Set tStoreResult associated tPigLoad"
description="The tPigStoreResult is now linked to a tPigLoad, we need to set the option for old jobs"
version="5.6.1">
</projecttask>
<projecttask
beforeLogon="false"
breaks="5.6.1"
class="org.talend.repository.model.migration.UpdateJobletContextInJobMigrationTask"
description="Update Joblet context in jobs"
id="org.talend.repository.model.migration.UpdateJobletContextInJobMigrationTask"
name="UpdateJobletContextInJobMigrationTask"
version="5.6.1">
</projecttask>
</extension>

View File

@@ -147,18 +147,20 @@ public class ExportItemUtil {
* @param progressMonitor, to show the progress during export
* @throws Exception in case of problem
*/
public void exportItems(File destination, Collection<Item> items, boolean exportAllVersions, IProgressMonitor progressMonitor)
throws Exception {
public void exportItems(File destination, final Collection<Item> items, List<String> folders, boolean exportAllVersions,
IProgressMonitor progressMonitor) throws Exception {
// bug 11301 :export 0 items
if (items == null) {
items = new ArrayList<Item>();
Collection<Item> workItems = items;
if (workItems == null) {
workItems = new ArrayList<Item>();
}
Collection<Item> otherVersions = new ArrayList<Item>();
// get all versions of the exported items if wanted
if (exportAllVersions) {
otherVersions = getOtherVersions(items);
items.addAll(otherVersions);
otherVersions = getOtherVersions(workItems);
workItems.addAll(otherVersions);
otherVersions.clear();
}// else keep current items version only
try {
@@ -188,7 +190,7 @@ public class ExportItemUtil {
try {
if (exporter != null) {
toExport = exportItems2(items, tmpDirectory, true, progressMonitor);
toExport = exportItems2(workItems, tmpDirectory, true, progressMonitor);
// in case of .tar.gz we remove extension twice
// IPath rootPath = new Path(destination.getName()).removeFileExtension().removeFileExtension();
@@ -197,8 +199,43 @@ public class ExportItemUtil {
// exporter.write(file.getAbsolutePath(), rootPath.append(path).toString());
exporter.write(file.getAbsolutePath(), path.toString());
}
if (folders != null) {
// filter folders that already created
List<String> toRemove = new ArrayList<String>();
for (String folderPath : folders) {
for (IPath resourcePath : toExport.values()) {
if (resourcePath.toPortableString().contains(folderPath)) {
toRemove.add(folderPath);
break;
}
}
}
folders.removeAll(toRemove);
for (String folderPath : folders) {
exporter.writeFolder(folderPath);
}
}
} else {
toExport = exportItems2(items, destination, true, progressMonitor);
toExport = exportItems2(workItems, destination, true, progressMonitor);
if (folders != null) {
// filter folders that already created
List<String> toRemove = new ArrayList<String>();
for (String folderPath : folders) {
for (IPath resourcePath : toExport.values()) {
if (resourcePath.toPortableString().contains(folderPath)) {
toRemove.add(folderPath);
break;
}
}
}
folders.removeAll(toRemove);
for (String folderPath : folders) {
IPath fullPath = new Path(destination.getAbsolutePath());
fullPath = fullPath.append(folderPath);
FilesUtils.createFoldersIfNotExists(fullPath.toPortableString(), false);
}
}
}
} catch (Exception e) {
throw e;
@@ -217,6 +254,21 @@ public class ExportItemUtil {
}
}
}
/**
* export the sected TOS model elements to the destination
*
* @param destination zip file or folder to store the exported elements
* @param items, the items to be exported
* @param exportAllVersions whether all the versions are export or only the selected once
* @param progressMonitor, to show the progress during export
* @throws Exception in case of problem
*/
public void exportItems(File destination, final Collection<Item> items, boolean exportAllVersions,
IProgressMonitor progressMonitor) throws Exception {
exportItems(destination, items, null, exportAllVersions, progressMonitor);
}
/**

View File

@@ -30,6 +30,7 @@ import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
@@ -102,13 +103,13 @@ public class EncryptDbPasswordMigrationTask extends AbstractItemMigrationTask {
}
private void encryptPassword(DatabaseConnection dbConn) throws Exception {
String password = PasswordEncryptUtil.encryptPassword(dbConn.getPassword());
String password = PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(dbConn.getPassword()));
dbConn.setPassword(password);
}
private void encryptPassword(ContextParameterType param) throws Exception {
// before migration task, the value should be raw. so keep it.
String password = PasswordEncryptUtil.encryptPassword(param.getValue());
String password = PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(param.getValue()));
param.setValue(password);
}

View File

@@ -26,6 +26,7 @@ import org.talend.core.model.properties.DatabaseConnectionItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
/**
* DOC zli class global comment. Detailled comment For
@@ -67,7 +68,7 @@ public class EncryptDbPasswordforItemFileMigrationTask extends AbstractItemMigra
}
public void encryptPassword(DatabaseConnection dbConn) throws Exception {
String password = PasswordEncryptUtil.encryptPassword(dbConn.getPassword());
String password = PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(dbConn.getPassword()));
dbConn.setPassword(password);
}

View File

@@ -26,6 +26,7 @@ import org.talend.core.model.properties.FTPConnectionItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
/**
* created by hcyi on Jul 8, 2014 Detailled comment
@@ -63,25 +64,26 @@ public class EncryptPassword4FTPItemFileMigrationTask extends AbstractItemMigrat
public boolean encryptPassword(FTPConnection ftpConn) throws Exception {
boolean modified = false;
if (ftpConn.getPassword() != null) {
String password = PasswordEncryptUtil.encryptPassword(ftpConn.getPassword());
String password = PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(ftpConn.getPassword()));
ftpConn.setPassword(password + PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}
if (ftpConn.getPassphrase() != null) {
String password = PasswordEncryptUtil.encryptPassword(ftpConn.getPassphrase());
String password = PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(ftpConn.getPassphrase()));
ftpConn.setPassphrase(password + PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}
if (ftpConn.getKeystorePassword() != null) {
String password = PasswordEncryptUtil.encryptPassword(ftpConn.getKeystorePassword());
String password = PasswordEncryptUtil
.encryptPassword(ConnectionHelper.getCleanPassword(ftpConn.getKeystorePassword()));
ftpConn.setKeystorePassword(password + PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}
if (ftpConn.getProxypassword() != null) {
String password = PasswordEncryptUtil.encryptPassword(ftpConn.getProxypassword());
String password = PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(ftpConn.getProxypassword()));
ftpConn.setProxypassword(password + PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}

View File

@@ -33,6 +33,7 @@ import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
@@ -125,7 +126,8 @@ public class EncryptPasswordInComponentsMigrationTask extends AbstractItemMigrat
}
if (!encrypted) {
param.setValue(PasswordEncryptUtil.encryptPassword(param.getValue())
param.setValue(
PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(param.getValue()))
+ PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}

View File

@@ -26,6 +26,7 @@ import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
@@ -127,7 +128,8 @@ public class EncryptPasswordInJobSettingsMigrationTask extends AbstractItemMigra
}
if (!encrypted) {
param.setValue(PasswordEncryptUtil.encryptPassword(param.getValue()) + PasswordEncryptUtil.ENCRYPT_KEY);
param.setValue(PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(param.getValue()))
+ PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}
return modified;

View File

@@ -24,6 +24,7 @@ import org.talend.core.model.general.Project;
import org.talend.core.model.properties.ImplicitContextSettings;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.StatAndLogsSettings;
import org.talend.cwm.helper.ConnectionHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ParametersType;
import org.talend.designer.core.model.utils.emf.talendfile.impl.ElementParameterTypeImpl;
@@ -144,7 +145,8 @@ public class EncryptPasswordInProjectSettingsMigrationTask extends AbstractMigra
}
if (!encrypted) {
param.setValue(PasswordEncryptUtil.encryptPassword(param.getValue()) + PasswordEncryptUtil.ENCRYPT_KEY);
param.setValue(PasswordEncryptUtil.encryptPassword(ConnectionHelper.getCleanPassword(param.getValue()))
+ PasswordEncryptUtil.ENCRYPT_KEY);
modified = true;
}
return modified;

View File

@@ -53,16 +53,18 @@ public class UnifyPasswordEncryption4ContextMigrationTask extends UnifyPasswordE
List<ContextParameterType> paramTypes = type.getContextParameter();
if (paramTypes != null) {
for (ContextParameterType param : paramTypes) {
try {
String value = param.getValue();
if (value != null && PasswordEncryptUtil.isPasswordType(param.getType())) {
String rawPassword = PasswordEncryptUtil.decryptPassword(value);
String value = param.getValue();
if (value != null && PasswordEncryptUtil.isPasswordType(param.getType())) {
value = cleanPassword(value);
String rawPassword;
try {
rawPassword = PasswordEncryptUtil.decryptPassword(value);
param.setRawValue(rawPassword);
modify = true;
} catch (Exception e) {
param.setRawValue(value);
modify = true;
}
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
}

View File

@@ -22,7 +22,6 @@ import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
import org.talend.core.model.properties.DatabaseConnectionItem;
import org.talend.core.model.properties.Item;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.cwm.helper.ConnectionHelper;
/**
* created by ggu on Aug 21, 2014 Detailled comment
@@ -52,12 +51,11 @@ public class UnifyPasswordEncryption4DBConnectionMigrationTask extends UnifyPass
if (!dbConn.isContextMode()) {
String pass = dbConn.getPassword();
String rawPass = null;
pass = cleanPassword(pass);
try {
rawPass = PasswordEncryptUtil.decryptPassword(pass);
} catch (Exception e) {
// MOD xqliu 2010-07-07 bug 13826
rawPass = ConnectionHelper.getDecryptPassword(pass);
// ~ 13826
rawPass = pass;
}
// decrypt the old password.
dbConn.setRawPassword(rawPass);

View File

@@ -17,6 +17,7 @@ import java.util.GregorianCalendar;
import org.talend.core.model.migration.AbstractItemMigrationTask;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
/**
* created by ggu on Aug 21, 2014 Detailled comment
@@ -37,4 +38,8 @@ public abstract class UnifyPasswordEncryption4ItemMigrationTask extends Abstract
return gc.getTime();
}
protected String cleanPassword(String password) {
return ConnectionHelper.getCleanPassword(password);
}
}

View File

@@ -108,7 +108,9 @@ public class UnifyPasswordEncryption4ParametersInJobMigrationTask extends UnifyP
if (paramTypes != null) {
for (ContextParameterType param : paramTypes) {
String value = param.getValue();
if (value != null && PasswordEncryptUtil.isPasswordType(param.getType())) {
if (value != null && (PasswordEncryptUtil.isPasswordType(param.getType())
|| PasswordEncryptUtil.isPasswordField(param.getName()))) {
value = cleanPassword(value);
try {
String rawPassword = PasswordEncryptUtil.decryptPassword(value);
param.setRawValue(rawPassword);
@@ -182,6 +184,7 @@ public class UnifyPasswordEncryption4ParametersInJobMigrationTask extends UnifyP
@SuppressWarnings("deprecation")
private boolean reencryptValueIfNeeded(ElementParameterType param) throws Exception {
String value = param.getValue();
value = cleanPassword(value);
int index = value.lastIndexOf(PasswordEncryptUtil.ENCRYPT_KEY);
if (index != -1) {
value = new StringBuilder(value).replace(index, index + PasswordEncryptUtil.ENCRYPT_KEY.length(), "").toString(); //$NON-NLS-1$

View File

@@ -25,6 +25,7 @@ import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.properties.ImplicitContextSettings;
import org.talend.core.model.properties.StatAndLogsSettings;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.cwm.helper.ConnectionHelper;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ParametersType;
import org.talend.designer.core.model.utils.emf.talendfile.impl.ElementParameterTypeImpl;
@@ -109,6 +110,7 @@ public class UnifyPasswordEncryption4ProjectSettingsMigrationTask extends Abstra
private boolean reencryptValueIfNeeded(ElementParameterType param) throws Exception {
String value = param.getValue();
value = ConnectionHelper.getCleanPassword(value);
int index = value.lastIndexOf(PasswordEncryptUtil.ENCRYPT_KEY);
if (index != -1) {
value = new StringBuilder(value).replace(index, index + PasswordEncryptUtil.ENCRYPT_KEY.length(), "").toString(); //$NON-NLS-1$

View File

@@ -0,0 +1,82 @@
package org.talend.repository.model.migration;
import java.util.ArrayList;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.migration.AbstractItemMigrationTask;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.designer.core.model.utils.emf.talendfile.ContextParameterType;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
public class UpdateJobletContextInJobMigrationTask extends AbstractItemMigrationTask {
@Override
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2016, 5, 17, 16, 0, 0);
return gc.getTime();
}
@Override
public ExecutionResult execute(Item item) {
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
List<ContextType> contexts = processItem.getProcess().getContext();
if (contexts.size() > 1) {
boolean isModified = false;
for (ContextType context1 : contexts) {
List<ContextParameterType> params1 = context1.getContextParameter();
for (ContextParameterType param1 : params1) {
String id = param1.getRepositoryContextId();
if (id != null) {
for (ContextType context2 : contexts) {
if (context2 != context1) {
List<ContextParameterType> params2 = context2.getContextParameter();
for (ContextParameterType param2 : params2) {
if (param2.getName().equals(param1.getName())
&& param2.getRepositoryContextId() == null) {
param2.setRepositoryContextId(id);
isModified = true;
break;
}
}
}
}
}
}
}
if (isModified) {
try {
ProxyRepositoryFactory.getInstance().save(item, true);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
}
}
return ExecutionResult.NOTHING_TO_DO;
}
@Override
public List<ERepositoryObjectType> getTypes() {
List<ERepositoryObjectType> allTypes = new ArrayList<ERepositoryObjectType>();
if (ERepositoryObjectType.PROCESS != null) {
allTypes.add(ERepositoryObjectType.PROCESS);
}
if (ERepositoryObjectType.PROCESS_MR != null) {
allTypes.add(ERepositoryObjectType.PROCESS_MR);
}
if (ERepositoryObjectType.PROCESS_STORM != null) {
allTypes.add(ERepositoryObjectType.PROCESS_STORM);
}
return allTypes;
}
}

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -76,6 +77,7 @@ import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.Project;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.Folder;
import org.talend.core.model.repository.IExtendedRepositoryNodeHandler;
import org.talend.core.model.repository.IRepositoryReviewFilter;
import org.talend.core.model.repository.IRepositoryViewObject;
@@ -91,6 +93,7 @@ import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.ProjectRepositoryNode;
import org.talend.repository.model.RepositoryNode;
import org.talend.repository.model.RepositoryNodeUtilities;
import org.talend.repository.model.nodes.IProjectRepositoryNode;
import org.talend.repository.viewer.ui.provider.INavigatorContentServiceProvider;
import org.talend.repository.viewer.ui.provider.RepoCommonViewerProvider;
@@ -1025,6 +1028,28 @@ public class ExportItemWizardPage extends WizardPage {
selectedItems.add(object.getProperty().getItem());
}
}
List<String> folders = new ArrayList<String>();
for (Object obj : filteredCheckboxTree.getViewer().getCheckedElements()) {
if (obj instanceof RepositoryNode) {
RepositoryNode repositoryNode = (RepositoryNode) obj;
if (repositoryNode.getType() == ENodeType.SIMPLE_FOLDER && repositoryNode.getObject() instanceof Folder) {
Folder folder = (Folder) repositoryNode.getObject();
ERepositoryObjectType contentType = repositoryNode.getContentType();
IProjectRepositoryNode root = repositoryNode.getRoot();
if (root != null && root.getProject() != null) {
IPath path = new Path(root.getProject().getTechnicalLabel());
path = path.append(contentType.getFolder());
String folderPath = folder.getPath();
if (folderPath != null && !"".equals(folderPath)) {
path = path.append(folderPath);
}
path = path.append(folder.getLabel());
folders.add(path.toPortableString() + "/");
}
}
}
}
try {
ExportItemUtil exportItemUtil = new ExportItemUtil();
if (itemFromArchiveRadio.getSelection()) {
@@ -1037,7 +1062,7 @@ public class ExportItemWizardPage extends WizardPage {
}
// MOD sgandon 31/03/2010 bug 12229: moved getAllVersion into ExportItemUtil.exportitems() method.
exportItemUtil.exportItems(new File(lastPath), selectedItems, true, new NullProgressMonitor());
exportItemUtil.exportItems(new File(lastPath), selectedItems, folders, true, new NullProgressMonitor());
} catch (Exception e) {
MessageBoxExceptionHandler.process(e);

View File

@@ -332,13 +332,8 @@ public class RepositoryReviewDialog extends Dialog {
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
protected Control createDialogArea(Composite parent, String specifiedPId) {
Composite container = (Composite) super.createDialogArea(parent);
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "before createDialogArea..."); //$NON-NLS-1$
GridData data = (GridData) container.getLayoutData();
@@ -354,7 +349,7 @@ public class RepositoryReviewDialog extends Dialog {
viewContainer.setLayout(new GridLayout());
viewContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
repositoryTreeViewer = RepoCommonViewerProvider.NORMAL.createViewer(viewContainer);
repositoryTreeViewer = RepoCommonViewerProvider.NORMAL.createViewer(viewContainer, specifiedPId);
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "finshed createViewer"); //$NON-NLS-1$
@@ -420,6 +415,16 @@ public class RepositoryReviewDialog extends Dialog {
return container;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
return createDialogArea(parent, null);
}
public void addFilter(ViewerFilter filter) {
if (filter != null) {
getRepositoryTreeViewer().addFilter(filter);

View File

@@ -60,6 +60,7 @@ import org.talend.commons.exception.BusinessException;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.utils.system.EclipseCommandLine;
import org.talend.commons.utils.system.EnvironmentUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
@@ -67,6 +68,7 @@ import org.talend.core.model.general.ConnectionBean;
import org.talend.core.model.general.Project;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.core.ui.workspace.ChooseWorkspaceData;
import org.talend.repository.i18n.Messages;
import org.talend.repository.ui.ERepositoryImages;
import org.talend.repository.ui.actions.importproject.ImportDemoProjectAction;
@@ -690,7 +692,15 @@ public class TOSLoginComposite extends Composite {
@Override
public void widgetSelected(SelectionEvent e) {
LoginComposite.isRestart = true;
perReader.saveLastConnectionBean(loginComposite.getConnection());
ConnectionBean connection = loginComposite.getConnection();
perReader.saveLastConnectionBean(connection);
// update the restart command line to specify the workspace to launch
// if relaunch, should delete the "disableLoginDialog" argument in eclipse data for bug TDI-19214
EclipseCommandLine.updateOrCreateExitDataPropertyWithCommand("-data", connection.getWorkSpace(), false); //$NON-NLS-1$
// store the workspace in the eclipse history so that it is rememebered on next studio launch
ChooseWorkspaceData workspaceData = new ChooseWorkspaceData(""); //$NON-NLS-1$
workspaceData.workspaceSelected(connection.getWorkSpace());
workspaceData.writePersistedData();
dialog.okPressed();
}
});

View File

@@ -201,6 +201,7 @@ public class JavaJobExportReArchieveCreator {
if (libFolder != null) {
File[] files = libFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX)
|| name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
@@ -221,6 +222,7 @@ public class JavaJobExportReArchieveCreator {
if (drlFolder != null) {
File[] files = drlFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".drl") //$NON-NLS-1$
? true
@@ -240,6 +242,7 @@ public class JavaJobExportReArchieveCreator {
if (xlsFolder != null) {
File[] files = xlsFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".xls") //$NON-NLS-1$
? true
@@ -257,6 +260,7 @@ public class JavaJobExportReArchieveCreator {
private String[] getJobFolderJarFilenames() {
File[] files = jobFolder.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX)
|| name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
@@ -316,7 +320,17 @@ public class JavaJobExportReArchieveCreator {
if (needjars != null) {
for (String needjar : needjars) {
if (".".equals(needjar)) {
break;
continue;
}
boolean found = false;
for (String jobJar : fs) {
if (jobJar != null && jobJar.equals(needjar)) {
found = true;
break;
}
}
if (found) {
continue;
}
sb.append(needjar + " ");
}

View File

@@ -13,12 +13,15 @@
package org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb;
import java.io.IOException;
import java.net.URL;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.talend.core.model.properties.ProcessItem;
import org.talend.designer.runprocess.IProcessor;
import org.talend.designer.runprocess.ProcessorException;
import org.talend.repository.documentation.ExportFileResource;
import aQute.bnd.osgi.Analyzer;
@@ -33,12 +36,18 @@ import aQute.bnd.osgi.Analyzer;
*/
public class RouteUsedJobManager extends JobJavaScriptOSGIForESBManager {
private String routeName;
private static final String DLL = ".dll";
private static final String OSGI_OS = System.getProperty("osgi.os");
private static final String OSGI_ARCH = System.getProperty("osgi.arch");
private String routeName;
private String bundleName;
private String routeVersion;
private String groupId;
private String artifactId;
private String artifactVersion;
private List<URL> dllLibraries = new java.util.ArrayList<URL>();
public RouteUsedJobManager(Map<ExportChoice, Object> exportChoiceMap) {
super(exportChoiceMap, null, null, IProcessor.NO_STATISTICS, IProcessor.NO_TRACES);
@@ -83,11 +92,34 @@ public class RouteUsedJobManager extends JobJavaScriptOSGIForESBManager {
extraParams.put("artifactId", artifactId);
extraParams.put("artifactVersion", artifactVersion);
appendExportServiceParams(analyzer, extraParams);
// TESB-15680: Add bundle manifest using the Bundle-NativeCode header
appendBundleNativeCodeForDll(analyzer, libResource);
return analyzer;
}
private void appendExportServiceParams(Analyzer analyzer, Map<String, String> extraParams) {
/**
* Add Bundle-NativeCode in Manifest
*/
private void appendBundleNativeCodeForDll(Analyzer analyzer, ExportFileResource libResource) {
StringBuilder sb = new StringBuilder();
for (URL url : libResource.getResourcesByRelativePath("")) {
String path = url.toString();
if (path.endsWith(DLL)) {
dllLibraries.add(url);
sb.append(path.substring(path.lastIndexOf('/') + 1, path.length())).append(';').append("osname=").append(OSGI_OS)
.append(';').append("processor=").append(OSGI_ARCH).append(',');
}
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
analyzer.setProperty(Analyzer.BUNDLE_NATIVECODE, sb.toString());
}
}
private void appendExportServiceParams(Analyzer analyzer, Map<String, String> extraParams) {
if (!extraParams.isEmpty()) {
StringBuilder sb = new StringBuilder(analyzer.getProperty(Analyzer.EXPORT_SERVICE));
for (Entry<String, String> e : extraParams.entrySet()) {
@@ -100,4 +132,22 @@ public class RouteUsedJobManager extends JobJavaScriptOSGIForESBManager {
}
}
/*
* Add DLLs in root path
*
* @see
* org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb.JobJavaScriptOSGIForESBManager#getExportResources
* (org.talend.repository.documentation.ExportFileResource[], java.lang.String[])
*/
@Override
public List<ExportFileResource> getExportResources(ExportFileResource[] processes, String... codeOptions)
throws ProcessorException {
List<ExportFileResource> list = super.getExportResources(processes, codeOptions);
if (dllLibraries.size() > 0) {
ExportFileResource dllResource = new ExportFileResource(null, ""); //$NON-NLS-1$;
dllResource.addResources(dllLibraries);
list.add(dllResource);
}
return list;
}
}