Compare commits

...

52 Commits

Author SHA1 Message Date
kjwang-talend
30b49bf9cc fix(TUP-17996):When Deploying one customer's job in CI, the build failed with error: constant string too long (#1403)
fix(TUP-17996):When Deploying one customer's job in CI, the build failed with error: constant string too long
https://jira.talendforge.org/browse/TUP-17996
2019-03-04 10:40:30 +08:00
apoltavtsev
a9fac457b2 TUP-17093:[Talend Studio] Compilation error not shown on a box 2018-10-09 10:43:25 +03:00
hcyi
be4b6f8883 TPS-2684:[6.3.1] Guess schema is not working in case of tMSSQLinput
component
2018-09-10 16:04:12 +08:00
zwxue
e612ab83de fix(TUP-20223):Wrong branch value in the jobs generated by CI. 2018-09-10 10:39:03 +08:00
Laurent BOURGEOIS
c54b63aa4f fix(TBD-7495): Add checkbox to transform date type in timestamp (#2593) (#2635) (#2664) 2018-09-05 16:53:00 +02:00
Chao MENG
71aac01583 fix(TUP-20391): Migration tasks are re-executed and encrypting passwords
https://jira.talendforge.org/browse/TUP-20391
2018-07-18 18:12:41 +08:00
Chao MENG
6def743f0b 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
2018-07-17 11:08:13 +08:00
hcyi
1d6c17de39 fix(TUP-19277):Errors when creating tSASoutput component from SAS (#1877)
metadata connection.
2018-05-02 10:22:15 +08:00
nrousseau
3ed6a8f9c3 fix(TUP-19758) generate code even if the jars are missing (#2065) 2018-04-23 14:23:31 +08:00
hwang
75e6c14f1b Revert "fix(TPS-2281):[6.3.1] Build Job very slow compared to version 5 even with TPS-1656 (TUP-17149)"
This reverts commit 87ad1be8cc.
2018-01-16 15:31:29 +08:00
hwang
b0d93eb010 Revert "TUP-17149:Build Job very slow compared to version 5 even with TPS-1656 (#1212)"
This reverts commit 4fd4cc00fc.
2018-01-16 15:31:24 +08:00
hwang
54551850d7 Revert "TUP-17149:Build Job very slow compared to version 5 even with TPS-1656"
This reverts commit 368fb9766e.
2018-01-16 15:31:18 +08:00
hwang
87ad1be8cc fix(TPS-2281):[6.3.1] Build Job very slow compared to version 5 even
with TPS-1656 (TUP-17149)
2018-01-15 15:46:15 +08:00
wchen-talend
4fd4cc00fc TUP-17149:Build Job very slow compared to version 5 even with TPS-1656
(#1212)
2018-01-15 14:10:31 +08:00
wchen-talend
368fb9766e TUP-17149:Build Job very slow compared to version 5 even with TPS-1656 2018-01-15 14:07:45 +08:00
hcyi
b25a9dec5c fix(TUP-18492): Stats Logs still use JTDS driver even select
Microsoft.Microsoft.
2017-12-05 11:05:24 +08:00
hcyi
6b65e0c041 fix (TUP-18492): Stats&Logs still use JTDS driver even select Microsoft 2017-12-05 11:00:45 +08:00
zwxue
f41c0331bf fix(TUP-18278):Could not find or load main class exception after (#1547) 2017-11-06 14:32:30 +08:00
wchen-talend
88b16605f4 fix(TUP-18738):UHG - Configuring SVN Polling from TAC (#1681) 2017-11-06 12:10:57 +08:00
GGu
76a5c7e3f3 bug(TUP-18570/Maven): update the project pom with reference projects 2017-10-30 10:45:07 +08:00
wchen-talend
8205741178 TPS-2146:[6.3.1] tLibraryLoad doesn't display the jars available in
local maven (TUP-18489)
2017-10-09 12:17:06 +08:00
seloen
4ee4d14d60 bugfix(TUP-17050):tmap looses setting for Die on error
*add a if judge in initCurrentModel() method

https://jira.talendforge.org/browse/TUP-17050
2017-09-11 14:56:48 +08:00
hcyi
5680735ab9 TPS-2104:Opening a BD job from the search feature in Studio transforms
it into a DI job
2017-09-11 14:52:38 +08:00
GGu
d84cef3f76 fix(TUP-18405/module): enable to update the list of modules parameter 2017-08-21 11:17:05 +08:00
apoltavtsev
83d892d71b TPS-2091 Fix for TESB-20067 is merged from master 2017-08-14 10:54:04 +03:00
zwxue
8533bd5f6d TUP-16573: cmdline generate time increase as the tasks number increase. 2017-07-24 14:37:52 +08:00
kjwang-talend
c36bdef220 fix(TUP-17642):6.3.1 studio takes about 25 mins to update project (#1273)
* fix(TUP-17642):6.3.1 studio takes about 25 mins to update project
settings for about 200 jobs in the GIT project.
https://jira.talendforge.org/browse/TUP-17642

* fix(TUP-17642):6.3.1 studio takes about 25 mins to update project
settings for about 200 jobs in the GIT project.
https://jira.talendforge.org/browse/TUP-17642

* fix(TUP-17642):6.3.1 studio takes about 25 mins to update project
settings for about 200 jobs in the GIT project.
https://jira.talendforge.org/browse/TUP-17642
2017-07-24 14:17:54 +08:00
wchen-talend
a31207d0a6 TUP-17072:Misleading Task Generation Status when jars are missing 2017-07-11 11:33:43 +08:00
nrousseau
d500eda261 TUP-17072:Misleading Task Generation Status when jars are missing
(#1071)
2017-07-11 11:33:11 +08:00
zwxue
c5dacdf731 fix(TUP-18158):tELTOracleMap / ELT Oracle Map Editor / left panel empty
after migration from 6.1.1 to 6.3.1.
2017-07-10 14:15:53 +08:00
hcyi
61294e6df8 TUP-18046:Cannot Retrieve Columns from Metadata MapRDB Database (#1448)
* TUP-18046:Cannot Retrieve Columns from Metadata MapRDB Database
Connection.

* TUP-18046:update,Cannot Retrieve Columns from Metadata MapRDB Database
Connection
2017-07-03 17:27:13 +08:00
hcyi
5264deeb27 TUP-18046:Cannot Retrieve Columns from Metadata MapRDB Database (#1445)
Connection.
2017-07-03 17:26:17 +08:00
Pingwen Lin
c50e6c531e TPS-2013 [6.3.1]Support of AWS ELB for MDM Cluster(TMDM-11072) (#1466) 2017-06-30 01:34:25 -05:00
hcyi
50bf46b627 TUP-17849:tWebservice wsdl wizard don't works. (#1301) 2017-05-26 17:18:13 +08:00
hwang-talend
b4c319fc1a fix(TUP-17538):"The connected components in a job must not form a closed (#1189)
loop"
2017-05-11 14:14:23 +08:00
hwang
694b61884b TUP-16161: code improve 2017-05-11 14:10:57 +08:00
hwang-talend
b970acaff8 TUP-16161:Different behavior on triggers between 611 and 621 (#887) 2017-05-11 14:10:35 +08:00
wchen-talend
c9db9f05b3 TUP-17245:Link names are renamed in jobs as Main1 when migrating from
5.4.1 to 6.2.1
2017-04-24 16:01:51 +08:00
Yucheng Bai
7352e86d4e TUP-17246: OSX hits GC Overhead Error modifying salesforce metadata in (#1057)
jobs
2017-04-24 15:54:13 +08:00
hwang-talend
42fe37ba62 TUP-17194:Error with a job using nested joblets with MDM components (#1041) 2017-04-24 15:13:28 +08:00
ycbai
edb7d1939f TUP-17424: Cann't retrieve schem for HDFS only on 623 2017-04-11 10:08:37 +08:00
GGu
8cfb8a6160 TUP-17017: enable to use reference template for reference jobs. (#1081) 2017-04-10 12:07:17 +08:00
hwang
1ce2c6f609 TUP-17214:Problem by using joblets from the reference project 2017-03-20 15:20:23 +08:00
hwang
5b4cfd7590 TUP-17214:Problem by using joblets from the reference project 2017-03-20 15:20:08 +08:00
hwang
d61f305cc9 TUP-17201:Upgrade issue with Jobs referencing joblets from a reference 2017-03-20 14:17:29 +08:00
hwang
34fc84da95 TUP-17201:Upgrade issue with Jobs referencing joblets from a reference
project.
2017-03-20 14:15:46 +08:00
wchen-talend
141bbee806 TUP-17120:Changing the order of output rows from tSAPBapi component
breaks the code generation
2017-03-07 11:07:47 +08:00
iwangtalend
cde4fcb03f Merge pull request #1034 from Talend/feature/DEVOPS-1729/patch/6.3.1_nexus
DEVOPS-1729 Nexus migration: Update URLs [patch/6.3.1]
2017-03-02 16:42:06 +01:00
build-talend
9963060e8f DEVOPS-1729 Nexus migration: Update URLs 2017-03-02 16:32:57 +01:00
jzhao
cc2f257a02 feat(TDI-35748):salesforce connection save and reuse session (#916)
* migration from old framework
* add directory mapping with widget type
2017-02-20 18:35:27 +08:00
Yucheng Bai
43ff058114 TUP-16774: File Widget of session directory in metadata for salesforce (#937) 2017-02-20 18:34:54 +08:00
Pingwen Lin
e00bdf3df1 TPS-1762 [6.3.1]Data Services with MDM Connection - behaviour change from 6.1.1(TMDM-10433)
TMDM-10433 : Data Services with MDM Connection - behaviour change from 6.1.1 (#915)
2017-01-25 11:13:50 +08:00
90 changed files with 2333 additions and 1074 deletions

View File

@@ -1124,13 +1124,16 @@ if (execStat) {
<% if(exist_tMDM) { %>
private void closeMDMConnections() {
try {
<% for (INode mdmComponent : mdmComponentsList) { %>
org.talend.mdm.webservice.TMDMService service_<%=mdmComponent.getUniqueName() %> = (org.talend.mdm.webservice.TMDMService)globalMap.get("TMDMService_<%=mdmComponent.getUniqueName() %>");
if(service_<%=mdmComponent.getUniqueName() %> != null)
{
service_<%=mdmComponent.getUniqueName() %>.logout(new org.talend.mdm.webservice.WSLogout());
}
<% } %>
java.util.Iterator keySets = globalMap.keySet().iterator();
while (keySets.hasNext()) {
String key = keySets.next().toString();
if (key.startsWith("TMDMService_tMDMConnection_")) {
org.talend.mdm.webservice.TMDMService service = (org.talend.mdm.webservice.TMDMService)globalMap.get(key);
if (service != null) {
service.logout(new org.talend.mdm.webservice.WSLogout());
}
}
}
} catch (java.lang.Exception e) {
}
}
@@ -1242,12 +1245,14 @@ if (execStat) {
connections.put("connBaseDN_<%=ldapNode.getUniqueName() %>", globalMap.get("connBaseDN_<%=ldapNode.getUniqueName() %>"));
<% } %>
<% for (INode mdmNode : mdmComponentsList) {%>
connections.put("TMDMService_<%=mdmNode.getUniqueName() %>", globalMap.get("TMDMService_<%=mdmNode.getUniqueName() %>"));
<% if( "false".equals(ElementParameterParser.getValue(mdmNode, "__AUTO_COMMIT__"))) {%>
connections.put("mdmTransaction_<%=mdmNode.getUniqueName() %>", globalMap.get("mdmTransaction_<%=mdmNode.getUniqueName() %>"));
<% }
} %>
<% for (INode mdmNode : mdmComponentsList) {%>
connections.put("mdmUrl_<%=mdmNode.getUniqueName() %>", globalMap.get("mdmUrl_<%=mdmNode.getUniqueName() %>"));
connections.put("username_<%=mdmNode.getUniqueName() %>", globalMap.get("username_<%=mdmNode.getUniqueName() %>"));
connections.put("password_<%=mdmNode.getUniqueName() %>", globalMap.get("password_<%=mdmNode.getUniqueName() %>"));
connections.put("useTransaction_<%=mdmNode.getUniqueName() %>", globalMap.get("useTransaction_<%=mdmNode.getUniqueName() %>"));
connections.put("useClientTranId_<%=mdmNode.getUniqueName() %>", globalMap.get("useClientTranId_<%=mdmNode.getUniqueName() %>"));
<% } %>
<% for (INode paloNode : paloComponentsList) { %>
connections.put("p_<%=paloNode.getUniqueName() %>", globalMap.get("p_<%=paloNode.getUniqueName() %>"));
connections.put("pConn_<%=paloNode.getUniqueName() %>", globalMap.get("pConn_<%=paloNode.getUniqueName() %>"));

View File

@@ -63,6 +63,7 @@ import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.ComponentManager;
import org.talend.core.model.components.ComponentProviderInfo;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IComponentsHandler;
@@ -82,6 +83,7 @@ import org.talend.designer.core.model.components.ComponentFilesNaming;
import org.talend.designer.core.model.components.EmfComponent;
import org.talend.designer.core.model.process.AbstractProcessProvider;
import org.talend.designer.core.model.process.GenericProcessProvider;
import org.talend.designer.core.ui.editor.jobletcontainer.JobletUtil;
/**
* Component factory that look for each component and load their information. <br/>
@@ -769,6 +771,32 @@ public class ComponentsFactory implements IComponentsFactory {
}
return null;
}
@Override
public IComponent getJobletComponent(String name, String paletteType) {
if (componentList == null) {
init(false);
}
for (IComponent comp : componentList) {
if(comp.getComponentType() != EComponentType.JOBLET){
continue;
}
String comName = comp.getName();
if(comp != null && paletteType.equals(comp.getPaletteType())){
if (comName.equals(name)) {
return comp;
}else if(new JobletUtil().matchExpression(comName)){
String[] names = comName.split(":"); //$NON-NLS-1$
comName = names[1];
if (comName.equals(name)) {
return comp;
}
}
}
}
return null;
}
@Override
public void initializeComponents(IProgressMonitor monitor) {

View File

@@ -1,6 +1,7 @@
package com.talend.mdm.transaction.client;
import java.io.IOException;
import java.util.List;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
@@ -10,98 +11,96 @@ import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.PostMethod;
@SuppressWarnings("nls")
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 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));
private String id;
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();
}
private String username;
int statuscode = method.getStatusCode();
if (statuscode >= 400) {
throw new MDMTransactionException("Commit failed. The commit operation has returned the code " + statuscode + ".");
}
}
private String password;
public void rollback() throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
private List<String> cookies;
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();
}
public void commit() throws IOException {
HttpClient client = new HttpClient();
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(username, password));
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;
HttpMethod method = new PostMethod(url + "/" + id);
method.setDoAuthentication(true);
try {
for (String cookie : cookies) {
method.addRequestHeader("Cookie", cookie);
}
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 + ".");
}
return stickySession;
}
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 {
for (String cookie : cookies) {
method.addRequestHeader("Cookie", cookie);
}
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 List<String> getCookies() {
return cookies;
}
public void setCookies(List<String> cookies) {
this.cookies = cookies;
}
}

View File

@@ -1,6 +1,8 @@
package com.talend.mdm.transaction.client;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
@@ -10,13 +12,10 @@ 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;
@SuppressWarnings("nls")
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));
@@ -25,11 +24,11 @@ public class MDMTransactionClient {
PutMethod put = new PutMethod(url);
put.setDoAuthentication(true);
String tid;
String sessionID;
List<String> cookies;
try {
client.executeMethod(put);
tid = put.getResponseBodyAsString();
sessionID = parseSessionID(put);
cookies = parseCookies(put);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
@@ -43,30 +42,30 @@ public class MDMTransactionClient {
result.setId(tid);
result.setUsername(username);
result.setPassword(password);
result.setSessionId(sessionID);
result.setCookies(cookies);
return result;
}
public static String getMDMTransactionURL(String url, boolean isNewServer) {
if(url == null || "".equals(url)) {
if (url == null || "".equals(url)) {
return "";
}
int count = 3;
int i=0;
for(;i<url.length();i++) {
int i = 0;
for (; i < url.length(); i++) {
char c = url.charAt(i);
if('/' == c) {
if ('/' == c) {
count--;
}
if(count == 0) {
if (count == 0) {
break;
}
}
String result = url.substring(0, i);
if(isNewServer){
if (isNewServer) {
result += "/talendmdm/services/rest/transactions";
} else {
result += "/datamanager/services/transactions";
@@ -75,17 +74,17 @@ public class MDMTransactionClient {
return result;
}
public static String getSessionID(String url, String username, String password) throws IOException {
public static List<String> getCookies(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;
List<String> cookies;
try {
client.executeMethod(get);
sessionID = parseSessionID(get);
cookies = parseCookies(get);
} catch (HttpException e) {
throw e;
} catch (IOException e) {
@@ -93,44 +92,16 @@ public class MDMTransactionClient {
} finally {
get.releaseConnection();
}
return sessionID;
return cookies;
}
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;
}
private static List<String> parseCookies(HttpMethod method) {
List<String> cookies = new ArrayList<String>();
Header[] setCookie = method.getResponseHeaders("Set-Cookie");
for (Header header : setCookie) {
cookies.add(header.getValue());
}
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 void main(String[] args) throws IOException {
String sessionID = MDMTransactionClient.getSessionID("http://localhost:8621/talendmdm/services/rest/transactions", "administrator", "administrator");
System.out.println(sessionID);
MDMTransaction mt = MDMTransactionClient.newTransaction("http://localhost:8180/talendmdm/services/rest/transactions", "administrator", "administrator");
mt.commit();
MDMTransaction mt1 = MDMTransactionClient.newTransaction("http://localhost:8180/talendmdm/services/rest/transactions", "administrator", "administrator");
mt1.rollback();
String url = "http://localhost:8180/talend/TalendPort";
String mdmurl = MDMTransactionClient.getMDMTransactionURL(url, true);
System.out.println(mdmurl);
return cookies;
}
}

View File

@@ -1,111 +1,111 @@
<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.libraries</groupId>
<artifactId>talend-soap</artifactId>
<version>2.0-20160927</version>
<packaging>jar</packaging>
<name>talend-soap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.1</cxf.version>
<talend.nexus.url>http://newbuild.talend.com:8081</talend.nexus.url>
</properties>
<distributionManagement>
<snapshotRepository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</snapshotRepository>
<repository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>rt.jar</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>${java.home}/lib/rt.jar</systemPath>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>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>${java.source.version}</source>
<target>${java.source.version}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<outputDirectory>../../../org.talend.designer.components.localprovider/components/tSOAP</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<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.libraries</groupId>
<artifactId>talend-soap</artifactId>
<version>2.0-20160927</version>
<packaging>jar</packaging>
<name>talend-soap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.1</cxf.version>
<talend.nexus.url>https://artifacts-zl.talend.com</talend.nexus.url>
</properties>
<distributionManagement>
<snapshotRepository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</snapshotRepository>
<repository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>rt.jar</artifactId>
<version>1.7</version>
<scope>system</scope>
<systemPath>${java.home}/lib/rt.jar</systemPath>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.messaging.saaj</groupId>
<artifactId>saaj-impl</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.6.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>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>${java.source.version}</source>
<target>${java.source.version}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<compilerArgument>-XDignore.symbol.file</compilerArgument>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<outputDirectory>../../../org.talend.designer.components.localprovider/components/tSOAP</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -14,7 +14,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<talend.nexus.url>http://newbuild.talend.com:8081</talend.nexus.url>
<talend.nexus.url>https://artifacts-zl.talend.com</talend.nexus.url>
</properties>
<distributionManagement>

View File

@@ -15,7 +15,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.1</cxf.version>
<talend.nexus.url>http://newbuild.talend.com:8081</talend.nexus.url>
<talend.nexus.url>https://artifacts-zl.talend.com</talend.nexus.url>
</properties>
<distributionManagement>

View File

@@ -1,84 +1,84 @@
<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.libraries</groupId>
<artifactId>talend-mscrm</artifactId>
<version>2.0-20161111</version>
<packaging>jar</packaging>
<name>talend-mscrm</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.1</cxf.version>
<talend.nexus.url>http://newbuild.talend.com:8081</talend.nexus.url>
</properties>
<distributionManagement>
<snapshotRepository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</snapshotRepository>
<repository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<outputDirectory>../../../org.talend.libraries.crm/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<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.libraries</groupId>
<artifactId>talend-mscrm</artifactId>
<version>2.0-20161111</version>
<packaging>jar</packaging>
<name>talend-mscrm</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.1</cxf.version>
<talend.nexus.url>https://artifacts-zl.talend.com</talend.nexus.url>
</properties>
<distributionManagement>
<snapshotRepository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</snapshotRepository>
<repository>
<id>talend_nexus_deployment</id>
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-xmlbeans</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.1</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<outputDirectory>../../../org.talend.libraries.crm/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -15,7 +15,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>3.1.1</cxf.version>
<talend.nexus.url>http://newbuild.talend.com:8081</talend.nexus.url>
<talend.nexus.url>https://artifacts-zl.talend.com</talend.nexus.url>
</properties>
<distributionManagement>

View File

@@ -36,33 +36,35 @@ String trans = "mdmTrans_" + connection;
org.talend.mdm.bulkload.client.BulkloadClient bulkloadClient_<%=cid %> = new org.talend.mdm.bulkload.client.BulkloadClient(<%=mdmUrl %>, <%=username %>, decryptedPassword_<%=cid %>, null, <%=dataCluster %> + "<%=isStaging?"#STAGING":""%>", <%=dataEntity %>, <%=dataModule %>);
<%if(useTransaction) {%>
String transKey_<%=cid %> = "<%=trans%>_" + Thread.currentThread().getThreadGroup().getName();
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
if(mdmTransaction_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
if(murl_<%=cid %>.endsWith("?wsdl")) {
murl_<%=cid %> = murl_<%=cid %>.substring(0, murl_<%=cid %>.length() - 5);
if(globalMap.get("useTransaction_<%=connection %>") != null && (Boolean)globalMap.get("useTransaction_<%=connection %>")) {
String transKey_<%=cid %> = "<%=trans%>_" + Thread.currentThread().getThreadGroup().getName();
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
if(mdmTransaction_<%=cid %> == null) {
String murl_<%=cid %> = (String)globalMap.get("mdmUrl_<%=connection %>");
if(murl_<%=cid %>.endsWith("?wsdl")) {
murl_<%=cid %> = murl_<%=cid %>.substring(0, murl_<%=cid %>.length() - 5);
}
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
String username_<%=cid %> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid %> = (String)globalMap.get("password_<%=connection %>");
if((Boolean)globalMap.get("useClientTranId_<%=connection %>")) {
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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 %>.setCookies(cookies_<%=cid%>);
} else {
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
}
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);
<% logUtil.debug("\"Got transaction successfully with key=\" + transKey_" + cid);%>
}
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
String username_<%=cid %> = (String)globalMap.get("username_<%=connection %>");
String password_<%=cid %> = (String)globalMap.get("password_<%=connection %>");
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 {
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
}
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);
<% logUtil.debug("\"Got transaction successfully with key=\" + transKey_" + cid);%>
bulkloadClient_<%=cid %>.setTransactionId(mdmTransaction_<%=cid %>.getId());
bulkloadClient_<%=cid %>.setCookies(mdmTransaction_<%=cid%>.getCookies());
}
bulkloadClient_<%=cid %>.setTransactionId(mdmTransaction_<%=cid %>.getId());
bulkloadClient_<%=cid %>.setSessionId(mdmTransaction_<%=cid%>.getSessionId());
<%}%>
bulkloadClient_<%=cid %>.startThreadCount();

View File

@@ -71,13 +71,13 @@ int nb_line_<%=cid %> = 0;
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -89,8 +89,7 @@ int nb_line_<%=cid %> = 0;
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -139,13 +139,13 @@ int nb_line_rejected_<%=cid %> = 0;
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -157,8 +157,7 @@ int nb_line_rejected_<%=cid %> = 0;
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -114,13 +114,13 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -132,8 +132,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -76,13 +76,13 @@ int nb_line_<%=cid %> = 0;
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -94,8 +94,7 @@ int nb_line_<%=cid %> = 0;
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -69,13 +69,13 @@ int nb_line_<%=cid %> = 0;
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -87,8 +87,7 @@ int nb_line_<%=cid %> = 0;
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -112,13 +112,13 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -130,8 +130,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -143,13 +143,13 @@ int nb_line_rejected_<%=cid %> = 0;
com.talend.mdm.transaction.client.MDMTransaction mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
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%>);
List<String> cookies_<%=cid%> = com.talend.mdm.transaction.client.MDMTransactionClient.getCookies(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%>);
mdmTransaction_<%=cid %>.setCookies(cookies_<%=cid%>);
}else{
<% logUtil.debug("\"Attempt to get a remote transaction from url: \" + murl_" + cid);%>
mdmTransaction_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.newTransaction(turl_<%=cid %>,username_<%=cid %>,password_<%=cid %>);
@@ -161,8 +161,7 @@ int nb_line_rejected_<%=cid %> = 0;
context_<%=cid %>.put(org.apache.cxf.headers.Header.HEADER_LIST, soapHeaders_<%=cid %>);
java.util.Map<String, java.util.List<String>> httpHeaders_<%=cid %> = new java.util.HashMap<String, java.util.List<String>>();
String cookie_<%=cid %> = com.talend.mdm.transaction.client.MDMTransaction.getStickySession() + "=" + mdmTransaction_<%=cid%>.getSessionId();
httpHeaders_<%=cid %>.put("Cookie", java.util.Arrays.asList(cookie_<%=cid %>));
httpHeaders_<%=cid %>.put("Cookie", mdmTransaction_<%=cid %>.getCookies());
context_<%=cid %>.put(org.apache.cxf.message.Message.PROTOCOL_HEADERS, httpHeaders_<%=cid %>);
globalMap.put(transKey_<%=cid %>, mdmTransaction_<%=cid %>);

View File

@@ -203,12 +203,12 @@ for(int i = 0; i &lt; result.length; i++){
<IMPORTS>
<IMPORT NAME="WebServiceInput" MODULE="WebServiceInput.jar" MVN="mvn:org.talend.libraries/WebServiceInput/6.0.0"
REQUIRED="true" />
<IMPORT NAME="SOAP-axis" MODULE="axis.jar" MVN="mvn:org.talend.libraries/axis/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/axis.jar" REQUIRED="true" />
<IMPORT NAME="SOAP-axis" MODULE="axis-p1.jar" MVN="mvn:org.talend.libraries/axis-p1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.axis2/lib/axis-p1.jar" REQUIRED="true" />
<IMPORT NAME="SOAP-jaxrpc" MODULE="jaxrpc.jar" MVN="mvn:org.talend.libraries/jaxrpc/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jax/lib/jaxrpc.jar"
REQUIRED="true" />
<IMPORT NAME="SOAP-saaj" MODULE="saaj.jar" MVN="mvn:org.talend.libraries/saaj/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.saaj/lib/saaj.jar" REQUIRED="true" />
<IMPORT NAME="WSDL4J-1_6_3" MODULE="wsdl4j-1.6.3.jar" MVN="mvn:org.talend.libraries/wsdl4j-1.6.3/6.0.0"
BundleID="org.apache.servicemix.bundles.wsdl4j" REQUIRED="true" />
REQUIRED="true" />
<IMPORT NAME="SOAP-discovery"
MODULE="commons-discovery-0.2.jar" MVN="mvn:org.talend.libraries/commons-discovery-0.2/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-discovery-0.2.jar" REQUIRED="true" />
<IMPORT NAME="SOAP-logging" MODULE="commons-logging-1.1.jar" MVN="mvn:org.talend.libraries/commons-logging-1.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.apache.common/lib/commons-logging-1.1.jar"

View File

@@ -133,6 +133,11 @@
name="widget.type.jsonTable"
widgetType="widget.type.jsonTable">
</Mapping>
<Mapping
mapFieldType="DIRECTORY"
name="widget.type.directory"
widgetType="widget.type.directory">
</Mapping>
</extension>
<extension
point="org.talend.designer.core.generators">

View File

@@ -378,7 +378,7 @@ public class GenericElementParameter extends ElementParameter {
return;
}
for (IElementParameter parameter : schemaParameters) {
if (currentContext.equals(parameter.getContext())) {
if (parameter != this && currentContext.equals(parameter.getContext())) {
parameter.setValue(newSchema);
}
}

View File

@@ -14,7 +14,9 @@ tSalesforceConnection.userPassword.securityKey=
tSalesforceConnection.bulkConnection=BULK_CONNECTION
tSalesforceConnection.needCompression=NEED_COMPRESSION
tSalesforceConnection.httpTraceMessage=HTTP_TRACEMESSAGE
tSalesforceConnection.httpChunked=USE_HTTP_CHUNKED
tSalesforceConnection.httpChunked=USE_HTTP_CHUNKED
tSalesforceConnection.reuseSession=USE_SAVE_SESSION
tSalesforceConnection.sessionDirectory=SESSION_DIRECTORY
tSalesforceConnection.clientId=CLIENT_ID
tSalesforceConnection.timeout=TIMEOUT
tSalesforceConnection.proxy.useProxy=USE_PROXY
@@ -51,6 +53,8 @@ tSalesforceInput.connection.bulkConnection=CONNECTION
tSalesforceInput.connection.needCompression=NEED_COMPRESSION
tSalesforceInput.connection.httpTraceMessage=HTTP_TRACEMESSAGE
tSalesforceInput.connection.httpChunked=USE_HTTP_CHUNKED
tSalesforceInput.connection.reuseSession=USE_SAVE_SESSION
tSalesforceInput.connection.sessionDirectory=SESSION_DIRECTORY
tSalesforceInput.connection.clientId=CLIENT_ID
tSalesforceInput.connection.timeout=TIMEOUT
tSalesforceInput.connection.proxy.useProxy=USE_PROXY
@@ -87,6 +91,8 @@ tSalesforceOutput.connection.bulkConnection=CONNECTION
tSalesforceOutput.connection.needCompression=NEED_COMPRESSION
tSalesforceOutput.connection.httpTraceMessage=HTTP_TRACEMESSAGE
tSalesforceOutput.connection.httpChunked=USE_HTTP_CHUNKED
tSalesforceOutput.connection.reuseSession=USE_SAVE_SESSION
tSalesforceOutput.connection.sessionDirectory=SESSION_DIRECTORY
tSalesforceOutput.connection.clientId=CLIENT_ID
tSalesforceOutput.connection.timeout=TIMEOUT
tSalesforceOutput.connection.proxy.useProxy=USE_PROXY
@@ -174,6 +180,8 @@ tSalesforceGetDeleted.connection.bulkConnection=CONNECTION
tSalesforceGetDeleted.connection.needCompression=NEED_COMPRESSION
tSalesforceGetDeleted.connection.httpTraceMessage=HTTP_TRACEMESSAGE
tSalesforceGetDeleted.connection.httpChunked=USE_HTTP_CHUNKED
tSalesforceGetDeleted.connection.reuseSession=USE_SAVE_SESSION
tSalesforceGetDeleted.connection.sessionDirectory=SESSION_DIRECTORY
tSalesforceGetDeleted.connection.clientId=CLIENT_ID
tSalesforceGetDeleted.connection.timeout=TIMEOUT
tSalesforceGetDeleted.connection.proxy.useProxy=USE_PROXY
@@ -205,6 +213,8 @@ tSalesforceGetUpdated.connection.bulkConnection=CONNECTION
tSalesforceGetUpdated.connection.needCompression=NEED_COMPRESSION
tSalesforceGetUpdated.connection.httpTraceMessage=HTTP_TRACEMESSAGE
tSalesforceGetUpdated.connection.httpChunked=USE_HTTP_CHUNKED
tSalesforceGetUpdated.connection.reuseSession=USE_SAVE_SESSION
tSalesforceGetUpdated.connection.sessionDirectory=SESSION_DIRECTORY
tSalesforceGetUpdated.connection.clientId=CLIENT_ID
tSalesforceGetUpdated.connection.timeout=TIMEOUT
tSalesforceGetUpdated.connection.proxy.useProxy=USE_PROXY
@@ -277,6 +287,8 @@ tSalesforceGetServerTimestamp.module.main.schema=SCHEMA
tSalesforceGetServerTimestamp.module.main.schema.connector=FLOW->MAIN
tSalesforceGetServerTimestamp.connection.needCompression=NEED_COMPRESSION
tSalesforceGetServerTimestamp.connection.httpChunked=USE_HTTP_CHUNKED
tSalesforceGetServerTimestamp.connection.reuseSession=USE_SAVE_SESSION
tSalesforceGetServerTimestamp.connection.sessionDirectory=SESSION_DIRECTORY
tSalesforceGetServerTimestamp.connection.clientId=CLIENT_ID
tSalesforceGetServerTimestamp.connection.timeout=TIMEOUT
tSalesforceGetServerTimestamp.connection.proxy.useProxy=USE_PROXY

View File

@@ -848,5 +848,12 @@
activate="true"
class="org.talend.designer.core.ui.viewer.proposal.TalendCompletionProposalComputer">
</javaCompletionProposalComputer>
</extension>
<extension
point="org.talend.core.repository.login.task">
<loginTask
class="org.talend.designer.core.ui.preferences.PreferencePreInitailizeTask"
priority="normal">
</loginTask>
</extension>
</plugin>

View File

@@ -730,6 +730,8 @@ PerformancePreferencePage.checkVersion=Check only the last version when updating
PerformancePreferencePage.addOrDeleteVariable=Propagate add/delete variable changes in repository contexts
PerformancePreferencePage.ActivedTimeoutSetting=Activate the timeout for database connection.
PerformancePreferencePage.ConnectionTimeout=Connection timeout (seconds)
PerformancePreferencePage.HBaseOrMaprDBScanLimit=HBase/MapR-DB scan limit (for retrieving schema)
PerformancePreferencePage.HBaseOrMaprDBScanLimitTip=If set it by zero, will be same as deactiving the limit.
PerformancePreferencePage.CodeFormatTimeout=Code Format timeout (seconds)
PerformancePreferencePage.ConnectionTimeoutTip=If set it by zero, will be same as deactiving the timeout.
PerformancePreferencePage.autoUpdateDoc=Automatic update of corresponding documentation of job/joblet
@@ -952,3 +954,16 @@ MainComposite.NameFormatError=Name contains incorrect characters.
MainComposite.SameAsProjectname=Name is same as project name.
ProcessController.UseDynamicJobSelectionDialog.message=Context param will be retreive from job : {0} !
InstallModuleDialog.text=Module
InstallModuleDialog.message=Select a module !
InstallModuleDialog.platfromBtn=Platform
InstallModuleDialog.repositoryBtn=Artifact Repository(local m2/nexus)
InstallModuleDialog.repository.name=File Name
InstallModuleDialog.repository.mvnURI=Maven URI
InstallModuleDialog.repository.name.error=Please input a valid module name !
InstallModuleDialog.repository.message=Please input the jar name and click the detect button !
InstallModuleDialog.repository.error=This jar is not installed in the artifact repository, please install it !
InstallModuleDialog.detectButton.text=Detect artifact install status
InstallModuleDialog.browseFileBtn=Browse a Module File
InstallModuleDialog.browseFile.error=Please select a file to install !

View File

@@ -733,6 +733,16 @@ public class DesignerCoreService implements IDesignerCoreService {
return 0;
}
@Override
public int getHBaseOrMaprDBScanLimit() {
final IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
if (preferenceStore != null) {
return preferenceStore.getInt(ITalendCorePrefConstants.HBASE_OR_MAPRDB_SCAN_LIMIT);
}
// disable
return 0;
}
/*
* (non-Javadoc)
*

View File

@@ -12,12 +12,14 @@
// ============================================================================
package org.talend.designer.core;
import org.eclipse.jface.action.IAction;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.IService;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.designer.core.ui.editor.ProcessEditorInput;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.repository.model.RepositoryNode;
/**
* DOC talend class global comment. Detailled comment
@@ -28,6 +30,8 @@ public interface ICreateMRProcessService extends IService {
public ProcessEditorInput getMRProcessEditorInput(ProcessItem processItem, boolean load) throws PersistenceException;
public ProcessEditorInput getMRProcessEditorInput(ProcessItem processItem, boolean load, boolean lastVersion, boolean readOnly)
throws PersistenceException;
public ProcessEditorInput getMRProcessEditorInput(ProcessItem processItem, boolean load, boolean lastVersion,
boolean readOnly) throws PersistenceException;
public IAction getEditProcessAction(RepositoryNode result);
}

View File

@@ -12,12 +12,14 @@
// ============================================================================
package org.talend.designer.core;
import org.eclipse.jface.action.IAction;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.IService;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.designer.core.ui.editor.ProcessEditorInput;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.repository.model.RepositoryNode;
/**
* DOC zwzhao class global comment. Detailled comment
@@ -34,4 +36,6 @@ public interface ICreateStormProcessService extends IService {
public ProcessEditorInput getStromProcessEditorInput(ProcessItem processItem, boolean load, boolean lastVersion,
boolean readOnly) throws PersistenceException;
public IAction getEditProcessAction(RepositoryNode result);
}

View File

@@ -161,4 +161,9 @@ public abstract class AbstractComponent implements IComponent {
public boolean isAllowedPropagated() {
return true;
}
@Override
public String getOriginalName(){
return getName();
}
}

View File

@@ -434,17 +434,19 @@ public class ConnectionManager {
String connectorName, String connectionName) {
newlineStyle = lineStyle;
boolean isMainConn = lineStyle==EConnectionType.FLOW_MAIN ;
if (source.equals(newTarget)) {
return false;
}
if ((source.getDesignSubjobStartNode().getOutgoingConnections(EConnectionType.ON_SUBJOB_OK).size() != 0 || source
.getDesignSubjobStartNode().getOutgoingConnections(EConnectionType.ON_SUBJOB_ERROR).size() != 0)
&& !newTarget.checkIfCanBeStart() && !((Node) newTarget).isJoblet()) {
final INode designSubjobStartNode = source.getDesignSubjobStartNode();
if ((designSubjobStartNode.getOutgoingConnections(EConnectionType.ON_SUBJOB_OK).size() != 0 ||
designSubjobStartNode.getOutgoingConnections(EConnectionType.ON_SUBJOB_ERROR).size() != 0)
&& !newTarget.checkIfCanBeStart() && isMainConn && !((Node) newTarget).isJoblet()) {
return false;
}
if ((source.getDesignSubjobStartNode().getIncomingConnections(EConnectionType.ON_SUBJOB_OK).size() != 0 || source
.getDesignSubjobStartNode().getIncomingConnections(EConnectionType.ON_SUBJOB_ERROR).size() != 0)
&& !newTarget.checkIfCanBeStart() && !((Node) newTarget).isJoblet()) {
if ((designSubjobStartNode.getIncomingConnections(EConnectionType.ON_SUBJOB_OK).size() != 0 ||
designSubjobStartNode.getIncomingConnections(EConnectionType.ON_SUBJOB_ERROR).size() != 0)
&& !newTarget.checkIfCanBeStart() && isMainConn && !((Node) newTarget).isJoblet()) {
return false;
}
if (newTarget.getJobletNode() != null) {

View File

@@ -215,6 +215,11 @@ public class JobContextLoadComponent implements IComponent {
public String getName() {
return this.getClass().getName();
}
@Override
public String getOriginalName(){
return getName();
}
@Override
public String getOriginalFamilyName() {

View File

@@ -131,6 +131,11 @@ public abstract class AbstractStatsLogsComponent implements IComponent {
public String getName() {
return this.getClass().getName();
}
@Override
public String getOriginalName(){
return getName();
}
// no use for virtual component
@Override

View File

@@ -20,7 +20,9 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jface.preference.IPreferenceStore;
import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.database.conn.DatabaseConnStrUtil;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.language.LanguageManager;
@@ -551,6 +553,15 @@ public class StatsAndLogsManager {
private static void setConnectionParameter(DataNode connectionNode, IProcess process, String connectionUID,
DataNode dataNode, List<DataNode> nodeList) {
// db type
String dbType = null;
IElementParameter dbTypeParameter = connectionNode.getElementParameter("TYPE");//$NON-NLS-1$
if (dbTypeParameter != null) {
Object dbTypeObj = dbTypeParameter.getValue();
if (dbTypeObj != null) {
dbType = dbTypeObj.toString();
}
}
if (connectionNode.getElementParameter(EParameterName.HOST.getName()) != null) {
connectionNode.getElementParameter(EParameterName.HOST.getName()).setValue(
process.getElementParameter(EParameterName.HOST.getName()).getValue());
@@ -619,6 +630,12 @@ public class StatsAndLogsManager {
connectionNode.getElementParameter(EParameterName.DB_VERSION.getName()).setValue(
process.getElementParameter(EParameterName.DB_VERSION.getName()).getValue());
}
if (StringUtils.isNotEmpty(dbType) && EDatabaseTypeName.MSSQL.getXmlName().equalsIgnoreCase(dbType)) {
if (connectionNode.getElementParameter("DRIVER") != null) {//$NON-NLS-1$
connectionNode.getElementParameter("DRIVER") //$NON-NLS-1$
.setValue(process.getElementParameter(EParameterName.DB_VERSION.getName()).getValue());
}
}
if (connectionNode.getElementParameter(EParameterName.PROPERTIES.getName()) != null) {
connectionNode.getElementParameter(EParameterName.PROPERTIES.getName()).setValue(
process.getElementParameter(EParameterName.PROPERTIES.getName()).getValue());

View File

@@ -18,7 +18,6 @@ import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IActionDelegate2;
import org.eclipse.ui.IWorkbenchWindow;
@@ -26,6 +25,7 @@ import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.talend.core.PluginChecker;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.utils.DesignerUtilities;
import org.talend.repository.ui.dialog.OpenJobSelectionDialog;
import org.talend.repository.ui.dialog.RepositoryReviewDialog;
@@ -52,20 +52,10 @@ public class OpenJobAction extends Action implements IWorkbenchWindowActionDeleg
final OpenJobSelectionDialog dialog = new OpenJobSelectionDialog(window.getShell(), repObjectTypes);
if (dialog.open() == RepositoryReviewDialog.OK) {
EditProcess editProcess = new EditProcess() {
/*
* (non-Javadoc)
*
* @see org.talend.repository.ui.actions.AContextualAction#getSelection()
*/
@Override
public ISelection getSelection() {
return new StructuredSelection(dialog.getResult());
}
};
editProcess.run();
IAction action = DesignerUtilities.getEditProcessAction(dialog.getResult());
if (action != null) {
action.run();
}
}
}

View File

@@ -21,6 +21,7 @@ import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.designer.core.ui.editor.properties.controllers.ConnectionListController;
import org.talend.designer.core.utils.UpgradeElementHelper;
/**
* Command that change the label of a connection. <br/>
@@ -86,6 +87,9 @@ public class ChangeConnTextCommand extends Command {
if (externalNode != null) {
externalNode.renameOutputConnection(oldName, newName);
}
UpgradeElementHelper.renameData(connection.getTarget(), oldName, newName);
((Process) connection.getSource().getProcess()).checkProcess();
}
@@ -120,6 +124,8 @@ public class ChangeConnTextCommand extends Command {
if (externalNode != null) {
externalNode.renameOutputConnection(newName, oldName);
}
UpgradeElementHelper.renameData(connection.getTarget(), newName, oldName);
((Process) connection.getSource().getProcess()).checkProcess();
}
}

View File

@@ -13,6 +13,8 @@
package org.talend.designer.core.ui.editor.cmd;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.eclipse.gef.commands.Command;
@@ -61,17 +63,31 @@ public class ChangeOutputConnectionOrderCommand extends Command {
*/
@Override
public void execute() {
List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
List<IMetadataTable> connectionMetadatas = new ArrayList<IMetadataTable>();
for (IConnection connection : connectionInNewOrder) {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
if (!metadataList.contains(connection.getMetadataTable())) {
metadataList.add(connection.getMetadataTable());
if (!connectionMetadatas.contains(connection.getMetadataTable())) {
connectionMetadatas.add(connection.getMetadataTable());
}
}
}
if (!metadataList.isEmpty()) {
multipleOutputNode.setMetadataList(metadataList);
}
List<IMetadataTable> metadataList = multipleOutputNode.getMetadataList();
Collections.sort(metadataList, new Comparator<IMetadataTable>() {
@Override
public int compare(IMetadataTable o1, IMetadataTable o2) {
int index1 = connectionMetadatas.indexOf(o1);
if (index1 == -1) {
index1 = 0;
}
int index2 = connectionMetadatas.indexOf(o2);
if (index2 == -1) {
index2 = 0;
}
return index1 - index2;
}
});
multipleOutputNode.setOutgoingConnections(connectionInNewOrder);
connectionInNewOrder.get(0).updateAllId();
((Process) multipleOutputNode.getProcess()).checkStartNodes();
@@ -85,18 +101,31 @@ public class ChangeOutputConnectionOrderCommand extends Command {
*/
@Override
public void undo() {
List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
// if (hasBuiltInConnector) {
List<IMetadataTable> connectionMetadatas = new ArrayList<IMetadataTable>();
for (IConnection connection : connectionInOldOrder) {
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {
if (!metadataList.contains(connection.getMetadataTable())) {
metadataList.add(connection.getMetadataTable());
if (!connectionMetadatas.contains(connection.getMetadataTable())) {
connectionMetadatas.add(connection.getMetadataTable());
}
}
}
// }
multipleOutputNode.setMetadataList(metadataList);
List<IMetadataTable> metadataList = multipleOutputNode.getMetadataList();
Collections.sort(metadataList, new Comparator<IMetadataTable>() {
@Override
public int compare(IMetadataTable o1, IMetadataTable o2) {
int index1 = connectionMetadatas.indexOf(o1);
if (index1 == -1) {
index1 = 0;
}
int index2 = connectionMetadatas.indexOf(o2);
if (index2 == -1) {
index2 = 0;
}
return index1 - index2;
}
});
multipleOutputNode.setOutgoingConnections(connectionInOldOrder);
connectionInOldOrder.get(0).updateAllId();

View File

@@ -84,7 +84,7 @@ public class PropertyChangeCommand extends Command {
// private ChangeMetadataCommand changeMetadataCommand;
private List<ChangeMetadataCommand> changeMetadataCommands;
private Command updateELTMapComponentCommand;
private String propertyTypeName;
@@ -264,7 +264,7 @@ public class PropertyChangeCommand extends Command {
String tableName = TalendQuoteUtils.removeQuotes((String) elem.getPropertyValue("ELT_TABLE_NAME")); //$NON-NLS-1$
if (oldParamValue != null && !"".equals(oldParamValue.trim())) {
oldELTValue = oldParamValue + "."; //$NON-NLS-1$
}
}
if (newParamValue != null && !"".equals(newParamValue.trim())) {
newELTValue = newParamValue + "."; //$NON-NLS-1$
}
@@ -273,13 +273,18 @@ public class PropertyChangeCommand extends Command {
}
List<? extends IConnection> connections = ((Node) elem).getOutgoingConnections();
for (IConnection connection : connections) {
if (!connection.getName().equals(oldELTValue)) {
// do nothing when custom connection name.
continue;
}
INode targetNode = connection.getTarget();
String componentName = targetNode.getComponent().getName();
if (componentName.matches("tELT.+Map")) { //$NON-NLS-1$
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapDesignerService.class)) {
IDbMapDesignerService service = (IDbMapDesignerService) GlobalServiceRegister.getDefault()
.getService(IDbMapDesignerService.class);
updateELTMapComponentCommand = service.getUpdateELTMapComponentCommand(targetNode, connection, oldELTValue, newELTValue);
IDbMapDesignerService service = (IDbMapDesignerService) GlobalServiceRegister.getDefault().getService(
IDbMapDesignerService.class);
updateELTMapComponentCommand = service.getUpdateELTMapComponentCommand(targetNode, connection,
oldELTValue, newELTValue);
updateELTMapComponentCommand.execute();
}
}
@@ -449,7 +454,10 @@ public class PropertyChangeCommand extends Command {
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
toUpdate = true;
}
// TUP-18405, need update module list
if (currentParam.getFieldType() == EParameterFieldType.MODULE_LIST) {
toUpdate = true;
}
if (toUpdate) {
elem.setPropertyValue(updataComponentParamName, Boolean.TRUE);
}
@@ -844,7 +852,7 @@ public class PropertyChangeCommand extends Command {
}
if (updateELTMapComponentCommand != null) {
updateELTMapComponentCommand.undo();
}
}
CodeView.refreshCodeView(elem);
ComponentSettings.switchToCurComponentSettingsView();
JobSettings.switchToCurJobSettingsView();
@@ -905,7 +913,7 @@ public class PropertyChangeCommand extends Command {
}
if (updateELTMapComponentCommand != null) {
updateELTMapComponentCommand.redo();
}
}
CodeView.refreshCodeView(elem);
ComponentSettings.switchToCurComponentSettingsView();
JobSettings.switchToCurJobSettingsView();

View File

@@ -85,6 +85,17 @@ public class JobletUtil {
}
return false;
}
public boolean isJoblet(NodeType node){
EList listParamType = node.getElementParameter();
for(Object o : listParamType){
ElementParameterType ele = ((ElementParameterType)o);
if(ele.getName()!=null && ele.getName().equals(EParameterName.FAMILY.getName()) && ele.getValue()!=null){
return ele.getValue().equals(IComponent.JOBLET_FAMILY);
}
}
return false;
}
public List<INodeConnector> createConnectors(INode node, IProcess2 process) {
List<INodeConnector> listConnector = new ArrayList<INodeConnector>();
@@ -846,17 +857,7 @@ public class JobletUtil {
if(expression == null){
return false;
}
Perl5Matcher matcher = new Perl5Matcher();
Perl5Compiler compiler = new Perl5Compiler();
Pattern pattern = null;
try {
pattern = compiler.compile("[0-9a-zA-Z_]{1,}:[0-9a-zA-Z_]{1,}"); //$NON-NLS-1$
} catch (MalformedPatternException e) {
CommonExceptionHandler.process(e);
}
if (matcher.matches(expression, pattern)) {
if(expression.contains(":")){//$NON-NLS-1$
return true;
}
return false;

View File

@@ -3622,7 +3622,7 @@ public class Node extends Element implements IGraphicalNode {
if (currentNode.getIncomingConnections().size() > 1) {
List<INode> nodeList = new ArrayList<INode>();
Set<INode> nodeSet = new HashSet<INode>();
getAllSourceNode(currentNode, nodeList);
getAllMainConnSourceNode(currentNode, nodeList);
for (INode node : nodeList) {
nodeSet.add(node);
}
@@ -3631,12 +3631,15 @@ public class Node extends Element implements IGraphicalNode {
return false;
}
private static void getAllSourceNode(INode source, List<INode> list) {
private static void getAllMainConnSourceNode(INode source, List<INode> list) {
List<? extends IConnection> connections = source.getIncomingConnections();
for (IConnection connection : connections) {
if(connection.getLineStyle() != EConnectionType.FLOW_MAIN){
continue;
}
INode node = connection.getSource();
list.add(node);
getAllSourceNode(node, list);
getAllMainConnSourceNode(node, list);
}
}
public boolean isSchemaSynchronized() {

View File

@@ -2212,16 +2212,20 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
if(!unloadedNode.isEmpty()){
List<NodeType> tempNodes = new ArrayList<NodeType>(unloadedNode);
JobletUtil jobletUtil = new JobletUtil();
for(NodeType unNode:tempNodes){
listParamType = unNode.getElementParameter();
String componentName = unNode.getComponentName();
if(!isCurrentProject && !componentName.contains(":")){
componentName = ProjectManager.getInstance().getProject(this.getProperty()).getLabel() +":"+componentName; //$NON-NLS-1$
}else if(new JobletUtil().matchExpression(componentName)){
}else if(jobletUtil.matchExpression(componentName)){
String[] names = componentName.split(":"); //$NON-NLS-1$
componentName = names[1];
}
IComponent component = ComponentsFactoryProvider.getInstance().get(componentName, componentsType);
if(component == null && jobletUtil.isJoblet(unNode)){
component = ComponentsFactoryProvider.getInstance().getJobletComponent(componentName, componentsType);
}
if(component!=null){
unloadedNode.remove(unNode);
nc = loadNode(unNode, component, nodesHashtable, listParamType);
@@ -3163,7 +3167,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
public String generateUniqueNodeName(INode node) {
String baseName = node.getComponent().getName();
String baseName = node.getComponent().getOriginalName();
return UniqueNodeNameGenerator.generateUniqueNodeName(baseName, uniqueNodeNameList);
}

View File

@@ -1478,12 +1478,16 @@ public abstract class AbstractElementPropertySectionController implements Proper
String driverClass = getValueFromRepositoryName(element, EConnectionParameterName.DRIVER_CLASS.getName(),
basePropertyParameter);
String dbVersion = getValueFromRepositoryName(element, "DB_VERSION", basePropertyParameter);
if (EDatabaseVersion4Drivers.VERTICA_5_1.getVersionValue().equals(dbVersion)
|| EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(dbVersion)
|| EDatabaseVersion4Drivers.VERTICA_6_1_X.getVersionValue().equals(dbVersion)
|| EDatabaseVersion4Drivers.VERTICA_7.getVersionValue().equals(dbVersion)) {
connParameters.setDbVersion(dbVersion);
String driverName = getValueFromRepositoryName(element, "DB_VERSION", basePropertyParameter); //$NON-NLS-1$
if (StringUtils.isBlank(driverName) && EDatabaseTypeName.MSSQL.getDisplayName().equals(connParameters.getDbType())) {
driverName = getValueFromRepositoryName(element, "DRIVER", basePropertyParameter); //$NON-NLS-1$
}
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(type, driverName);
connParameters.setDbVersion(dbVersionName);
if (EDatabaseVersion4Drivers.VERTICA_5_1.getVersionValue().equals(dbVersionName)
|| EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(dbVersionName)
|| EDatabaseVersion4Drivers.VERTICA_6_1_X.getVersionValue().equals(dbVersionName)
|| EDatabaseVersion4Drivers.VERTICA_7.getVersionValue().equals(dbVersionName)) {
driverClass = EDatabase4DriverClassName.VERTICA2.getDriverClass();
}

View File

@@ -203,8 +203,11 @@ public class ComponentListController extends AbstractElementPropertySectionContr
for (Node curNode : nodesToUpdate) {
for (IElementParameter curParam : curNode.getElementParameters()) {
if (curParam.getFieldType().equals(EParameterFieldType.COMPONENT_LIST)) {
String value = (String)curParam.getValue();
if (oldConnectionName.equals(curParam.getValue())) {
curParam.setValue(newConnectionName);
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
}
} else if (curParam.getFieldType().equals(EParameterFieldType.TABLE)) {
final Object[] itemsValue = curParam.getListItemsValue();
@@ -220,6 +223,8 @@ public class ComponentListController extends AbstractElementPropertySectionContr
if (connectionName.equals(oldConnectionName)) {
// note: change from "Integer" value stored to "String" value
curLine.put(param.getName(), newConnectionName);
}else if (connectionName != null && connectionName.startsWith(oldConnectionName + "_")) {
curParam.setValue(connectionName.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
}
} else if (value instanceof String) {
curLine.put(param.getName(), newConnectionName);

View File

@@ -244,15 +244,18 @@ public class DbInfo {
} else {
driverClassName = EDatabase4DriverClassName.HIVE.getDriverClass();
}
}
driverClassName = ExtractMetaDataUtils.getInstance().getDriverClassByDbType(dbType);
if (dbType.equals(EDatabaseTypeName.VERTICA.getXmlName())) {
} else if (dbType.equals(EDatabaseTypeName.VERTICA.getXmlName())) {
if (EDatabaseVersion4Drivers.VERTICA_6.getVersionValue().equals(dbVersion)
|| EDatabaseVersion4Drivers.VERTICA_5_1.getVersionValue().equals(dbVersion)
|| EDatabaseVersion4Drivers.VERTICA_6_1_X.getVersionValue().equals(dbVersion)
|| EDatabaseVersion4Drivers.VERTICA_7.getVersionValue().equals(dbVersion)) {
driverClassName = EDatabase4DriverClassName.VERTICA2.getDriverClass();
}
} else if (EDatabaseTypeName.MSSQL.getDisplayName().equals(dbType)
&& EDatabaseVersion4Drivers.MSSQL_PROP.getVersionValue().equals(dbVersion)) {
driverClassName = EDatabase4DriverClassName.MSSQL2.getDriverClass();
} else {
driverClassName = ExtractMetaDataUtils.getInstance().getDriverClassByDbType(dbType);
}
}

View File

@@ -14,6 +14,7 @@ package org.talend.designer.core.ui.editor.properties.controllers;
import java.beans.PropertyChangeEvent;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.Path;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.fieldassist.DecoratedField;
@@ -45,9 +46,9 @@ import org.talend.designer.core.ui.editor.properties.controllers.creator.SelectA
/**
* DOC yzhang class global comment. Detailled comment <br/>
*
*
* $Id: talend-code-templates.xml 1 2006-09-29 17:06:40 +0000 (星期五, 29 九月 2006) nrousseau $
*
*
*/
public class DirectoryController extends AbstractElementPropertySectionController {
@@ -55,7 +56,7 @@ public class DirectoryController extends AbstractElementPropertySectionControlle
/**
* DOC yzhang DirectoryController constructor comment.
*
*
* @param parameterBean
*/
public DirectoryController(IDynamicProperty dp) {
@@ -65,7 +66,7 @@ public class DirectoryController extends AbstractElementPropertySectionControlle
/*
* (non-Javadoc)
*
*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
@Override
@@ -75,7 +76,7 @@ public class DirectoryController extends AbstractElementPropertySectionControlle
/**
* DOC yzhang Comment method "setCommand".
*
*
* @param propertyName
*/
private Command createCommand(SelectionEvent event) {
@@ -84,23 +85,20 @@ public class DirectoryController extends AbstractElementPropertySectionControlle
String propertyName = (String) btn.getData(PARAMETER_NAME);
Text dirPathText = (Text) hashCurControls.get(propertyName);
String directory = dial.open();
if (directory != null) {
if (!directory.equals("")) { //$NON-NLS-1$
if (!elem.getPropertyValue(propertyName).equals(directory)) {
String portableValue = Path.fromOSString(directory).toPortableString();
dirPathText.setText(TalendTextUtils.addQuotes(portableValue));
return new PropertyChangeCommand(elem, propertyName, TalendTextUtils.addQuotes(portableValue));
}
if (StringUtils.isNotBlank(directory) && !directory.equals(elem.getPropertyValue(propertyName))) {
String portableValue = Path.fromOSString(directory).toPortableString();
if (!isInWizard()) {
portableValue = TalendTextUtils.addQuotes(portableValue);
}
dirPathText.setText(portableValue);
return new PropertyChangeCommand(elem, propertyName, portableValue);
}
return null;
}
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.core.ui.editor.properties2.editors.AbstractElementPropertySectionController#
* createControl( org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter, int, int, int,
* org.eclipse.swt.widgets.Control)
@@ -202,10 +200,9 @@ public class DirectoryController extends AbstractElementPropertySectionControlle
/*
* (non-Javadoc)
*
* @see
* org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#estimateRowSize
* (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
*
* @see org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController#
* estimateRowSize (org.eclipse.swt.widgets.Composite, org.talend.core.model.process.IElementParameter)
*/
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {

View File

@@ -26,9 +26,9 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.jface.fieldassist.DecoratedField;
import org.eclipse.jface.fieldassist.FieldDecoration;
import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.jface.fieldassist.IControlCreator;
import org.eclipse.jface.fieldassist.TextControlCreator;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -41,11 +41,10 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
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.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
@@ -61,6 +60,8 @@ 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.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator;
import org.talend.designer.core.ui.editor.properties.controllers.uidialog.InstallModuleDialog;
/**
* DOC yzhang class global comment. Detailled comment <br/>
@@ -105,10 +106,10 @@ public class ModuleListController extends AbstractElementPropertySectionControll
ExceptionHandler.process(e);
}
// update the combo current value
CCombo combo = (CCombo) hashCurControls.get(propertyName);
if (combo != null && !combo.isDisposed()) {
combo.setText(Path.fromOSString(file).lastSegment());
// update the text current value
Text text = (Text) hashCurControls.get(propertyName);
if (text != null && !text.isDisposed()) {
text.setText(Path.fromOSString(file).lastSegment());
}
return new PropertyChangeCommand(elem, propertyName, lastSegment);
}
@@ -119,27 +120,25 @@ public class ModuleListController extends AbstractElementPropertySectionControll
}
} else {
FileDialog dial = new FileDialog(composite.getShell(), SWT.NONE);
dial.setFilterExtensions(FilesUtils.getAcceptJARFilesSuffix());
String file = dial.open();
if (file != null && !file.equals("")) { //$NON-NLS-1$
String propertyName = (String) button.getData(PARAMETER_NAME);
String lastSegment = TalendTextUtils.addQuotes(Path.fromOSString(file).lastSegment());
String propertyName = (String) button.getData(PARAMETER_NAME);
Object value = elem.getPropertyValue(propertyName);
String initValue = value == null ? "" : TalendTextUtils.removeQuotes(value.toString());
InstallModuleDialog dial = new InstallModuleDialog(composite.getShell(), initValue);
if (Window.OK == dial.open()) {
String file = dial.getResult();
if (file != null && !file.equals("")) { //$NON-NLS-1$
String lastSegment = TalendTextUtils.addQuotes(Path.fromOSString(file).lastSegment());
try {
CorePlugin.getDefault().getLibrariesService().deployLibrary(Path.fromOSString(file).toFile().toURL());
} catch (Exception e) {
ExceptionHandler.process(e);
}
if (!elem.getPropertyValue(propertyName).equals(lastSegment)) {
if (!elem.getPropertyValue(propertyName).equals(lastSegment)) {
// update the combo current value
CCombo combo = (CCombo) hashCurControls.get(propertyName);
if (combo != null && !combo.isDisposed()) {
combo.setText(Path.fromOSString(file).lastSegment());
// update the text current value
Text text = (Text) hashCurControls.get(propertyName);
if (text != null && !text.isDisposed()) {
text.setText(Path.fromOSString(file).lastSegment());
}
return new PropertyChangeCommand(elem, propertyName, lastSegment);
}
return new PropertyChangeCommand(elem, propertyName, lastSegment);
}
}
}
@@ -147,60 +146,6 @@ public class ModuleListController extends AbstractElementPropertySectionControll
return null;
}
public Command createCommand(SelectionEvent selectionEvent) {
Set<String> elementsName;
Control ctrl;
elementsName = hashCurControls.keySet();
for (String name : elementsName) {
Object o = hashCurControls.get(name);
if (o instanceof Control) {
ctrl = (Control) o;
if (ctrl == null) {
hashCurControls.remove(name);
return null;
}
if (ctrl.equals(selectionEvent.getSource()) && ctrl instanceof CCombo) {
boolean isDisposed = ((CCombo) ctrl).isDisposed();
if (!isDisposed && (!elem.getPropertyValue(name).equals(((CCombo) ctrl).getText()))) {
String value = new String(""); //$NON-NLS-1$
for (int i = 0; i < elem.getElementParameters().size(); i++) {
IElementParameter param = elem.getElementParameters().get(i);
if (param.getName().equals(name)) {
for (int j = 0; j < param.getListItemsValue().length; j++) {
if (((CCombo) ctrl).getText().equals(param.getListItemsDisplayName()[j])) {
value = (String) param.getListItemsValue()[j];
}
}
}
}
if (value.equals(elem.getPropertyValue(name))) { // same
// value so
// no
// need to do
// anything
return null;
}
CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
return new PropertyChangeCommand(elem, name, value);
}
}
}
}
return null;
}
IControlCreator cbCtrl = new IControlCreator() {
@Override
public Control createControl(final Composite parent, final int style) {
CCombo cb = new CCombo(parent, style);
return cb;
}
};
/*
* (non-Javadoc)
*
@@ -216,7 +161,7 @@ public class ModuleListController extends AbstractElementPropertySectionControll
}
}
DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, cbCtrl);
final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new SelectAllTextControlCreator());
if (param.isRequired()) {
FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
FieldDecorationRegistry.DEC_REQUIRED);
@@ -224,14 +169,13 @@ public class ModuleListController extends AbstractElementPropertySectionControll
}
Control cLayout = dField.getLayoutControl();
CCombo combo = (CCombo) dField.getControl();
Text text = (Text) dField.getControl();
combo.setEditable(false);
text.setEditable(false);
cLayout.setBackground(subComposite.getBackground());
combo.setEnabled(!param.isReadOnly());
combo.addSelectionListener(listenerSelection);
text.setEnabled(!param.isReadOnly());
if (elem instanceof Node) {
combo.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
text.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
}
CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName());
@@ -267,6 +211,7 @@ public class ModuleListController extends AbstractElementPropertySectionControll
} else {
data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT);
}
data.right = new FormAttachment(labelLabel, STANDARD_LABEL_WIDTH * 3, SWT.RIGHT);
data.top = new FormAttachment(0, top);
cLayout.setLayoutData(data);
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -286,7 +231,7 @@ public class ModuleListController extends AbstractElementPropertySectionControll
btnEdit.addSelectionListener(listenerSelection);
// **********************
hashCurControls.put(param.getName(), combo);
hashCurControls.put(param.getName(), text);
hashCurControls.put(param.getName() + BUTTON_EDIT, btnEdit);
updateData();
// this.dynamicTabbedPropertySection.updateColumnList(null);
@@ -304,7 +249,7 @@ public class ModuleListController extends AbstractElementPropertySectionControll
*/
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, cbCtrl);
DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new TextControlCreator());
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
dField.getLayoutControl().dispose();
@@ -380,34 +325,28 @@ public class ModuleListController extends AbstractElementPropertySectionControll
if (event.getSource() instanceof Button) {
Command cmd = createCommand((Button) event.getSource());
executeCommand(cmd);
} else {
Command cmd = createCommand(event);
executeCommand(cmd);
}
}
};
@Override
public void refresh(IElementParameter param, boolean check) {
CCombo combo = (CCombo) hashCurControls.get(param.getName());
if (combo == null || combo.isDisposed()) {
Text text = (Text) hashCurControls.get(param.getName());
if (text == null || text.isDisposed()) {
return;
}
updateData();
String[] curNameList = param.getListItemsDisplayName();
Object value = param.getValue();
combo.setItems(curNameList);
if (value instanceof String) {
combo.setText(TalendTextUtils.removeQuotes((String) value));
text.setText(TalendTextUtils.removeQuotes((String) value));
}
if (param.isContextMode()) {
Button buttonEdit = (Button) hashCurControls.get(param.getName() + BUTTON_EDIT);
combo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
combo.setEnabled(false);
text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
text.setEnabled(false);
buttonEdit.setEnabled(false);
}
}

View File

@@ -0,0 +1,490 @@
// ============================================================================
//
// Copyright (C) 2006-2017 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.core.ui.editor.properties.controllers.uidialog;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeoutException;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.utils.io.FilesUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ILibraryManagerService;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.general.ModuleNeeded.ELibraryInstallStatus;
import org.talend.core.nexus.NexusServerBean;
import org.talend.core.nexus.TalendLibsServerManager;
import org.talend.core.runtime.maven.MavenUrlHelper;
import org.talend.designer.core.i18n.Messages;
import org.talend.librariesmanager.model.ModulesNeededProvider;
import org.talend.librariesmanager.model.service.LibrariesIndexManager;
import org.talend.librariesmanager.ui.LibManagerUiPlugin;
/**
*
* DOC wchen class global comment. Detailled comment
*/
public class InstallModuleDialog extends TitleAreaDialog {
private Text jarPathTxt;
private Text nameTxt;
private Text uriTxt;
private Button platfromRadioBtn;
private Combo platformCombo;
private Button repositoryRadioBtn;
private Button fileRadioBtn;
private Button detectButton;
private Button fileBrowse;
private String moduleName;
private String initValue;
private final String MVN_DATA_KEY = "MVN_DATA_KEY";
/**
* DOC wchen InstallModuleDialog constructor comment.
*
* @param parentShell
*/
public InstallModuleDialog(Shell parentShell, String initValue) {
super(parentShell);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation());
this.initValue = initValue;
}
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(Messages.getString("InstallModuleDialog.text"));//$NON-NLS-1$
}
@Override
protected Control createDialogArea(Composite parent) {
GridData data = new GridData(GridData.FILL_BOTH);
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginTop = 10;
layout.marginLeft = 20;
layout.marginRight = 20;
layout.marginBottom = 50;
container.setLayout(layout);
container.setLayoutData(data);
createPlatformGroup(container);
createRepositoryGroup(container);
browseFileGroup(container);
return parent;
}
@Override
protected Control createContents(Composite parent) {
Control control = super.createContents(parent);
setPlatformGroupEnabled(true);
setRepositoryGroupEnabled(false);
setFileGroupEnabled(false);
return control;
}
private void createPlatformGroup(Composite container) {
Composite composite = new Composite(container, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(data);
platfromRadioBtn = new Button(composite, SWT.RADIO);
platfromRadioBtn.setText(Messages.getString("InstallModuleDialog.platfromBtn"));
platfromRadioBtn.setSelection(true);
platformCombo = new Combo(composite, SWT.READ_ONLY);
platformCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
platfromRadioBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setPlatformGroupEnabled(true);
setRepositoryGroupEnabled(false);
setFileGroupEnabled(false);
}
});
ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(
ILibraryManagerService.class);
Set<String> jarsAvailable = librairesManagerService.list(new NullProgressMonitor());
List<ModuleNeeded> unUsedModules = ModulesNeededProvider.getUnUsedModules();
for (ModuleNeeded module : unUsedModules) {
if (module.getStatus() == ELibraryInstallStatus.INSTALLED) {
jarsAvailable.add(module.getModuleName());
}
}
String[] moduleValueArray = jarsAvailable.toArray(new String[jarsAvailable.size()]);
Comparator<String> comprarator = new Comparator<String>() {
public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2);
}
};
Arrays.sort(moduleValueArray, comprarator);
platformCombo.setItems(moduleValueArray);
if (jarsAvailable.contains(initValue)) {
platformCombo.setText(initValue);
} else {
platformCombo.setText(moduleValueArray[0]);
}
}
private void setPlatformGroupEnabled(boolean enable) {
platfromRadioBtn.setSelection(enable);
platformCombo.setEnabled(enable);
if (enable) {
setMessage(Messages.getString("InstallModuleDialog.message"), IMessageProvider.INFORMATION);
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
}
private void createRepositoryGroup(Composite container) {
Composite composite = new Composite(container, SWT.NONE);
GridLayout layout = new GridLayout();
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(data);
repositoryRadioBtn = new Button(composite, SWT.RADIO);
repositoryRadioBtn.setText(Messages.getString("InstallModuleDialog.repositoryBtn"));
data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
repositoryRadioBtn.setLayoutData(data);
Composite subComposite = new Composite(container, SWT.NONE);
layout = new GridLayout();
layout.marginLeft = 25;
layout.numColumns = 2;
subComposite.setLayout(layout);
data = new GridData(GridData.FILL_BOTH);
subComposite.setLayoutData(data);
Label nameLabel = new Label(subComposite, SWT.NONE);
nameLabel.setText(Messages.getString("InstallModuleDialog.repository.name"));
nameTxt = new Text(subComposite, SWT.BORDER);
nameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
Label uriLabel = new Label(subComposite, SWT.NONE);
uriLabel.setText(Messages.getString("InstallModuleDialog.repository.mvnURI"));
uriTxt = new Text(subComposite, SWT.BORDER);
uriTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
uriTxt.setEnabled(false);
detectButton = new Button(subComposite, SWT.NONE);
detectButton.setText(Messages.getString("InstallModuleDialog.detectButton.text"));
detectButton.setEnabled(false);
data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
data.horizontalSpan = 2;
detectButton.setLayoutData(data);
repositoryRadioBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setPlatformGroupEnabled(false);
setRepositoryGroupEnabled(true);
setFileGroupEnabled(false);
}
});
detectButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkMavenRepository();
}
});
nameTxt.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String jarName = nameTxt.getText().trim();
if (jarName.contains(".")) {
detectButton.setEnabled(true);
String mvnUriFromIndex = LibrariesIndexManager.getInstance().getMvnUriFromIndex(jarName);
if (mvnUriFromIndex != null) {
final String[] mvnUris = mvnUriFromIndex.split(MavenUrlHelper.MVN_INDEX_SPLITER);
uriTxt.setText(mvnUris[0]);
} else {
String generatedMavenURI = MavenUrlHelper.generateMvnUrlForJarName(jarName, true, true);
uriTxt.setText(generatedMavenURI);
}
setMessage(Messages.getString("InstallModuleDialog.repository.message"), IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
} else {
setMessage(Messages.getString("InstallModuleDialog.repository.name.error"), IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
}
});
}
private void setRepositoryGroupEnabled(boolean enable) {
repositoryRadioBtn.setSelection(enable);
nameTxt.setEnabled(enable);
// detectButton.setEnabled(enable);
if (enable) {
setMessage(Messages.getString("InstallModuleDialog.repository.message"), IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
}
private void browseFileGroup(Composite container) {
Composite composite = new Composite(container, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
composite.setLayout(layout);
GridData data = new GridData(GridData.FILL_BOTH);
composite.setLayoutData(data);
fileRadioBtn = new Button(composite, SWT.RADIO);
fileRadioBtn.setText(Messages.getString("InstallModuleDialog.browseFileBtn"));
jarPathTxt = new Text(composite, SWT.BORDER);
jarPathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
fileBrowse = new Button(composite, SWT.PUSH);
fileBrowse.setText("...");//$NON-NLS-1$
fileRadioBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setPlatformGroupEnabled(false);
setRepositoryGroupEnabled(false);
setFileGroupEnabled(true);
}
});
fileBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleButtonPressed();
}
});
jarPathTxt.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
File file = new File(jarPathTxt.getText());
if (!file.exists()) {
setMessage(Messages.getString("InstallModuleDialog.browseFile.error"), IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
} else {
setMessage(Messages.getString("InstallModuleDialog.message"), IMessageProvider.INFORMATION);
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
}
});
}
private void setFileGroupEnabled(boolean enable) {
fileRadioBtn.setSelection(enable);
jarPathTxt.setEnabled(enable);
fileBrowse.setEnabled(enable);
if (enable) {
File file = new File(jarPathTxt.getText());
if (file.exists()) {
getButton(IDialogConstants.OK_ID).setEnabled(true);
} else {
setMessage(Messages.getString("InstallModuleDialog.browseFile.error"), IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
}
}
private void checkMavenRepository() {
String jarName = nameTxt.getText().trim();
String mvnURI = uriTxt.getText().trim();
final boolean[] status = new boolean[1];
status[0] = false;
final IRunnableWithProgress acceptOursProgress = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
String mvnUriFromIndex = LibrariesIndexManager.getInstance().getMvnUriFromIndex(jarName);
NexusServerBean customNexusServer = TalendLibsServerManager.getInstance().getCustomNexusServer();
if (mvnUriFromIndex != null && mvnUriFromIndex.split(MavenUrlHelper.MVN_INDEX_SPLITER).length > 1) {
String[] mvnURIs = mvnUriFromIndex.split(MavenUrlHelper.MVN_INDEX_SPLITER);
for (String mvnURI : mvnURIs) {
checkModuleStatus(customNexusServer, jarName, mvnURI, status);
}
} else {
checkModuleStatus(customNexusServer, jarName, mvnURI, status);
}
}
};
ProgressMonitorDialog dialog = new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
try {
dialog.run(true, true, acceptOursProgress);
} catch (Throwable e) {
if (!(e instanceof TimeoutException)) {
ExceptionHandler.process(e);
}
}
if (!status[0]) {
setMessage(Messages.getString("InstallModuleDialog.repository.error"), IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
} else {
List<String> modulesNeededNames = ModulesNeededProvider.getModulesNeededNames();
if (!modulesNeededNames.contains(jarName)) {
ModulesNeededProvider.userAddUnusedModules(ELibraryInstallStatus.UNKNOWN.name(), jarName);
}
setMessage(Messages.getString("InstallModuleDialog.message"), IMessageProvider.INFORMATION);
getButton(IDialogConstants.OK_ID).setEnabled(true);
}
}
private void checkModuleStatus(NexusServerBean customNexusServer, String jarName, String mvnURI, boolean[] status) {
ModuleNeeded needed = new ModuleNeeded(jarName, null, true, mvnURI);
ELibraryInstallStatus installStatus = needed.getDeployStatus();
if (installStatus == ELibraryInstallStatus.DEPLOYED) {
status[0] |= true;
} else {
if (customNexusServer != null) {
try {
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault()
.getService(ILibraryManagerService.class);
File resolveJar = libManagerService.resolveJar(TalendLibsServerManager.getInstance(), customNexusServer,
mvnURI);
if (resolveJar != null) {
status[0] |= true;
LibManagerUiPlugin.getDefault().getLibrariesService().checkLibraries();
}
} catch (Exception e) {
status[0] |= false;
}
}
}
}
private void handleButtonPressed() {
FileDialog dialog = new FileDialog(getShell());
dialog.setFilterExtensions(FilesUtils.getAcceptJARFilesSuffix());
dialog.setText(Messages.getString("InstallModuleDialog.text")); //$NON-NLS-1$
String filePath = this.jarPathTxt.getText().trim();
if (filePath.length() == 0) {
dialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
} else {
File file = new File(filePath);
if (file.exists()) {
dialog.setFilterPath(new Path(filePath).toOSString());
}
}
String result = dialog.open();
if (result != null) {
this.jarPathTxt.setText(result);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@Override
protected void okPressed() {
if (platfromRadioBtn.getSelection()) {
moduleName = platformCombo.getText();
} else if (repositoryRadioBtn.getSelection()) {
moduleName = nameTxt.getText().trim();
} else {
final File file = new File(jarPathTxt.getText().trim());
final IRunnableWithProgress acceptOursProgress = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
monitor.beginTask("Install module " + file.getName(), 100);
monitor.worked(10);
CorePlugin.getDefault().getLibrariesService().deployLibrary(file.toURL());
monitor.worked(80);
moduleName = file.getName();
List<String> modulesNeededNames = ModulesNeededProvider.getModulesNeededNames();
if (!modulesNeededNames.contains(moduleName)) {
ModulesNeededProvider.userAddUnusedModules(ELibraryInstallStatus.UNKNOWN.name(), moduleName);
}
monitor.done();
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
};
ProgressMonitorDialog dialog = new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell());
try {
dialog.run(true, true, acceptOursProgress);
} catch (Throwable e) {
if (!(e instanceof TimeoutException)) {
ExceptionHandler.process(e);
}
}
}
super.okPressed();
}
public String getResult() {
return moduleName;
}
}

View File

@@ -34,6 +34,8 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
private IntegerFieldEditor dbConnTimeout;
private IntegerFieldEditor hbaseOrMaprDBScanLimit;
public PerformancePreferencePage() {
super(GRID);
setPreferenceStore(DesignerPlugin.getDefault().getPreferenceStore());
@@ -81,7 +83,6 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
textControl.setToolTipText(Messages.getString("PerformancePreferencePage.ConnectionTimeoutTip")); //$NON-NLS-1$
dbConnTimeout.setValidRange(0, Short.MAX_VALUE);
textControl.setEnabled(getPreferenceStore().getBoolean(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED));
addField(dbConnTimeoutActive);
addField(dbConnTimeout);
addSVNInforAutoCheckFiled();
@@ -118,7 +119,6 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
textControl.setToolTipText(Messages.getString("PerformancePreferencePage.ConnectionTimeoutTip")); //$NON-NLS-1$
dbConnTimeout.setValidRange(0, Short.MAX_VALUE);
textControl.setEnabled(getPreferenceStore().getBoolean(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT_ACTIVED));
addField(dbConnTimeoutActive);
addField(dbConnTimeout);
@@ -137,6 +137,14 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
getFieldEditorParent());
codeFormatTimeout.setValidRange(1, Short.MAX_VALUE);
addField(codeFormatTimeout);
hbaseOrMaprDBScanLimit = new IntegerFieldEditor(ITalendCorePrefConstants.HBASE_OR_MAPRDB_SCAN_LIMIT,
Messages.getString("PerformancePreferencePage.HBaseOrMaprDBScanLimit"), //$NON-NLS-1$
getFieldEditorParent());
Text limitTextControl = hbaseOrMaprDBScanLimit.getTextControl(getFieldEditorParent());
limitTextControl.setToolTipText(Messages.getString("PerformancePreferencePage.HBaseOrMaprDBScanLimitTip")); //$NON-NLS-1$
hbaseOrMaprDBScanLimit.setValidRange(0, Short.MAX_VALUE);
addField(hbaseOrMaprDBScanLimit);
}
private void addSVNInforAutoCheckFiled() {

View File

@@ -144,6 +144,9 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
store.setDefault(ITalendCorePrefConstants.DB_CONNECTION_TIMEOUT, 15);
// store.setDefault(ITalendCorePrefConstants.ITEM_INDEX, false);
// HBase or MaprDB scan limit
store.setDefault(ITalendCorePrefConstants.HBASE_OR_MAPRDB_SCAN_LIMIT, 50);
// Add dependencies routines for job
store.setDefault(ITalendCorePrefConstants.ADD_USER_ROUTINES, true);
store.setDefault(ITalendCorePrefConstants.ADD_SYSTEM_ROUTINES, true);
@@ -160,7 +163,6 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
if (PluginChecker.isSVNProviderPluginLoaded()) {
store.setDefault(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK, true);
store.setDefault(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK_TIME_INTERVAL, 1);
store.setDefault(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK, true);
store.setDefault(ITalendCorePrefConstants.AUTO_REFRESH_LOCKS, true);
store.setDefault(ITalendCorePrefConstants.PERFORMANCE_TAC_CONNECTION_TIMEOUT, 5);
}

View File

@@ -0,0 +1,49 @@
// ============================================================================
//
// Copyright (C) 2006-2017 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.core.ui.preferences;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.designer.core.DesignerPlugin;
import org.talend.login.AbstractLoginTask;
/**
*
* DOC wchen class global comment. Detailled comment
*/
public class PreferencePreInitailizeTask extends AbstractLoginTask {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IPreferenceStore store = DesignerPlugin.getDefault().getPreferenceStore();
String pAutoCheck = System.getProperty("svn.update.info.check");
if (pAutoCheck != null) {
boolean enableAutoCheckSvn = Boolean.valueOf(pAutoCheck);
store.setValue(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK, enableAutoCheckSvn);
}
String pInterval = System.getProperty("svn.update.info.interval");
if (pInterval != null) {
try {
int svnCheckInterval = Integer.parseInt(pInterval);
store.setValue(ITalendCorePrefConstants.SVN_UPDATE_INFO_AUTO_CHECK_TIME_INTERVAL, svnCheckInterval);
} catch (NumberFormatException e) {
ExceptionHandler.process(e);
}
}
}
}

View File

@@ -20,7 +20,12 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
@@ -403,6 +408,7 @@ public abstract class AbstractJobSettingsPage extends ProjectSettingPage {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask(getTaskMessages(), (checkedNodeObject.size()) * 100);
final Map<String, Set<String>> contextVars = DetectContextVarsUtils.detectByPropertyType(elem, true);
@@ -420,14 +426,15 @@ public abstract class AbstractJobSettingsPage extends ProjectSettingPage {
IElementParameter propertyElem = ptParam.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName());
Object proValue = propertyElem.getValue();
if (proValue instanceof String && ((String) proValue).equalsIgnoreCase(EmfComponent.REPOSITORY)) {
IElementParameter repositoryElem = ptParam.getChildParameters().get(
EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
IElementParameter repositoryElem = ptParam.getChildParameters()
.get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
String value = (String) repositoryElem.getValue();
ConnectionItem connectionItem = UpdateRepositoryUtils.getConnectionItemByItemId(value);
connection = connectionItem.getConnection();
if (connection != null && connection.isContextMode()) {
addContextModel = true;
// ContextItem contextItem = ContextUtils.getContextItemById(connection.getContextId());
// ContextItem contextItem =
// ContextUtils.getContextItemById(connection.getContextId());
// for (IProcess process : openedProcessList) {
// Set<String> addedContext =
// ConnectionContextHelper.checkAndAddContextVariables(contextItem,
@@ -461,9 +468,22 @@ public abstract class AbstractJobSettingsPage extends ProjectSettingPage {
}
}
monitor.worked(10);
IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
for (IRepositoryViewObject object : checkedNodeObject) {
saveProcess(object, addContextModel, contextVars, monitor);
@Override
public void run(IProgressMonitor monitor) throws CoreException {
for (IRepositoryViewObject object : checkedNodeObject) {
saveProcess(object, addContextModel, contextVars, monitor);
}
}
};
IWorkspace workspace = ResourcesPlugin.getWorkspace();
try {
ISchedulingRule schedulingRule = workspace.getRoot();
workspace.run(workspaceRunnable, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
monitor.done();
}

View File

@@ -15,12 +15,17 @@ package org.talend.designer.core.utils;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.PlatformUI;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.PluginChecker;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
import org.talend.core.model.metadata.designerproperties.RepositoryToComponentProperty;
@@ -32,13 +37,17 @@ import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.ui.editor.JobEditorInput;
import org.talend.designer.core.ICreateMRProcessService;
import org.talend.designer.core.ICreateStormProcessService;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.process.jobsettings.JobSettingsConstants;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.ui.action.EditProcess;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.designer.runprocess.ItemCacheManager;
import org.talend.repository.model.RepositoryNode;
/**
* DOC bqian class global comment. Detailled comment
@@ -96,6 +105,7 @@ public class DesignerUtilities {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
IEditorReference[] editors = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.getEditorReferences();
@@ -135,10 +145,10 @@ public class DesignerUtilities {
public static void setSchemaDB(IElementParameter schemaDB, Object value) {
if (schemaDB != null) {
if (value instanceof String) {
if (JobSettingsConstants.ORACLE_OUTPUT_SID_ALIAS.equals((String) value)
|| JobSettingsConstants.ORACLE_OUTPUT_SN_ALIAS.equals((String) value)
|| JobSettingsConstants.ORACLE_INOUT_SN_ALIAS.equals((String) value)
|| JobSettingsConstants.ORACLE_INPUT_SID_ALIAS.equals((String) value)) {
if (JobSettingsConstants.ORACLE_OUTPUT_SID_ALIAS.equals(value)
|| JobSettingsConstants.ORACLE_OUTPUT_SN_ALIAS.equals(value)
|| JobSettingsConstants.ORACLE_INOUT_SN_ALIAS.equals(value)
|| JobSettingsConstants.ORACLE_INPUT_SID_ALIAS.equals(value)) {
schemaDB.setRequired(true);
} else {
schemaDB.setRequired(false);
@@ -158,4 +168,39 @@ public class DesignerUtilities {
}
return aliasName;
}
public static IAction getEditProcessAction(RepositoryNode result) {
if (result != null) {
if (result.getContentType() == ERepositoryObjectType.PROCESS) {
return new EditProcess() {
@Override
public ISelection getSelection() {
return new StructuredSelection(result);
}
};
} else if (result.getContentType() == ERepositoryObjectType.PROCESS_STORM) {
if (PluginChecker.isStormPluginLoader()) {
boolean isStormProcessServiceRegistered = GlobalServiceRegister.getDefault().isServiceRegistered(
ICreateStormProcessService.class);
if (isStormProcessServiceRegistered) {
ICreateStormProcessService stromService = (ICreateStormProcessService) GlobalServiceRegister.getDefault()
.getService(ICreateStormProcessService.class);
return stromService.getEditProcessAction(result);
}
}
} else if (result.getContentType() == ERepositoryObjectType.PROCESS_MR) {
if (PluginChecker.isMapReducePluginLoader()) {
boolean isMRProcessServiceRegistered = GlobalServiceRegister.getDefault().isServiceRegistered(
ICreateMRProcessService.class);
if (isMRProcessServiceRegistered) {
ICreateMRProcessService mRService = (ICreateMRProcessService) GlobalServiceRegister.getDefault()
.getService(ICreateMRProcessService.class);
return mRService.getEditProcessAction(result);
}
}
}
}
return null;
}
}

View File

@@ -335,9 +335,15 @@ public class JavaProcessUtil {
continue;
}
if (curParam.getFieldType().equals(EParameterFieldType.MODULE_LIST)) {
if (curParam.getValue() != null && !"".equals(curParam.getValue())) { // if the parameter //$NON-NLS-1$
// is not empty.
modulesNeeded.add(getModuleValue(process, (String) curParam.getValue()));
Object curParamValue = curParam.getValue();
if (curParamValue != null) {
if (curParamValue instanceof String) {
if (StringUtils.isNotEmpty((String) curParamValue)) {
modulesNeeded.add(getModuleValue(process, (String) curParamValue));
}
} else if (curParamValue instanceof List) {
getModulesInTable(process, curParam, modulesNeeded);
}
}
} else if (curParam.getFieldType() == EParameterFieldType.TABLE) {
getModulesInTable(process, curParam, modulesNeeded);

View File

@@ -2,6 +2,7 @@ package org.talend.designer.dbmap.command;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.gef.commands.Command;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.INode;
@@ -36,6 +37,8 @@ public class UpdateELTMapComponentCommand extends Command {
private void execute(String oldValue, String newValue) {
connection.setName(newValue);
// may have several tables with different aliases.
boolean isAliasIncludeTableName = false;
// update table name
for (IExternalMapTable input : newInputTables) {
if (input instanceof ExternalDbMapTable) {
@@ -43,6 +46,12 @@ public class UpdateELTMapComponentCommand extends Command {
if (oldValue.equals(dbMapTable.getName()) || oldValue.equals(dbMapTable.getTableName())) {
dbMapTable.setName(newValue);
dbMapTable.setTableName(newValue);
String alias = dbMapTable.getAlias();
if (alias != null) {
if (alias.contains(oldValue)) {
isAliasIncludeTableName = true;
}
}
}
}
}
@@ -52,15 +61,8 @@ public class UpdateELTMapComponentCommand extends Command {
List<ExternalDbMapEntry> entries = ((ExternalDbMapTable) output).getMetadataTableEntries();
for (ExternalDbMapEntry entry : entries) {
String expression = entry.getExpression();
if (expression != null && !"".equals(expression.trim())) { //$NON-NLS-1$
int index = expression.lastIndexOf("."); //$NON-NLS-1$
// at least "a.b"
if (index > 0) {
String connectionName = expression.substring(0, index);
if (oldValue.equals(connectionName)) {
entry.setExpression(newValue + expression.substring(index, expression.length()));
}
}
if (!StringUtils.isBlank(expression) && expression.contains(oldValue) && !isAliasIncludeTableName) {
entry.setExpression(expression.replace(oldValue, newValue));
}
}
}

View File

@@ -70,6 +70,10 @@ public abstract class DbGenerationManager {
protected String tabSpaceString = DEFAULT_TAB_SPACE_STRING;
protected static final String DEFAULT_TAB_SPACE_STRING = ""; //$NON-NLS-1$
protected List<String> queryColumnsSegments = new ArrayList<String>();
protected List<String> querySegments = new ArrayList<String>();
/**
* DOC amaumont GenerationManager constructor comment.
@@ -252,6 +256,9 @@ public abstract class DbGenerationManager {
public String buildSqlSelect(DbMapComponent component, String outputTableName, String tabString) {
queryColumnsName = "\""; //$NON-NLS-1$
aliasAlreadyDeclared.clear();
queryColumnsSegments.clear();
querySegments.clear();
this.tabSpaceString = tabString;
List<IConnection> outputConnections = (List<IConnection>) component.getOutgoingConnections();
@@ -288,10 +295,10 @@ public abstract class DbGenerationManager {
// outputTable = removeUnmatchingEntriesWithColumnsOfMetadataTable(outputTable, metadataTable);
}
}
sb.append("\""); //$NON-NLS-1$
sb.append(DbMapSqlConstants.SELECT);
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, "\"", false); //$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.SELECT);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
List<ExternalDbMapEntry> metadataTableEntries = outputTable.getMetadataTableEntries();
if (metadataTableEntries != null) {
int lstSizeOutTableEntries = metadataTableEntries.size();
@@ -311,28 +318,29 @@ public abstract class DbGenerationManager {
expression += DbMapSqlConstants.SPACE + DbMapSqlConstants.AS + DbMapSqlConstants.SPACE
+ getAliasOf(dbMapEntry.getName());
}
String columnSegment = expression;
if (i > 0) {
sb.append(DbMapSqlConstants.COMMA);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.COMMA);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
queryColumnsName += DbMapSqlConstants.COMMA + DbMapSqlConstants.SPACE;
columnSegment = DbMapSqlConstants.COMMA + DbMapSqlConstants.SPACE + columnSegment;
}
if (expression != null && expression.trim().length() > 0) {
sb.append(expression);
appendSqlQuery(sb, expression);
queryColumnsName += expression;
queryColumnsSegments.add(columnSegment);
} else {
sb.append(DbMapSqlConstants.LEFT_COMMENT);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_COMMENT);
String str = outputTable.getName() + DbMapSqlConstants.DOT + dbMapEntry.getName();
sb.append(Messages.getString("DbGenerationManager.OuputExpSetMessage", str)); //$NON-NLS-1$
sb.append(DbMapSqlConstants.RIGHT_COMMENT);
appendSqlQuery(sb, Messages.getString("DbGenerationManager.OuputExpSetMessage", str));//$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_COMMENT);
}
}
}
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
sb.append(DbMapSqlConstants.FROM);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.FROM);
List<ExternalDbMapTable> inputTables = data.getInputTables();
// load input table in hash
@@ -358,8 +366,8 @@ public abstract class DbGenerationManager {
}
}
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
IJoinType previousJoinType = null;
for (int i = 0; i < lstSizeInputTables; i++) {
@@ -381,13 +389,14 @@ public abstract class DbGenerationManager {
buildTableDeclaration(component, sb, inputTables.get(i - 1), commaCouldBeAdded, crCouldBeAdded, true);
previousJoinType = joinType;
} else {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
}
String labelJoinType = joinType.getLabel();
sb.append(labelJoinType);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, labelJoinType);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
if (joinType == AbstractDbLanguage.JOIN.CROSS_JOIN) {
ExternalDbMapTable nextTable = null;
if (i < lstSizeInputTables) {
@@ -403,19 +412,19 @@ public abstract class DbGenerationManager {
// } else {
// sb.append(" <!! NO JOIN CLAUSES FOR '" + inputTable.getName() + "' !!> ");
// }
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.ON);
sb.append(DbMapSqlConstants.LEFT_BRACKET);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.ON);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_BRACKET);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
if (!buildConditions(component, sb, inputTable, true, true)) {
sb.append(DbMapSqlConstants.LEFT_COMMENT);
sb.append(DbMapSqlConstants.SPACE);
sb.append(Messages.getString("DbGenerationManager.conditionNotSet")); //$NON-NLS-1$
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.RIGHT_COMMENT);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_COMMENT);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, Messages.getString("DbGenerationManager.conditionNotSet"));//$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_COMMENT);
}
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.RIGHT_BRACKET);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_BRACKET);
}
}
@@ -473,35 +482,39 @@ public abstract class DbGenerationManager {
boolean whereOriginalFlag = !originalWhereAddition.isEmpty();
if (whereFlag || whereAddFlag || whereOriginalFlag) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
sb.append(DbMapSqlConstants.WHERE);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.WHERE);
}
if (whereFlag) {
sb.append(whereClauses);
appendSqlQuery(sb, whereClauses);
}
if (whereAddFlag) {
for (int i = 0; i < whereAddition.size(); i++) {
if (i == 0 && whereFlag || i > 0) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.AND);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.AND);
}
sb.append(DbMapSqlConstants.SPACE);
sb.append(whereAddition.get(i));
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, whereAddition.get(i));
}
}
if (whereOriginalFlag) {
for (String s : originalWhereAddition) {
sb.append(DbMapSqlConstants.NEW_LINE);
sb.append(DbMapSqlConstants.SPACE);
sb.append(s);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, s);
}
}
if (!otherAddition.isEmpty()) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
for (String s : otherAddition) {
sb.append(s);
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, s);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
}
}
@@ -514,9 +527,11 @@ public abstract class DbGenerationManager {
sqlQuery = sqlQuery.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
replaceQueryContext(querySegments, context);
if (queryColumnsName.contains(context)) {
queryColumnsName = queryColumnsName.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
replaceQueryContext(queryColumnsSegments, context);
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
@@ -524,9 +539,11 @@ public abstract class DbGenerationManager {
if (sqlQuery.contains(context)) {
sqlQuery = sqlQuery.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
replaceQueryContext(querySegments, context);
if (queryColumnsName.contains(context)) {
queryColumnsName = queryColumnsName.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
replaceQueryContext(queryColumnsSegments, context);
}
}
}
@@ -535,6 +552,40 @@ public abstract class DbGenerationManager {
return sqlQuery;
}
protected void replaceQueryContext(List<String> querySegments, String context) {
if (querySegments == null || querySegments.size() == 0) {
return;
}
for (int i = 0; i < querySegments.size(); i++) {
String segment = querySegments.get(i);
if (segment.contains(context)) {
segment = segment.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
querySegments.set(i, segment);
}
}
}
protected void appendSqlQuery(StringBuilder sb, String value) {
appendSqlQuery(sb, value, true);
}
protected void appendSqlQuery(StringBuilder sb, String value, boolean addToQuerySegment) {
if (!"".equals(value)) {//$NON-NLS-1$
sb.append(value);
if (addToQuerySegment) {
querySegments.add(value);
}
}
}
public List<String> getQuerySegments() {
return querySegments;
}
public List<String> getQueryColumnsSegments() {
return queryColumnsSegments;
}
protected String handleQuery(String query) {
if (query != null) {
@@ -697,7 +748,7 @@ public abstract class DbGenerationManager {
*/
protected void buildTableDeclaration(DbMapComponent component, StringBuilder sb, ExternalDbMapTable inputTable,
boolean commaCouldBeAdded, boolean crCouldBeAdded, boolean writingInJoin) {
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
String alias = inputTable.getAlias();
if (alias != null) {
List<IConnection> inputConnections = (List<IConnection>) component.getIncomingConnections();
@@ -714,31 +765,34 @@ public abstract class DbGenerationManager {
buildTableDeclaration(component, sb, inputTable);
} else if (!aliasAlreadyDeclared.contains(inputTable.getName())) {
if (crCouldBeAdded) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
if (commaCouldBeAdded) {
sb.append(DbMapSqlConstants.COMMA);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.COMMA);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
}
sb.append(getHandledTableName(component, inputTable.getTableName()));
sb.append(DbMapSqlConstants.SPACE);
sb.append(getHandledField(alias));
String handledTableName = getHandledTableName(component, inputTable.getTableName());
appendSqlQuery(sb, handledTableName);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
String handledField = getHandledField(alias);
appendSqlQuery(sb, handledField);
aliasAlreadyDeclared.add(alias);
} else {
if (writingInJoin) {
sb.append(getHandledTableName(component, inputTable.getName()));
appendSqlQuery(sb, getHandledTableName(component, inputTable.getName()));
}
}
} else {
if (crCouldBeAdded) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
if (commaCouldBeAdded) {
sb.append(DbMapSqlConstants.COMMA);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.COMMA);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
}
buildTableDeclaration(component, sb, inputTable);
}
}
@@ -788,9 +842,15 @@ public abstract class DbGenerationManager {
int begin = 1;
int end = deliveredTable.length() - 1;
if (begin <= end) {
sb.append("(").append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString).append(" "); //$NON-NLS-1$ //$NON-NLS-2$
sb.append(deliveredTable.substring(begin, end)).append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString)
.append(" ) "); //$NON-NLS-1$
appendSqlQuery(sb, "("); //$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, " "); //$NON-NLS-1$
appendSqlQuery(sb, deliveredTable.substring(begin, end));
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, " ) "); //$NON-NLS-1$
}
}
String tableColneName = tableName;
@@ -807,9 +867,8 @@ public abstract class DbGenerationManager {
String tableLabel = tableEntry.getKey();
String schemaValue = tableEntry.getValue();
if (tableLabel.equals(metadataTable.getLabel()) && tableColneName.equals(tableLabel)) {
sb.append(schemaValue);
sb.append("."); //$NON-NLS-1$
sb.append(tableName);
String name = schemaValue + "." + tableName; //$NON-NLS-1$
appendSqlQuery(sb, name);
replace = true;
}
}
@@ -817,16 +876,14 @@ public abstract class DbGenerationManager {
}
} else if (tableName != null) {
if (inputTableName.equals(metadataTable.getLabel()) && tableColneName.equals(inputTableName)) {
sb.append(tableName);
appendSqlQuery(sb, tableName);
replace = true;
}
}
if (!replace) {
sb.append(inputTable.getName());
appendSqlQuery(sb, inputTable.getName());
}
}
}
protected static boolean isELTDBMap(INode node) {

View File

@@ -42,7 +42,12 @@ public class HiveGenerationManager extends DbGenerationManager {
if (inputTableName != null && inputTableName.contains(".")) {
String[] inputTableNames = inputTableName.split("\\.");
if (inputTableNames.length > 1) {
query = query.replaceAll(inputTableName + "\\.", inputTableNames[1] + ".");
query = query.replaceAll(inputTableName + "\\.", inputTableNames[1] + "."); //$NON-NLS-1$ //$NON-NLS-2$
for (int i = 0; i < querySegments.size(); i++) {
String segment = querySegments.get(i);
segment = segment.replaceAll(inputTableName + "\\.", inputTableNames[1] + "."); //$NON-NLS-1$ //$NON-NLS-2$
querySegments.set(i, segment);
}
}
}
}

View File

@@ -65,6 +65,8 @@ public class OracleGenerationManager extends DbGenerationManager {
public String buildSqlSelect(DbMapComponent component, String outputTableName, String tabString) {
queryColumnsName = "\""; //$NON-NLS-1$
aliasAlreadyDeclared.clear();
queryColumnsSegments.clear();
querySegments.clear();
this.tabSpaceString = tabString;
List<IConnection> outputConnections = (List<IConnection>) component.getOutgoingConnections();
@@ -101,9 +103,10 @@ public class OracleGenerationManager extends DbGenerationManager {
// outputTable = removeUnmatchingEntriesWithColumnsOfMetadataTable(outputTable, metadataTable);
}
}
sb.append("\""); //$NON-NLS-1$
sb.append(DbMapSqlConstants.SELECT);
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, "\"", false); //$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.SELECT);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
List<ExternalDbMapEntry> metadataTableEntries = outputTable.getMetadataTableEntries();
if (metadataTableEntries != null) {
@@ -126,14 +129,15 @@ public class OracleGenerationManager extends DbGenerationManager {
+ getAliasOf(dbMapEntry.getName());
added = true;
}
String columnSegment = expression;
if (i > 0) {
sb.append(DbMapSqlConstants.COMMA);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.COMMA);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
queryColumnsName += DbMapSqlConstants.COMMA + DbMapSqlConstants.SPACE;
columnSegment = DbMapSqlConstants.COMMA + DbMapSqlConstants.SPACE + columnSegment;
}
if (expression != null && expression.trim().length() > 0) {
sb.append(expression);
appendSqlQuery(sb, expression);
if (component.getMapperMain() == null) {
component.getExternalEmfData();
}
@@ -158,22 +162,25 @@ public class OracleGenerationManager extends DbGenerationManager {
}
}
if (!added && columnChanged) {
sb.append(DbMapSqlConstants.SPACE + DbMapSqlConstants.AS + DbMapSqlConstants.SPACE
+ getAliasOf(dbMapEntry.getName()));
String name = DbMapSqlConstants.SPACE + DbMapSqlConstants.AS + DbMapSqlConstants.SPACE
+ getAliasOf(dbMapEntry.getName());
appendSqlQuery(sb, name);
}
}
queryColumnsName += expression;
queryColumnsSegments.add(columnSegment);
} else {
sb.append(DbMapSqlConstants.LEFT_COMMENT);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_COMMENT);
String str = outputTable.getName() + DbMapSqlConstants.DOT + dbMapEntry.getName();
sb.append(Messages.getString("DbGenerationManager.OuputExpSetMessage", str)); //$NON-NLS-1$
sb.append(DbMapSqlConstants.RIGHT_COMMENT);
appendSqlQuery(sb, Messages.getString("DbGenerationManager.OuputExpSetMessage", str));//$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_COMMENT);
}
}
}
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
sb.append(DbMapSqlConstants.FROM);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.FROM);
List<ExternalDbMapTable> inputTables = data.getInputTables();
@@ -200,7 +207,8 @@ public class OracleGenerationManager extends DbGenerationManager {
}
}
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
IJoinType previousJoinType = null;
@@ -223,13 +231,14 @@ public class OracleGenerationManager extends DbGenerationManager {
buildTableDeclaration(component, sb, inputTables.get(i - 1), commaCouldBeAdded, crCouldBeAdded, true);
previousJoinType = joinType;
} else {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
}
String labelJoinType = joinType.getLabel();
sb.append(labelJoinType);
sb.append(DbMapSqlConstants.SPACE);
appendSqlQuery(sb, labelJoinType);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
if (joinType == AbstractDbLanguage.JOIN.CROSS_JOIN) {
ExternalDbMapTable nextTable = null;
if (i < lstSizeInputTables) {
@@ -244,20 +253,20 @@ public class OracleGenerationManager extends DbGenerationManager {
// if (rightTable != null) {
// } else {
// sb.append(" <!! NO JOIN CLAUSES FOR '" + inputTable.getName() + "' !!> ");
// }
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.ON);
sb.append(DbMapSqlConstants.LEFT_BRACKET);
sb.append(DbMapSqlConstants.SPACE);
// }
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.ON);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_BRACKET);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
if (!buildConditions(component, sb, inputTable, true, true)) {
sb.append(DbMapSqlConstants.LEFT_COMMENT);
sb.append(DbMapSqlConstants.SPACE);
sb.append(Messages.getString("DbGenerationManager.conditionNotSet")); //$NON-NLS-1$
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.RIGHT_COMMENT);
appendSqlQuery(sb, DbMapSqlConstants.LEFT_COMMENT);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, Messages.getString("DbGenerationManager.conditionNotSet"));//$NON-NLS-1$
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_COMMENT);
}
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.RIGHT_BRACKET);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.RIGHT_BRACKET);
}
}
@@ -315,35 +324,39 @@ public class OracleGenerationManager extends DbGenerationManager {
boolean whereOriginalFlag = !originalWhereAddition.isEmpty();
if (whereFlag || whereAddFlag || whereOriginalFlag) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
sb.append(DbMapSqlConstants.WHERE);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.WHERE);
}
if (whereFlag) {
sb.append(whereClauses);
}
if (whereAddFlag) {
for (int i = 0; i < whereAddition.size(); i++) {
if (i == 0 && whereFlag || i > 0) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
sb.append(DbMapSqlConstants.SPACE);
sb.append(DbMapSqlConstants.AND);
if (i == 0 && whereFlag || i > 0) {
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, DbMapSqlConstants.AND);
}
sb.append(DbMapSqlConstants.SPACE);
sb.append(whereAddition.get(i));
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, whereAddition.get(i));
}
}
if (whereOriginalFlag) {
for (String s : originalWhereAddition) {
sb.append(DbMapSqlConstants.NEW_LINE);
sb.append(DbMapSqlConstants.SPACE);
sb.append(s);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
appendSqlQuery(sb, s);
}
}
if (!otherAddition.isEmpty()) {
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
for (String s : otherAddition) {
sb.append(s);
sb.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
appendSqlQuery(sb, s);
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
appendSqlQuery(sb, tabSpaceString);
}
}
}
@@ -356,9 +369,11 @@ public class OracleGenerationManager extends DbGenerationManager {
sqlQuery = sqlQuery.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
haveReplace = true;
}
replaceQueryContext(querySegments, context);
if (queryColumnsName.contains(context)) {
queryColumnsName = queryColumnsName.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
replaceQueryContext(queryColumnsSegments, context);
}
if (!haveReplace) {
List<String> connContextList = getConnectionContextList(component);
@@ -366,9 +381,11 @@ public class OracleGenerationManager extends DbGenerationManager {
if (sqlQuery.contains(context)) {
sqlQuery = sqlQuery.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
replaceQueryContext(querySegments, context);
if (queryColumnsName.contains(context)) {
queryColumnsName = queryColumnsName.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
replaceQueryContext(queryColumnsSegments, context);
}
}
}

View File

@@ -1,16 +1,10 @@
package org.talend.designer.dbmap.service;
import java.util.List;
import org.eclipse.gef.commands.Command;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.node.IExternalMapTable;
import org.talend.designer.core.IDbMapDesignerService;
import org.talend.designer.dbmap.DbMapComponent;
import org.talend.designer.dbmap.command.UpdateELTMapComponentCommand;
import org.talend.designer.dbmap.external.data.ExternalDbMapEntry;
import org.talend.designer.dbmap.external.data.ExternalDbMapTable;
public class DbMapDesignerService implements IDbMapDesignerService {

View File

@@ -14,6 +14,7 @@ package org.talend.designer.dbmap.service;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.talend.core.model.process.IExternalNode;
import org.talend.core.service.IDbMapService;
import org.talend.designer.core.model.utils.emf.talendfile.AbstractExternalData;
@@ -42,25 +43,28 @@ public class DbMapService implements IDbMapService {
AbstractExternalData nodeData = nodeType.getNodeData();
if (nodeData instanceof DBMapData) {
DBMapData dbMapData = (DBMapData) nodeData;
// may have several tables with different aliases.
boolean isAliasIncludeTableName = false;
for (InputTable input : dbMapData.getInputTables()) {
if (input.getName().equals(oldValue) || input.getTableName().equals(oldValue)) {
input.setName(newValue);
input.setTableName(newValue);
String alias = input.getAlias();
if (alias != null) {
if (alias.contains(oldValue)) {
isAliasIncludeTableName = true;
}
}
}
}
// do this when no alias in expression(or has alias which alias = old tableName, when tableName change to new, don't change alias in expression)
for (OutputTable output : dbMapData.getOutputTables()) {
List<DBMapperTableEntry> entries = output.getDBMapperTableEntries();
for (DBMapperTableEntry entry : entries) {
String expression = entry.getExpression();
if (expression != null && !"".equals(expression.trim())) { //$NON-NLS-1$
int index = expression.lastIndexOf("."); //$NON-NLS-1$
// at least "a.b"
if (index > 0) {
String connectionName = expression.substring(0, index);
if (oldValue.equals(connectionName)) {
entry.setExpression(newValue + expression.substring(index, expression.length()));
}
}
if (!StringUtils.isBlank(expression) && expression.contains(oldValue) && !isAliasIncludeTableName) {
entry.setExpression(expression.replace(oldValue, newValue));
}
}
}

View File

@@ -102,7 +102,11 @@ public class MapperSettingsManager {
currentModel.setTempDataDir(defaultModel.getTempDataDir());
currentModel.setRowBufferSize(defaultModel.getRowBufferSize());
AbstractMapComponent component = manager.getAbstractMapComponent();
IElementParameter parameter = component.getElementParameter(REPLICATED_JOIN);
IElementParameter parameter = component.getElementParameter(DIE_ON_ERROR);
if (parameter != null && parameter.getValue() != null && parameter.getValue() instanceof Boolean) {
currentModel.setDieOnError((Boolean) parameter.getValue());
}
parameter = component.getElementParameter(REPLICATED_JOIN);
if (parameter != null && parameter.getValue() != null && parameter.getValue() instanceof Boolean) {
currentModel.setReplicatedJoin((Boolean) parameter.getValue());
}

View File

@@ -218,6 +218,7 @@
<moduleSets>
<moduleSet>
<!-- for routines or talend libs -->
<includeSubModules>false</includeSubModules>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>${routines.binaries.includes.set}</include>
@@ -232,6 +233,7 @@
</moduleSet>
<moduleSet>
<!-- for pigudfs or talend libs -->
<includeSubModules>false</includeSubModules>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>${pigudfs.binaries.includes.set}</include>

View File

@@ -22,7 +22,6 @@
<talend.project.name>@ProjectName@</talend.project.name>
<talend.project.name.lowercase>@ProjectName@</talend.project.name.lowercase>
<talend.project.id>@ProjectId@</talend.project.id>
<talend.project.branch>@ProjectBranch@</talend.project.branch>
<talend.job.name>@JobName@</talend.job.name>
<talend.job.version>@JobVersion@</talend.job.version>
<talend.job.date>@JobDate@</talend.job.date>

View File

@@ -54,6 +54,7 @@ import org.talend.core.repository.utils.Log4jUtil;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
import org.talend.core.ui.ITestContainerProviderService;
import org.talend.designer.maven.tools.ProjectPomManager;
import org.talend.designer.runprocess.i18n.Messages;
import org.talend.designer.runprocess.java.JavaProcessorUtilities;
import org.talend.designer.runprocess.language.SyntaxCheckerFactory;
@@ -256,7 +257,8 @@ public class DefaultRunProcessService implements IRunProcessService {
* org.talend.core.model.process.IProcess, java.util.Set)
*/
@Override
public void updateLibraries(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules) {
public void updateLibraries(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules)
throws ProcessorException {
JavaProcessorUtilities.computeLibrariesPath(new HashSet<ModuleNeeded>(jobModuleList), process, alreadyRetrievedModules);
}
@@ -525,4 +527,15 @@ public class DefaultRunProcessService implements IRunProcessService {
return JavaProcessorUtilities.extractLibNamesOnlyForMapperAndReducer(process);
}
@Override
public void updateProjectPomWithTemplate() {
try {
ProjectPomManager manager = new ProjectPomManager(getTalendProcessJavaProject().getProject());
manager.updateFromTemplate(null);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}

View File

@@ -30,9 +30,7 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.ui.IStartup;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.generation.JavaUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.designer.maven.model.TalendMavenConstants;
@@ -49,12 +47,14 @@ public class DeleteAllJobWhenStartUp implements IStartup {
public static boolean executed;
private boolean startUnderPluginModel;
public void startup(boolean pluginModel) {
startUnderPluginModel = pluginModel;
public void startup() {
earlyStartup();
}
@Deprecated
public void startup(boolean pluginModel) {
startup();
}
/*
* (non-Javadoc)
@@ -63,10 +63,6 @@ public class DeleteAllJobWhenStartUp implements IStartup {
*/
@Override
public void earlyStartup() {
if (!startUnderPluginModel && !CorePlugin.getDefault().getRepositoryService().isRCPMode()) {
return;
}
if (!GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
return;
}

View File

@@ -189,7 +189,8 @@ public class RunProcessService implements IRunProcessService {
* org.talend.core.model.process.IProcess, java.util.Set)
*/
@Override
public void updateLibraries(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules) {
public void updateLibraries(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules)
throws ProcessorException {
delegateService.updateLibraries(jobModuleList, process, alreadyRetrievedModules);
}
@@ -366,4 +367,9 @@ public class RunProcessService implements IRunProcessService {
return delegateService.getLibJarsForBD(process);
}
@Override
public void updateProjectPomWithTemplate() {
delegateService.updateProjectPomWithTemplate();
}
}

View File

@@ -144,16 +144,16 @@ import org.talend.utils.io.FilesUtils;
/**
* Creat the package folder for the java file, and put the generated file to the correct folder.
*
*
* The creation for the java package should follow the pattern below:
*
*
* 1)The name for the first grade folder should keep same with the T.O.S project name. 2)The folder name within the
* project should be the job name.
*
*
* <br/>
*
*
* $Id: JavaProcessor.java 2007-1-22 上<>?<3F>10:53:24 yzhang $
*
*
*/
@SuppressWarnings("restriction")
public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpointListener {
@@ -194,9 +194,9 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Set current status.
*
*
* DOC yzhang Comment method "setStatus".
*
*
* @param states
*/
public void setStatus(IJavaProcessorStates states) {
@@ -205,7 +205,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Constructs a new JavaProcessor.
*
*
* @param process Process to be turned in Java code.
* @param filenameFromLabel Tells if filename is based on id or label of the process.
*/
@@ -262,7 +262,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* Initialization of the variable codePath and contextPath.
*
*
* @see org.talend.designer.runprocess.IProcessor#initPaths(org.talend.core.model .process.IContext)
*/
@Override
@@ -386,7 +386,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* DOC chuang Comment method "computeMethodSizeIfNeeded".
*
*
* @param processCode
* @return
*/
@@ -502,7 +502,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* Append the generated java code form context into java file wihtin the project. If the file not existed new one
* will be created.
*
*
* @see org.talend.designer.runprocess.IProcessor#generateCode(org.talend.core .model.process.IContext, boolean,
* boolean, boolean)
*/
@@ -631,7 +631,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
}
/**
*
*
* Test the formating source codes,only when talend debug mode
*/
private void writeCodesToFile(String contents, String fileBaseName) {
@@ -755,9 +755,9 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* DOC nrousseau Comment method "formatCode".
*
*
* from SourceViewer.doOperation for FORMAT.
*
*
* @param processCode
* @return
*/
@@ -840,7 +840,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getCodeContext()
*/
@Override
@@ -854,7 +854,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getCodePath()
*/
@Override
@@ -864,7 +864,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getContextPath()
*/
@Override
@@ -874,7 +874,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getDataSetPath()
*/
@Override
@@ -884,7 +884,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getCodeProject()
*/
@Override
@@ -894,7 +894,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Find line numbers of the beginning of the code of process nodes.
*
*
* @param file Code file where we are searching node's code.
* @param nodes List of nodes searched.
* @return Line numbers where code of nodes appears.
@@ -949,7 +949,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Return line number where stands specific node in code generated.
*
*
* @param nodeName
*/
@Override
@@ -972,7 +972,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Tells if a line is a line of perl code, not an empty or comment line.
*
*
* @param line The tested line of code.
* @return true if the line is a line of code.
*/
@@ -983,7 +983,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Set java breakpoints in a java file.
*
*
* @param srcFile Java file in wich breakpoints are added.
* @param lineNumbers Line numbers in the source file where breakpoints are installed.
* @throws CoreException Breakpoint addition failed.
@@ -1008,7 +1008,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* Get the interpreter of Java.
*
*
* @see org.talend.designer.runprocess.IProcessor#getInterpreter()
*/
@Override
@@ -1048,7 +1048,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Getter for compliedCodePath.
*
*
* @return the compliedCodePath
*/
public IPath getCompiledCodePath() {
@@ -1058,7 +1058,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Getter for compiledContextPath.
*
*
* @return the compiledContextPath
*/
public IPath getCompiledContextPath() {
@@ -1068,7 +1068,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Getter for codePath.
*
*
* @return the codePath
*/
public IPath getSrcCodePath() {
@@ -1078,7 +1078,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Getter for srcContextPath.
*
*
* @return the srcContextPath
*/
public IPath getSrcContextPath() {
@@ -1088,7 +1088,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Getter for SrcDataSetPath.
*
*
* @return the SrcDataSetPath
*/
public IPath getSrcDataSetPath() {
@@ -1452,7 +1452,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getProcessorType()
*/
@Override
@@ -1462,7 +1462,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#getProcessorStates()
*/
@Override
@@ -1477,7 +1477,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* Get current class name, and it imported package structure.
*
*
* @see org.talend.designer.runprocess.IProcessor#getTypeName()
*/
@Override
@@ -1487,7 +1487,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.IProcessor#saveLaunchConfiguration()
*/
@Override
@@ -1543,7 +1543,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.talend.designer.runprocess.Processor#generateContextCode()
*/
@Override
@@ -1718,7 +1718,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* Check current stream whether zip stream by check header signature. Zip header signature = 0x504B 0304(big endian)
*
*
* @param wsdlStream the wsdl stream. <b>Must Support Mark&Reset . Must at beginning of stream.</b>
* @return true, if is zip stream.
* @throws IOException Signals that an I/O exception has occurred.
@@ -1775,7 +1775,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.eclipse.jdt.debug.core.IJavaBreakpointListener#addingBreakpoint(org
* .eclipse.jdt.debug.core.IJavaDebugTarget, org.eclipse.jdt.debug.core.IJavaBreakpoint)
*/
@@ -1786,7 +1786,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @seeorg.eclipse.jdt.debug.core.IJavaBreakpointListener#
* breakpointHasCompilationErrors(org.eclipse.jdt.debug.core. IJavaLineBreakpoint,
* org.eclipse.jdt.core.dom.Message[])
@@ -1799,7 +1799,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @seeorg.eclipse.jdt.debug.core.IJavaBreakpointListener# breakpointHasRuntimeException(org.eclipse.jdt.debug.core.
* IJavaLineBreakpoint, org.eclipse.debug.core.DebugException)
*/
@@ -1811,7 +1811,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.eclipse.jdt.debug.core.IJavaBreakpointListener#breakpointHit(org. eclipse.jdt.debug.core.IJavaThread,
* org.eclipse.jdt.debug.core.IJavaBreakpoint)
*/
@@ -1823,7 +1823,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.eclipse.jdt.debug.core.IJavaBreakpointListener#breakpointInstalled
* (org.eclipse.jdt.debug.core.IJavaDebugTarget , org.eclipse.jdt.debug.core.IJavaBreakpoint)
*/
@@ -1834,7 +1834,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.eclipse.jdt.debug.core.IJavaBreakpointListener#breakpointRemoved(
* org.eclipse.jdt.debug.core.IJavaDebugTarget, org.eclipse.jdt.debug.core.IJavaBreakpoint)
*/
@@ -1848,7 +1848,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/**
* yzhang Comment method "updateGraphicalNodeBreaking".
*
*
* @param breakpoint
*/
private void updateGraphicalNodeBreaking(IJavaBreakpoint breakpoint, boolean removed) {
@@ -1922,7 +1922,7 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
/*
* (non-Javadoc)
*
*
* @see org.eclipse.jdt.debug.core.IJavaBreakpointListener#installingBreakpoint
* (org.eclipse.jdt.debug.core.IJavaDebugTarget , org.eclipse.jdt.debug.core.IJavaBreakpoint,
* org.eclipse.jdt.debug.core.IJavaType)
@@ -1935,7 +1935,10 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
@Override
public Property getProperty() {
if (property == null) {
property = ItemCacheManager.getProcessItem(process.getId(), process.getVersion()).getProperty();
ProcessItem processItem = ItemCacheManager.getProcessItem(process.getId(), process.getVersion());
if (processItem != null) {
property = processItem.getProperty();
}
}
return property;
}

View File

@@ -69,6 +69,7 @@ import org.talend.designer.maven.tools.MavenPomSynchronizer;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.maven.utils.TalendCodeProjectUtil;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.designer.runprocess.ProcessorException;
import org.talend.designer.runprocess.RunProcessPlugin;
import org.talend.designer.runprocess.i18n.Messages;
import org.talend.librariesmanager.model.ModulesNeededProvider;
@@ -158,6 +159,7 @@ public class JavaProcessorUtilities {
public static Set<ModuleNeeded> getNeededModulesForProcess(IProcess process) {
Set<ModuleNeeded> neededLibraries = new HashSet<ModuleNeeded>();
Set<ModuleNeeded> neededModules = LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(process.getId(),
process.getVersion());
neededLibraries.addAll(neededModules);
@@ -266,7 +268,11 @@ public class JavaProcessorUtilities {
* @see org.talend.designer.runprocess.IProcessor#computeLibrariesPath(Set<String>)
*/
public static void computeLibrariesPath(Set<ModuleNeeded> jobModuleList, IProcess process) {
computeLibrariesPath(jobModuleList, process, new HashSet<ModuleNeeded>());
try {
computeLibrariesPath(jobModuleList, process, new HashSet<ModuleNeeded>());
} catch (ProcessorException e) {
ExceptionHandler.process(e);
}
}
/**
@@ -275,9 +281,10 @@ public class JavaProcessorUtilities {
* @param hashSet
* @param process
* @param alreadyRetrievedModules
* @throws BusinessException
*/
public static void computeLibrariesPath(Set<ModuleNeeded> jobModuleList, IProcess process,
Set<ModuleNeeded> alreadyRetrievedModules) {
Set<ModuleNeeded> alreadyRetrievedModules) throws ProcessorException {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(
Context.REPOSITORY_CONTEXT_KEY);
Project project = repositoryContext.getProject();
@@ -287,8 +294,6 @@ public class JavaProcessorUtilities {
// use maven to update the class path.
try {
sortClasspath(jobModuleList, process, alreadyRetrievedModules);
} catch (BusinessException be1) {
ExceptionHandler.process(be1);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
@@ -302,7 +307,7 @@ public class JavaProcessorUtilities {
// command
// // line in run mode
private static void sortClasspath(Set<ModuleNeeded> jobModuleList, IProcess process, Set<ModuleNeeded> alreadyRetrievedModules)
throws CoreException, BusinessException {
throws CoreException, ProcessorException {
ITalendProcessJavaProject jProject = getTalendJavaProject();
if (jProject == null) {
return;
@@ -411,7 +416,7 @@ public class JavaProcessorUtilities {
* @throws BusinessException
*/
private static void handleMissingJarsForProcess(Set<String> missingJarsForRoutines, final Set<String> missingJarsForProcess,
String missingJars) throws BusinessException {
String missingJars) throws ProcessorException {
final StringBuffer sb = new StringBuffer(""); //$NON-NLS-1$
if (missingJarsForProcess.size() > 0) {
sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.forProcess")); //$NON-NLS-1$
@@ -461,8 +466,9 @@ public class JavaProcessorUtilities {
});
}
} else if (!Boolean.getBoolean("skip_missing_jars")) {
throw new ProcessorException(missingJars);
}
throw new BusinessException(missingJars);
} else {
if (missingJarsForRoutines.size() > 0) {
@@ -548,6 +554,7 @@ public class JavaProcessorUtilities {
public static boolean hasBatchOrStreamingSubProcess(Item item) throws PersistenceException {
return hasBatchOrStreamingSubProcess(item, new HashSet<String>());
}
public static boolean hasBatchOrStreamingSubProcess(Item item, Set<String> testedItems) throws PersistenceException {
if (testedItems.contains(item.getProperty().getId())) {
return false;
@@ -582,9 +589,10 @@ public class JavaProcessorUtilities {
IRepositoryViewObject lastVersion = RunProcessPlugin.getDefault().getRepositoryService()
.getProxyRepositoryFactory().getLastVersion(value.toString());
if (lastVersion != null) {
boolean hasBatchOrStreaming = hasBatchOrStreamingSubProcess(lastVersion.getProperty().getItem(), testedItems);
boolean hasBatchOrStreaming = hasBatchOrStreamingSubProcess(lastVersion.getProperty()
.getItem(), testedItems);
if (hasBatchOrStreaming) {
// only stop the loop once we checked every child
// only stop the loop once we checked every child
return hasBatchOrStreaming;
}
}

View File

@@ -292,7 +292,8 @@ public class TalendProcessJavaProject implements ITalendProcessJavaProject {
if (childModulePomFile.getLocation().toFile().exists()) { // existed
MavenPomCommandLauncher mavenLauncher = null;
// by default is compile
if (goals == null || goals.trim().length() == 0 || goals.equals(TalendMavenConstants.GOAL_COMPILE)) {
if (goals == null || goals.trim().length() == 0 || goals.equals(TalendMavenConstants.GOAL_COMPILE)
|| goals.equals(TalendMavenConstants.GOAL_TEST_COMPILE)) {
// mavenLauncher = new MavenPomCommandLauncher(childModulePomFile, TalendMavenConstants.GOAL_REFRESH);
// mavenLauncher.setArgumentsMap(argumentsMap);
// mavenLauncher.execute(monitor);
@@ -360,4 +361,9 @@ public class TalendProcessJavaProject implements ITalendProcessJavaProject {
this.synchronizer.cleanMavenFiles(monitor);
}
@Override
public void regenerateMainProjectPom(IProgressMonitor monitor) throws Exception {
this.synchronizer.regenerateMainProjectPom(monitor, null);
}
}

View File

@@ -14,16 +14,8 @@ package org.talend.designer.runprocess.maven;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.login.AbstractLoginTask;
/**
@@ -34,31 +26,31 @@ public class CleanMavenFilesLoginTask extends AbstractLoginTask implements IRunn
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
final IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) {
try {
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(
IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
talendProcessJavaProject.cleanMavenFiles(monitor);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
};
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace.run(runnable, workspace.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
throw new InvocationTargetException(e);
}
// final IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
//
// @Override
// public void run(IProgressMonitor monitor) {
// try {
// if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
// IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(
// IRunProcessService.class);
// ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
// if (talendProcessJavaProject != null) {
// talendProcessJavaProject.cleanMavenFiles(monitor);
// }
// }
// } catch (Exception e) {
// ExceptionHandler.process(e);
// }
// }
// };
//
// try {
// IWorkspace workspace = ResourcesPlugin.getWorkspace();
// workspace.run(runnable, workspace.getRoot(), IWorkspace.AVOID_UPDATE, monitor);
// } catch (CoreException e) {
// throw new InvocationTargetException(e);
// }
}

View File

@@ -826,14 +826,14 @@ public class ComponentBuilder {
// }
if (xmlSchemaElement.getSchemaTypeName() != null) {
String elementTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
String elementTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
if (elementTypeName != null && elementTypeName.equals("anyType")) {
parameterSon.setName(xmlSchemaElement.getName() + ":anyType");
}
parameterSon.setType(elementTypeName);
parameterSon.setNameSpace(xmlSchemaElement.getQName().getNamespaceURI());
if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
buileParameterFromTypes(xmlSchemaElement.getQName().getNamespaceURI(), elementTypeName, parameterSon,
ioOrRecursion);
buileParameterFromTypes(elementTypeNamespace, elementTypeName, parameterSon, ioOrRecursion);
}
} else if (xmlSchemaElement.getSchemaType() != null) {
if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaComplexType) {

View File

@@ -2737,7 +2737,7 @@
id="org.talend.repository.model.migration.SubstituteRemovedMDMOperatorMigrationTask"
name="SubstituteRemovedMDMOperatorMigrationTask"
version="6.2.0">
</projecttask>
</projecttask>
<projecttask
beforeLogon="false"
breaks="5.6.2"
@@ -2783,7 +2783,7 @@
version="6.2.1">
</projecttask>
<projecttask
beforeLogon="false"
beforeLogon="false"
breaks="6.2.0"
class="org.talend.repository.model.migration.ReplaceVarcharArrayWithVarcharIssueTDI35719"
id="org.talend.repository.model.migration.ReplaceVarcharArrayWithVarcharIssueTDI35719"
@@ -2791,7 +2791,7 @@
version="6.2.1">
</projecttask>
<projecttask
beforeLogon="false"
beforeLogon="false"
breaks="6.2.0"
class="org.talend.repository.model.migration.AddDefaultVersionValueForElasticsearchLookupInput"
id="org.talend.repository.model.migration.AddDefaultVersionValueForElasticsearchLookupInput"
@@ -2833,6 +2833,23 @@
name="ChangeTypeMappingForRedshift"
version="6.3.1">
</projecttask>
<projecttask
beforeLogon="false"
breaks="6.3.0"
class="org.talend.repository.model.migration.ChangeJobsettingDBversionForMssqlMigrationTask"
id="org.talend.repository.model.migration.ChangeJobsettingDBversionForMssqlMigrationTask"
name="Fill the default db version of mssql for Jobsetting"
version="6.3.1">
</projecttask>
<projecttask
beforeLogon="false"
breaks="6.3.1"
class="org.talend.repository.model.migration.spark.UseSqlDateTypeInDataframesTask"
description="Keep Date type for component impacted by change from Date to Timestamp"
id="org.talend.repository.model.migration.spark.UseSqlDateTypeInDataframesTask"
name="UseSqlDateTypeInDataframesTask"
version="6.3.2">
</projecttask>
</extension>
<extension

View File

@@ -0,0 +1,91 @@
// ============================================================================
//
// Copyright (C) 2006-2017 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.model.migration;
import java.util.Date;
import java.util.GregorianCalendar;
import org.eclipse.emf.common.util.EList;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.database.conn.version.EDatabaseVersion4Drivers;
import org.talend.core.model.migration.AbstractJobMigrationTask;
import org.talend.core.model.properties.Item;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.designer.core.model.utils.emf.talendfile.impl.ElementParameterTypeImpl;
/**
* created by hcyi on Nov 29, 2017 Detailled comment
*
*/
public class ChangeJobsettingDBversionForMssqlMigrationTask extends AbstractJobMigrationTask {
private static final ProxyRepositoryFactory FACTORY = ProxyRepositoryFactory.getInstance();
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType.getParameters() != null) {
@SuppressWarnings("rawtypes")
EList elementParameter = processType.getParameters().getElementParameter();
boolean modified = false;
for (int i = 0; i < elementParameter.size(); i++) {
final Object object = elementParameter.get(i);
if (object instanceof ElementParameterTypeImpl) {
ElementParameterTypeImpl parameterType = (ElementParameterTypeImpl) object;
String name = parameterType.getName();
if ("DB_TYPE".equals(name) && parameterType.getValue().startsWith("tMSSql")) { //$NON-NLS-1$//$NON-NLS-2$
modified = updateJarValue(elementParameter);
}
}
}
if (modified) {
try {
FACTORY.save(item, true);
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
}
return ExecutionResult.NOTHING_TO_DO;
}
private boolean updateJarValue(EList elementParameter) {
for (int i = 0; i < elementParameter.size(); i++) {
final Object object = elementParameter.get(i);
if (object instanceof ElementParameterTypeImpl) {
ElementParameterTypeImpl parameterType = (ElementParameterTypeImpl) object;
String name = parameterType.getName();
if ("DB_VERSION".equals(name)) {//$NON-NLS-1$
String value = parameterType.getValue();
if (value.equals(EDatabaseVersion4Drivers.MSSQL.getVersionValue())
|| value.equals(EDatabaseVersion4Drivers.MSSQL_PROP.getVersionValue())) {
// do nothing
} else {
parameterType.setValue(EDatabaseVersion4Drivers.MSSQL.getVersionValue());
return true;
}
}
}
}
return false;
}
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2017, 11, 29, 17, 0, 0);
return gc.getTime();
}
}

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

@@ -34,6 +34,7 @@ import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.component.ComponentsFactoryProvider;
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

@@ -111,6 +111,7 @@ public class UnifyPasswordEncryption4ParametersInJobMigrationTask extends UnifyP
if (value != null
&& (PasswordEncryptUtil.isPasswordType(param.getType()) || PasswordEncryptUtil
.isPasswordField(param.getName()))) {
value = cleanPassword(value);
try {
String rawPassword = PasswordEncryptUtil.decryptPassword(value);
param.setRawValue(rawPassword);
@@ -207,6 +208,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

@@ -53,20 +53,19 @@ public class UpdateELTComponentMigrationTask extends AbstractJobMigrationTask {
if (connection.getLabel().equals(tableName)) {
connection.setLabel(connectionName);
isModified = true;
} else {
// if user custom connection name, keep everything currently they had.
break;
}
List<MetadataTypeImpl> tables = eltInputNode.getMetadata();
for (MetadataTypeImpl table : tables) {
if (table.getLabel().equals(tableName)) {
table.setLabel(connectionName);
isModified = true;
}
MetadataTypeImpl table = (MetadataTypeImpl) eltInputNode.getMetadata().get(0);
if (table.getLabel().equals(tableName)) {
table.setLabel(connectionName);
}
NodeType eltMapNode = getNodeTypeByUniqueName(nodes, targetNodeName);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapService.class)) {
IDbMapService service = (IDbMapService) GlobalServiceRegister.getDefault().getService(IDbMapService.class);
service.updateEMFDBMapData(eltMapNode, tableName, connectionName);
isModified = true;
}
}
}

View File

@@ -0,0 +1,94 @@
// ============================================================================
//
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.model.migration.spark;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.ModifyComponentsAction;
import org.talend.core.model.components.conversions.IComponentConversion;
import org.talend.core.model.components.filters.NameComponentFilter;
import org.talend.core.model.migration.AbstractJobMigrationTask;
import org.talend.core.model.properties.Item;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
/**
*
* @author kcoepeau
*
* Keep Date type for component impacted by change from Date to Timestamp
*
*/
public class UseSqlDateTypeInDataframesTask extends AbstractJobMigrationTask {
@Override
public List<ERepositoryObjectType> getTypes() {
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
toReturn.add(ERepositoryObjectType.PROCESS_SPARK);
toReturn.add(ERepositoryObjectType.PROCESS_SPARKSTREAMING);
return toReturn;
}
@Override
public ExecutionResult execute(Item item) {
ProcessType processType = getProcessType(item);
if (processType == null) {
return ExecutionResult.NOTHING_TO_DO;
}
List<String> impactedComponents =
Arrays.asList("tFileOutputParquet", "tHiveOutput", "tRedshiftOutput", "tSqlRow", "tMatchPairing",
"tMatchPredict");
IComponentConversion addUseTimestampForDateType = new AddUseTimestampForDateType();
try {
for (String componentName : impactedComponents) {
ModifyComponentsAction.searchAndModify(item, processType, new NameComponentFilter(componentName),
Arrays.<IComponentConversion> asList(addUseTimestampForDateType));
}
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
return ExecutionResult.FAILURE;
}
}
private class AddUseTimestampForDateType implements IComponentConversion {
private String field = "CHECK"; //$NON-NLS-1$
private String name = "DATE_TO_TIMESTAMP_DF_TYPE_SUBSTITUTION"; //$NON-NLS-1$
public void transform(NodeType node) {
if (ComponentUtilities.getNodeProperty(node, name) == null) {
ComponentUtilities.addNodeProperty(node, name, field);
ComponentUtilities.setNodeValue(node, name, "false");
}
}
}
@Override
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2018, 8, 10, 18, 0, 0);
return gc.getTime();
}
}

View File

@@ -15,6 +15,7 @@ package org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb;
import java.io.File;
import java.io.FileOutputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -25,11 +26,14 @@ import org.eclipse.core.runtime.Path;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.PluginChecker;
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.repository.utils.ItemResourceUtil;
import org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.designer.maven.template.MavenTemplateManager;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.repository.ProjectManager;
import org.talend.repository.documentation.ExportFileResource;
import org.talend.resources.util.EMavenBuildScriptProperties;
@@ -53,6 +57,8 @@ public class OSGIJavaScriptForESBWithMavenManager extends JavaScriptForESBWithMa
super(exportChoiceMap, contextName, launcher, statisticPort, tracePort);
}
@Override
protected void addMavenBuildScripts(ExportFileResource[] processes, List<URL> scriptsUrls,
Map<String, String> mavenPropertiesMap) {
@@ -74,10 +80,11 @@ public class OSGIJavaScriptForESBWithMavenManager extends JavaScriptForESBWithMa
}
}
final Map<String, Object> templateParameters = PomUtil.getTemplateParameters(item.getProperty());
String mavenScript = MavenTemplateManager.getTemplateContent(templateFile,
IProjectSettingPreferenceConstants.TEMPLATE_OSGI_BUNDLE_POM, PluginChecker.EXPORT_JOB_PLUGIN_ID,
IProjectSettingTemplateConstants.PATH_OSGI_BUNDLE + '/'
+ IProjectSettingTemplateConstants.POM_JOB_TEMPLATE_FILE_NAME);
+ IProjectSettingTemplateConstants.POM_JOB_TEMPLATE_FILE_NAME, templateParameters);
// String mavenScript = mavenUiService
// .getProjectSettingValue(IProjectSettingPreferenceConstants.TEMPLATE_OSGI_BUNDLE_POM);

370
pom.xml
View File

@@ -1,185 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>parent-pom</artifactId>
<version>6.3.1</version>
<relativePath />
</parent>
<artifactId>tdi-studio-se</artifactId>
<packaging>pom</packaging>
<repositories>
<repository>
<id>talend_open</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://newbuild.talend.com:8081/nexus/content/repositories/TalendOpenSourceRelease/</url>
</repository>
<repository>
<id>talend_open_snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>http://newbuild.talend.com:8081/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
</repository>
</repositories>
<modules>
<module>i18n/plugins/org.talend.componentdesigner.nl</module>
<module>i18n/plugins/org.talend.componentdesigner.rcp.nl</module>
<module>i18n/plugins/org.talend.designer.abstractmap.nl</module>
<module>i18n/plugins/org.talend.designer.alfrescooutput.nl</module>
<module>i18n/plugins/org.talend.designer.business.diagram.nl</module>
<module>i18n/plugins/org.talend.designer.codegen.nl</module>
<module>i18n/plugins/org.talend.designer.components.exchange.nl</module>
<module>i18n/plugins/org.talend.designer.core.nl</module>
<module>i18n/plugins/org.talend.designer.dbmap.nl</module>
<module>i18n/plugins/org.talend.designer.documentation.nl</module>
<module>i18n/plugins/org.talend.designer.fileoutputxml.nl</module>
<module>i18n/plugins/org.talend.designer.gefabstractmap.nl</module>
<module>i18n/plugins/org.talend.designer.hl7.nl</module>
<module>i18n/plugins/org.talend.designer.mapper.nl</module>
<module>i18n/plugins/org.talend.designer.maven.job.nl</module>
<module>i18n/plugins/org.talend.designer.rowgenerator.nl</module>
<module>i18n/plugins/org.talend.designer.runprocess.nl</module>
<module>i18n/plugins/org.talend.designer.scd.nl</module>
<module>i18n/plugins/org.talend.designer.webservice.nl</module>
<module>i18n/plugins/org.talend.designer.xmlmap.nl</module>
<module>i18n/plugins/org.talend.expressionbuilder.nl</module>
<module>i18n/plugins/org.talend.presentation.onboarding.resource.nl</module>
<module>i18n/plugins/org.talend.presentation.onboarding.resource.tos.nl</module>
<module>i18n/plugins/org.talend.repository.ftp.nl</module>
<module>i18n/plugins/org.talend.repository.json.nl</module>
<module>i18n/plugins/org.talend.repository.nl</module>
<module>i18n/plugins/org.talend.repository.view.di.nl</module>
<module>i18n/plugins/org.talend.sbi.engines.client.nl</module>
<module>i18n/plugins/org.talend.spagic.engines.client.nl</module>
<module>i18n/plugins/org.talend.sqlbuilder.nl</module>
<module>main/features/org.talend.componentdesigner.feature</module>
<module>main/features/org.talend.designer.feature</module>
<module>main/features/org.talend.designer.business.feature</module>
<module>main/features/org.talend.rcp.branding.tos.feature</module>
<module>main/features/org.talend.rcp.branding.tos.test.feature</module>
<module>main/features/org.talend.repository.feature</module>
<module>main/features/org.talend.sbi.feature</module>
<module>main/features/org.talend.spagic.feature</module>
<module>main/features/org.talend.tos.feature</module>
<module>main/features/org.talend.tos.components.feature</module>
<module>main/features/org.talend.tos.libraries.feature</module>
<module>main/plugins/org.talend.componentdesigner</module>
<module>main/plugins/org.talend.componentdesigner.rcp</module>
<module>main/plugins/org.talend.designer.core.generic</module>
<module>main/plugins/org.talend.repository.generic</module>
<module>main/plugins/org.talend.designer.abstractmap</module>
<module>main/plugins/org.talend.designer.alfrescooutput</module>
<module>main/plugins/org.talend.designer.business.diagram</module>
<module>main/plugins/org.talend.designer.codegen</module>
<module>main/plugins/org.talend.designer.components.exchange</module>
<module>main/plugins/org.talend.designer.components.libs</module>
<module>main/plugins/org.talend.designer.components.localprovider</module>
<module>main/plugins/org.talend.designer.core</module>
<module>main/plugins/org.talend.designer.dbmap</module>
<module>main/plugins/org.talend.designer.documentation</module>
<module>main/plugins/org.talend.designer.filemultischemas</module>
<module>main/plugins/org.talend.designer.fileoutputxml</module>
<module>main/plugins/org.talend.designer.gefabstractmap</module>
<module>main/plugins/org.talend.designer.hl7</module>
<module>main/plugins/org.talend.designer.mapper</module>
<module>main/plugins/org.talend.designer.mapper.advanced</module>
<module>main/plugins/org.talend.designer.maven.job</module>
<module>main/plugins/org.talend.designer.publish.core</module>
<module>main/plugins/org.talend.designer.rowgenerator</module>
<module>main/plugins/org.talend.designer.runprocess</module>
<module>main/plugins/org.talend.designer.scd</module>
<module>main/plugins/org.talend.designer.spss</module>
<module>main/plugins/org.talend.designer.webservice</module>
<module>main/plugins/org.talend.designer.xmlmap</module>
<module>main/plugins/org.talend.expressionbuilder</module>
<module>main/plugins/org.talend.libraries.asm</module>
<module>main/plugins/org.talend.libraries.bonita</module>
<module>main/plugins/org.talend.libraries.crm</module>
<module>main/plugins/org.talend.libraries.css</module>
<module>main/plugins/org.talend.libraries.custom</module>
<module>main/plugins/org.talend.libraries.edifact</module>
<module>main/plugins/org.talend.libraries.ehcache</module>
<module>main/plugins/org.talend.libraries.excel</module>
<module>main/plugins/org.talend.libraries.ftp</module>
<module>main/plugins/org.talend.libraries.groovy</module>
<module>main/plugins/org.talend.libraries.guava</module>
<module>main/plugins/org.talend.libraries.hl7</module>
<module>main/plugins/org.talend.libraries.hl7.jars</module>
<module>main/plugins/org.talend.libraries.jax</module>
<module>main/plugins/org.talend.libraries.jboss</module>
<module>main/plugins/org.talend.libraries.jboss.jars</module>
<module>main/plugins/org.talend.libraries.jersey</module>
<module>main/plugins/org.talend.libraries.jetty</module>
<module>main/plugins/org.talend.libraries.microsoft</module>
<module>main/plugins/org.talend.libraries.mondrian</module>
<module>main/plugins/org.talend.libraries.mozilla</module>
<module>main/plugins/org.talend.libraries.palo</module>
<module>main/plugins/org.talend.libraries.saaj</module>
<module>main/plugins/org.talend.libraries.salesforce</module>
<module>main/plugins/org.talend.libraries.servlet</module>
<module>main/plugins/org.talend.libraries.slf4j</module>
<module>main/plugins/org.talend.libraries.uniserv</module>
<module>main/plugins/org.talend.libraries.w3c</module>
<module>main/plugins/org.talend.libraries.xml</module>
<module>main/plugins/org.talend.libraries.hadoop.mapr.5.0.0</module>
<module>main/plugins/org.talend.presentation.onboarding.resource</module>
<module>main/plugins/org.talend.presentation.onboarding.resource.tos</module>
<module>main/plugins/org.talend.rcp.branding.tos</module>
<module>main/plugins/org.talend.repository</module>
<module>main/plugins/org.talend.repository.ftp</module>
<module>main/plugins/org.talend.libraries.json</module>
<module>main/plugins/org.talend.repository.json</module>
<module>main/plugins/org.talend.repository.view.di</module>
<module>main/plugins/org.talend.sbi.engines.client</module>
<module>main/plugins/org.talend.spagic.engines.client</module>
<module>main/plugins/org.talend.libraries.sqlbuilder</module>
<module>main/plugins/org.talend.libraries.sqlbuilder.jars</module>
<module>main/plugins/org.talend.sqlbuilder</module>
<module>main/plugins/org.talend.designer.runtime.visualization</module>
<module>main/plugins/org.talend.designer.runtime.visualization.tools</module>
<module>test/plugins/org.talend.designer.codegen.test</module>
<module>test/plugins/org.talend.designer.components.localprovider.test</module>
<module>test/plugins/org.talend.designer.core.test</module>
<module>test/plugins/org.talend.designer.dbmap.test</module>
<module>test/plugins/org.talend.designer.mapper.test</module>
<module>test/plugins/org.talend.designer.rowgenerator.test</module>
<module>test/plugins/org.talend.designer.runprocess.test</module>
<module>test/plugins/org.talend.designer.xmlmap.test</module>
<module>test/plugins/org.talend.repository.test</module>
<module>test/plugins/org.talend.repository.generic.test</module>
<module>test/plugins/org.talend.designer.core.generic.test</module>
<module>test/plugins/org.talend.repository.view.di.test</module>
<module>test/plugins/org.talend.designer.webservice.test</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>parent-pom</artifactId>
<version>6.3.1</version>
<relativePath />
</parent>
<artifactId>tdi-studio-se</artifactId>
<packaging>pom</packaging>
<repositories>
<repository>
<id>talend_open</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/</url>
</repository>
<repository>
<id>talend_open_snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
</repository>
</repositories>
<modules>
<module>i18n/plugins/org.talend.componentdesigner.nl</module>
<module>i18n/plugins/org.talend.componentdesigner.rcp.nl</module>
<module>i18n/plugins/org.talend.designer.abstractmap.nl</module>
<module>i18n/plugins/org.talend.designer.alfrescooutput.nl</module>
<module>i18n/plugins/org.talend.designer.business.diagram.nl</module>
<module>i18n/plugins/org.talend.designer.codegen.nl</module>
<module>i18n/plugins/org.talend.designer.components.exchange.nl</module>
<module>i18n/plugins/org.talend.designer.core.nl</module>
<module>i18n/plugins/org.talend.designer.dbmap.nl</module>
<module>i18n/plugins/org.talend.designer.documentation.nl</module>
<module>i18n/plugins/org.talend.designer.fileoutputxml.nl</module>
<module>i18n/plugins/org.talend.designer.gefabstractmap.nl</module>
<module>i18n/plugins/org.talend.designer.hl7.nl</module>
<module>i18n/plugins/org.talend.designer.mapper.nl</module>
<module>i18n/plugins/org.talend.designer.maven.job.nl</module>
<module>i18n/plugins/org.talend.designer.rowgenerator.nl</module>
<module>i18n/plugins/org.talend.designer.runprocess.nl</module>
<module>i18n/plugins/org.talend.designer.scd.nl</module>
<module>i18n/plugins/org.talend.designer.webservice.nl</module>
<module>i18n/plugins/org.talend.designer.xmlmap.nl</module>
<module>i18n/plugins/org.talend.expressionbuilder.nl</module>
<module>i18n/plugins/org.talend.presentation.onboarding.resource.nl</module>
<module>i18n/plugins/org.talend.presentation.onboarding.resource.tos.nl</module>
<module>i18n/plugins/org.talend.repository.ftp.nl</module>
<module>i18n/plugins/org.talend.repository.json.nl</module>
<module>i18n/plugins/org.talend.repository.nl</module>
<module>i18n/plugins/org.talend.repository.view.di.nl</module>
<module>i18n/plugins/org.talend.sbi.engines.client.nl</module>
<module>i18n/plugins/org.talend.spagic.engines.client.nl</module>
<module>i18n/plugins/org.talend.sqlbuilder.nl</module>
<module>main/features/org.talend.componentdesigner.feature</module>
<module>main/features/org.talend.designer.feature</module>
<module>main/features/org.talend.designer.business.feature</module>
<module>main/features/org.talend.rcp.branding.tos.feature</module>
<module>main/features/org.talend.rcp.branding.tos.test.feature</module>
<module>main/features/org.talend.repository.feature</module>
<module>main/features/org.talend.sbi.feature</module>
<module>main/features/org.talend.spagic.feature</module>
<module>main/features/org.talend.tos.feature</module>
<module>main/features/org.talend.tos.components.feature</module>
<module>main/features/org.talend.tos.libraries.feature</module>
<module>main/plugins/org.talend.componentdesigner</module>
<module>main/plugins/org.talend.componentdesigner.rcp</module>
<module>main/plugins/org.talend.designer.core.generic</module>
<module>main/plugins/org.talend.repository.generic</module>
<module>main/plugins/org.talend.designer.abstractmap</module>
<module>main/plugins/org.talend.designer.alfrescooutput</module>
<module>main/plugins/org.talend.designer.business.diagram</module>
<module>main/plugins/org.talend.designer.codegen</module>
<module>main/plugins/org.talend.designer.components.exchange</module>
<module>main/plugins/org.talend.designer.components.libs</module>
<module>main/plugins/org.talend.designer.components.localprovider</module>
<module>main/plugins/org.talend.designer.core</module>
<module>main/plugins/org.talend.designer.dbmap</module>
<module>main/plugins/org.talend.designer.documentation</module>
<module>main/plugins/org.talend.designer.filemultischemas</module>
<module>main/plugins/org.talend.designer.fileoutputxml</module>
<module>main/plugins/org.talend.designer.gefabstractmap</module>
<module>main/plugins/org.talend.designer.hl7</module>
<module>main/plugins/org.talend.designer.mapper</module>
<module>main/plugins/org.talend.designer.mapper.advanced</module>
<module>main/plugins/org.talend.designer.maven.job</module>
<module>main/plugins/org.talend.designer.publish.core</module>
<module>main/plugins/org.talend.designer.rowgenerator</module>
<module>main/plugins/org.talend.designer.runprocess</module>
<module>main/plugins/org.talend.designer.scd</module>
<module>main/plugins/org.talend.designer.spss</module>
<module>main/plugins/org.talend.designer.webservice</module>
<module>main/plugins/org.talend.designer.xmlmap</module>
<module>main/plugins/org.talend.expressionbuilder</module>
<module>main/plugins/org.talend.libraries.asm</module>
<module>main/plugins/org.talend.libraries.bonita</module>
<module>main/plugins/org.talend.libraries.crm</module>
<module>main/plugins/org.talend.libraries.css</module>
<module>main/plugins/org.talend.libraries.custom</module>
<module>main/plugins/org.talend.libraries.edifact</module>
<module>main/plugins/org.talend.libraries.ehcache</module>
<module>main/plugins/org.talend.libraries.excel</module>
<module>main/plugins/org.talend.libraries.ftp</module>
<module>main/plugins/org.talend.libraries.groovy</module>
<module>main/plugins/org.talend.libraries.guava</module>
<module>main/plugins/org.talend.libraries.hl7</module>
<module>main/plugins/org.talend.libraries.hl7.jars</module>
<module>main/plugins/org.talend.libraries.jax</module>
<module>main/plugins/org.talend.libraries.jboss</module>
<module>main/plugins/org.talend.libraries.jboss.jars</module>
<module>main/plugins/org.talend.libraries.jersey</module>
<module>main/plugins/org.talend.libraries.jetty</module>
<module>main/plugins/org.talend.libraries.microsoft</module>
<module>main/plugins/org.talend.libraries.mondrian</module>
<module>main/plugins/org.talend.libraries.mozilla</module>
<module>main/plugins/org.talend.libraries.palo</module>
<module>main/plugins/org.talend.libraries.saaj</module>
<module>main/plugins/org.talend.libraries.salesforce</module>
<module>main/plugins/org.talend.libraries.servlet</module>
<module>main/plugins/org.talend.libraries.slf4j</module>
<module>main/plugins/org.talend.libraries.uniserv</module>
<module>main/plugins/org.talend.libraries.w3c</module>
<module>main/plugins/org.talend.libraries.xml</module>
<module>main/plugins/org.talend.libraries.hadoop.mapr.5.0.0</module>
<module>main/plugins/org.talend.presentation.onboarding.resource</module>
<module>main/plugins/org.talend.presentation.onboarding.resource.tos</module>
<module>main/plugins/org.talend.rcp.branding.tos</module>
<module>main/plugins/org.talend.repository</module>
<module>main/plugins/org.talend.repository.ftp</module>
<module>main/plugins/org.talend.libraries.json</module>
<module>main/plugins/org.talend.repository.json</module>
<module>main/plugins/org.talend.repository.view.di</module>
<module>main/plugins/org.talend.sbi.engines.client</module>
<module>main/plugins/org.talend.spagic.engines.client</module>
<module>main/plugins/org.talend.libraries.sqlbuilder</module>
<module>main/plugins/org.talend.libraries.sqlbuilder.jars</module>
<module>main/plugins/org.talend.sqlbuilder</module>
<module>main/plugins/org.talend.designer.runtime.visualization</module>
<module>main/plugins/org.talend.designer.runtime.visualization.tools</module>
<module>test/plugins/org.talend.designer.codegen.test</module>
<module>test/plugins/org.talend.designer.components.localprovider.test</module>
<module>test/plugins/org.talend.designer.core.test</module>
<module>test/plugins/org.talend.designer.dbmap.test</module>
<module>test/plugins/org.talend.designer.mapper.test</module>
<module>test/plugins/org.talend.designer.rowgenerator.test</module>
<module>test/plugins/org.talend.designer.runprocess.test</module>
<module>test/plugins/org.talend.designer.xmlmap.test</module>
<module>test/plugins/org.talend.repository.test</module>
<module>test/plugins/org.talend.repository.generic.test</module>
<module>test/plugins/org.talend.designer.core.generic.test</module>
<module>test/plugins/org.talend.repository.view.di.test</module>
<module>test/plugins/org.talend.designer.webservice.test</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -162,6 +162,88 @@ public class ConnectionManagerTest {
}
}
/**
* Test method for
* {@link org.talend.designer.core.model.process.ConnectionManager#canConnectToTarget(org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.core.model.process.EConnectionType, java.lang.String, java.lang.String)}
* .
*/
@Test
public void testCanConnectToTargetWithLoop1() {
try {
IComponent component = ComponentsFactoryProvider.getInstance().get("tJava",
ComponentCategory.CATEGORY_4_DI.getName());
Node source1 = new Node(component, sourceProcess);
Node middle1 = new Node(component, sourceProcess);
Node target1 = new Node(component, sourceProcess);
Connection connection1 = new Connection(source1, middle1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "test3",
"test3", "test3", false);
Connection connection2 = new Connection( middle1, target1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "test4",
"test4", "test4", false);
boolean canConnect = ConnectionManager.canConnectToTarget(target1, null, source1, EConnectionType.FLOW_MAIN,
EConnectionType.FLOW_MAIN.getName(), "test_3_4");
assertTrue(!canConnect);
} catch (Exception e) {
e.printStackTrace();
fail("Test CanConnectToSource() method failure.");
}
}
/**
* Test method for
* {@link org.talend.designer.core.model.process.ConnectionManager#canConnectToTarget(org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.core.model.process.EConnectionType, java.lang.String, java.lang.String)}
* .
*/
@Test
public void testCanConnectToTargetWithLoop2() {
try {
IComponent component = ComponentsFactoryProvider.getInstance().get("tJava",
ComponentCategory.CATEGORY_4_DI.getName());
Node source2 = new Node(component, sourceProcess);
Node middle2 = new Node(component, sourceProcess);
Node target2 = new Node(component, sourceProcess);
Connection connection3 = new Connection(source2, middle2, EConnectionType.ON_SUBJOB_OK, EConnectionType.ON_SUBJOB_OK.getName(), "test5",
"test5", "test5", false);
Connection connection4 = new Connection( middle2, target2, EConnectionType.ON_SUBJOB_ERROR, EConnectionType.ON_SUBJOB_ERROR.getName(), "test6",
"test6", "test6", false);
boolean canConnect = ConnectionManager.canConnectToTarget(target2, null, source2, EConnectionType.RUN_IF,
EConnectionType.RUN_IF.getName(), "test_5_6");
assertTrue(!canConnect);
} catch (Exception e) {
e.printStackTrace();
fail("Test CanConnectToSource() method failure.");
}
}
/**
* Test method for
* {@link org.talend.designer.core.model.process.ConnectionManager#canConnectToTarget(org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.core.model.process.EConnectionType, java.lang.String, java.lang.String)}
* .
*/
@Test
public void testCanConnectToTargetWithLoop3() {
try {
IComponent component = ComponentsFactoryProvider.getInstance().get("tJava",
ComponentCategory.CATEGORY_4_DI.getName());
Node source2 = new Node(component, sourceProcess);
Node middle2 = new Node(component, sourceProcess);
Node target2 = new Node(component, sourceProcess);
Connection connection3 = new Connection(middle2, source2, EConnectionType.ON_SUBJOB_OK, EConnectionType.ON_SUBJOB_OK.getName(), "test5",
"test5", "test5", false);
Connection connection4 = new Connection( middle2, target2, EConnectionType.ON_SUBJOB_ERROR, EConnectionType.ON_SUBJOB_ERROR.getName(), "test6",
"test6", "test6", false);
boolean canConnect = ConnectionManager.canConnectToTarget(target2, null, source2, EConnectionType.RUN_IF,
EConnectionType.RUN_IF.getName(), "test_5_6");
assertTrue(canConnect);
} catch (Exception e) {
e.printStackTrace();
fail("Test CanConnectToSource() method failure.");
}
}
/**
* Test method for
* {@link org.talend.designer.core.model.process.ConnectionManager#canConnectToTarget(org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.designer.core.ui.editor.nodes.Node, org.talend.core.model.process.EConnectionType, java.lang.String, java.lang.String)}

View File

@@ -207,6 +207,11 @@ public class TalendEditorPaletteFactoryTest {
public String getName() {
return name;
}
@Override
public String getOriginalName(){
return getName();
}
@Override
public String getLongName() {

View File

@@ -0,0 +1,78 @@
// ============================================================================
//
// Copyright (C) 2006-2016 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.designer.core.ui.editor.properties.controllers;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.talend.commons.utils.VersionUtils;
import org.talend.core.CorePlugin;
import org.talend.core.context.Context;
import org.talend.core.context.RepositoryContext;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.properties.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.Process;
/**
* created by hwang on 2017-3-8 Detailled comment
*
*/
public class ComponentListControllerTest {
@Before
public void before() {
}
@Test
public void testrenameComponentUniqueName(){
//---first
String oldConnectionName = "joblet3_1";
String newConnectionName = "joblet1_1_joblet2_1_joblet3_1";
List<Node> nodesToUpdate = new ArrayList<Node>();
IComponent component = ComponentsFactoryProvider.getInstance().get("tMysqlInput",
ComponentCategory.CATEGORY_4_DI.getName());
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
property.setVersion(VersionUtils.DEFAULT_VERSION);
Process process = new Process(property);
Node node = new Node(component, process);
nodesToUpdate.add(node);
IElementParameter param = node.getElementParameter("CONNECTION");
param.setValue("joblet3_1_joblet4_1_joblet5_1_tMysqlConnection_1");
ComponentListController.renameComponentUniqueName(oldConnectionName, newConnectionName, nodesToUpdate);
assertTrue(param.getValue().equals("joblet1_1_joblet2_1_joblet3_1_joblet4_1_joblet5_1_tMysqlConnection_1"));
//---second
oldConnectionName = "tMysqlConnection_1";
newConnectionName = "joblet1_1_joblet2_1_tMysqlConnection_1";
param.setValue("tMysqlConnection_1_joblet4_1_joblet5_1_tMysqlConnection_1");
ComponentListController.renameComponentUniqueName(oldConnectionName, newConnectionName, nodesToUpdate);
assertTrue(param.getValue().equals("joblet1_1_joblet2_1_tMysqlConnection_1_joblet4_1_joblet5_1_tMysqlConnection_1"));
}
}

View File

@@ -1,6 +1,6 @@
package org.talend.designer.dbmap.command;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
@@ -47,6 +47,10 @@ public class UpdateELTMapComponentCommandTest {
private List<ExternalDbMapTable> inputs;
private List<ExternalDbMapTable> outputs;
private ExternalDbMapTable input;
private ExternalDbMapEntry outputEntry;
@BeforeClass
public static void beforeClass() {
@@ -74,16 +78,16 @@ public class UpdateELTMapComponentCommandTest {
connection = new Connection(sourceNode, targetNode, EConnectionType.FLOW_MAIN, "connector", "meta", "oldTable", true);
inputs = (List<ExternalDbMapTable>) targetNode.getExternalData().getInputTables();
ExternalDbMapTable input = new ExternalDbMapTable();
input = new ExternalDbMapTable();
input.setName("oldTable");
input.setTableName("oldTable");
inputs.add(input);
outputs = (List<ExternalDbMapTable>) targetNode.getExternalData().getOutputTables();
ExternalDbMapTable output = new ExternalDbMapTable();
ExternalDbMapEntry entry = new ExternalDbMapEntry("oldTable", "oldTable.column");
outputEntry = new ExternalDbMapEntry("oldTable", "oldTable.column");
output.setMetadataTableEntries(new ArrayList<ExternalDbMapEntry>());
output.getMetadataTableEntries().add(entry);
output.getMetadataTableEntries().add(outputEntry);
outputs.add(output);
}
@@ -91,18 +95,38 @@ public class UpdateELTMapComponentCommandTest {
public void testUpdateELTMapComponentCommand() throws InterruptedException {
UpdateELTMapComponentCommand command = new UpdateELTMapComponentCommand(targetNode, connection, "oldTable", "newTable");
command.execute();
validateResult("newTable");
validateResult("newTable", "newTable");
command.undo();
validateResult("oldTable");
validateResult("oldTable", "oldTable");
command.redo();
validateResult("newTable");
validateResult("newTable", "newTable");
}
@Test
public void testUpdateELTMapComponentCommandWithAliasSameWithTableName() throws InterruptedException {
input.setAlias("oldTable");
UpdateELTMapComponentCommand command = new UpdateELTMapComponentCommand(targetNode, connection, "oldTable", "newTable");
command.execute();
validateResult("newTable", "oldTable");
}
@Test
public void testUpdateELTMapComponentCommandWithAlias() throws InterruptedException {
input.setAlias("aliasName");
outputEntry.setExpression("aliasName.column");
UpdateELTMapComponentCommand command = new UpdateELTMapComponentCommand(targetNode, connection, "oldTable", "newTable");
command.execute();
validateResult("newTable", "aliasName");
}
private void validateResult(String value) {
assertEquals(value, connection.getName());
assertEquals(value, inputs.get(0).getName());
assertEquals(value, inputs.get(0).getTableName());
assertEquals(value + ".column", outputs.get(0).getMetadataTableEntries().get(0).getExpression());
private void validateResult(String tableValue, String expressionValue) {
assertEquals(tableValue, connection.getName());
assertEquals(tableValue, inputs.get(0).getName());
assertEquals(tableValue, inputs.get(0).getTableName());
assertEquals(expressionValue + ".column", outputs.get(0).getMetadataTableEntries().get(0).getExpression());
}
private static Property createProperty() {

View File

@@ -19,13 +19,17 @@ public class DbMapServiceTest {
private String oldValue = "table";
private String newValue = "context.schema.context.table";
private InputTable input;
private DBMapperTableEntry outEntry;
@Before
public void setUp() throws Exception {
nodeType = TalendFileFactory.eINSTANCE.createNodeType();
DBMapData data = DbmapFactory.eINSTANCE.createDBMapData();
nodeType.setNodeData(data);
InputTable input = DbmapFactory.eINSTANCE.createInputTable();
input = DbmapFactory.eINSTANCE.createInputTable();
input.setName(oldValue);
input.setTableName(oldValue);
DBMapperTableEntry inputEntry = DbmapFactory.eINSTANCE.createDBMapperTableEntry();
@@ -35,7 +39,7 @@ public class DbMapServiceTest {
OutputTable out = DbmapFactory.eINSTANCE.createOutputTable();
out.setName("output");
out.setTableName("output");
DBMapperTableEntry outEntry = DbmapFactory.eINSTANCE.createDBMapperTableEntry();
outEntry = DbmapFactory.eINSTANCE.createDBMapperTableEntry();
outEntry.setName("column");
outEntry.setExpression(oldValue + ".column");
out.getDBMapperTableEntries().add(outEntry);
@@ -56,5 +60,38 @@ public class DbMapServiceTest {
DBMapperTableEntry outEntry = out.getDBMapperTableEntries().get(0);
assertEquals("context.schema.context.table.column", outEntry.getExpression());
}
@Test
public void testUpdateEMFDBMapDataWithAliasSameWithTable() {
input.setAlias(oldValue);
DbMapService service = new DbMapService();
service.updateEMFDBMapData(nodeType, oldValue, newValue);
DBMapData data = (DBMapData) nodeType.getNodeData();
InputTable input = data.getInputTables().get(0);
assertEquals("context.schema.context.table", input.getName());
assertEquals("context.schema.context.table", input.getTableName());
OutputTable out = data.getOutputTables().get(0);
// output connection name should not be updated.
assertEquals("output", out.getName());
DBMapperTableEntry outEntry = out.getDBMapperTableEntries().get(0);
assertEquals(oldValue + ".column", outEntry.getExpression());
}
@Test
public void testUpdateEMFDBMapDataWithAlias() {
input.setAlias("alias");
outEntry.setExpression("alias.column");
DbMapService service = new DbMapService();
service.updateEMFDBMapData(nodeType, oldValue, newValue);
DBMapData data = (DBMapData) nodeType.getNodeData();
InputTable input = data.getInputTables().get(0);
assertEquals("context.schema.context.table", input.getName());
assertEquals("context.schema.context.table", input.getTableName());
OutputTable out = data.getOutputTables().get(0);
// output connection name should not be updated.
assertEquals("output", out.getName());
DBMapperTableEntry outEntry = out.getDBMapperTableEntries().get(0);
assertEquals("alias.column", outEntry.getExpression());
}
}