Compare commits
66 Commits
patch/TPS-
...
patch/6.2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec90da2ec4 | ||
|
|
257de029cc | ||
|
|
0b782891c1 | ||
|
|
a913118af5 | ||
|
|
cd705075ea | ||
|
|
ec6aa5ab06 | ||
|
|
423f53f552 | ||
|
|
30ef6fc468 | ||
|
|
ed42bb5219 | ||
|
|
ed5dbe18fa | ||
|
|
6a527e75fe | ||
|
|
6cde2ae7d7 | ||
|
|
feeafd4903 | ||
|
|
d9da03b602 | ||
|
|
746ace2b5e | ||
|
|
b73c932d4d | ||
|
|
d3173d80a5 | ||
|
|
097fbee0be | ||
|
|
7deff74377 | ||
|
|
e5e4b7a51d | ||
|
|
2dd0069b6c | ||
|
|
1ed0c7f097 | ||
|
|
cf641aedc5 | ||
|
|
a88465f325 | ||
|
|
f6e06eb32b | ||
|
|
52b21db1d1 | ||
|
|
084fac454e | ||
|
|
a55eafdf22 | ||
|
|
538a77015b | ||
|
|
ddee810392 | ||
|
|
273ed94100 | ||
|
|
8a29ce0cca | ||
|
|
3baad3ccb4 | ||
|
|
000d0a7303 | ||
|
|
7ff2c1ed85 | ||
|
|
f29a245b37 | ||
|
|
353ddf4c81 | ||
|
|
628b9823d0 | ||
|
|
e43eddc640 | ||
|
|
7324909e47 | ||
|
|
07dbb2290b | ||
|
|
0d9fcd37aa | ||
|
|
04e548767d | ||
|
|
05b930b03c | ||
|
|
57129a397b | ||
|
|
9ae828aff5 | ||
|
|
9070781c2f | ||
|
|
b4a3af4f67 | ||
|
|
48f72b11d7 | ||
|
|
46220f02bc | ||
|
|
13c80b2c88 | ||
|
|
f0da35cf60 | ||
|
|
2537ae8e2e | ||
|
|
b55cf75135 | ||
|
|
0627124947 | ||
|
|
190450f915 | ||
|
|
86c77c0416 | ||
|
|
2fb6ef6e53 | ||
|
|
b1311bcd54 | ||
|
|
b271f83c1c | ||
|
|
45afa66efd | ||
|
|
3aa3e47855 | ||
|
|
eb1301dccf | ||
|
|
ac1022bc79 | ||
|
|
cd3a00d088 | ||
|
|
164fcde5b0 |
@@ -1110,13 +1110,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) {
|
||||
}
|
||||
}
|
||||
@@ -1228,12 +1231,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() %>"));
|
||||
|
||||
@@ -65,6 +65,8 @@ List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(c
|
||||
(<%= componentProps.getClass().getName()%>) def_<%=cid %>.createRuntimeProperties();
|
||||
<%
|
||||
|
||||
int schemaIndex = 0;
|
||||
|
||||
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
|
||||
List<NamedThing> properties = propInfo.props.getProperties();
|
||||
for (NamedThing prop : properties) { // property
|
||||
@@ -116,9 +118,59 @@ for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
|
||||
<%=property.getType()%>.<%=property.getValue()%>);
|
||||
<%
|
||||
} else if (property instanceof org.talend.daikon.properties.property.SchemaProperty) {
|
||||
String schemaValue = component.getCodegenValue(property, property.getStringValue());
|
||||
String[] splits = schemaValue.split("(?=\\\\\"name\\\\\":)");
|
||||
%>
|
||||
|
||||
class SchemaSettingTool_<%=cid%>_<%=++schemaIndex%> {
|
||||
|
||||
String getSchemaValue() {
|
||||
<%
|
||||
if((splits == null) || (splits.length < 2)) {
|
||||
%>
|
||||
return <%=schemaValue%>;
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
StringBuilder s = new StringBuilder();
|
||||
<%
|
||||
for(int i=0; i<splits.length; i++) {
|
||||
String currentSplit = splits[i];
|
||||
if(i == 0) {
|
||||
%>
|
||||
a(<%=currentSplit%>",s);
|
||||
<%
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i == (splits.length - 1)) {
|
||||
%>
|
||||
a("<%=currentSplit%>,s);
|
||||
<%
|
||||
continue;
|
||||
}
|
||||
|
||||
%>
|
||||
a("<%=currentSplit%>",s);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
return s.toString();
|
||||
<%
|
||||
}
|
||||
%>
|
||||
}
|
||||
|
||||
void a(String part, StringBuilder strB) {
|
||||
strB.append(part);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SchemaSettingTool_<%=cid%>_<%=schemaIndex%> sst_<%=cid%>_<%=schemaIndex%> = new SchemaSettingTool_<%=cid%>_<%=schemaIndex%>();
|
||||
|
||||
props_<%=cid %><%=propInfo.fieldName%>.setValue("<%=property.getName()%>",
|
||||
new org.apache.avro.Schema.Parser().parse(<%=component.getCodegenValue(property, property.getStringValue())%>));
|
||||
new org.apache.avro.Schema.Parser().parse(sst_<%=cid%>_<%=schemaIndex%>.getSchemaValue()));
|
||||
<%
|
||||
} else if (!(value instanceof String) || !((String)value).equals("")) { // if
|
||||
%>
|
||||
|
||||
@@ -304,6 +304,13 @@ public <%=JavaTypesManager.getTypeToGenerate(ctxParam.getType(),true)%> get<%=Ch
|
||||
if(isRunInMultiThread || NodeUtil.containsMultiThreadComponent(process)){
|
||||
%>
|
||||
private final java.util.Map<String, Object> globalMap = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Object>());
|
||||
<%
|
||||
if(ProcessUtils.isTestContainer(process)) {
|
||||
%>
|
||||
private final static java.util.Map<String, Object> junitGlobalMap = java.util.Collections.synchronizedMap(new java.util.HashMap<String, Object>());
|
||||
<%
|
||||
}
|
||||
%>
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
@@ -480,6 +487,7 @@ private class TalendException extends Exception {
|
||||
|
||||
if(!(e instanceof TDieException)){
|
||||
<%
|
||||
boolean needCatchTalendException = false;
|
||||
if (process.getNodesOfType("tLogCatcher").size() > 0) {
|
||||
List<INode> logCatchers = (List<INode>)process.getNodesOfType("tLogCatcher");
|
||||
for (INode logCatcher : logCatchers) {
|
||||
@@ -511,6 +519,7 @@ private class TalendException extends Exception {
|
||||
if (ElementParameterParser.getValue(logCatcher, "__CATCH_JAVA_EXCEPTION__").equals("true")) {
|
||||
if(logCatcher!=virtualNCatchNode){
|
||||
// 2) launch logCatcher subProcess
|
||||
needCatchTalendException = true;
|
||||
%>
|
||||
<%=logCatcher.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
|
||||
<%
|
||||
@@ -523,6 +532,7 @@ private class TalendException extends Exception {
|
||||
<%
|
||||
}
|
||||
if(virtualNCatchNode!=null){
|
||||
needCatchTalendException = true;
|
||||
%>
|
||||
<%=virtualNCatchNode.getDesignSubjobStartNode().getUniqueName() %>Process(globalMap);
|
||||
<%
|
||||
@@ -536,31 +546,13 @@ private class TalendException extends Exception {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
boolean needCatchTalendException = false;
|
||||
if (process.getNodesOfType("tLogCatcher").size() > 0) {
|
||||
for(INode node:process.getNodesOfType("tLogCatcher")){
|
||||
if(ElementParameterParser.getValue(node, "__CATCH_JAVA_EXCEPTION__").equals("true")){
|
||||
needCatchTalendException = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((!needCatchTalendException) && (process.getNodesOfType("tAssertCatcher").size() > 0)) {
|
||||
for(INode node:process.getNodesOfType("tAssertCatcher")){
|
||||
if(ElementParameterParser.getValue(node, "__CATCH_JAVA_EXCEPTION__").equals("true")){
|
||||
needCatchTalendException = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needCatchTalendException) {
|
||||
if (process.getNodesOfType("tLogCatcher").size() > 0) {
|
||||
//TODO should catch the TalendException in assertcatcher process? but before should not work too as use java reflect, this exception can't catch
|
||||
%>
|
||||
} catch (TalendException e) {
|
||||
// do nothing
|
||||
<%
|
||||
}
|
||||
}
|
||||
%>
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -99,7 +100,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
|
||||
private static Logger log = Logger.getLogger(ComponentsFactory.class);
|
||||
|
||||
private static HashSet<IComponent> componentList = null;
|
||||
private static Set<IComponent> componentList = null;
|
||||
|
||||
private static HashSet<IComponent> customComponentList = null;
|
||||
|
||||
@@ -145,7 +146,7 @@ public class ComponentsFactory implements IComponentsFactory {
|
||||
// TimeMeasure.measureActive = true;
|
||||
// TimeMeasure.begin("initComponents");
|
||||
|
||||
componentList = new HashSet<IComponent>();
|
||||
componentList = Collections.synchronizedSet(new HashSet<IComponent>());
|
||||
customComponentList = new HashSet<IComponent>();
|
||||
skeletonList = new ArrayList<String>();
|
||||
userComponentList = new HashSet<IComponent>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -36,33 +36,50 @@ 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) {
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=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();
|
||||
|
||||
Binary file not shown.
@@ -70,18 +70,34 @@ int nb_line_<%=cid %> = 0;
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -89,8 +105,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 %>);
|
||||
|
||||
@@ -138,18 +138,34 @@ int nb_line_rejected_<%=cid %> = 0;
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -157,8 +173,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 %>);
|
||||
|
||||
@@ -63,9 +63,11 @@ if(!usePartialUpdate){%>
|
||||
<%
|
||||
}else{%>
|
||||
if(miList_<%=cid %>.size() > 0){
|
||||
org.talend.mdm.webservice.WSPutItemArray putItemArray = new org.talend.mdm.webservice.WSPutItemArray(miList_<%=cid %>);
|
||||
|
||||
<% logUtil.debug("\"Try to put item array.\"");%>
|
||||
|
||||
wspks_<%=cid %> = service_<%=cid %>.putItemArray(miList_<%=cid %>).getWsItemPK();
|
||||
wspks_<%=cid %> = service_<%=cid %>.putItemArray(putItemArray).getWsItemPK();
|
||||
|
||||
<% logUtil.debug("\"Put item size:\"+wspks_"+cid+".size()");%>
|
||||
|
||||
|
||||
@@ -113,18 +113,34 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -132,8 +148,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 %>);
|
||||
|
||||
@@ -75,18 +75,34 @@ int nb_line_<%=cid %> = 0;
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -94,8 +110,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 %>);
|
||||
|
||||
@@ -68,18 +68,34 @@ int nb_line_<%=cid %> = 0;
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -87,8 +103,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 %>);
|
||||
|
||||
@@ -111,18 +111,34 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -130,8 +146,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 %>);
|
||||
|
||||
@@ -142,18 +142,34 @@ int nb_line_rejected_<%=cid %> = 0;
|
||||
String turl_<%=cid %> = com.talend.mdm.transaction.client.MDMTransactionClient.getMDMTransactionURL(murl_<%=cid %>, true);
|
||||
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%>);
|
||||
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 %>);
|
||||
Boolean transInitStart_<%=cid%> = false;
|
||||
synchronized(globalMap){
|
||||
if(globalMap.containsKey(transKey_<%=cid %> + "_initStart")){
|
||||
transInitStart_<%=cid%> = true;
|
||||
}else{
|
||||
globalMap.put(transKey_<%=cid %> + "_initStart", true);
|
||||
}
|
||||
}
|
||||
if(transInitStart_<%=cid%> == false){
|
||||
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 %>);
|
||||
}
|
||||
}else{
|
||||
while(mdmTransaction_<%=cid %> == null){
|
||||
Thread.sleep(10);
|
||||
mdmTransaction_<%=cid %> = (com.talend.mdm.transaction.client.MDMTransaction)globalMap.get(transKey_<%=cid %>);
|
||||
}
|
||||
}
|
||||
|
||||
java.util.List<org.apache.cxf.headers.Header> soapHeaders_<%=cid %> = new java.util.ArrayList<org.apache.cxf.headers.Header>();
|
||||
javax.xml.namespace.QName qName_<%=cid %> = new javax.xml.namespace.QName("http://www.talend.com/mdm", "transaction-id");
|
||||
org.apache.cxf.databinding.DataBinding dataBinding_<%=cid %> = new org.apache.cxf.jaxb.JAXBDataBinding(String.class);
|
||||
@@ -161,8 +177,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 %>);
|
||||
|
||||
@@ -114,6 +114,11 @@
|
||||
name="widget.type.file"
|
||||
widgetType="widget.type.file">
|
||||
</Mapping>
|
||||
<Mapping
|
||||
mapFieldType="DIRECTORY"
|
||||
name="widget.type.directory"
|
||||
widgetType="widget.type.directory">
|
||||
</Mapping>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.designer.core.generators">
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.talend.commons.exception.BusinessException;
|
||||
import org.talend.components.api.component.ComponentDefinition;
|
||||
import org.talend.components.api.component.ComponentImageType;
|
||||
import org.talend.components.api.component.Connector;
|
||||
import org.talend.components.api.component.OutputComponentDefinition;
|
||||
import org.talend.components.api.component.PropertyPathConnector;
|
||||
import org.talend.components.api.component.VirtualComponentDefinition;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
@@ -942,6 +943,18 @@ public class Component extends AbstractBasicComponent {
|
||||
addStandardType(listConnector, EConnectionType.ON_COMPONENT_ERROR, parentNode);
|
||||
addStandardType(listConnector, EConnectionType.ON_SUBJOB_OK, parentNode);
|
||||
addStandardType(listConnector, EConnectionType.ON_SUBJOB_ERROR, parentNode);
|
||||
|
||||
// 1.Any component can have outgoing iterate connector
|
||||
// 2.Only standalone and input components can have incoming iterate connector
|
||||
// 3.No transformer component was created in 6.2, so ignore this situation
|
||||
boolean isOutputComponent = componentDefinition instanceof OutputComponentDefinition || componentDefinition instanceof VirtualComponentDefinition;
|
||||
INodeConnector iterateConnector = addStandardType(listConnector, EConnectionType.ITERATE, parentNode);
|
||||
iterateConnector.setMaxLinkOutput(-1);
|
||||
if (isOutputComponent) {
|
||||
iterateConnector.setMaxLinkInput(0);
|
||||
} else {
|
||||
iterateConnector.setMaxLinkInput(1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < EConnectionType.values().length; i++) {
|
||||
EConnectionType currentType = EConnectionType.values()[i];
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.components.api.component.Connector;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.components.api.service.ComponentService;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataToolAvroHelper;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
@@ -302,18 +304,33 @@ public class GenericElementParameter extends ElementParameter {
|
||||
if ((!mainTable.sameMetadataAs(newTable) || !newTable.sameMetadataAs(mainTable))) {
|
||||
mainTable.setListColumns(newTable.getListColumns());
|
||||
if (this.askPropagate == null && node.getOutgoingConnections().size() != 0) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
askPropagate = ChangeMetadataCommand.askPropagate();
|
||||
boolean hasPropagation = false;
|
||||
for (IConnection connection : node.getOutgoingConnections()) {
|
||||
if (connector.getName().equals(connection.getConnectorName())) {
|
||||
if (isSchemaPropagated(connection.getTarget())) {
|
||||
hasPropagation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (hasPropagation) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
askPropagate = ChangeMetadataCommand.askPropagate();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.askPropagate != null && this.askPropagate) {
|
||||
for (IConnection connection : node.getOutgoingConnections()) {
|
||||
if (connector.getName().equals(connection.getConnectorName())) {
|
||||
ChangeMetadataCommand cmd = new ChangeMetadataCommand(connection.getTarget(), null, null,
|
||||
INode target = connection.getTarget();
|
||||
if (!isSchemaPropagated(target)) {
|
||||
continue;
|
||||
}
|
||||
ChangeMetadataCommand cmd = new ChangeMetadataCommand(target, null, null,
|
||||
newTable, null);
|
||||
cmd.setPropagate(true);
|
||||
IProcess process = node.getProcess();
|
||||
@@ -333,6 +350,21 @@ public class GenericElementParameter extends ElementParameter {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSchemaPropagated(INode node) {
|
||||
if (node == null) {
|
||||
return false;
|
||||
}
|
||||
IComponent component = node.getComponent();
|
||||
if (component == null) {
|
||||
return false;
|
||||
}
|
||||
// Always consider it is true for the new component.
|
||||
if (EComponentType.GENERIC.equals(component.getComponentType())) {
|
||||
return true;
|
||||
}
|
||||
return component.isSchemaAutoPropagated();
|
||||
}
|
||||
|
||||
public String getParameterName() {
|
||||
String paramName = getName();
|
||||
if (paramName.indexOf(IGenericConstants.EXP_SEPARATOR) != -1) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
tSalesforceConnection=tSalesforceConnection
|
||||
tSalesforceConnection.loginType=LOGIN_TYPE
|
||||
tSalesforceConnection.endpoint=ENDPOINT
|
||||
tSalesforceConnection.apiVersion=API_VERSION
|
||||
tSalesforceConnection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceConnection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceConnection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -14,7 +15,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
|
||||
@@ -29,6 +32,7 @@ tSalesforceInput=tSalesforceInput
|
||||
tSalesforceInput.connection.referencedComponent=CONNECTION
|
||||
tSalesforceInput.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceInput.connection.endpoint=ENDPOINT
|
||||
tSalesforceInput.connection.apiVersion=API_VERSION
|
||||
tSalesforceInput.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceInput.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceInput.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -51,6 +55,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
|
||||
@@ -68,6 +74,7 @@ tSalesforceOutput=tSalesforceOutput
|
||||
tSalesforceOutput.connection.referencedComponent=CONNECTION
|
||||
tSalesforceOutput.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceOutput.connection.endpoint=ENDPOINT
|
||||
tSalesforceOutput.connection.apiVersion=API_VERSION
|
||||
tSalesforceOutput.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceOutput.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceOutput.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -87,6 +94,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
|
||||
@@ -113,6 +122,7 @@ tSalesforceBulkExec=tSalesforceBulkExec
|
||||
tSalesforceBulkExec.connection.referencedComponent=CONNECTION
|
||||
tSalesforceBulkExec.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceBulkExec.connection.endpoint=ENDPOINT
|
||||
tSalesforceBulkExec.connection.apiVersion=API_VERSION
|
||||
tSalesforceBulkExec.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceBulkExec.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceBulkExec.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -157,6 +167,7 @@ tSalesforceGetDeleted=tSalesforceGetDeleted
|
||||
tSalesforceGetDeleted.connection.referencedComponent=CONNECTION
|
||||
tSalesforceGetDeleted.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceGetDeleted.connection.endpoint=ENDPOINT
|
||||
tSalesforceGetDeleted.connection.apiVersion=API_VERSION
|
||||
tSalesforceGetDeleted.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceGetDeleted.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceGetDeleted.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -174,6 +185,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
|
||||
@@ -188,6 +201,7 @@ tSalesforceGetUpdated=tSalesforceGetUpdated
|
||||
tSalesforceGetUpdated.connection.referencedComponent=CONNECTION
|
||||
tSalesforceGetUpdated.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceGetUpdated.connection.endpoint=ENDPOINT
|
||||
tSalesforceGetUpdated.connection.apiVersion=API_VERSION
|
||||
tSalesforceGetUpdated.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceGetUpdated.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceGetUpdated.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -205,6 +219,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
|
||||
@@ -219,6 +235,7 @@ tSalesforceOutputBulkExec=tSalesforceOutputBulkExec
|
||||
tSalesforceOutputBulkExec.connection.referencedComponent=CONNECTION
|
||||
tSalesforceOutputBulkExec.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceOutputBulkExec.connection.endpoint=ENDPOINT
|
||||
tSalesforceOutputBulkExec.connection.apiVersion=API_VERSION
|
||||
tSalesforceOutputBulkExec.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceOutputBulkExec.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceOutputBulkExec.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -265,6 +282,7 @@ tSalesforceGetServerTimestamp=tSalesforceGetServerTimestamp
|
||||
tSalesforceGetServerTimestamp.connection.referencedComponent=CONNECTION
|
||||
tSalesforceGetServerTimestamp.connection.loginType=LOGIN_TYPE
|
||||
tSalesforceGetServerTimestamp.connection.endpoint=ENDPOINT
|
||||
tSalesforceGetServerTimestamp.connection.apiVersion=API_VERSION
|
||||
tSalesforceGetServerTimestamp.connection.oauth.clientId=OAUTH_CLIENT_ID
|
||||
tSalesforceGetServerTimestamp.connection.oauth.clientSecret=OAUTH_CLIENT_SECRET
|
||||
tSalesforceGetServerTimestamp.connection.oauth.callbackHost=OAUTH_CALLBACK_HOST
|
||||
@@ -277,6 +295,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
|
||||
|
||||
@@ -588,13 +588,21 @@ public class ComponentsUtils {
|
||||
}
|
||||
|
||||
public static ComponentProperties getComponentPropertiesFromSerialized(String serialized, Connection connection) {
|
||||
return getComponentPropertiesFromSerialized(serialized, connection, true);
|
||||
}
|
||||
|
||||
public static ComponentProperties getComponentPropertiesFromSerialized(String serialized, Connection connection,
|
||||
boolean withEvaluator) {
|
||||
if (serialized != null) {
|
||||
SerializerDeserializer.Deserialized<ComponentProperties> fromSerialized = Properties.Helper.fromSerializedPersistent(serialized,
|
||||
ComponentProperties.class, new PostDeserializeSetup() {
|
||||
SerializerDeserializer.Deserialized<ComponentProperties> fromSerialized = Properties.Helper
|
||||
.fromSerializedPersistent(serialized, ComponentProperties.class, new PostDeserializeSetup() {
|
||||
|
||||
@Override
|
||||
public void setup(Object properties) {
|
||||
((Properties)properties).setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
|
||||
if (withEvaluator) {
|
||||
((Properties) properties)
|
||||
.setValueEvaluator(new MetadataContextPropertyValueEvaluator(connection));
|
||||
}
|
||||
}
|
||||
});
|
||||
if (fromSerialized != null) {
|
||||
|
||||
@@ -226,4 +226,8 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
|
||||
AbstractProcessProvider.componentProcess = componentProcess;
|
||||
}
|
||||
|
||||
public boolean canHandleNode(INode node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -483,6 +483,10 @@ public abstract class Processor implements IProcessor, IEclipseProcessor, Talend
|
||||
// do something...
|
||||
}
|
||||
|
||||
public void generateCode(boolean statistics, boolean trace, boolean properties, int option) throws ProcessorException {
|
||||
generateCode(statistics, trace, properties);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -77,7 +77,8 @@ public class SetupProcessDependenciesRoutinesAction extends AContextualAction {
|
||||
} else if (ERepositoryObjectType.PROCESS_MR != null && node.getObjectType().equals(ERepositoryObjectType.PROCESS_MR)) {
|
||||
canWork = true;
|
||||
} else if (node.getObjectType() != ERepositoryObjectType.PROCESS
|
||||
&& node.getObjectType() != ERepositoryObjectType.JOBLET) {
|
||||
&& node.getObjectType() != ERepositoryObjectType.JOBLET
|
||||
&& node.getObjectType() != ERepositoryObjectType.PROCESS_ROUTE) {
|
||||
canWork = false;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -20,7 +20,9 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.talend.commons.utils.threading.ExecutionLimiter;
|
||||
import org.talend.commons.utils.threading.ExecutionLimiterImproved;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
@@ -84,7 +86,7 @@ public class PropertyChangeCommand extends Command {
|
||||
|
||||
// private ChangeMetadataCommand changeMetadataCommand;
|
||||
private List<ChangeMetadataCommand> changeMetadataCommands;
|
||||
|
||||
|
||||
private Command updateELTMapComponentCommand;
|
||||
|
||||
private String propertyTypeName;
|
||||
@@ -246,6 +248,22 @@ public class PropertyChangeCommand extends Command {
|
||||
|
||||
oldValue = elem.getPropertyValue(propName);
|
||||
elem.setPropertyValue(propName, newValue);
|
||||
if (currentParam.getFieldType().equals(EParameterFieldType.CONNECTION_LIST) && currentParam.getContext() != null
|
||||
&& (elem instanceof Node)) {
|
||||
String connParaname = currentParam.getContext() + ":" + currentParam.getName();
|
||||
if (connParaname.equals(propName)) {
|
||||
IConnection selectedConn = null;
|
||||
for (IConnection conn : ((Node) elem).getIncomingConnections()) {
|
||||
if (conn.getUniqueName().equals(newValue)) {
|
||||
selectedConn = conn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selectedConn != null && getTakeSchema()) {
|
||||
((Node) selectedConn.getSource()).takeSchemaFrom((Node) elem, currentParam.getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("ELT_TABLE_NAME".equals(propName) || "ELT_SCHEMA_NAME".equals(propName)) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String oldELTValue = ""; //$NON-NLS-1$
|
||||
String newELTValue = ""; //$NON-NLS-1$
|
||||
@@ -264,12 +282,12 @@ 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$
|
||||
}
|
||||
oldELTValue = oldELTValue + tableName; //$NON-NLS-1$
|
||||
newELTValue = newELTValue + tableName; //$NON-NLS-1$
|
||||
oldELTValue = oldELTValue + tableName; // $NON-NLS-1$
|
||||
newELTValue = newELTValue + tableName; // $NON-NLS-1$
|
||||
}
|
||||
List<? extends IConnection> connections = ((Node) elem).getOutgoingConnections();
|
||||
for (IConnection connection : connections) {
|
||||
@@ -279,7 +297,8 @@ public class PropertyChangeCommand extends Command {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDbMapDesignerService.class)) {
|
||||
IDbMapDesignerService service = (IDbMapDesignerService) GlobalServiceRegister.getDefault()
|
||||
.getService(IDbMapDesignerService.class);
|
||||
updateELTMapComponentCommand = service.getUpdateELTMapComponentCommand(targetNode, connection, oldELTValue, newELTValue);
|
||||
updateELTMapComponentCommand = service.getUpdateELTMapComponentCommand(targetNode, connection,
|
||||
oldELTValue, newELTValue);
|
||||
updateELTMapComponentCommand.execute();
|
||||
}
|
||||
}
|
||||
@@ -295,13 +314,12 @@ public class PropertyChangeCommand extends Command {
|
||||
Node node = (Node) elem;
|
||||
for (IElementParameter param : node.getElementParameters()) {
|
||||
String repositoryValue = param.getRepositoryValue();
|
||||
if ((repositoryValue != null)
|
||||
&& (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName()))
|
||||
if ((repositoryValue != null) && (!param.getName().equals(EParameterName.PROPERTY_TYPE.getName()))
|
||||
&& param.getFieldType() != EParameterFieldType.MEMO_SQL
|
||||
&& !("tMDMReceive".equals(node.getComponent().getName()) && "XPATH_PREFIX".equals(param //$NON-NLS-1$ //$NON-NLS-2$
|
||||
.getRepositoryValue()))
|
||||
&& !("tSAPOutput".equals(node.getComponent().getName()) && param.getName().equals(
|
||||
UpdatesConstants.MAPPING))
|
||||
&& !("tSAPOutput".equals(node.getComponent().getName())
|
||||
&& param.getName().equals(UpdatesConstants.MAPPING))
|
||||
&& !("tFileInputEBCDIC".equals(node.getComponent().getName()) && "DATA_FILE".equals(repositoryValue))) {
|
||||
param.setRepositoryValueUsed(true);
|
||||
if (!(EParameterName.DB_VERSION.getName()).equals(param.getName())) {
|
||||
@@ -423,10 +441,10 @@ public class PropertyChangeCommand extends Command {
|
||||
JobSettingVersionUtil.setDbVersion(elementParameter, dbType, true);
|
||||
DesignerUtilities.setSchemaDB(schemaParameter, newValue);
|
||||
} else if (propName.equals(JobSettingsConstants.getExtraParameterName(EParameterName.DB_TYPE.getName()))) {
|
||||
IElementParameter elementParameter = elem.getElementParameter(JobSettingsConstants
|
||||
.getExtraParameterName(EParameterName.DB_VERSION.getName()));
|
||||
schemaParameter = elem.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB
|
||||
.getName()));
|
||||
IElementParameter elementParameter = elem
|
||||
.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.DB_VERSION.getName()));
|
||||
schemaParameter = elem
|
||||
.getElementParameter(JobSettingsConstants.getExtraParameterName(EParameterName.SCHEMA_DB.getName()));
|
||||
JobSettingVersionUtil.setDbVersion(elementParameter, dbType, true);
|
||||
DesignerUtilities.setSchemaDB(schemaParameter, newValue);
|
||||
}
|
||||
@@ -435,13 +453,12 @@ public class PropertyChangeCommand extends Command {
|
||||
&& !schemaParameter.getValue().equals("")) {
|
||||
schemaParameter.setValue("");
|
||||
}
|
||||
if (!toUpdate
|
||||
&& (currentParam.getFieldType().equals(EParameterFieldType.RADIO)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.OPENED_LIST)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CHECK)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK) || currentParam.getFieldType()
|
||||
.equals(EParameterFieldType.COMPONENT_LIST))) {
|
||||
if (!toUpdate && (currentParam.getFieldType().equals(EParameterFieldType.RADIO)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.OPENED_LIST)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CHECK)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.COMPONENT_LIST))) {
|
||||
toUpdate = false;
|
||||
setDefaultValues(currentParam, elem);
|
||||
}
|
||||
@@ -700,8 +717,8 @@ public class PropertyChangeCommand extends Command {
|
||||
oldElementValues.put(testedParam, testedParam.getValue());
|
||||
|
||||
// if the field is not a schema type, then use standard "set value".
|
||||
if (!(testedParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE) || testedParam.getFieldType().equals(
|
||||
EParameterFieldType.SCHEMA_REFERENCE))) {
|
||||
if (!(testedParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)
|
||||
|| testedParam.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE))) {
|
||||
String oldMapping = ""; //$NON-NLS-1$
|
||||
if (!testedParam.getFieldType().equals(EParameterFieldType.CHECK)
|
||||
&& !testedParam.getFieldType().equals(EParameterFieldType.RADIO)) {
|
||||
@@ -729,8 +746,8 @@ public class PropertyChangeCommand extends Command {
|
||||
// for feature 0014652
|
||||
boolean isBuiltIn = false;
|
||||
|
||||
final IElementParameter elementParameter = testedParam.getChildParameters().get(
|
||||
EParameterFieldType.SCHEMA_TYPE.getName());
|
||||
final IElementParameter elementParameter = testedParam.getChildParameters()
|
||||
.get(EParameterFieldType.SCHEMA_TYPE.getName());
|
||||
if (elementParameter != null) {
|
||||
Object value = elementParameter.getValue();
|
||||
if ("BUILT_IN".equals(value.toString())) {//$NON-NLS-1$
|
||||
@@ -844,7 +861,7 @@ public class PropertyChangeCommand extends Command {
|
||||
}
|
||||
if (updateELTMapComponentCommand != null) {
|
||||
updateELTMapComponentCommand.undo();
|
||||
}
|
||||
}
|
||||
CodeView.refreshCodeView(elem);
|
||||
ComponentSettings.switchToCurComponentSettingsView();
|
||||
JobSettings.switchToCurJobSettingsView();
|
||||
@@ -905,7 +922,7 @@ public class PropertyChangeCommand extends Command {
|
||||
}
|
||||
if (updateELTMapComponentCommand != null) {
|
||||
updateELTMapComponentCommand.redo();
|
||||
}
|
||||
}
|
||||
CodeView.refreshCodeView(elem);
|
||||
ComponentSettings.switchToCurComponentSettingsView();
|
||||
JobSettings.switchToCurJobSettingsView();
|
||||
@@ -929,8 +946,8 @@ public class PropertyChangeCommand extends Command {
|
||||
private void refreshResumingConnections() {
|
||||
if (propName.equals(EParameterName.RESUMING_CHECKPOINT.getName()) && this.elem instanceof Connection) {
|
||||
if (((Connection) this.elem).getConnectionTrace() != null && !propName.equals(EParameterName.CONDITION)) {
|
||||
((Connection) this.elem).getConnectionTrace()
|
||||
.setPropertyValue(EParameterName.RESUMING_CHECKPOINT.getName(), true);
|
||||
((Connection) this.elem).getConnectionTrace().setPropertyValue(EParameterName.RESUMING_CHECKPOINT.getName(),
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1007,4 +1024,8 @@ public class PropertyChangeCommand extends Command {
|
||||
|
||||
}
|
||||
|
||||
private boolean getTakeSchema() {
|
||||
return MessageDialog.openQuestion(new Shell(), "", Messages.getString("Node.getSchemaOrNot")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -669,7 +669,24 @@ public class Connection extends Element implements IConnection, IPerformance {
|
||||
IConnection.TRACE_SCHEMA_COLUMN_CONDITION };
|
||||
param.setListItemsDisplayCodeName(columns);
|
||||
param.setListItemsDisplayName(columns);
|
||||
param.setListItemsValue(new ElementParameter[0]);
|
||||
|
||||
ElementParameter traceColumn = new ElementParameter(this);
|
||||
traceColumn.setName(IConnection.TRACE_SCHEMA_COLUMN);
|
||||
traceColumn.setDisplayName(""); //$NON-NLS-1$
|
||||
traceColumn.setFieldType(EParameterFieldType.TEXT);
|
||||
traceColumn.setValue(""); //$NON-NLS-1$
|
||||
ElementParameter traceColumnChecked = new ElementParameter(this);
|
||||
traceColumnChecked.setName(IConnection.TRACE_SCHEMA_COLUMN_CHECKED);
|
||||
traceColumnChecked.setDisplayName(""); //$NON-NLS-1$
|
||||
traceColumnChecked.setFieldType(EParameterFieldType.CHECK);
|
||||
traceColumnChecked.setValue(true);
|
||||
ElementParameter traceColumnCondition = new ElementParameter(this);
|
||||
traceColumnCondition.setName(IConnection.TRACE_SCHEMA_COLUMN_CHECKED);
|
||||
traceColumnCondition.setDisplayName(""); //$NON-NLS-1$
|
||||
traceColumnCondition.setFieldType(EParameterFieldType.TEXT);
|
||||
traceColumnCondition.setValue(""); //$NON-NLS-1$
|
||||
ElementParameter[] listItemsValue = new ElementParameter[] { traceColumn, traceColumnChecked, traceColumnCondition };
|
||||
param.setListItemsValue(listItemsValue);
|
||||
param.setValue(new ArrayList<Map<String, Object>>());
|
||||
param.setCategory(EComponentCategory.ADVANCED);
|
||||
param.setShow(false);
|
||||
|
||||
@@ -3289,12 +3289,12 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
*/
|
||||
@Override
|
||||
public void checkProcess() {
|
||||
if (isActivate()) {
|
||||
if (isActivate() && !isDuplicate()) {
|
||||
checkProblems();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkProblems() {
|
||||
protected void checkProblems() {
|
||||
Problems.removeProblemsByProcess(this);
|
||||
|
||||
for (INode node : nodes) {
|
||||
|
||||
@@ -78,6 +78,7 @@ import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.ComponentUtilities;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IComponentsService;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.IEbcdicConstant;
|
||||
import org.talend.core.model.metadata.IHL7Constant;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
@@ -191,6 +192,7 @@ import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
|
||||
import org.talend.designer.core.utils.DesignerUtilities;
|
||||
import org.talend.designer.core.utils.ValidationRulesUtil;
|
||||
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryPlugin;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
@@ -626,7 +628,8 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
|
||||
}
|
||||
|
||||
Item subItem = repositoryNode.getObject().getProperty().getItem();
|
||||
Item hadoopClusterItem = hadoopClusterService.getHadoopClusterBySubitemId(subItem.getProperty().getId());
|
||||
Item hadoopClusterItem = hadoopClusterService.getHadoopClusterBySubitemId(
|
||||
new Project(ProjectManager.getInstance().getProject(subItem)), subItem.getProperty().getId());
|
||||
String hadoopClusterId = hadoopClusterItem.getProperty().getId();
|
||||
|
||||
String propertyParamName = MR_PROPERTY_PREFIX + EParameterName.PROPERTY_TYPE.getName();
|
||||
|
||||
@@ -16,8 +16,6 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.jface.fieldassist.DecoratedField;
|
||||
import org.eclipse.jface.fieldassist.FieldDecoration;
|
||||
@@ -36,36 +34,22 @@ import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.IESBService;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.QueriesConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.Query;
|
||||
import org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.DatabaseConnectionItem;
|
||||
import org.talend.core.model.properties.FileItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.LinkRulesItem;
|
||||
import org.talend.core.model.properties.RulesItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.properties.tab.IDynamicProperty;
|
||||
import org.talend.designer.core.DesignerPlugin;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.components.EmfComponent;
|
||||
import org.talend.designer.core.ui.editor.cmd.ChangeMetadataCommand;
|
||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.creator.SelectAllTextControlCreator;
|
||||
import org.talend.repository.UpdateRepositoryUtils;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment
|
||||
@@ -76,6 +60,8 @@ public abstract class AbstractRepositoryController extends AbstractElementProper
|
||||
|
||||
protected static final int STANDARD_REPOSITORY_WIDTH = 250;
|
||||
|
||||
protected ControllerRepositoryValueHander repositoryValueHander;
|
||||
|
||||
/**
|
||||
* DOC nrousseau AbstractRepositoryController constructor comment.
|
||||
*
|
||||
@@ -83,6 +69,7 @@ public abstract class AbstractRepositoryController extends AbstractElementProper
|
||||
*/
|
||||
public AbstractRepositoryController(IDynamicProperty dp) {
|
||||
super(dp);
|
||||
repositoryValueHander = new ControllerRepositoryValueHander();
|
||||
}
|
||||
|
||||
protected abstract String getRepositoryTypeParamName();
|
||||
@@ -321,204 +308,8 @@ public abstract class AbstractRepositoryController extends AbstractElementProper
|
||||
return initialSize.y + ITabbedPropertyConstants.VSPACE;
|
||||
}
|
||||
|
||||
protected ConnectionItem lastItemUsed;
|
||||
|
||||
private FileItem lastFileItemUsed; // hywang add for 6484
|
||||
|
||||
private LinkRulesItem lastLinkItem;
|
||||
|
||||
private void fastRepositoryUpdateProperty(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
|
||||
String linkedRepository = (String) param.getValue();
|
||||
// value stored is the id, so we can get this item directly
|
||||
Item item;
|
||||
String displayName = "";
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository.split(" - ")[0]);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
// Assert.isTrue(item instanceof ConnectionItem);
|
||||
IESBService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
|
||||
service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
}
|
||||
if (service != null && ERepositoryObjectType.getItemType(item) == service.getServicesType()) {
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
displayName = "Service:" + service.getServiceLabel(item, linkedRepository);
|
||||
} else if (item instanceof ConnectionItem) {
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
displayName = dynamicProperty.getRepositoryAliasName(lastItemUsed) + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel();
|
||||
}
|
||||
if (item instanceof FileItem) { // hywang add for 6484
|
||||
lastFileItemUsed = (FileItem) item;
|
||||
if (lastFileItemUsed instanceof RulesItem) {
|
||||
displayName = "Rules:" //$NON-NLS-1$
|
||||
+ lastFileItemUsed.getProperty().getLabel();
|
||||
}
|
||||
}
|
||||
if (item instanceof LinkRulesItem) {
|
||||
lastLinkItem = (LinkRulesItem) item;
|
||||
displayName = "Rules:" //$NON-NLS-1$
|
||||
+ lastLinkItem.getProperty().getLabel();
|
||||
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateSchema(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
String queryIdAndName = (String) param.getValue();
|
||||
String[] names = queryIdAndName.split(" - "); //$NON-NLS-1$
|
||||
if (names.length < 2) {
|
||||
return;
|
||||
}
|
||||
String linkedRepository = names[0];
|
||||
String tableName = null;
|
||||
if (names.length == 2) {
|
||||
tableName = names[1];
|
||||
} else if (names.length > 2) {
|
||||
tableName = queryIdAndName.substring(linkedRepository.length() + 3);
|
||||
}
|
||||
|
||||
if (lastItemUsed != null) {
|
||||
if (!linkedRepository.equals(lastItemUsed.getProperty().getId())) {
|
||||
lastItemUsed = null;
|
||||
}
|
||||
}
|
||||
if (lastItemUsed == null) {
|
||||
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
|
||||
Item item;
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
Assert.isTrue(item instanceof ConnectionItem);
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
// EList<MetadataTable> tableList = lastItemUsed.getConnection().getTables();
|
||||
// for (MetadataTable table )
|
||||
|
||||
String displayName = dynamicProperty.getRepositoryAliasName(lastItemUsed) + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel() + " - " + tableName; //$NON-NLS-1$
|
||||
IElementParameter infoObjectTypeParam = param.getElement().getElementParameter("INFO_OBJECT_TYPE"); //$NON-NLS-1$
|
||||
if (infoObjectTypeParam != null) {
|
||||
String innerIOType = (String) infoObjectTypeParam.getValue();
|
||||
if (innerIOType != null) {
|
||||
displayName = displayName + " (" + innerIOType + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
}
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateQuery(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
String queryIdAndName = (String) param.getValue();
|
||||
String[] names = queryIdAndName.split(" - "); //$NON-NLS-1$
|
||||
if (names.length < 2) {
|
||||
return;
|
||||
}
|
||||
String linkedRepository = names[0];
|
||||
String queryName = null;
|
||||
if (names.length == 2) {
|
||||
queryName = names[1];
|
||||
} else if (names.length > 2) {
|
||||
queryName = queryIdAndName.substring(linkedRepository.length() + 3);
|
||||
}
|
||||
if (lastItemUsed != null) {
|
||||
if (!linkedRepository.equals(lastItemUsed.getProperty().getId())) {
|
||||
lastItemUsed = null;
|
||||
}
|
||||
}
|
||||
if (lastItemUsed == null) {
|
||||
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
|
||||
Item item;
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
Assert.isTrue(lastItemUsed instanceof DatabaseConnectionItem);
|
||||
QueriesConnection queriesConnection = ((DatabaseConnection) lastItemUsed.getConnection()).getQueries();
|
||||
EList<Query> queries = queriesConnection.getQuery();
|
||||
|
||||
String repositoryAliasName = dynamicProperty.getRepositoryAliasName(lastItemUsed);
|
||||
for (Query currentQuery : queries) {
|
||||
if (currentQuery.getLabel().equals(queryName)) {
|
||||
String displayName = repositoryAliasName + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel() + " - " + currentQuery.getLabel(); //$NON-NLS-1$
|
||||
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
/* query cache should be deleted ,bug 16969 */
|
||||
// dynamicProperty.getRepositoryQueryStoreMap().clear();
|
||||
// dynamicProperty.getRepositoryQueryStoreMap().put((String) param.getValue(), currentQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fastInitializeRepositoryNames(IElementParameter param) {
|
||||
lastItemUsed = null;
|
||||
|
||||
if (param.getValue() == null || param.getValue().equals("")) {
|
||||
return;
|
||||
}
|
||||
if (param.getName().equals(EParameterName.REPOSITORY_PROPERTY_TYPE.getName())) {
|
||||
fastRepositoryUpdateProperty(param);
|
||||
} else if (param.getName().equals(EParameterName.REPOSITORY_SCHEMA_TYPE.getName())) {
|
||||
fastRepositoryUpdateSchema(param);
|
||||
} else if (param.getName().equals(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName())) {
|
||||
fastRepositoryUpdateQuery(param);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getDisplayNameFromValue(IElementParameter param, String value) {
|
||||
// to load informations from repository only if needed.
|
||||
|
||||
int index = param.getIndexOfItemFromList(value);
|
||||
IElementParameter infoObjectParam = param.getElement().getElementParameter("INFO_OBJECT_TYPE"); //$NON-NLS-1$
|
||||
if (infoObjectParam != null && infoObjectParam.getValue() != null) {
|
||||
index = -1;
|
||||
}
|
||||
if (index == -1) {
|
||||
|
||||
fastInitializeRepositoryNames(param);
|
||||
// if even after the initialize there is nothing, just return an empty string
|
||||
if (param.getListItemsDisplayName().length == 0) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
index = param.getIndexOfItemFromList(value);
|
||||
if (index == -1) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
return param.getListItemsDisplayName()[index];
|
||||
return repositoryValueHander.getDisplayNameFromValue(param, value);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -585,4 +376,12 @@ public abstract class AbstractRepositoryController extends AbstractElementProper
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for repositoryValueHander.
|
||||
*
|
||||
* @return the repositoryValueHander
|
||||
*/
|
||||
public ControllerRepositoryValueHander getRepositoryValueHander() {
|
||||
return this.repositoryValueHander;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -369,6 +369,12 @@ public class ConnectionListController extends AbstractElementPropertySectionCont
|
||||
}
|
||||
curLine.put(newConnectionName, newValue);
|
||||
}
|
||||
}else if(curParam.getFieldType().equals(EParameterFieldType.SCHEMA_TYPE)){
|
||||
Map<String, IElementParameter> children = curParam.getChildParameters();
|
||||
IElementParameter ele = children.get(EParameterName.CONNECTION.getName());
|
||||
if(ele!=null && ele.getFieldType().equals(EParameterFieldType.CONNECTION_LIST) && ele.getValue().equals(oldConnectionName)){
|
||||
ele.setValue(newConnectionName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 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 java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
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.GlobalServiceRegister;
|
||||
import org.talend.core.IESBService;
|
||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.QueriesConnection;
|
||||
import org.talend.core.model.metadata.builder.connection.Query;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.DatabaseConnectionItem;
|
||||
import org.talend.core.model.properties.FileItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.LinkRulesItem;
|
||||
import org.talend.core.model.properties.RulesItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.designer.core.DesignerPlugin;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.metadata.RepositoryObjectHelper;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
/**
|
||||
* created by wchen on Aug 23, 2016 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class ControllerRepositoryValueHander {
|
||||
|
||||
private static Map<EParameterFieldType, ControllerRepositoryValueHander> repositoryValueHandlerMap = new HashMap<EParameterFieldType, ControllerRepositoryValueHander>();
|
||||
|
||||
protected ConnectionItem lastItemUsed;
|
||||
|
||||
private FileItem lastFileItemUsed; // hywang add for 6484
|
||||
|
||||
private LinkRulesItem lastLinkItem;
|
||||
|
||||
public String getDisplayNameFromValue(IElementParameter param, String value) {
|
||||
// to load informations from repository only if needed.
|
||||
|
||||
int index = param.getIndexOfItemFromList(value);
|
||||
IElementParameter infoObjectParam = param.getElement().getElementParameter("INFO_OBJECT_TYPE"); //$NON-NLS-1$
|
||||
if (infoObjectParam != null && infoObjectParam.getValue() != null) {
|
||||
index = -1;
|
||||
}
|
||||
if (index == -1) {
|
||||
|
||||
fastInitializeRepositoryNames(param);
|
||||
// if even after the initialize there is nothing, just return an empty string
|
||||
if (param.getListItemsDisplayName().length == 0) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
index = param.getIndexOfItemFromList(value);
|
||||
if (index == -1) {
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
return param.getListItemsDisplayName()[index];
|
||||
}
|
||||
|
||||
protected void fastInitializeRepositoryNames(IElementParameter param) {
|
||||
lastItemUsed = null;
|
||||
|
||||
if (param.getValue() == null || param.getValue().equals("")) {
|
||||
return;
|
||||
}
|
||||
if (param.getName().equals(EParameterName.REPOSITORY_PROPERTY_TYPE.getName())) {
|
||||
fastRepositoryUpdateProperty(param);
|
||||
} else if (param.getName().equals(EParameterName.REPOSITORY_SCHEMA_TYPE.getName())) {
|
||||
fastRepositoryUpdateSchema(param);
|
||||
} else if (param.getName().equals(EParameterName.REPOSITORY_QUERYSTORE_TYPE.getName())) {
|
||||
fastRepositoryUpdateQuery(param);
|
||||
}
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateProperty(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
|
||||
String linkedRepository = (String) param.getValue();
|
||||
// value stored is the id, so we can get this item directly
|
||||
Item item;
|
||||
String displayName = "";
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository.split(" - ")[0]);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
// Assert.isTrue(item instanceof ConnectionItem);
|
||||
IESBService service = null;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
|
||||
service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
}
|
||||
if (service != null && ERepositoryObjectType.getItemType(item) == service.getServicesType()) {
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
displayName = "Service:" + service.getServiceLabel(item, linkedRepository);
|
||||
} else if (item instanceof ConnectionItem) {
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
displayName = RepositoryObjectHelper.getRepositoryAliasName(lastItemUsed) + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel();
|
||||
}
|
||||
if (item instanceof FileItem) { // hywang add for 6484
|
||||
lastFileItemUsed = (FileItem) item;
|
||||
if (lastFileItemUsed instanceof RulesItem) {
|
||||
displayName = "Rules:" //$NON-NLS-1$
|
||||
+ lastFileItemUsed.getProperty().getLabel();
|
||||
}
|
||||
}
|
||||
if (item instanceof LinkRulesItem) {
|
||||
lastLinkItem = (LinkRulesItem) item;
|
||||
displayName = "Rules:" //$NON-NLS-1$
|
||||
+ lastLinkItem.getProperty().getLabel();
|
||||
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateSchema(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
String queryIdAndName = (String) param.getValue();
|
||||
String[] names = queryIdAndName.split(" - "); //$NON-NLS-1$
|
||||
if (names.length < 2) {
|
||||
return;
|
||||
}
|
||||
String linkedRepository = names[0];
|
||||
String tableName = null;
|
||||
if (names.length == 2) {
|
||||
tableName = names[1];
|
||||
} else if (names.length > 2) {
|
||||
tableName = queryIdAndName.substring(linkedRepository.length() + 3);
|
||||
}
|
||||
|
||||
if (lastItemUsed != null) {
|
||||
if (!linkedRepository.equals(lastItemUsed.getProperty().getId())) {
|
||||
lastItemUsed = null;
|
||||
}
|
||||
}
|
||||
if (lastItemUsed == null) {
|
||||
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
|
||||
Item item;
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
Assert.isTrue(item instanceof ConnectionItem);
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
// EList<MetadataTable> tableList = lastItemUsed.getConnection().getTables();
|
||||
// for (MetadataTable table )
|
||||
|
||||
String displayName = RepositoryObjectHelper.getRepositoryAliasName(lastItemUsed) + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel() + " - " + tableName; //$NON-NLS-1$
|
||||
IElementParameter infoObjectTypeParam = param.getElement().getElementParameter("INFO_OBJECT_TYPE"); //$NON-NLS-1$
|
||||
if (infoObjectTypeParam != null) {
|
||||
String innerIOType = (String) infoObjectTypeParam.getValue();
|
||||
if (innerIOType != null) {
|
||||
displayName = displayName + " (" + innerIOType + ")"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
}
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateQuery(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
String queryIdAndName = (String) param.getValue();
|
||||
String[] names = queryIdAndName.split(" - "); //$NON-NLS-1$
|
||||
if (names.length < 2) {
|
||||
return;
|
||||
}
|
||||
String linkedRepository = names[0];
|
||||
String queryName = null;
|
||||
if (names.length == 2) {
|
||||
queryName = names[1];
|
||||
} else if (names.length > 2) {
|
||||
queryName = queryIdAndName.substring(linkedRepository.length() + 3);
|
||||
}
|
||||
if (lastItemUsed != null) {
|
||||
if (!linkedRepository.equals(lastItemUsed.getProperty().getId())) {
|
||||
lastItemUsed = null;
|
||||
}
|
||||
}
|
||||
if (lastItemUsed == null) {
|
||||
IProxyRepositoryFactory factory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
|
||||
Item item;
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
Assert.isTrue(lastItemUsed instanceof DatabaseConnectionItem);
|
||||
QueriesConnection queriesConnection = ((DatabaseConnection) lastItemUsed.getConnection()).getQueries();
|
||||
EList<Query> queries = queriesConnection.getQuery();
|
||||
|
||||
String repositoryAliasName = RepositoryObjectHelper.getRepositoryAliasName(lastItemUsed);
|
||||
for (Query currentQuery : queries) {
|
||||
if (currentQuery.getLabel().equals(queryName)) {
|
||||
String displayName = repositoryAliasName + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel() + " - " + currentQuery.getLabel(); //$NON-NLS-1$
|
||||
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
/* query cache should be deleted ,bug 16969 */
|
||||
// dynamicProperty.getRepositoryQueryStoreMap().clear();
|
||||
// dynamicProperty.getRepositoryQueryStoreMap().put((String) param.getValue(), currentQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for repositoryValueHandlerMap.
|
||||
*
|
||||
* @return the repositoryValueHandlerMap
|
||||
*/
|
||||
public static Map<EParameterFieldType, ControllerRepositoryValueHander> getRepositoryValueHandlerMap() {
|
||||
return repositoryValueHandlerMap;
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -241,40 +241,25 @@ public class GuessSchemaProcess {
|
||||
if (ConnectionUtils.isVertica(info.getUrl())) {
|
||||
createStatament = "conn.createStatement()";
|
||||
}
|
||||
codeStart = systemProperty
|
||||
+ "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" + info.getUrl() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" + info.getUsername() //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "\", \"" + info.getPwd() + "\");\r\n" + "java.sql.Statement stm = " + createStatament + ";\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "try {\r\nstm.setFetchSize(" + fetchSize + ");\r\n} catch (Exception e) {\r\n// Exception is thrown if db don't support, no need to catch exception here\r\n} \r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "java.sql.ResultSet rs = stm.executeQuery(" + memoSQL + ");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "java.sql.ResultSetMetaData rsmd = rs.getMetaData();\r\n" + "int numbOfColumn = rsmd.getColumnCount();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "\r\n" + "String fileName = (new java.io.File(\r\n" + " \"" + temppath //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "\")).getAbsolutePath().replace(\r\n" + " \"\\\\\", \"/\");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "com.talend.csv.CSVWriter csvWriter = new com.talend.csv.CSVWriter(\r\n" //$NON-NLS-1$
|
||||
+ " new java.io.BufferedWriter(new java.io.OutputStreamWriter(\r\n" //$NON-NLS-1$
|
||||
+ " new java.io.FileOutputStream(\r\n" //$NON-NLS-1$
|
||||
+ " fileName, false),\r\n" //$NON-NLS-1$
|
||||
+ " \"GBK\")));\r\n" + " \r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.setSeparator(';');\r\n" + "csvWriter.setQuoteStatus(com.talend.csv.CSVWriter.QuoteStatus.FORCE);\r\n" + "int nbRows = 0;\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "String[] columnNames = new String[numbOfColumn];\r\n" + "String[] nullables = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "String[] lengths = new String[numbOfColumn];\r\n" + "String[] precisions = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "String[] dbtypes = new String[numbOfColumn];\r\n" //$NON-NLS-1$
|
||||
+ "for(int i = 1;i<=numbOfColumn;i++){\r\n" + "columnNames[i-1] = rsmd.getColumnName(i);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "nullables[i-1] = rsmd.isNullable(i) == 0? \"false\" : \"true\";\r\n" //$NON-NLS-1$
|
||||
+ "lengths[i-1] = Integer.toString(rsmd.getScale(i));\r\n" //$NON-NLS-1$
|
||||
+ "precisions[i-1] = Integer.toString(rsmd.getPrecision(i));" //$NON-NLS-1$
|
||||
+ "dbtypes[i-1] = rsmd.getColumnTypeName(i);\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
+ "csvWriter.writeNext(columnNames);\r\n" + "csvWriter.writeNext(nullables);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.writeNext(lengths);\r\n" + "csvWriter.writeNext(precisions);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.writeNext(dbtypes);\r\n" + "while (rs.next()) {"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (EDatabaseTypeName.GENERAL_JDBC.getXmlName().equals(info.getDbType())
|
||||
&& "com.sap.db.jdbc.Driver".equals(info.getDriverClassName())
|
||||
|| EDatabaseTypeName.SAPHana.getXmlName().equals(info.getDbType())) {
|
||||
createStatament = "conn.createStatement()";
|
||||
}
|
||||
codeStart = systemProperty + getCodeStart(connectionNode, createStatament, fetchSize);
|
||||
|
||||
codeMain = "String[] dataOneRow = new String[numbOfColumn];\r\n" + "for (int i = 1; i <= numbOfColumn; i++) {\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ " \r\n" + " try{\r\n" + " String tempStr = rs.getString(i);\r\n" + " dataOneRow[i-1] = tempStr;\r\n" + " } catch (java.sql.SQLException e) {\r\n" + "}\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
+ "csvWriter.writeNext(dataOneRow);"; //$NON-NLS-1$
|
||||
|
||||
codeEnd = "nbRows++;\r\n" + " if (nbRows > " + maximumRowsToPreview + ") break;\r\n" + "}\r\n" + "stm.close();\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
+ "conn.close();\r\n" + "csvWriter.close();\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
|
||||
if(EDatabaseTypeName.REDSHIFT.getXmlName().equals(info.getDbType())){
|
||||
codeEnd = "nbRows++;\r\n" + " if (nbRows > " + maximumRowsToPreview + ") break;\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
+ "conn.close();\r\n" + "csvWriter.close();\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}else{
|
||||
codeEnd = "nbRows++;\r\n" + " if (nbRows > " + maximumRowsToPreview + ") break;\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
+ "conn.close();\r\n" + "csvWriter.close();\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
IComponent component = null;
|
||||
switch (LanguageManager.getCurrentLanguage()) {
|
||||
@@ -295,6 +280,101 @@ public class GuessSchemaProcess {
|
||||
|
||||
process.addNodeContainer(new NodeContainer(flexNode));
|
||||
}
|
||||
|
||||
private String getCodeStart(INode connectionNode, String createStatament, int fetchSize){
|
||||
String codeStart = null;
|
||||
if(EDatabaseTypeName.REDSHIFT.getXmlName().equals(info.getDbType())){
|
||||
String tableName = (String) node.getElementParameter("TABLE").getValue();
|
||||
String dbName = null;
|
||||
String schema = null;
|
||||
if(connectionNode!=null){
|
||||
if(connectionNode.getElementParameter("DBNAME")!=null){
|
||||
dbName = (String) connectionNode.getElementParameter("DBNAME").getValue();
|
||||
}
|
||||
if(connectionNode.getElementParameter("SCHEMA_DB")!=null){
|
||||
schema = (String) connectionNode.getElementParameter("SCHEMA_DB").getValue();
|
||||
}
|
||||
}else{
|
||||
if(node.getElementParameter("DBNAME")!=null){
|
||||
dbName = (String) node.getElementParameter("DBNAME").getValue();
|
||||
}
|
||||
if(node.getElementParameter("SCHEMA_DB")!=null){
|
||||
schema = (String) node.getElementParameter("SCHEMA_DB").getValue();
|
||||
}
|
||||
}
|
||||
codeStart = "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" + info.getUrl() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" + info.getUsername() //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "\", \"" + info.getPwd() + "\");\r\n" + "java.sql.DatabaseMetaData metaData = conn.getMetaData();\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "java.sql.ResultSet rs = metaData.getColumns(" + dbName + "," + schema + "," + tableName + ",null);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
+ "\r\n" + "String fileName = (new java.io.File(\r\n" + " \"" + temppath //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "\")).getAbsolutePath().replace(\r\n" + " \"\\\\\", \"/\");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "com.talend.csv.CSVWriter csvWriter = new com.talend.csv.CSVWriter(\r\n" //$NON-NLS-1$
|
||||
+ " new java.io.BufferedWriter(new java.io.OutputStreamWriter(\r\n" //$NON-NLS-1$
|
||||
+ " new java.io.FileOutputStream(\r\n" //$NON-NLS-1$
|
||||
+ " fileName, false),\r\n" //$NON-NLS-1$
|
||||
+ " \"GBK\")));\r\n" + " \r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.setSeparator(';');\r\n" + "csvWriter.setQuoteStatus(com.talend.csv.CSVWriter.QuoteStatus.FORCE);\r\n" + "int nbRows = 0;\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
|
||||
|
||||
+ "java.util.List<String> columnNameList= new java.util.ArrayList<String>();\r\n" + "java.util.List<String> nullableList= new java.util.ArrayList<String>();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "java.util.List<String> lengthList= new java.util.ArrayList<String>();\r\n" + "java.util.List<String> precisionList= new java.util.ArrayList<String>();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "java.util.List<String> dbtypeList= new java.util.ArrayList<String>();\r\n" //$NON-NLS-1$
|
||||
|
||||
+"while (rs.next()) {\r\n" //$NON-NLS-1$
|
||||
+"columnNameList.add(rs.getString(\"COLUMN_NAME\"));\r\n" //$NON-NLS-1$
|
||||
+"nullableList.add(rs.getBoolean(\"NULLABLE\") ? \"true\" : \"false\");\r\n" //$NON-NLS-1$
|
||||
+"lengthList.add(Integer.toString(rs.getInt(\"COLUMN_SIZE\")));\r\n" //$NON-NLS-1$
|
||||
+"precisionList.add(Integer.toString(rs.getInt(\"NUM_PREC_RADIX\")));\r\n" //$NON-NLS-1$
|
||||
+"dbtypeList.add(rs.getString(\"TYPE_NAME\"));\r\n" //$NON-NLS-1$
|
||||
+"}\r\n" //$NON-NLS-1$
|
||||
|
||||
+"int numbOfColumn = columnNameList.size();" //$NON-NLS-1$
|
||||
+ "String[] columnNames = new String[numbOfColumn];\r\n" + "String[] nullables = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "String[] lengths = new String[numbOfColumn];\r\n" + "String[] precisions = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "String[] dbtypes = new String[numbOfColumn];\r\n" //$NON-NLS-1$
|
||||
|
||||
|
||||
+ "for(int i = 0;i<=numbOfColumn-1;i++){\r\n" + "columnNames[i] = columnNameList.get(i);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "nullables[i] = nullableList.get(i);\r\n" //$NON-NLS-1$
|
||||
+ "lengths[i] = lengthList.get(i);\r\n" //$NON-NLS-1$
|
||||
+ "precisions[i] = precisionList.get(i);" //$NON-NLS-1$
|
||||
+ "dbtypes[i] = dbtypeList.get(i);\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
+ "csvWriter.writeNext(columnNames);\r\n" + "csvWriter.writeNext(nullables);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.writeNext(lengths);\r\n" + "csvWriter.writeNext(precisions);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.writeNext(dbtypes);\r\n" + "while (rs.next()) {"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}else{
|
||||
codeStart = "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" + info.getUrl() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" + info.getUsername() //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "\", \"" + info.getPwd() + "\");\r\n" + "java.sql.Statement stm = " + createStatament + ";\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "try {\r\nstm.setFetchSize(" + fetchSize + ");\r\n} catch (Exception e) {\r\n// Exception is thrown if db don't support, no need to catch exception here\r\n} \r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "java.sql.ResultSet rs = stm.executeQuery(" + memoSQL + ");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "java.sql.ResultSetMetaData rsmd = rs.getMetaData();\r\n" + "int numbOfColumn = rsmd.getColumnCount();\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "\r\n" + "String fileName = (new java.io.File(\r\n" + " \"" + temppath //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "\")).getAbsolutePath().replace(\r\n" + " \"\\\\\", \"/\");\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "com.talend.csv.CSVWriter csvWriter = new com.talend.csv.CSVWriter(\r\n" //$NON-NLS-1$
|
||||
+ " new java.io.BufferedWriter(new java.io.OutputStreamWriter(\r\n" //$NON-NLS-1$
|
||||
+ " new java.io.FileOutputStream(\r\n" //$NON-NLS-1$
|
||||
+ " fileName, false),\r\n" //$NON-NLS-1$
|
||||
+ " \"GBK\")));\r\n" + " \r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.setSeparator(';');\r\n" + "csvWriter.setQuoteStatus(com.talend.csv.CSVWriter.QuoteStatus.FORCE);\r\n" + "int nbRows = 0;\r\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ "String[] columnNames = new String[numbOfColumn];\r\n" + "String[] nullables = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "String[] lengths = new String[numbOfColumn];\r\n" + "String[] precisions = new String[numbOfColumn];\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "String[] dbtypes = new String[numbOfColumn];\r\n" //$NON-NLS-1$
|
||||
+ "for(int i = 1;i<=numbOfColumn;i++){\r\n" + "columnNames[i-1] = rsmd.getColumnName(i);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "nullables[i-1] = rsmd.isNullable(i) == 0? \"false\" : \"true\";\r\n" //$NON-NLS-1$
|
||||
+ "lengths[i-1] = Integer.toString(rsmd.getScale(i));\r\n" //$NON-NLS-1$
|
||||
+ "precisions[i-1] = Integer.toString(rsmd.getPrecision(i));" //$NON-NLS-1$
|
||||
+ "dbtypes[i-1] = rsmd.getColumnTypeName(i);\r\n" + "}\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
+ "csvWriter.writeNext(columnNames);\r\n" + "csvWriter.writeNext(nullables);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.writeNext(lengths);\r\n" + "csvWriter.writeNext(precisions);\r\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ "csvWriter.writeNext(dbtypes);\r\n" + "while (rs.next()) {"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return codeStart;
|
||||
}
|
||||
|
||||
// write content to a temp .csv file
|
||||
private IPath buildTempCSVFilename() {
|
||||
|
||||
@@ -43,15 +43,12 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.language.ECodeLanguage;
|
||||
import org.talend.core.language.LanguageManager;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.PerlResourcesHelper;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
import org.talend.core.ui.properties.tab.IDynamicProperty;
|
||||
@@ -64,7 +61,6 @@ import org.talend.designer.core.ui.editor.properties.controllers.creator.SelectA
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
import org.talend.repository.model.RepositoryNodeUtilities;
|
||||
import org.talend.repository.ui.dialog.RepositoryReviewDialog;
|
||||
import org.talend.repository.ui.dialog.UseDynamicJobSelectionDialog;
|
||||
|
||||
@@ -173,10 +169,6 @@ public class ProcessController extends AbstractElementPropertySectionController
|
||||
|
||||
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
|
||||
boolean addVersionCombo = true;
|
||||
if (LanguageManager.getCurrentLanguage() == ECodeLanguage.PERL) {
|
||||
addVersionCombo = PerlResourcesHelper.USE_VERSIONING;
|
||||
}
|
||||
// feature 19312
|
||||
IElementParameter useDynamicJobParameter = param.getElement().getElementParameter(
|
||||
EParameterName.USE_DYNAMIC_JOB.getName());
|
||||
@@ -190,7 +182,7 @@ public class ProcessController extends AbstractElementPropertySectionController
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
|
||||
IBrandingService.class);
|
||||
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
|
||||
if (addVersionCombo && allowVerchange) {
|
||||
if (allowVerchange) {
|
||||
lastControlUsed = addJobVersionCombo(subComposite,
|
||||
param.getChildParameters().get(EParameterName.PROCESS_TYPE_VERSION.getName()), lastControlUsed, numInRow + 1,
|
||||
nbInRow, top);
|
||||
@@ -547,20 +539,10 @@ public class ProcessController extends AbstractElementPropertySectionController
|
||||
if (elem != null && elem instanceof Node) {
|
||||
Node runJobNode = (Node) elem;
|
||||
String paramName = (String) button.getData(PARAMETER_NAME);
|
||||
String jobIds = (String) runJobNode.getPropertyValue(paramName); // .getElementParameter(name).getValue();
|
||||
String jobIds = (String) runJobNode.getPropertyValue(paramName);
|
||||
if (StringUtils.isNotEmpty(jobIds)) {
|
||||
String[] jobsArr = jobIds.split(ProcessController.COMMA);
|
||||
List<RepositoryNode> repositoryNodeList = new ArrayList<RepositoryNode>();
|
||||
for (String id : jobsArr) {
|
||||
if (StringUtils.isNotEmpty(id)) {
|
||||
// if user have selected jobs
|
||||
RepositoryNode node = RepositoryNodeUtilities.getRepositoryNode(id);
|
||||
repositoryNodeList.add(node);
|
||||
}
|
||||
}
|
||||
if (repositoryNodeList != null || repositoryNodeList.size() != 0) {
|
||||
dialog.setRepositoryNodes(repositoryNodeList);
|
||||
}
|
||||
dialog.setNeedCheckedjobs(jobsArr);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.ui.properties.tab.IDynamicProperty;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.components.EmfComponent;
|
||||
import org.talend.designer.core.model.metadata.RepositoryObjectHelper;
|
||||
import org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository;
|
||||
import org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand;
|
||||
import org.talend.designer.core.utils.ValidationRulesUtil;
|
||||
@@ -46,6 +47,7 @@ public class ValidationRuleTypeController extends AbstractRepositoryController {
|
||||
|
||||
public ValidationRuleTypeController(IDynamicProperty dp) {
|
||||
super(dp);
|
||||
repositoryValueHander = new ValidationRuleValueHander();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,42 +129,6 @@ public class ValidationRuleTypeController extends AbstractRepositoryController {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fastInitializeRepositoryNames(IElementParameter param) {
|
||||
super.fastInitializeRepositoryNames(param);
|
||||
|
||||
if (param.getName().equals(EParameterName.REPOSITORY_VALIDATION_RULE_TYPE.getName())) {
|
||||
fastRepositoryUpdateValidationRule(param);
|
||||
}
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateValidationRule(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
String linkedRepository = (String) param.getValue();
|
||||
Item item;
|
||||
String displayName = "";
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
if (item instanceof ConnectionItem) {
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
displayName = dynamicProperty.getRepositoryAliasName(lastItemUsed) + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel();
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -209,4 +175,41 @@ public class ValidationRuleTypeController extends AbstractRepositoryController {
|
||||
}
|
||||
}
|
||||
|
||||
private class ValidationRuleValueHander extends ControllerRepositoryValueHander {
|
||||
|
||||
@Override
|
||||
protected void fastInitializeRepositoryNames(IElementParameter param) {
|
||||
if (param.getName().equals(EParameterName.REPOSITORY_VALIDATION_RULE_TYPE.getName())) {
|
||||
fastRepositoryUpdateValidationRule(param);
|
||||
}
|
||||
}
|
||||
|
||||
private void fastRepositoryUpdateValidationRule(IElementParameter param) {
|
||||
if (param != null && param.getValue() != null) {
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
String linkedRepository = (String) param.getValue();
|
||||
Item item;
|
||||
String displayName = "";
|
||||
try {
|
||||
IRepositoryViewObject object = factory.getLastVersion(linkedRepository);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
item = object.getProperty().getItem();
|
||||
if (item instanceof ConnectionItem) {
|
||||
lastItemUsed = (ConnectionItem) item;
|
||||
displayName = RepositoryObjectHelper.getRepositoryAliasName(lastItemUsed) + ":" //$NON-NLS-1$
|
||||
+ lastItemUsed.getProperty().getLabel();
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
param.setListItemsDisplayName(new String[] { displayName });
|
||||
param.setListItemsValue(new String[] { (String) param.getValue() });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,10 +121,14 @@ public class UpdateJobletNodeCommand extends Command {
|
||||
Node currentNode = getOriginalNodeFromProcess(node);
|
||||
boolean neesPro = needPropagate(currentNode);
|
||||
if (currentNode.isJoblet() || currentNode.isMapReduce()) {// maybe no need modify
|
||||
List<IElementParameter> tempList = new ArrayList<IElementParameter>(currentNode.getElementParameters());
|
||||
if (result.isNeedReloadJoblet()) {
|
||||
reloadNode(currentNode, newComponent);
|
||||
}
|
||||
if (currentNode.getNodeContainer() instanceof JobletContainer) {
|
||||
for(IElementParameter para : tempList){
|
||||
currentNode.getElementParameter(para.getName()).setValue(para.getValue());
|
||||
}
|
||||
((JobletContainer) currentNode.getNodeContainer()).updateJobletNodes(true);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -23,6 +23,8 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.ui.properties.tab.IDynamicProperty;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.AbstractElementPropertySectionController;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.AbstractRepositoryController;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.ControllerRepositoryValueHander;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.generator.IControllerGenerator;
|
||||
|
||||
/**
|
||||
@@ -49,8 +51,7 @@ public class DynamicPropertyGenerator {
|
||||
public void initController(IDynamicProperty dp) {
|
||||
if (!initialized) {
|
||||
|
||||
for (int i = 0; i < extensionElements.length; i++) {
|
||||
IConfigurationElement element = extensionElements[i];
|
||||
for (IConfigurationElement element : extensionElements) {
|
||||
try {
|
||||
String controllerName = element.getAttribute("mapping"); //$NON-NLS-1$
|
||||
EParameterFieldType key = EParameterFieldType.getFieldTypeByName(controllerName);
|
||||
@@ -63,6 +64,11 @@ public class DynamicPropertyGenerator {
|
||||
generator.setDynamicProperty(dp);
|
||||
AbstractElementPropertySectionController controller = generator.generate();
|
||||
dtpControls.put(key, controller);
|
||||
if (controller instanceof AbstractRepositoryController) {
|
||||
ControllerRepositoryValueHander repositoryValueHander = ((AbstractRepositoryController) controller)
|
||||
.getRepositoryValueHander();
|
||||
ControllerRepositoryValueHander.getRepositoryValueHandlerMap().put(key, repositoryValueHander);
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
|
||||
@@ -708,7 +708,7 @@ public class MultipleThreadDynamicComposite extends ScrolledComposite implements
|
||||
|
||||
}
|
||||
|
||||
private final Listener resizeListener = new Listener() {
|
||||
protected final Listener resizeListener = new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
@@ -726,13 +726,7 @@ public class MultipleThreadDynamicComposite extends ScrolledComposite implements
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!isDisposed() && !getParent().isDisposed()) {
|
||||
int currentSize = getParent().getClientArea().height;
|
||||
if (getLastCompositeSize() != currentSize) {
|
||||
addComponents(true);
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
handleResize();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -740,6 +734,17 @@ public class MultipleThreadDynamicComposite extends ScrolledComposite implements
|
||||
}
|
||||
};
|
||||
|
||||
protected void handleResize() {
|
||||
if (!isDisposed() && !getParent().isDisposed()) {
|
||||
int currentSize = getParent().getClientArea().height;
|
||||
if (getLastCompositeSize() != currentSize) {
|
||||
addComponents(true);
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for isCompactView.
|
||||
*
|
||||
|
||||
@@ -516,6 +516,7 @@ public class JavaProcessUtil {
|
||||
if (var.equals(paramName)) {
|
||||
ModuleNeeded module = getModuleNeededForContextParam(contextPara);
|
||||
if (module != null && !modulesNeeded.contains(module)) {
|
||||
module.setDynamic(true);
|
||||
modulesNeeded.add(module);
|
||||
}
|
||||
}
|
||||
@@ -523,6 +524,7 @@ public class JavaProcessUtil {
|
||||
}
|
||||
} else {
|
||||
ModuleNeeded module = new ModuleNeeded(null, TalendTextUtils.removeQuotes(text), null, true);
|
||||
module.setDynamic(true);
|
||||
modulesNeeded.add(module);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,5 +119,82 @@ public class ExternalDbMapData implements IExternalData {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ExternalDbMapData other = (ExternalDbMapData) obj;
|
||||
if(this.inputTables.size() != other.inputTables.size()){
|
||||
return false;
|
||||
}
|
||||
if(this.outputTables.size() != other.outputTables.size()){
|
||||
return false;
|
||||
}
|
||||
if(this.varsTables.size() != other.varsTables.size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
for(ExternalDbMapTable inTable:inputTables){
|
||||
boolean found = false;
|
||||
for(ExternalDbMapTable otherTable:other.inputTables){
|
||||
if(inTable.getName().equals(otherTable.getName())){
|
||||
found = true;
|
||||
if(!inTable.equals(otherTable)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(ExternalDbMapTable outTable:outputTables){
|
||||
boolean found = false;
|
||||
for(ExternalDbMapTable otherTable:other.outputTables){
|
||||
if(outTable.getName().equals(otherTable.getName())){
|
||||
found = true;
|
||||
if(!outTable.equals(otherTable)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(ExternalDbMapTable varTable:varsTables){
|
||||
boolean found = false;
|
||||
for(ExternalDbMapTable var:other.varsTables){
|
||||
if(varTable.getName().equals(var.getName())){
|
||||
found = true;
|
||||
if(!varTable.equals(var)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -127,5 +127,40 @@ public class ExternalDbMapEntry implements IExternalMapEntry, Serializable, Clon
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
return super.clone();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
final ExternalDbMapEntry other = (ExternalDbMapEntry) obj;
|
||||
if (this.expression == null) {
|
||||
if (other.expression != null)
|
||||
return false;
|
||||
} else if (!this.expression.equals(other.expression))
|
||||
return false;
|
||||
if (this.name == null) {
|
||||
if (other.name != null)
|
||||
return false;
|
||||
} else if (!this.name.equals(other.name))
|
||||
return false;
|
||||
if (this.isJoin() != other.isJoin())
|
||||
return false;
|
||||
if (this.operator == null) {
|
||||
if (other.operator != null)
|
||||
return false;
|
||||
} else if (!this.operator.equals(other.operator))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -194,5 +194,154 @@ public class ExternalDbMapTable extends AbstractExternalMapTable implements Seri
|
||||
}
|
||||
return cloned;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final ExternalDbMapTable other = (ExternalDbMapTable) obj;
|
||||
|
||||
if (this.minimized != other.minimized) {
|
||||
return false;
|
||||
}
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.joinType == null) {
|
||||
if (other.joinType != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.joinType.equals(other.joinType)) {
|
||||
return false;
|
||||
}
|
||||
if (this.alias == null) {
|
||||
if (other.alias != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.alias.equals(other.alias)) {
|
||||
return false;
|
||||
}
|
||||
if (this.tableName == null) {
|
||||
if (other.tableName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.tableName.equals(other.tableName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<ExternalDbMapEntry> this_customOtherConditionsEntries = null;
|
||||
if(this.customOtherConditionsEntries == null){
|
||||
this_customOtherConditionsEntries = new ArrayList<ExternalDbMapEntry>();
|
||||
}else{
|
||||
this_customOtherConditionsEntries = new ArrayList<ExternalDbMapEntry>(this.customOtherConditionsEntries);
|
||||
}
|
||||
List<ExternalDbMapEntry> this_metadataTableEntries = null;
|
||||
if(this.metadataTableEntries == null){
|
||||
this_metadataTableEntries = new ArrayList<ExternalDbMapEntry>();
|
||||
}else{
|
||||
this_metadataTableEntries = new ArrayList<ExternalDbMapEntry>(this.metadataTableEntries);
|
||||
}
|
||||
List<ExternalDbMapEntry> this_customWhereConditionsEntries = null;
|
||||
if(this.customWhereConditionsEntries == null){
|
||||
this_customWhereConditionsEntries = new ArrayList<ExternalDbMapEntry>();
|
||||
}else{
|
||||
this_customWhereConditionsEntries = new ArrayList<ExternalDbMapEntry>(this.customWhereConditionsEntries);
|
||||
}
|
||||
|
||||
List<ExternalDbMapEntry> other_customOtherConditionsEntries = null;
|
||||
if(other.customOtherConditionsEntries == null){
|
||||
other_customOtherConditionsEntries = new ArrayList<ExternalDbMapEntry>();
|
||||
}else{
|
||||
other_customOtherConditionsEntries = new ArrayList<ExternalDbMapEntry>(other.customOtherConditionsEntries);
|
||||
}
|
||||
List<ExternalDbMapEntry> other_metadataTableEntries = null;
|
||||
if(other.metadataTableEntries == null){
|
||||
other_metadataTableEntries = new ArrayList<ExternalDbMapEntry>();
|
||||
}else{
|
||||
other_metadataTableEntries = new ArrayList<ExternalDbMapEntry>(other.metadataTableEntries);
|
||||
}
|
||||
List<ExternalDbMapEntry> other_customWhereConditionsEntries = null;
|
||||
if(other.customWhereConditionsEntries == null){
|
||||
other_customWhereConditionsEntries = new ArrayList<ExternalDbMapEntry>();
|
||||
}else{
|
||||
other_customWhereConditionsEntries = new ArrayList<ExternalDbMapEntry>(other.customWhereConditionsEntries);
|
||||
}
|
||||
|
||||
if(this_customOtherConditionsEntries.size() != other_customOtherConditionsEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(ExternalDbMapEntry oriObj:this_customOtherConditionsEntries){
|
||||
boolean found = false;
|
||||
for(ExternalDbMapEntry otherObj:other_customOtherConditionsEntries){
|
||||
if(oriObj.getName().equals(otherObj.getName())){
|
||||
found = true;
|
||||
if(!oriObj.equals(otherObj)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this_customWhereConditionsEntries.size() != other_customWhereConditionsEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(ExternalDbMapEntry oriObj:this_customWhereConditionsEntries){
|
||||
boolean found = false;
|
||||
for(ExternalDbMapEntry otherObj:other_customWhereConditionsEntries){
|
||||
if(oriObj.getName().equals(otherObj.getName())){
|
||||
found = true;
|
||||
if(!oriObj.equals(otherObj)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this_metadataTableEntries.size() != other_metadataTableEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(ExternalDbMapEntry oriObj:this_metadataTableEntries){
|
||||
boolean found = false;
|
||||
for(ExternalDbMapEntry otherObj:other_metadataTableEntries){
|
||||
if(oriObj.getName().equals(otherObj.getName())){
|
||||
found = true;
|
||||
if(!oriObj.equals(otherObj)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,5 +384,63 @@ public class AbstractDBDataMapTableImpl extends EObjectImpl implements AbstractD
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AbstractDBDataMapTableImpl other = (AbstractDBDataMapTableImpl) obj;
|
||||
if(this.minimized != other.minimized){
|
||||
return false;
|
||||
}
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.tableName == null) {
|
||||
if (other.tableName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.tableName.equals(other.tableName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EList<DBMapperTableEntry> otherEntriss = other.getDBMapperTableEntries();
|
||||
if(getDBMapperTableEntries().size() != otherEntriss.size()){
|
||||
return false;
|
||||
}
|
||||
for(DBMapperTableEntry entry:dbMapperTableEntries){
|
||||
boolean found = false;
|
||||
for(DBMapperTableEntry otherEntry:otherEntriss){
|
||||
if(entry.getName().equals(otherEntry.getName())){
|
||||
found = true;
|
||||
if(!entry.equals(otherEntry)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} //AbstractDBDataMapTableImpl
|
||||
|
||||
@@ -227,4 +227,83 @@ public class DBMapDataImpl extends AbstractExternalDataImpl implements DBMapData
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DBMapDataImpl dbObj = (DBMapDataImpl) obj;
|
||||
EList<InputTable> inputs = dbObj.getInputTables();
|
||||
EList<OutputTable> outputs =dbObj.getOutputTables();
|
||||
EList<VarTable> vars =dbObj.getVarTables();
|
||||
if(inputs.size() != getInputTables().size()){
|
||||
return false;
|
||||
}
|
||||
if(outputs.size() != getOutputTables().size()){
|
||||
return false;
|
||||
}
|
||||
if(vars.size() != getVarTables().size()){
|
||||
return false;
|
||||
}
|
||||
for(InputTable inputTable:inputTables){
|
||||
boolean found = false;
|
||||
for(InputTable input:inputs){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(OutputTable outputTable:outputTables){
|
||||
boolean found = false;
|
||||
for(OutputTable output:outputs){
|
||||
if(outputTable.getName().equals(output.getName())){
|
||||
found = true;
|
||||
if(!outputTable.equals(output)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(VarTable varTable:varTables){
|
||||
boolean found = false;
|
||||
for(VarTable var:vars){
|
||||
if(varTable.getName().equals(var.getName())){
|
||||
found = true;
|
||||
if(!varTable.equals(var)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} //DBMapDataImpl
|
||||
|
||||
@@ -433,5 +433,62 @@ public class DBMapperTableEntryImpl extends EObjectImpl implements DBMapperTable
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DBMapperTableEntryImpl other = (DBMapperTableEntryImpl) obj;
|
||||
if(this.join != other.join){
|
||||
return false;
|
||||
}
|
||||
if(this.nullable != other.nullable){
|
||||
return false;
|
||||
}
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.expression == null) {
|
||||
if (other.expression != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expression.equals(other.expression)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.operator == null) {
|
||||
if (other.operator != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.operator.equals(other.operator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.type == null) {
|
||||
if (other.type != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.type.equals(other.type)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} //DBMapperTableEntryImpl
|
||||
|
||||
@@ -253,5 +253,48 @@ public class FilterEntryImpl extends EObjectImpl implements FilterEntry {
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
FilterEntryImpl other = (FilterEntryImpl) obj;
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.expression == null) {
|
||||
if (other.expression != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expression.equals(other.expression)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.filterKind == null) {
|
||||
if (other.filterKind != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.filterKind.equals(other.filterKind)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // FilterEntryImpl
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
package org.talend.designer.dbmap.model.emf.dbmap.impl;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.DBMapperTableEntry;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.DbmapPackage;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.InputTable;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.VarTable;
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
@@ -216,5 +217,41 @@ public class InputTableImpl extends AbstaceDBInOutTableImpl implements InputTabl
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
InputTableImpl other = (InputTableImpl) obj;
|
||||
if (this.alias == null) {
|
||||
if (other.alias != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.alias.equals(other.alias)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.joinType == null) {
|
||||
if (other.joinType != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.joinType.equals(other.joinType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //InputTableImpl
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.eclipse.emf.ecore.EClass;
|
||||
import org.eclipse.emf.ecore.InternalEObject;
|
||||
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.DBMapperTableEntry;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.DbmapPackage;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.FilterEntry;
|
||||
import org.talend.designer.dbmap.model.emf.dbmap.OutputTable;
|
||||
@@ -146,5 +147,47 @@ public class OutputTableImpl extends AbstaceDBInOutTableImpl implements OutputTa
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
OutputTableImpl other = (OutputTableImpl) obj;
|
||||
|
||||
EList<FilterEntry> otherFilters = other.getFilterEntries();
|
||||
|
||||
if (getFilterEntries().size() != otherFilters.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for(FilterEntry filter:getFilterEntries()){
|
||||
boolean found = false;
|
||||
for(FilterEntry otherFilter:otherFilters){
|
||||
if(filter.getName().equals(otherFilter.getName())){
|
||||
found = true;
|
||||
if(!filter.equals(otherFilter)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} // OutputTableImpl
|
||||
|
||||
@@ -140,26 +140,62 @@ public class ExternalMapperData implements IExternalData {
|
||||
return false;
|
||||
}
|
||||
final ExternalMapperData other = (ExternalMapperData) obj;
|
||||
if (this.inputTables == null) {
|
||||
if (other.inputTables != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.inputTables.equals(other.inputTables)) {
|
||||
if(this.inputTables.size() != other.inputTables.size()){
|
||||
return false;
|
||||
}
|
||||
if (this.outputTables == null) {
|
||||
if (other.outputTables != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.outputTables.equals(other.outputTables)) {
|
||||
if(this.outputTables.size() != other.outputTables.size()){
|
||||
return false;
|
||||
}
|
||||
if (this.varsTables == null) {
|
||||
if (other.varsTables != null) {
|
||||
if(this.varsTables.size() != other.varsTables.size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
for(ExternalMapperTable inTable:inputTables){
|
||||
boolean found = false;
|
||||
for(ExternalMapperTable otherTable:other.inputTables){
|
||||
if(inTable.getName().equals(otherTable.getName())){
|
||||
found = true;
|
||||
if(!inTable.equals(otherTable)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(ExternalMapperTable outTable:outputTables){
|
||||
boolean found = false;
|
||||
for(ExternalMapperTable otherTable:other.outputTables){
|
||||
if(outTable.getName().equals(otherTable.getName())){
|
||||
found = true;
|
||||
if(!outTable.equals(otherTable)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(ExternalMapperTable varTable:varsTables){
|
||||
boolean found = false;
|
||||
for(ExternalMapperTable var:other.varsTables){
|
||||
if(varTable.getName().equals(var.getName())){
|
||||
found = true;
|
||||
if(!varTable.equals(var)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
} else if (!this.varsTables.equals(other.varsTables)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -399,13 +399,7 @@ public class ExternalMapperTable extends AbstractExternalMapTable implements Ser
|
||||
if (this.activateExpressionFilter != other.activateExpressionFilter) {
|
||||
return false;
|
||||
}
|
||||
if (this.constraintTableEntries == null) {
|
||||
if (other.constraintTableEntries != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.constraintTableEntries.equals(other.constraintTableEntries)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.expressionFilter == null) {
|
||||
if (other.expressionFilter != null) {
|
||||
return false;
|
||||
@@ -430,13 +424,7 @@ public class ExternalMapperTable extends AbstractExternalMapTable implements Ser
|
||||
} else if (!this.lookupMode.equals(other.lookupMode)) {
|
||||
return false;
|
||||
}
|
||||
if (this.metadataTableEntries == null) {
|
||||
if (other.metadataTableEntries != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.metadataTableEntries.equals(other.metadataTableEntries)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.minimized != other.minimized) {
|
||||
return false;
|
||||
}
|
||||
@@ -473,13 +461,101 @@ public class ExternalMapperTable extends AbstractExternalMapTable implements Ser
|
||||
} else if (!this.id.equals(other.id)) {
|
||||
return false;
|
||||
}
|
||||
if (this.globalMapKeysValues == null) {
|
||||
if (other.globalMapKeysValues != null) {
|
||||
|
||||
List<ExternalMapperTableEntry> this_constraintTableEntries = null;
|
||||
if(this.constraintTableEntries == null){
|
||||
this_constraintTableEntries = new ArrayList<ExternalMapperTableEntry>();
|
||||
}else{
|
||||
this_constraintTableEntries = new ArrayList<ExternalMapperTableEntry>(this.constraintTableEntries);
|
||||
}
|
||||
List<ExternalMapperTableEntry> this_metadataTableEntries = null;
|
||||
if(this.metadataTableEntries == null){
|
||||
this_metadataTableEntries = new ArrayList<ExternalMapperTableEntry>();
|
||||
}else{
|
||||
this_metadataTableEntries = new ArrayList<ExternalMapperTableEntry>(this.metadataTableEntries);
|
||||
}
|
||||
List<ExternalMapperTableEntry> this_globalMapKeysValues = null;
|
||||
if(this.globalMapKeysValues == null){
|
||||
this_globalMapKeysValues = new ArrayList<ExternalMapperTableEntry>();
|
||||
}else{
|
||||
this_globalMapKeysValues = new ArrayList<ExternalMapperTableEntry>(this.globalMapKeysValues);
|
||||
}
|
||||
|
||||
List<ExternalMapperTableEntry> other_constraintTableEntries = null;
|
||||
if(other.constraintTableEntries == null){
|
||||
other_constraintTableEntries = new ArrayList<ExternalMapperTableEntry>();
|
||||
}else{
|
||||
other_constraintTableEntries = new ArrayList<ExternalMapperTableEntry>(other.constraintTableEntries);
|
||||
}
|
||||
List<ExternalMapperTableEntry> other_metadataTableEntries = null;
|
||||
if(other.metadataTableEntries == null){
|
||||
other_metadataTableEntries = new ArrayList<ExternalMapperTableEntry>();
|
||||
}else{
|
||||
other_metadataTableEntries = new ArrayList<ExternalMapperTableEntry>(other.metadataTableEntries);
|
||||
}
|
||||
List<ExternalMapperTableEntry> other_globalMapKeysValues = null;
|
||||
if(other.globalMapKeysValues == null){
|
||||
other_globalMapKeysValues = new ArrayList<ExternalMapperTableEntry>();
|
||||
}else{
|
||||
other_globalMapKeysValues = new ArrayList<ExternalMapperTableEntry>(other.globalMapKeysValues);
|
||||
}
|
||||
|
||||
if(this_constraintTableEntries.size() != other_constraintTableEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(ExternalMapperTableEntry oriObj:this_constraintTableEntries){
|
||||
boolean found = false;
|
||||
for(ExternalMapperTableEntry otherObj:other_constraintTableEntries){
|
||||
if(oriObj.getName().equals(otherObj.getName())){
|
||||
found = true;
|
||||
if(!oriObj.equals(otherObj)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
} else if (!this.globalMapKeysValues.equals(other.globalMapKeysValues)) {
|
||||
}
|
||||
|
||||
if(this_metadataTableEntries.size() != other_metadataTableEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(ExternalMapperTableEntry oriObj:this_metadataTableEntries){
|
||||
boolean found = false;
|
||||
for(ExternalMapperTableEntry otherObj:other_metadataTableEntries){
|
||||
if(oriObj.getName().equals(otherObj.getName())){
|
||||
found = true;
|
||||
if(!oriObj.equals(otherObj)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this_globalMapKeysValues.size() != other_globalMapKeysValues.size()){
|
||||
return false;
|
||||
}
|
||||
for(ExternalMapperTableEntry oriObj:this_globalMapKeysValues){
|
||||
boolean found = false;
|
||||
for(ExternalMapperTableEntry otherObj:other_globalMapKeysValues){
|
||||
if(oriObj.getName().equals(otherObj.getName())){
|
||||
found = true;
|
||||
if(!oriObj.equals(otherObj)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ public class JavaLanguage extends AbstractLanguage {
|
||||
/**
|
||||
* {0} and {1} must be replaced respectively by the table name and the column name.
|
||||
*/
|
||||
private static final String SUBST_PATTERN_FOR_REPLACE_LOCATION = PREFIX_TABLE_NAME_REGEXP + "(\\s*){0}(\\s*)" //$NON-NLS-1$
|
||||
+ SUFFIX_TABLE_NAME_REGEXP + "(\\s*)" + PREFIX_FIELD_NAME_REGEXP + "(\\s*){1}(\\s*)" + SUFFIX_FIELD_NAME_REGEXP; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
private static final String SUBST_PATTERN_FOR_REPLACE_LOCATION = PREFIX_TABLE_NAME_REGEXP + "(\\s*)\\b{0}\\b(\\s*)" //$NON-NLS-1$
|
||||
+ SUFFIX_TABLE_NAME_REGEXP + "(\\s*)" + PREFIX_FIELD_NAME_REGEXP + "(\\s*)\\b{1}\\b(\\s*)" + SUFFIX_FIELD_NAME_REGEXP; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
/**
|
||||
* {0} and {1} must be replaced respectively by the table name and the column name.
|
||||
|
||||
@@ -86,6 +86,7 @@ import org.talend.designer.mapper.ui.visualmap.table.EntryState;
|
||||
import org.talend.designer.mapper.ui.visualmap.zone.Zone;
|
||||
import org.talend.designer.mapper.ui.visualmap.zone.scrollable.TablesZoneView;
|
||||
import org.talend.designer.mapper.utils.DataMapExpressionParser;
|
||||
import org.talend.designer.mapper.utils.MapperHelper;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
|
||||
@@ -132,8 +133,7 @@ public class MapperManager extends AbstractMapperManager {
|
||||
problemsManager = new ProblemsManager(this);
|
||||
IProcess process = getAbstractMapComponent().getProcess();
|
||||
isMRProcess = ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(process.getComponentsType());
|
||||
isBigDataProcess = isMRProcess || ComponentCategory.CATEGORY_4_SPARK.getName().equals(process.getComponentsType())
|
||||
|| ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType());
|
||||
isBigDataProcess = MapperHelper.isMapperOnBigDataProcess(process.getComponentsType());
|
||||
getDefaultSetting();
|
||||
}
|
||||
|
||||
|
||||
@@ -310,4 +310,64 @@ public abstract class AbstractDataMapTableImpl extends EObjectImpl implements Ab
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AbstractDataMapTableImpl other = (AbstractDataMapTableImpl) obj;
|
||||
if(this.minimized != other.minimized){
|
||||
return false;
|
||||
}
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.sizeState == null) {
|
||||
if (other.sizeState != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.sizeState.getName().equals(other.sizeState.getName())) {
|
||||
return false;
|
||||
}else if (this.sizeState.getValue() != other.sizeState.getValue()) {
|
||||
return false;
|
||||
}else if (!this.sizeState.getLiteral().equals(other.sizeState.getLiteral())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EList<MapperTableEntry> otherEntries = other.getMapperTableEntries();
|
||||
if(getMapperTableEntries().size() != otherEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(MapperTableEntry entry:mapperTableEntries){
|
||||
boolean found = false;
|
||||
for(MapperTableEntry otherEntry:otherEntries){
|
||||
if(entry.getName().equals(otherEntry.getName())){
|
||||
found = true;
|
||||
if(!entry.equals(otherEntry)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // AbstractDataMapTableImpl
|
||||
|
||||
@@ -7,11 +7,8 @@
|
||||
package org.talend.designer.mapper.model.emf.mapper.impl;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
|
||||
import org.talend.designer.mapper.model.emf.mapper.AbstractInOutTable;
|
||||
import org.talend.designer.mapper.model.emf.mapper.MapperPackage;
|
||||
|
||||
@@ -324,5 +321,40 @@ public abstract class AbstractInOutTableImpl extends AbstractDataMapTableImpl im
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AbstractInOutTableImpl other = (AbstractInOutTableImpl) obj;
|
||||
if (this.activateCondensedTool != other.activateCondensedTool) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.activateExpressionFilter != other.activateExpressionFilter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.expressionFilter == null) {
|
||||
if (other.expressionFilter != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expressionFilter.equals(other.expressionFilter)) {
|
||||
return false;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //AbstractInOutTableImpl
|
||||
|
||||
@@ -380,5 +380,69 @@ public class InputTableImpl extends AbstractInOutTableImpl implements InputTable
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
InputTableImpl other = (InputTableImpl) obj;
|
||||
if (this.innerJoin != other.innerJoin) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.persistent != other.persistent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.lookupMode == null) {
|
||||
if (other.lookupMode != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.lookupMode.equals(other.lookupMode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.matchingMode == null) {
|
||||
if (other.matchingMode != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.matchingMode.equals(other.matchingMode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EList<MapperTableEntry> otherEntries = other.getGlobalMapKeysValues();
|
||||
if(getGlobalMapKeysValues().size() != otherEntries.size()){
|
||||
return false;
|
||||
}
|
||||
for(MapperTableEntry entry:getGlobalMapKeysValues()){
|
||||
boolean found = false;
|
||||
for(MapperTableEntry otherEntry:otherEntries){
|
||||
if(entry.getName().equals(otherEntry.getName())){
|
||||
found = true;
|
||||
if(!entry.equals(otherEntry)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //InputTableImpl
|
||||
|
||||
@@ -22,7 +22,6 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.impl.AbstractExternalDataImpl;
|
||||
|
||||
import org.talend.designer.mapper.model.emf.mapper.InputTable;
|
||||
import org.talend.designer.mapper.model.emf.mapper.MapperData;
|
||||
import org.talend.designer.mapper.model.emf.mapper.MapperPackage;
|
||||
@@ -297,4 +296,83 @@ public class MapperDataImpl extends AbstractExternalDataImpl implements MapperDa
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MapperDataImpl dbObj = (MapperDataImpl) obj;
|
||||
EList<InputTable> inputs = dbObj.getInputTables();
|
||||
EList<OutputTable> outputs =dbObj.getOutputTables();
|
||||
EList<VarTable> vars =dbObj.getVarTables();
|
||||
if(inputs.size() != getInputTables().size()){
|
||||
return false;
|
||||
}
|
||||
if(outputs.size() != getOutputTables().size()){
|
||||
return false;
|
||||
}
|
||||
if(vars.size() != getVarTables().size()){
|
||||
return false;
|
||||
}
|
||||
for(InputTable inputTable:inputTables){
|
||||
boolean found = false;
|
||||
for(InputTable input:inputs){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(OutputTable outputTable:outputTables){
|
||||
boolean found = false;
|
||||
for(OutputTable output:outputs){
|
||||
if(outputTable.getName().equals(output.getName())){
|
||||
found = true;
|
||||
if(!outputTable.equals(output)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(VarTable varTable:varTables){
|
||||
boolean found = false;
|
||||
for(VarTable var:vars){
|
||||
if(varTable.getName().equals(var.getName())){
|
||||
found = true;
|
||||
if(!varTable.equals(var)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} //MapperDataImpl
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package org.talend.designer.mapper.model.emf.mapper.impl;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
@@ -379,5 +379,60 @@ public class MapperTableEntryImpl extends EObjectImpl implements MapperTableEntr
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
MapperTableEntryImpl other = (MapperTableEntryImpl) obj;
|
||||
if(this.nullable != other.nullable){
|
||||
return false;
|
||||
}
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.expression == null) {
|
||||
if (other.expression != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expression.equals(other.expression)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.type == null) {
|
||||
if (other.type != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.type.equals(other.type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.operator == null) {
|
||||
if (other.operator != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.operator.equals(other.operator)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} //MapperTableEntryImpl
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
package org.talend.designer.mapper.model.emf.mapper.impl;
|
||||
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.emf.ecore.EClass;
|
||||
|
||||
import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
|
||||
import org.talend.designer.mapper.model.emf.mapper.MapperPackage;
|
||||
import org.talend.designer.mapper.model.emf.mapper.OutputTable;
|
||||
|
||||
@@ -324,5 +323,51 @@ public class OutputTableImpl extends AbstractInOutTableImpl implements OutputTab
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
OutputTableImpl other = (OutputTableImpl) obj;
|
||||
if(this.isErrorRejectTable != other.isErrorRejectTable){
|
||||
return false;
|
||||
}
|
||||
if(this.reject != other.reject){
|
||||
return false;
|
||||
}
|
||||
if(this.rejectInnerJoin != other.rejectInnerJoin){
|
||||
return false;
|
||||
}
|
||||
if(this.rejectInnerJoin != other.rejectInnerJoin){
|
||||
return false;
|
||||
}
|
||||
if (this.isJoinTableOf == null) {
|
||||
if (other.isJoinTableOf != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.isJoinTableOf.equals(other.isJoinTableOf)) {
|
||||
return false;
|
||||
}
|
||||
if (this.expressionFilter == null) {
|
||||
if (other.expressionFilter != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expressionFilter.equals(other.expressionFilter)) {
|
||||
return false;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //OutputTableImpl
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.designer.mapper.external.data.ExternalMapperData;
|
||||
@@ -45,6 +46,9 @@ public class MapperHelper {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isGeneratedAsVirtualComponent(final INode mapperNode) {
|
||||
if (isMapperOnBigDataProcess(mapperNode.getComponent().getPaletteType())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean hasPersistentSortedLookup = false;
|
||||
|
||||
@@ -86,6 +90,11 @@ public class MapperHelper {
|
||||
}
|
||||
return hasPersistentSortedLookup;
|
||||
}
|
||||
|
||||
public static boolean isMapperOnBigDataProcess(String componentType) {
|
||||
return ComponentCategory.CATEGORY_4_SPARK.getName().equals(componentType)
|
||||
|| ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(componentType) || ComponentCategory.CATEGORY_4_MAPREDUCE.getName().equals(componentType);
|
||||
}
|
||||
|
||||
public static void saveDataToEmf(ExternalMapperData externalData, MapperData emfMapperData) {
|
||||
if (externalData == null || externalData == null) {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
|
||||
<files>
|
||||
@@ -197,6 +196,7 @@
|
||||
<moduleSets>
|
||||
<moduleSet>
|
||||
<!-- for routines or talend libs -->
|
||||
<includeSubModules>false</includeSubModules>
|
||||
<useAllReactorProjects>true</useAllReactorProjects>
|
||||
<includes>
|
||||
<include>${routines.binaries.includes.set}</include>
|
||||
@@ -211,6 +211,7 @@
|
||||
</moduleSet>
|
||||
<moduleSet>
|
||||
<!-- for pigudfs or talend libs -->
|
||||
<includeSubModules>false</includeSubModules>
|
||||
<useAllReactorProjects>true</useAllReactorProjects>
|
||||
<includes>
|
||||
<include>${pigudfs.binaries.includes.set}</include>
|
||||
|
||||
@@ -164,9 +164,12 @@ public abstract class AbstractPublishJobAction implements IRunnableWithProgress
|
||||
exportChoiceMap.put(ExportChoice.includeLibs, true);
|
||||
|
||||
ProcessItem processItem = (ProcessItem) node.getObject().getProperty().getItem();
|
||||
|
||||
BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(), processItem, processItem.getProperty().getVersion(),
|
||||
processItem.getProcess().getDefaultContext(), exportChoiceMap, exportType, monitor);
|
||||
String contextName = (String) exportChoiceMap.get(ExportChoice.contextName);
|
||||
if (contextName == null) {
|
||||
contextName = processItem.getProcess().getDefaultContext();
|
||||
}
|
||||
BuildJobManager.getInstance().buildJob(tmpJob.getAbsolutePath(), processItem, jobVersion, contextName,
|
||||
exportChoiceMap, exportType, monitor);
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(
|
||||
IRunProcessService.class);
|
||||
|
||||
@@ -20,9 +20,13 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.designer.rowgenerator.RowGeneratorComponent;
|
||||
import org.talend.designer.rowgenerator.managers.UIManager;
|
||||
import org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt;
|
||||
import org.talend.utils.json.JSONArray;
|
||||
import org.talend.utils.json.JSONException;
|
||||
import org.talend.utils.json.JSONObject;
|
||||
|
||||
/**
|
||||
* class global comment. Detailled comment <br/>
|
||||
@@ -112,6 +116,35 @@ public class FunctionManagerExt extends FunctionManager {
|
||||
return arrayTalendFunctions2;
|
||||
}
|
||||
|
||||
public Function getFunctionFromColumn(MetadataColumnExt column) {
|
||||
Function function = null;
|
||||
String functionInfo = column.getFunctionInfo();
|
||||
if (functionInfo != null) {
|
||||
try {
|
||||
JSONObject functionObj = new JSONObject(functionInfo);
|
||||
String functionName = functionObj.getString(Function.NAME);
|
||||
int functionSize = 0;
|
||||
JSONArray parametersArray = functionObj.getJSONArray(Function.PARAMETERS);
|
||||
if (parametersArray != null) {
|
||||
functionSize = parametersArray.length();
|
||||
}
|
||||
List<Function> funcs = getFunctionsByType(column.getTalendType());
|
||||
for (Function func : funcs) {
|
||||
if (func.getName().equals(functionName) && func.getParameters().size() == functionSize) {
|
||||
function = func;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (function != null) {
|
||||
function = function.clone(parametersArray);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return function;
|
||||
}
|
||||
|
||||
public Function getFuntionFromArray(MetadataColumnExt bean, RowGeneratorComponent externalNode, int index) {
|
||||
String value = externalNode.getColumnValue(bean, index);
|
||||
List<Function> functions = getFunctionsByType(bean.getTalendType());
|
||||
|
||||
@@ -240,7 +240,11 @@ public class UIManager {
|
||||
List<Function> funs = functionManager.getFunctionsByType(ext.getTalendType());
|
||||
ext.setArrayFunctions(functionManager.getFunctionArrays(funs));
|
||||
if (!funs.isEmpty()) {
|
||||
ext.setFunction(functionManager.getFuntionFromArray(ext, externalNode, j));
|
||||
Function funtion = functionManager.getFunctionFromColumn(ext);
|
||||
if (funtion == null) {
|
||||
funtion = functionManager.getFuntionFromArray(ext, externalNode, j);
|
||||
}
|
||||
ext.setFunction(funtion);
|
||||
}
|
||||
exts.add(ext);
|
||||
}
|
||||
|
||||
@@ -14,10 +14,12 @@ package org.talend.designer.rowgenerator.ui.editor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
import org.talend.core.model.metadata.MetadataColumn;
|
||||
import org.talend.designer.rowgenerator.data.Function;
|
||||
import org.talend.designer.rowgenerator.data.Parameter;
|
||||
import org.talend.utils.json.JSONException;
|
||||
|
||||
/**
|
||||
* qzhang class global comment. Detailled comment <br/>
|
||||
@@ -27,6 +29,8 @@ import org.talend.designer.rowgenerator.data.Parameter;
|
||||
*/
|
||||
public class MetadataColumnExt extends MetadataColumn {
|
||||
|
||||
public static final String FUNCTION_INFO = "FUNCTION_INFO"; //$NON-NLS-1$
|
||||
|
||||
private boolean isChanged;
|
||||
|
||||
/**
|
||||
@@ -51,9 +55,25 @@ public class MetadataColumnExt extends MetadataColumn {
|
||||
|
||||
public void setFunction(Function function) {
|
||||
this.function = function;
|
||||
updateFunctionInfo();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
||||
private void updateFunctionInfo() {
|
||||
if (function != null) {
|
||||
try {
|
||||
String serializedFunction = function.toSerialized();
|
||||
this.getAdditionalField().put(FUNCTION_INFO, serializedFunction);
|
||||
} catch (JSONException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getFunctionInfo() {
|
||||
return this.getAdditionalField().get(FUNCTION_INFO);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public String getParameter() {
|
||||
String currentPara = ""; //$NON-NLS-1$
|
||||
if (this.function != null) {
|
||||
|
||||
@@ -127,4 +127,5 @@ WorkingSetConfigurationDialog_down_label=&Down
|
||||
ShellShSettingPreferencePage_Title=Shell scripts
|
||||
ShellBatSettingPreferencePage_Title=Bat scripts
|
||||
JavaProcessor.warn.codeFormatTimeout.title=Warning
|
||||
JavaProcessor.warn.codeFormatTimeout.message=Code Format action for source code is stopped by studio since it ran time out.\n\n You can configure the timeout in Window > Preference > Talend > Performance : Code Format timeout(seconds)
|
||||
JavaProcessor.warn.codeFormatTimeout.message=Code Format action for source code is stopped by studio since it ran time out.\n\n You can configure the timeout in Window > Preference > Talend > Performance : Code Format timeout(seconds)
|
||||
JavaCompilationParticipant.validateRoutine=Validate routines...
|
||||
@@ -430,16 +430,17 @@ public class DefaultRunProcessService implements IRunProcessService {
|
||||
String log4jStr = getTemplateStrFromPreferenceStore(Log4jPrefsConstants.LOG4J_CONTENT_NODE);
|
||||
if (log4jStr != null) {
|
||||
File ljFile = new File(log4jFile.getLocation().toOSString());
|
||||
// if (!ljFile.exists()) {
|
||||
FileOutputStream ljFileOutputStream = null;
|
||||
try {
|
||||
ljFile.getParentFile().mkdirs();
|
||||
ljFileOutputStream = new FileOutputStream(ljFile);
|
||||
ljFileOutputStream.write(log4jStr.getBytes());
|
||||
} finally {
|
||||
ljFileOutputStream.close();
|
||||
if (ljFileOutputStream != null) {
|
||||
ljFileOutputStream.close();
|
||||
}
|
||||
}
|
||||
resFolder.refreshLocal(IResource.DEPTH_ONE, null);
|
||||
// }
|
||||
}
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -143,10 +143,11 @@ public class JobErrorsChecker {
|
||||
}
|
||||
// check the item has compile error when export job
|
||||
boolean ret = false;
|
||||
String message = null;
|
||||
IMarker[] markers = sourceFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ONE);
|
||||
for (IMarker marker : markers) {
|
||||
Integer lineNr = (Integer) marker.getAttribute(IMarker.LINE_NUMBER);
|
||||
String message = (String) marker.getAttribute(IMarker.MESSAGE);
|
||||
message = (String) marker.getAttribute(IMarker.MESSAGE);
|
||||
Integer severity = (Integer) marker.getAttribute(IMarker.SEVERITY);
|
||||
Integer start = (Integer) marker.getAttribute(IMarker.CHAR_START);
|
||||
Integer end = (Integer) marker.getAttribute(IMarker.CHAR_END);
|
||||
@@ -164,11 +165,11 @@ public class JobErrorsChecker {
|
||||
if (isJob) {
|
||||
throw new ProcessorException(Messages.getString("JobErrorsChecker_compile_errors") + '\n' + //$NON-NLS-1$
|
||||
Messages.getString("JobErrorsChecker_compile_error_content", item.getProperty() //$NON-NLS-1$
|
||||
.getLabel()));
|
||||
.getLabel()) + '\n' + message);
|
||||
} else {
|
||||
throw new ProcessorException(Messages.getString("CamelJobErrorsChecker_compile_errors") + '\n' + //$NON-NLS-1$
|
||||
Messages.getString("CamelJobErrorsChecker_compile_error_content", item.getProperty() //$NON-NLS-1$
|
||||
.getLabel()));
|
||||
.getLabel()) + '\n' + message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ public class RunProcessContext {
|
||||
final IProgressMonitor progressMonitor = new EventLoopProgressMonitor(monitor);
|
||||
|
||||
progressMonitor.beginTask(Messages.getString("ProcessComposite.buildTask"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
try {
|
||||
|
||||
testPort();
|
||||
// findNewStatsPort();
|
||||
if (monitorPerf || monitorTrace) {
|
||||
@@ -557,10 +557,23 @@ public class RunProcessContext {
|
||||
final String log4jRuntimeLevel = getLog4jRuntimeLevel();
|
||||
processor.setContext(context);
|
||||
((IEclipseProcessor) processor).setTargetExecutionConfig(getSelectedTargetExecutionConfig());
|
||||
|
||||
ProcessorUtilities.generateCode(processor, process, context,
|
||||
try {
|
||||
ProcessorUtilities.generateCode(processor, process, context,
|
||||
getStatisticsPort() != IProcessor.NO_STATISTICS, getTracesPort() != IProcessor.NO_TRACES
|
||||
&& hasConnectionTrace(), true, progressMonitor);
|
||||
} catch (Throwable e) {
|
||||
// catch any Exception or Error to kill the process,
|
||||
// see bug 0003567
|
||||
running = true;
|
||||
ExceptionHandler.process(e);
|
||||
addErrorMessage(e);
|
||||
kill();
|
||||
} finally {
|
||||
progressMonitor.done();
|
||||
// System.out.println("exitValue:" +
|
||||
// ps.exitValue());
|
||||
}
|
||||
|
||||
final boolean[] refreshUiAndWait = new boolean[1];
|
||||
refreshUiAndWait[0] = true;
|
||||
final Display display = shell.getDisplay();
|
||||
@@ -640,18 +653,7 @@ public class RunProcessContext {
|
||||
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
// catch any Exception or Error to kill the process,
|
||||
// see bug 0003567
|
||||
running = true;
|
||||
ExceptionHandler.process(e);
|
||||
addErrorMessage(e);
|
||||
kill();
|
||||
} finally {
|
||||
progressMonitor.done();
|
||||
// System.out.println("exitValue:" +
|
||||
// ps.exitValue());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
} catch (InvocationTargetException e1) {
|
||||
|
||||
@@ -20,23 +20,13 @@ import java.util.List;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.log4j.Level;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.PropertiesPackage;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
|
||||
import org.talend.core.service.IMRProcessService;
|
||||
import org.talend.core.service.IStormProcessService;
|
||||
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;
|
||||
import org.talend.designer.runprocess.IProcessMessageManager;
|
||||
import org.talend.designer.runprocess.ProcessorException;
|
||||
import org.talend.designer.runprocess.RunProcessPlugin;
|
||||
@@ -73,7 +63,16 @@ public class ExportModelJavaProcessor extends MavenJavaProcessor {
|
||||
// export job
|
||||
String watchParam = ArrayUtils.contains(optionsParam, TalendProcessArgumentConstant.CMD_ARG_WATCH) ? TalendProcessArgumentConstant.CMD_ARG_WATCH
|
||||
: null;
|
||||
archive = helper.exportJob(this, statisticsPort, tracePort, watchParam, monitor);
|
||||
String log4jLevel = null;
|
||||
if (ArrayUtils.contains(optionsParam, TalendProcessArgumentConstant.CMD_ARG_LOG4J_LEVEL)) {
|
||||
for (String param : optionsParam) {
|
||||
if (param != null && param.indexOf(TalendProcessArgumentConstant.CMD_ARG_LOG4J_LEVEL) >= 0) {
|
||||
log4jLevel = param;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
archive = helper.exportJob(this, statisticsPort, tracePort, watchParam, log4jLevel, monitor);
|
||||
unzipFolder = unzipAndDeploy(process, archive);
|
||||
|
||||
Process process = super.execFrom(unzipFolder + File.separatorChar + this.process.getName(), Level.INFO, statisticsPort,
|
||||
|
||||
@@ -107,7 +107,7 @@ public class ExportProcessorHelper {
|
||||
return tempFolder;
|
||||
}
|
||||
|
||||
public String exportJob(Processor processor, int statisticsPort, int tracePort, String watchParam,
|
||||
public String exportJob(Processor processor, int statisticsPort, int tracePort, String watchParam, String log4jLevel,
|
||||
final IProgressMonitor progressMonitor) throws ProcessorException {
|
||||
ProcessItem processItem = (ProcessItem) processor.getProperty().getItem();
|
||||
processName = processor.getProperty().getLabel();
|
||||
@@ -145,7 +145,7 @@ public class ExportProcessorHelper {
|
||||
}
|
||||
|
||||
export(progressMonitor, processItem, ERepositoryObjectType.getItemType(processItem), processor.getContext().getName(),
|
||||
archiveFile.toString(), null, false, statisticsPort, tracePort, prop);
|
||||
archiveFile.toString(), log4jLevel, false, statisticsPort, tracePort, prop);
|
||||
|
||||
return archiveFile.toString();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jdt.core.IJavaProject;
|
||||
import org.eclipse.jdt.core.compiler.BuildContext;
|
||||
import org.eclipse.jdt.core.compiler.CompilationParticipant;
|
||||
@@ -36,6 +40,7 @@ import org.talend.designer.codegen.ITalendSynchronizer;
|
||||
import org.talend.designer.codegen.model.CodeGeneratorEmittersPoolFactory;
|
||||
import org.talend.designer.core.ui.views.problems.Problems;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.designer.runprocess.i18n.Messages;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
/**
|
||||
@@ -58,46 +63,60 @@ public class JavaCompilationParticipant extends CompilationParticipant {
|
||||
* [])
|
||||
*/
|
||||
@Override
|
||||
public void processAnnotations(BuildContext[] files) {
|
||||
public void processAnnotations(final BuildContext[] files) {
|
||||
|
||||
boolean routineToUpdate = false;
|
||||
super.processAnnotations(files);
|
||||
|
||||
List<IRepositoryViewObject> routineObjectList = null;
|
||||
for (BuildContext context : files) {
|
||||
Job routineJob = new Job(Messages.getString("JavaCompilationParticipant.validateRoutine")) { //$NON-NLS-1$
|
||||
|
||||
String filePath = (context.getFile().getProjectRelativePath()).toString();
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
boolean routineToUpdate = false;
|
||||
List<IRepositoryViewObject> routineObjectList = null;
|
||||
for (BuildContext context : files) {
|
||||
|
||||
if (isRoutineFile(filePath)) {
|
||||
if (!routineToUpdate) {
|
||||
IProxyRepositoryFactory factory = CorePlugin.getDefault().getProxyRepositoryFactory();
|
||||
String filePath = (context.getFile().getProjectRelativePath()).toString();
|
||||
|
||||
try {
|
||||
if (isRoutineFile(filePath)) {
|
||||
if (!routineToUpdate) {
|
||||
IProxyRepositoryFactory factory = CorePlugin.getDefault().getProxyRepositoryFactory();
|
||||
|
||||
routineObjectList = factory.getAll(ERepositoryObjectType.ROUTINES, false);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
try {
|
||||
|
||||
routineObjectList = factory.getAll(ERepositoryObjectType.ROUTINES, false);
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
updateProblems(routineObjectList, filePath);
|
||||
routineToUpdate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateProblems(routineObjectList, filePath);
|
||||
routineToUpdate = true;
|
||||
|
||||
if (routineToUpdate && !CommonsPlugin.isHeadless()) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Problems.refreshProblemTreeView();
|
||||
} catch (Exception e) {
|
||||
// ignore any exception here, as there is no impact if refresh or not.
|
||||
// but if don't ignore, exception could be thrown if refresh is done too early.
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
if (routineToUpdate && !CommonsPlugin.isHeadless()) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Problems.refreshProblemTreeView();
|
||||
} catch (Exception e) {
|
||||
// ignore any exception here, as there is no impact if refresh or not.
|
||||
// but if don't ignore, exception could be thrown if refresh is done too early.
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
routineJob.setUser(false);
|
||||
routineJob.setRule(null);
|
||||
routineJob.schedule();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.io.LineNumberReader;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -117,6 +118,7 @@ import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.process.TalendProcessOptionConstants;
|
||||
import org.talend.core.ui.services.IRulesProviderService;
|
||||
import org.talend.core.utils.BitwiseOptionUtils;
|
||||
import org.talend.designer.codegen.ICodeGenerator;
|
||||
@@ -455,21 +457,13 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
for (IResource resource : javaCodeFolder.members()) {
|
||||
if ("java".equals(resource.getFileExtension())) {//$NON-NLS-1$
|
||||
if (processSourceFileName != null && processSourceFileName.equals(resource.getName())) {
|
||||
((IFile) resource).setContents(new ByteArrayInputStream(new byte[0]), IResource.KEEP_HISTORY,
|
||||
((IFile) resource).setContents(new ByteArrayInputStream(new byte[0]), true, false,
|
||||
null);
|
||||
} else {
|
||||
try {
|
||||
org.talend.commons.utils.io.FilesUtils.removeExistedResources(null, resource, true, true);
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
resource.delete(true, null);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
org.talend.commons.utils.io.FilesUtils.removeExistedResources(null, resource, true, true);
|
||||
} catch (Exception e) {
|
||||
throw new ProcessorException(e);
|
||||
}
|
||||
resource.delete(true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -514,8 +508,8 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
* boolean, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void generateCode(boolean statistics, boolean trace, boolean javaProperties) throws ProcessorException {
|
||||
super.generateCode(statistics, trace, javaProperties);
|
||||
public void generateCode(boolean statistics, boolean trace, boolean javaProperties, int option) throws ProcessorException {
|
||||
super.generateCode(statistics, trace, javaProperties, option);
|
||||
try {
|
||||
// hywang modified for 6484
|
||||
String currentJavaProject = ProjectManager.getInstance().getProject(property).getTechnicalLabel();
|
||||
@@ -579,96 +573,9 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
// format the code before save the file.
|
||||
final String toFormat = processCode;
|
||||
writeCodesToFile(toFormat, "1-beforeFormat");//$NON-NLS-1$
|
||||
// fix for 21320
|
||||
final Job job = new Job("t") { //$NON-NLS-1$
|
||||
|
||||
private Thread workThread;
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
monitor.beginTask("Format code", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
FutureTask<Boolean> ft = new FutureTask<Boolean>(new Callable<Boolean>() {
|
||||
|
||||
@Override
|
||||
public Boolean call() throws Exception {
|
||||
formatedCode = formatCode(toFormat);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
});
|
||||
Boolean isSucceed = null;
|
||||
try {
|
||||
workThread = new Thread(ft);
|
||||
workThread.start();
|
||||
isSucceed = ft.get();
|
||||
} catch (Throwable e) {
|
||||
if (!monitor.isCanceled()) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (isSucceed == Boolean.TRUE && !monitor.isCanceled()) {
|
||||
writeCodesToFile(formatedCode, "2-afterFormat");//$NON-NLS-1$
|
||||
}
|
||||
monitor.done();
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void canceling() {
|
||||
try {
|
||||
super.canceling();
|
||||
if (workThread != null) {
|
||||
workThread.stop();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// should catch the ThreadDeath, in case to crash Studio
|
||||
}
|
||||
}
|
||||
};
|
||||
long time1 = System.currentTimeMillis();
|
||||
|
||||
job.setSystem(true);
|
||||
job.schedule();
|
||||
boolean f = true;
|
||||
long timeout = 1000 * DesignerPlugin.getDefault().getPreferenceStore()
|
||||
.getInt(ITalendCorePrefConstants.PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT);
|
||||
if (timeout <= 0) {
|
||||
timeout = 30000;
|
||||
if (!BitwiseOptionUtils.containOption(option, TalendProcessOptionConstants.GENERATE_WITHOUT_FORMAT)) {
|
||||
processCode = doFormat(processCode);
|
||||
}
|
||||
while (f) {
|
||||
long time2 = System.currentTimeMillis();
|
||||
if (time2 - time1 > timeout) {
|
||||
if (job.getResult() == null || !job.getResult().isOK()) {
|
||||
f = false;
|
||||
job.cancel();
|
||||
if (!CommonsPlugin.isHeadless()) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
Messages.getString("JavaProcessor.warn.codeFormatTimeout.title"), //$NON-NLS-1$
|
||||
Messages.getString("JavaProcessor.warn.codeFormatTimeout.message")); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
processCode = formatedCode;
|
||||
f = false;
|
||||
}
|
||||
} else {
|
||||
if (job.getState() != Job.RUNNING) {
|
||||
if (job.getResult() != null && job.getResult().isOK()) {
|
||||
processCode = formatedCode;
|
||||
f = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
formatedCode = null;
|
||||
|
||||
// see feature 4610:option to see byte length of each code method
|
||||
processCode = computeMethodSizeIfNeeded(processCode);
|
||||
@@ -753,6 +660,100 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
}
|
||||
}
|
||||
|
||||
private String doFormat(String processCode) {
|
||||
// format the code before save the file.
|
||||
final String toFormat = processCode;
|
||||
writeCodesToFile(toFormat, "1-beforeFormat");//$NON-NLS-1$
|
||||
// fix for 21320
|
||||
final Job job = new Job("t") { //$NON-NLS-1$
|
||||
|
||||
private Thread workThread;
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
monitor.beginTask("Format code", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
|
||||
FutureTask<Boolean> ft = new FutureTask<Boolean>(new Callable<Boolean>() {
|
||||
|
||||
@Override
|
||||
public Boolean call() throws Exception {
|
||||
formatedCode = formatCode(toFormat);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
});
|
||||
Boolean isSucceed = null;
|
||||
try {
|
||||
workThread = new Thread(ft);
|
||||
workThread.start();
|
||||
isSucceed = ft.get();
|
||||
} catch (Throwable e) {
|
||||
if (!monitor.isCanceled()) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (isSucceed == Boolean.TRUE && !monitor.isCanceled()) {
|
||||
writeCodesToFile(formatedCode, "2-afterFormat");//$NON-NLS-1$
|
||||
}
|
||||
monitor.done();
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void canceling() {
|
||||
try {
|
||||
super.canceling();
|
||||
if (workThread != null) {
|
||||
workThread.stop();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// should catch the ThreadDeath, in case to crash Studio
|
||||
}
|
||||
}
|
||||
};
|
||||
long time1 = System.currentTimeMillis();
|
||||
|
||||
job.setSystem(true);
|
||||
job.schedule();
|
||||
boolean f = true;
|
||||
long timeout = 1000 * DesignerPlugin.getDefault().getPreferenceStore()
|
||||
.getInt(ITalendCorePrefConstants.PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT);
|
||||
if (timeout <= 0) {
|
||||
timeout = 30000;
|
||||
}
|
||||
while (f) {
|
||||
long time2 = System.currentTimeMillis();
|
||||
if (time2 - time1 > timeout) {
|
||||
if (job.getResult() == null || !job.getResult().isOK()) {
|
||||
f = false;
|
||||
job.cancel();
|
||||
if (!CommonsPlugin.isHeadless()) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
|
||||
Messages.getString("JavaProcessor.warn.codeFormatTimeout.title"), //$NON-NLS-1$
|
||||
Messages.getString("JavaProcessor.warn.codeFormatTimeout.message")); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
processCode = formatedCode;
|
||||
f = false;
|
||||
}
|
||||
} else {
|
||||
if (job.getState() != Job.RUNNING) {
|
||||
if (job.getResult() != null && job.getResult().isOK()) {
|
||||
processCode = formatedCode;
|
||||
f = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
formatedCode = null;
|
||||
return processCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "formatCode".
|
||||
*
|
||||
@@ -763,8 +764,9 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
private String formatCode(String processCode) {
|
||||
// if export, won't format too.
|
||||
// we cannot make calls to Ui in headless mode
|
||||
if (CommonsPlugin.isHeadless()) {
|
||||
if (ProcessorUtilities.isExportConfig() || CommonsPlugin.isHeadless()) {
|
||||
return processCode; // nothing to do
|
||||
}
|
||||
final IDocument document = new Document(processCode);
|
||||
@@ -1306,6 +1308,8 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
File[] jarFiles = libDir.listFiles(FilesUtils.getAcceptJARFilesFilter());
|
||||
List<File> listFile = Arrays.asList(jarFiles);
|
||||
Collections.sort(listFile);
|
||||
|
||||
if (jarFiles != null && jarFiles.length > 0) {
|
||||
for (File jarFile : jarFiles) {
|
||||
@@ -1578,8 +1582,8 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
if (null != uniqueName && null != wsdlContent && !wsdlContent.trim().isEmpty()) {
|
||||
|
||||
// configure decoding and uncompressing
|
||||
InputStream wsdlStream = new BufferedInputStream(
|
||||
new InflaterInputStream(new Base64InputStream(new ByteArrayInputStream(wsdlContent.getBytes()))));
|
||||
InputStream wsdlStream = new BufferedInputStream(new InflaterInputStream(new Base64InputStream(
|
||||
new ByteArrayInputStream(wsdlContent.getBytes()))));
|
||||
|
||||
if (!wsdlsPackageFolder.exists()) {
|
||||
wsdlsPackageFolder.create(true, true, null);
|
||||
|
||||
@@ -14,10 +14,12 @@ package org.talend.designer.runprocess.java;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
@@ -157,7 +159,13 @@ public class JavaProcessorUtilities {
|
||||
}
|
||||
|
||||
public static Set<ModuleNeeded> getNeededModulesForProcess(IProcess process) {
|
||||
Set<ModuleNeeded> neededLibraries = new HashSet<ModuleNeeded>();
|
||||
Set<ModuleNeeded> neededLibraries = new TreeSet<ModuleNeeded>(new Comparator<ModuleNeeded>() {
|
||||
@Override
|
||||
public int compare(ModuleNeeded m1, ModuleNeeded m2) {
|
||||
return m1.toString().compareTo(m2.toString());
|
||||
}
|
||||
});
|
||||
|
||||
Set<ModuleNeeded> neededModules = LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(process.getId(),
|
||||
process.getVersion());
|
||||
neededLibraries.addAll(neededModules);
|
||||
|
||||
@@ -258,7 +258,6 @@ public class TalendProcessJavaProject implements ITalendProcessJavaProject {
|
||||
mavenBuildCodeProjectPom(goals, TalendMavenConstants.CURRENT_PATH, argumentsMap, monitor);
|
||||
} else { // JDT build
|
||||
buildWholeCodeProject();
|
||||
buildWholeCodeProject();
|
||||
}
|
||||
} else if (childrenModules.length > 0) {
|
||||
for (String module : childrenModules) {
|
||||
@@ -293,17 +292,17 @@ 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)) {
|
||||
mavenLauncher = new MavenPomCommandLauncher(childModulePomFile, TalendMavenConstants.GOAL_REFRESH);
|
||||
mavenLauncher.setArgumentsMap(argumentsMap);
|
||||
mavenLauncher.execute(monitor);
|
||||
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);
|
||||
buildWholeCodeProject();
|
||||
} else {
|
||||
mavenLauncher = new MavenPomCommandLauncher(childModulePomFile, goals);
|
||||
mavenLauncher.setArgumentsMap(argumentsMap);
|
||||
mavenLauncher.execute(monitor);
|
||||
}
|
||||
buildWholeCodeProject();
|
||||
buildWholeCodeProject();
|
||||
} else {
|
||||
throw new RuntimeException("The pom.xml is not existed. Can't build the job: " + module); //$NON-NLS-1$
|
||||
}
|
||||
@@ -321,6 +320,7 @@ public class TalendProcessJavaProject implements ITalendProcessJavaProject {
|
||||
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||
}
|
||||
project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
|
||||
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
|
||||
} catch (CoreException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -361,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,8 @@ public class MavenJavaProcessor extends JavaProcessor {
|
||||
if (property != null) {
|
||||
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo((ProcessItem) property.getItem());
|
||||
for (JobInfo jobInfo : infos) {
|
||||
if (jobInfo.isTestContainer()
|
||||
&& !ProcessUtils.isOptionChecked(getArguments(), TalendProcessArgumentConstant.ARG_GENERATE_OPTION,
|
||||
TalendProcessOptionConstants.GENERATE_TESTS)) {
|
||||
if (jobInfo.isTestContainer() && !ProcessUtils.isOptionChecked(getArguments(),
|
||||
TalendProcessArgumentConstant.ARG_GENERATE_OPTION, TalendProcessOptionConstants.GENERATE_TESTS)) {
|
||||
continue;
|
||||
}
|
||||
buildChildrenJobs.add(jobInfo);
|
||||
@@ -302,7 +301,9 @@ public class MavenJavaProcessor extends JavaProcessor {
|
||||
public void build(IProgressMonitor monitor) throws Exception {
|
||||
final ITalendProcessJavaProject talendJavaProject = getTalendJavaProject();
|
||||
// compile with JDT first in order to make the maven packaging work with a JRE.
|
||||
talendJavaProject.buildModules(monitor, null, null);
|
||||
if (TalendMavenConstants.GOAL_PACKAGE.equals(getGoals())) {
|
||||
talendJavaProject.buildModules(monitor, null, null);
|
||||
}
|
||||
|
||||
final Map<String, Object> argumentsMap = new HashMap<>();
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, getGoals());
|
||||
@@ -316,7 +317,7 @@ public class MavenJavaProcessor extends JavaProcessor {
|
||||
return TalendMavenConstants.GOAL_TEST_COMPILE;
|
||||
}
|
||||
|
||||
if (requirePackaging()) {
|
||||
if (!ProcessorUtilities.isExportConfig() && requirePackaging()) {
|
||||
// We return the PACKAGE goal if the main job and/or one of its recursive job is a Big Data job.
|
||||
return TalendMavenConstants.GOAL_PACKAGE;
|
||||
} else {
|
||||
|
||||
@@ -215,46 +215,7 @@ public class ImportTreeFromRepository extends SelectionAction {
|
||||
|
||||
private void prepareEmfTreeFromXml(XmlFileConnection connection) throws Exception {
|
||||
if (!connection.isInputModel()) {
|
||||
String file = connection.getXmlFilePath();
|
||||
List<FOXTreeNode> list = new ArrayList<FOXTreeNode>();
|
||||
// fix for TDI-20671 , root element is loop in output
|
||||
String rootXpath = null;
|
||||
if (!connection.getRoot().isEmpty()) {
|
||||
rootXpath = connection.getRoot().get(0).getXMLPath();
|
||||
} else if (!connection.getLoop().isEmpty()) {
|
||||
rootXpath = connection.getLoop().get(0).getXMLPath();
|
||||
}
|
||||
File xmlFile = new File(file);
|
||||
if (xmlFile.exists() && !file.endsWith(".zip")) {
|
||||
list = TreeUtil.getFoxTreeNodesForXmlMap(xmlFile.getAbsolutePath(), rootXpath, true);
|
||||
} else if (connection.getFileContent() != null && connection.getFileContent().length > 0) {
|
||||
String xsdFile = initFileContent(connection);
|
||||
if (xsdFile != null && new File(xsdFile).exists()) {
|
||||
list = TreeUtil.getFoxTreeNodesForXmlMap(xsdFile, rootXpath, true);
|
||||
} else {
|
||||
// for manually created output
|
||||
prepareEmfTreeFromConnection(connection);
|
||||
return;
|
||||
|
||||
}
|
||||
} else {
|
||||
// for manually created output
|
||||
prepareEmfTreeFromConnection(connection);
|
||||
return;
|
||||
}
|
||||
schemaNode.getChildren().clear();
|
||||
root = connection.getRoot();
|
||||
loop = connection.getLoop();
|
||||
group = connection.getGroup();
|
||||
groupElements = new ArrayList<TreeNode>();
|
||||
prepareModelFromOutput(list, schemaNode);
|
||||
if (loopNode != null) {
|
||||
fillGroup(loopNode, groupElements);
|
||||
} else {
|
||||
if (!schemaNode.getChildren().isEmpty()) {
|
||||
schemaNode.getChildren().get(0).setLoop(true);
|
||||
}
|
||||
}
|
||||
prepareEmfTreeFromConnection(connection);
|
||||
} else {
|
||||
List<SchemaTarget> schemaTargets = null;
|
||||
if (!connection.getSchema().isEmpty() && connection.getSchema().get(0) instanceof XmlXPathLoopDescriptorImpl) {
|
||||
|
||||
@@ -19,4 +19,9 @@ import org.eclipse.emf.ecore.EObject;
|
||||
* @generated
|
||||
*/
|
||||
public interface IConnection extends EObject {
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
String getName();
|
||||
} // IConnection
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
import org.eclipse.emf.ecore.impl.EObjectImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
|
||||
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.XmlmapPackage;
|
||||
@@ -475,5 +474,56 @@ public abstract class AbstractInOutTreeImpl extends EObjectImpl implements Abstr
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AbstractInOutTreeImpl other = (AbstractInOutTreeImpl) obj;
|
||||
if(this.getFilterIncomingConnections().size() != other.getFilterIncomingConnections().size()){
|
||||
return false;
|
||||
}
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.expressionFilter == null) {
|
||||
if (other.expressionFilter != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expressionFilter.equals(other.expressionFilter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(this.activateExpressionFilter != other.activateExpressionFilter){
|
||||
return false;
|
||||
}
|
||||
if(this.activateCondensedTool != other.activateCondensedTool){
|
||||
return false;
|
||||
}
|
||||
if(this.minimized != other.minimized){
|
||||
return false;
|
||||
}
|
||||
if(this.multiLoops != other.multiLoops){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} //AbstractInOutTreeImpl
|
||||
|
||||
@@ -383,4 +383,55 @@ public abstract class AbstractNodeImpl extends EObjectImpl implements AbstractNo
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
AbstractNodeImpl other = (AbstractNodeImpl) obj;
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if (this.expression == null) {
|
||||
if (other.expression != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.expression.equals(other.expression)) {
|
||||
return false;
|
||||
}
|
||||
if (this.type == null) {
|
||||
if (other.type != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.type.equals(other.type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(this.getFilterOutGoingConnections().size() != this.getFilterOutGoingConnections().size()){
|
||||
return false;
|
||||
}
|
||||
if(this.getIncomingConnections().size() != this.getIncomingConnections().size()){
|
||||
return false;
|
||||
}
|
||||
if(this.getOutgoingConnections().size() != this.getOutgoingConnections().size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} //AbstractNodeImpl
|
||||
|
||||
@@ -529,5 +529,88 @@ public class InputXmlTreeImpl extends AbstractInOutTreeImpl implements InputXmlT
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
InputXmlTreeImpl other = (InputXmlTreeImpl) obj;
|
||||
if (this.matchingMode == null) {
|
||||
if (other.matchingMode != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.matchingMode.equals(other.matchingMode)) {
|
||||
return false;
|
||||
}
|
||||
if (this.lookupMode == null) {
|
||||
if (other.lookupMode != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.lookupMode.equals(other.lookupMode)) {
|
||||
return false;
|
||||
}
|
||||
if (this.lookup != other.lookup) {
|
||||
return false;
|
||||
}
|
||||
if (this.innerJoin != other.innerJoin) {
|
||||
return false;
|
||||
}
|
||||
if (this.persistent != other.persistent) {
|
||||
return false;
|
||||
}
|
||||
if (this.activateGlobalMap != other.activateGlobalMap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(this.getNodes().size() != other.getNodes().size()){
|
||||
return false;
|
||||
}
|
||||
for(TreeNode inputTable:nodes){
|
||||
boolean found = false;
|
||||
for(TreeNode input:other.nodes){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getGlobalMapKeysValues().size() != other.getGlobalMapKeysValues().size()){
|
||||
return false;
|
||||
}
|
||||
for(GlobalMapNode inputTable:globalMapKeysValues){
|
||||
boolean found = false;
|
||||
for(GlobalMapNode input:other.globalMapKeysValues){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //InputXmlTreeImpl
|
||||
|
||||
@@ -20,10 +20,10 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.XmlmapPackage;
|
||||
|
||||
/**
|
||||
@@ -474,5 +474,61 @@ public class OutputXmlTreeImpl extends AbstractInOutTreeImpl implements OutputXm
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
OutputXmlTreeImpl other = (OutputXmlTreeImpl) obj;
|
||||
if(this.reject != other.reject){
|
||||
return false;
|
||||
}
|
||||
if(this.rejectInnerJoin != other.rejectInnerJoin){
|
||||
return false;
|
||||
}
|
||||
if(this.errorReject != other.errorReject){
|
||||
return false;
|
||||
}
|
||||
if(this.allInOne != other.allInOne){
|
||||
return false;
|
||||
}
|
||||
if(this.enableEmptyElement != other.enableEmptyElement){
|
||||
return false;
|
||||
}
|
||||
if(this.getNodes().size() != other.getNodes().size()){
|
||||
return false;
|
||||
}
|
||||
if(this.getInputLoopNodesTables().size() != other.getInputLoopNodesTables().size()){
|
||||
return false;
|
||||
}
|
||||
for(TreeNode tree:nodes){
|
||||
boolean found = false;
|
||||
for(TreeNode otherTree:other.nodes){
|
||||
if(tree.getName().equals(otherTree.getName())){
|
||||
found = true;
|
||||
if(!tree.equals(otherTree)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //OutputXmlTreeImpl
|
||||
|
||||
@@ -21,7 +21,8 @@ import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
||||
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.Connection;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.NodeType;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode;
|
||||
@@ -885,5 +886,99 @@ public class TreeNodeImpl extends AbstractNodeImpl implements TreeNode {
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
TreeNodeImpl other = (TreeNodeImpl) obj;
|
||||
if (this.xpath == null) {
|
||||
if (other.xpath != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.xpath.equals(other.xpath)) {
|
||||
return false;
|
||||
}
|
||||
if (this.pattern == null) {
|
||||
if (other.pattern != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.pattern.equals(other.pattern)) {
|
||||
return false;
|
||||
}
|
||||
if (this.nodeType == null) {
|
||||
if (other.nodeType != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (this.nodeType.getValue() != other.nodeType.getValue()) {
|
||||
return false;
|
||||
}else if (!this.nodeType.getLiteral().equals(other.nodeType.getLiteral())) {
|
||||
return false;
|
||||
}else if (!this.nodeType.getName().equals(other.nodeType.getName())) {
|
||||
return false;
|
||||
}
|
||||
if(this.group != other.group){
|
||||
return false;
|
||||
}
|
||||
if(this.nullable != other.nullable){
|
||||
return false;
|
||||
}
|
||||
if(this.key != other.key){
|
||||
return false;
|
||||
}
|
||||
if(this.choice != other.choice){
|
||||
return false;
|
||||
}
|
||||
if(this.optional != other.optional){
|
||||
return false;
|
||||
}
|
||||
if(this.loop != other.loop){
|
||||
return false;
|
||||
}
|
||||
if(this.main != other.main){
|
||||
return false;
|
||||
}
|
||||
if(this.substitution != other.substitution){
|
||||
return false;
|
||||
}
|
||||
if(this.getChildren().size() != this.getChildren().size()){
|
||||
return false;
|
||||
}
|
||||
if(this.getLookupIncomingConnections().size() != this.getLookupIncomingConnections().size()){
|
||||
return false;
|
||||
}
|
||||
if(this.getLookupOutgoingConnections().size() != this.getLookupOutgoingConnections().size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
for(TreeNode inputTable:getChildren()){
|
||||
boolean found = false;
|
||||
for(TreeNode input:other.getChildren()){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //TreeNodeImpl
|
||||
|
||||
@@ -162,5 +162,28 @@ public class VarNodeImpl extends AbstractNodeImpl implements VarNode {
|
||||
result.append(')');
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
VarNodeImpl other = (VarNodeImpl) obj;
|
||||
if(this.nullable != other.nullable){
|
||||
return false;
|
||||
}
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
} //VarNodeImpl
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.eclipse.emf.ecore.impl.EObjectImpl;
|
||||
|
||||
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.VarNode;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.VarTable;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.XmlmapPackage;
|
||||
@@ -277,4 +277,52 @@ public class VarTableImpl extends EObjectImpl implements VarTable {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
VarTableImpl other = (VarTableImpl) obj;
|
||||
if (this.name == null) {
|
||||
if (other.name != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!this.name.equals(other.name)) {
|
||||
return false;
|
||||
}
|
||||
if(this.minimized != other.minimized){
|
||||
return false;
|
||||
}
|
||||
if(this.getNodes().size() != other.getNodes().size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
for(VarNode inputTable:getNodes()){
|
||||
boolean found = false;
|
||||
for(VarNode input:other.getNodes()){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} //VarTableImpl
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.eclipse.emf.ecore.util.EObjectContainmentEList;
|
||||
import org.eclipse.emf.ecore.util.InternalEList;
|
||||
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.impl.AbstractExternalDataImpl;
|
||||
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.IConnection;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree;
|
||||
import org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree;
|
||||
@@ -263,5 +262,89 @@ public class XmlMapDataImpl extends AbstractExternalDataImpl implements XmlMapDa
|
||||
}
|
||||
return super.eIsSet(featureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* <!-- begin-user-doc -->
|
||||
* <!-- end-user-doc -->
|
||||
* @generated not
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
XmlMapDataImpl dbObj = (XmlMapDataImpl) obj;
|
||||
EList<InputXmlTree> inputs = dbObj.getInputTrees();
|
||||
EList<OutputXmlTree> outputs =dbObj.getOutputTrees();
|
||||
EList<VarTable> vars =dbObj.getVarTables();
|
||||
EList<IConnection> conns = dbObj.getConnections();
|
||||
if(inputs.size() != getInputTrees().size()){
|
||||
return false;
|
||||
}
|
||||
if(outputs.size() != getOutputTrees().size()){
|
||||
return false;
|
||||
}
|
||||
if(vars.size() != getVarTables().size()){
|
||||
return false;
|
||||
}
|
||||
if(getConnections().size() != conns.size()){
|
||||
return false;
|
||||
}
|
||||
|
||||
for(InputXmlTree inputTable:inputTrees){
|
||||
boolean found = false;
|
||||
for(InputXmlTree input:inputs){
|
||||
if(inputTable.getName().equals(input.getName())){
|
||||
found = true;
|
||||
if(!inputTable.equals(input)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(OutputXmlTree outputTable:outputTrees){
|
||||
boolean found = false;
|
||||
for(OutputXmlTree output:outputs){
|
||||
if(outputTable.getName().equals(output.getName())){
|
||||
found = true;
|
||||
if(!outputTable.equals(output)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(VarTable varTable:varTables){
|
||||
boolean found = false;
|
||||
for(VarTable var:vars){
|
||||
if(varTable.getName().equals(var.getName())){
|
||||
found = true;
|
||||
if(!varTable.equals(var)){
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} //XmlMapDataImpl
|
||||
|
||||
@@ -86,6 +86,8 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
private Text customText;
|
||||
|
||||
private Button fnEncodingBtn;
|
||||
|
||||
private Button sftpSuppBut;
|
||||
|
||||
private Button ftpsSuppBut;
|
||||
@@ -94,6 +96,8 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
private Group buildGroup;
|
||||
|
||||
private Composite encodingComp;
|
||||
|
||||
private Composite sftpChildCom;
|
||||
|
||||
private Composite ftpsChildCom;
|
||||
@@ -108,9 +112,11 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
private GridData proxyChildComGridData;
|
||||
|
||||
private GridData fnEncodingBtnGD;
|
||||
|
||||
/**
|
||||
* DOC Administrator FTPForm constructor comment.
|
||||
*
|
||||
*
|
||||
* @param parent
|
||||
* @param style
|
||||
*/
|
||||
@@ -131,7 +137,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.ui.swt.utils.AbstractForm#adaptFormToReadOnly()
|
||||
*/
|
||||
|
||||
@@ -143,7 +149,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.ui.swt.utils.AbstractForm#addFields()
|
||||
*/
|
||||
|
||||
@@ -151,9 +157,9 @@ public class FTPForm extends AbstractForm {
|
||||
protected void addFields() {
|
||||
Group ftpParameterGroup = new Group(this, SWT.NULL);
|
||||
ftpParameterGroup.setText("Server"); //$NON-NLS-1$
|
||||
GridLayout layoutGroup = new GridLayout();
|
||||
layoutGroup.numColumns = 2;
|
||||
ftpParameterGroup.setLayout(layoutGroup);
|
||||
GridLayout ftpParameterLayout = new GridLayout();
|
||||
ftpParameterLayout.numColumns = 2;
|
||||
ftpParameterGroup.setLayout(ftpParameterLayout);
|
||||
|
||||
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
ftpParameterGroup.setLayoutData(gridData);
|
||||
@@ -167,20 +173,28 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
ftpPortText = new LabelledText(ftpParameterGroup, Messages.getString("FTPForm_ftpPortText"), true); //$NON-NLS-1$
|
||||
|
||||
Composite com = new Composite(ftpParameterGroup, SWT.NONE);
|
||||
layoutGroup = new GridLayout(2, false);
|
||||
com.setLayout(layoutGroup);
|
||||
encodingComp = new Composite(ftpParameterGroup, SWT.NONE);
|
||||
GridData encodingCompGD = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||
encodingCompGD.horizontalSpan = 2;
|
||||
encodingComp.setLayoutData(encodingCompGD);
|
||||
GridLayout encodingCompLayout = new GridLayout(4, false);
|
||||
encodingCompLayout.marginWidth = 0;
|
||||
encodingComp.setLayout(encodingCompLayout);
|
||||
fnEncodingBtn = new Button(encodingComp, SWT.CHECK);
|
||||
fnEncodingBtn.setText("Filename encoding"); //$NON-NLS-1$
|
||||
fnEncodingBtnGD = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
|
||||
fnEncodingBtn.setLayoutData(fnEncodingBtnGD);
|
||||
List<String> codeList = new ArrayList<String>();
|
||||
codeList.add(ENCODING);
|
||||
codeList.add("UTF-8"); //$NON-NLS-1$
|
||||
codeList.add(CUSTOM);
|
||||
encodeCombo = new LabelledCombo(com, "Encoding", "", codeList); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
encodeCombo = new LabelledCombo(encodingComp, "Encoding", "", codeList); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (getConnection().getEcoding() == null || "".equals(getConnection().getEcoding())) { //$NON-NLS-1$
|
||||
encodeCombo.setText(ENCODING);
|
||||
getConnection().setEcoding(encodeCombo.getText());
|
||||
}
|
||||
|
||||
customText = new Text(ftpParameterGroup, SWT.BORDER | SWT.SINGLE);
|
||||
customText = new Text(encodingComp, SWT.BORDER | SWT.SINGLE);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||
gridData.horizontalSpan = 1;
|
||||
customText.setLayoutData(gd);
|
||||
@@ -196,7 +210,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
buildGroup = new Group(this, SWT.NULL);
|
||||
buildGroup.setText("Parameter"); //$NON-NLS-1$
|
||||
layoutGroup = new GridLayout(1, false);
|
||||
GridLayout layoutGroup = new GridLayout(1, false);
|
||||
buildGroup.setLayout(layoutGroup);
|
||||
gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||
buildGroup.setLayoutData(gridData);
|
||||
@@ -276,7 +290,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.ui.swt.utils.AbstractForm#addFieldsListeners()
|
||||
*/
|
||||
|
||||
@@ -433,7 +447,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.ui.swt.utils.AbstractForm#addUtilsButtonListeners()
|
||||
*/
|
||||
|
||||
@@ -443,7 +457,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
|
||||
@@ -452,9 +466,15 @@ public class FTPForm extends AbstractForm {
|
||||
boolean show = sftpSuppBut.getSelection();
|
||||
if (show) {
|
||||
sftpChildComGridData.exclude = false;
|
||||
fnEncodingBtnGD.exclude = false;
|
||||
ftpsChildComGridData.exclude = true;
|
||||
encodeCombo.setHideWidgets(!fnEncodingBtn.getSelection());
|
||||
customText.setVisible(fnEncodingBtn.getSelection() && CUSTOM.equals(getConnection().getEcoding()));
|
||||
} else {
|
||||
sftpChildComGridData.exclude = true;
|
||||
fnEncodingBtnGD.exclude = true;
|
||||
encodeCombo.setHideWidgets(false);
|
||||
customText.setVisible(CUSTOM.equals(getConnection().getEcoding()));
|
||||
}
|
||||
if (show && ftpsSuppBut.getSelection()) {
|
||||
getConnection().setFTPS(!show);
|
||||
@@ -472,6 +492,9 @@ public class FTPForm extends AbstractForm {
|
||||
checkFieldsValue();
|
||||
sftpChildCom.setVisible(show);
|
||||
ftpsChildCom.setVisible(!show && ftpsSuppBut.getSelection());
|
||||
fnEncodingBtn.setVisible(show);
|
||||
encodingComp.layout();
|
||||
encodingComp.getParent().layout();
|
||||
sftpChildCom.layout();
|
||||
ftpsChildCom.layout();
|
||||
tetsCom.layout();
|
||||
@@ -484,7 +507,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
|
||||
@@ -518,7 +541,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
*/
|
||||
|
||||
@@ -539,11 +562,23 @@ public class FTPForm extends AbstractForm {
|
||||
layout();
|
||||
}
|
||||
});
|
||||
|
||||
fnEncodingBtn.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
boolean show = fnEncodingBtn.getSelection();
|
||||
encodeCombo.setHideWidgets(!show);
|
||||
customText.setVisible(show && CUSTOM.equals(getConnection().getEcoding()));
|
||||
encodingComp.layout();
|
||||
getConnection().setUseFileNameEncoding(show && getConnection().isSFTP());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.ui.swt.utils.AbstractForm#checkFieldsValue()
|
||||
*/
|
||||
|
||||
@@ -589,7 +624,7 @@ public class FTPForm extends AbstractForm {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.talend.repository.ui.swt.utils.AbstractForm#initialize()
|
||||
*/
|
||||
|
||||
@@ -614,10 +649,15 @@ public class FTPForm extends AbstractForm {
|
||||
}
|
||||
connModelCombo.setText(conn.getMode());
|
||||
if (conn.isSFTP()) {
|
||||
fnEncodingBtn.setSelection(conn.isUseFileNameEncoding());
|
||||
sftpChildComGridData.exclude = false;
|
||||
ftpsChildComGridData.exclude = true;
|
||||
fnEncodingBtnGD.exclude = false;
|
||||
fnEncodingBtn.setVisible(true);
|
||||
sftpChildCom.setVisible(true);
|
||||
ftpsChildCom.setVisible(false);
|
||||
encodeCombo.setHideWidgets(!fnEncodingBtn.getSelection());
|
||||
encodingComp.layout();
|
||||
sftpChildCom.layout();
|
||||
ftpsChildCom.layout();
|
||||
tetsCom.layout();
|
||||
@@ -637,8 +677,12 @@ public class FTPForm extends AbstractForm {
|
||||
}
|
||||
} else {
|
||||
sftpChildComGridData.exclude = true;
|
||||
fnEncodingBtnGD.exclude = true;
|
||||
encodeCombo.setHideWidgets(false);
|
||||
fnEncodingBtn.setVisible(false);
|
||||
sftpChildCom.setVisible(false);
|
||||
sftpChildCom.layout();
|
||||
encodingComp.layout();
|
||||
tetsCom.layout();
|
||||
buildGroup.layout();
|
||||
}
|
||||
@@ -700,6 +744,9 @@ public class FTPForm extends AbstractForm {
|
||||
if (!useSocksBut.isVisible()) {
|
||||
conn.setUsesocks(false);
|
||||
}
|
||||
if (!fnEncodingBtn.isVisible()) {
|
||||
conn.setUseFileNameEncoding(false);
|
||||
}
|
||||
if (!methodCombo.getCombo().isVisible()) {
|
||||
conn.setMethod(""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ public class GenericWizardService implements IGenericWizardService {
|
||||
if (isGenericConnection(connection)) {
|
||||
GenericConnection genericConnection = (GenericConnection) connection;
|
||||
String compProperties = genericConnection.getCompProperties();
|
||||
ComponentProperties cp = ComponentsUtils.getComponentPropertiesFromSerialized(compProperties, connection);
|
||||
ComponentProperties cp = ComponentsUtils.getComponentPropertiesFromSerialized(compProperties, connection, false);
|
||||
if (cp != null) {
|
||||
componentProperties.add(cp);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ public class GenericWizardService implements IGenericWizardService {
|
||||
for (TaggedValue taggedValue : metadataTable.getTaggedValue()) {
|
||||
if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(taggedValue.getTag())) {
|
||||
ComponentProperties compPros = ComponentsUtils.getComponentPropertiesFromSerialized(
|
||||
taggedValue.getValue(), connection);
|
||||
taggedValue.getValue(), connection, false);
|
||||
if (compPros != null && !componentProperties.contains(compPros)) {
|
||||
compPros.updateNestedProperties(cp);
|
||||
componentProperties.add(compPros);
|
||||
|
||||
@@ -51,16 +51,12 @@ import org.talend.core.model.repository.RepositoryObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.runtime.services.IGenericWizardService;
|
||||
import org.talend.daikon.properties.Properties;
|
||||
import org.talend.daikon.properties.presentation.Form;
|
||||
import org.talend.daikon.serialize.PostDeserializeSetup;
|
||||
import org.talend.daikon.serialize.SerializerDeserializer;
|
||||
import org.talend.designer.core.generic.constants.IGenericConstants;
|
||||
import org.talend.designer.core.generic.utils.ComponentsUtils;
|
||||
import org.talend.designer.core.model.components.ElementParameter;
|
||||
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
|
||||
import org.talend.metadata.managment.ui.wizard.CheckLastVersionRepositoryWizard;
|
||||
import org.talend.metadata.managment.ui.wizard.context.MetadataContextPropertyValueEvaluator;
|
||||
import org.talend.repository.generic.i18n.Messages;
|
||||
import org.talend.repository.generic.internal.IGenericWizardInternalService;
|
||||
import org.talend.repository.generic.internal.service.GenericWizardInternalService;
|
||||
@@ -147,6 +143,9 @@ public class GenericConnWizard extends CheckLastVersionRepositoryWizard {
|
||||
RepositoryObject object = new RepositoryObject(node.getObject().getProperty());
|
||||
setRepositoryObject(object);
|
||||
connection = (GenericConnection) ((ConnectionItem) object.getProperty().getItem()).getConnection();
|
||||
// Set context name to null so as to open context select dialog once if there are more than one context
|
||||
// group when opening a connection.
|
||||
connection.setContextName(null);
|
||||
connectionProperty = object.getProperty();
|
||||
connectionItem = (ConnectionItem) object.getProperty().getItem();
|
||||
// set the repositoryObject, lock and set isRepositoryObjectEditable
|
||||
@@ -190,7 +189,8 @@ public class GenericConnWizard extends CheckLastVersionRepositoryWizard {
|
||||
} else {
|
||||
String compPropertiesStr = connection.getCompProperties();
|
||||
if (compPropertiesStr != null) {
|
||||
ComponentProperties properties = ComponentsUtils.getComponentPropertiesFromSerialized(compPropertiesStr, connection);
|
||||
ComponentProperties properties = ComponentsUtils.getComponentPropertiesFromSerialized(compPropertiesStr,
|
||||
connection, false);
|
||||
if (properties != null) {
|
||||
componentWizard = internalService.getTopLevelComponentWizard(properties, repNode.getId());
|
||||
}
|
||||
@@ -264,7 +264,7 @@ public class GenericConnWizard extends CheckLastVersionRepositoryWizard {
|
||||
if (creation) {
|
||||
factory.create(connectionItem, pathToSave);
|
||||
}
|
||||
compService.afterFormFinish(form.getName(), (ComponentProperties) form.getProperties());
|
||||
compService.afterFormFinish(form.getName(), form.getProperties());
|
||||
}
|
||||
if (!creation) {
|
||||
GenericUpdateManager.updateGenericConnection(connectionItem, oldMetadataTable);
|
||||
|
||||
@@ -31,4 +31,13 @@ public class JobDesignsContentProvider extends ProjectRepoDirectChildrenNodeCont
|
||||
return projectNode.getRootRepositoryNode(ERepositoryObjectType.PROCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
if (element instanceof RepositoryNode) {
|
||||
final RepositoryNode node = (RepositoryNode) element;
|
||||
return node.getParent();
|
||||
}
|
||||
|
||||
return super.getParent(element);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,14 +53,8 @@ public class JobDesignImportHandler extends ImportRepTypeHandler {
|
||||
return new TalendXMIResource(pathUri);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.repository.items.importexport.handlers.imports.ImportRepTypeHandler#beforeCreatingItem(org.talend
|
||||
* .repository.items.importexport.ui.wizard.imports.models.ItemRecord)
|
||||
*/
|
||||
@Override
|
||||
protected void beforeCreatingItem(ImportItem importItem) {
|
||||
protected void afterApplyMigrationTasks(ImportItem importItem) throws Exception {
|
||||
Item tmpItem = importItem.getItem();
|
||||
if (tmpItem instanceof ProcessItem) {
|
||||
ProcessItem processItem = (ProcessItem) tmpItem;
|
||||
@@ -116,9 +110,7 @@ public class JobDesignImportHandler extends ImportRepTypeHandler {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2786,6 +2786,25 @@
|
||||
name="AddDefaultVersionValueForElasticsearchLookupInput"
|
||||
version="6.2.1">
|
||||
</projecttask>
|
||||
<projecttask
|
||||
beforeLogon="false"
|
||||
breaks="6.0.0"
|
||||
class="org.talend.repository.model.migration.ReviseInvalidContextNamesMigrationTask"
|
||||
description="Revise invalid context names of context items."
|
||||
id="org.talend.repository.model.migration.ReviseInvalidContextNamesMigrationTask"
|
||||
name="ReviseInvalidContextNamesMigrationTask"
|
||||
version="6.1.2">
|
||||
</projecttask>
|
||||
|
||||
<projecttask
|
||||
beforeLogon="false"
|
||||
breaks="4.2.4"
|
||||
class="org.talend.repository.model.migration.ResetItemLabelMigrationTask"
|
||||
description="Reset the item label"
|
||||
id="org.talend.repository.model.migration.ResetItemLabelMigrationTask"
|
||||
name="ResetItemLabelMigrationTask"
|
||||
version="5.2.2">
|
||||
</projecttask>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// 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.repository.model.migration;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.core.model.migration.AbstractItemMigrationTask;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.utils.WorkspaceUtils;
|
||||
import org.talend.migration.IProjectMigrationTask;
|
||||
import org.talend.repository.items.importexport.handlers.imports.ImportBasicHandler;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
/**
|
||||
* DOC hwang class global comment. Detailled comment
|
||||
*/
|
||||
public class ResetItemLabelMigrationTask extends AbstractItemMigrationTask implements IProjectMigrationTask{
|
||||
|
||||
@Override
|
||||
public Date getOrder() {
|
||||
GregorianCalendar gc = new GregorianCalendar(2017, 3, 13, 12, 0, 0);
|
||||
return gc.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
IProxyRepositoryFactory repositoryFactory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
ImportBasicHandler handler = new ImportBasicHandler();
|
||||
Property property = item.getProperty();
|
||||
if(property == null){
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
String label = property.getLabel();
|
||||
if(label == null){
|
||||
return ExecutionResult.NOTHING_TO_DO;
|
||||
}
|
||||
try {
|
||||
boolean isAvailable = WorkspaceUtils.checkNameIsOK(label);
|
||||
if(!isAvailable){
|
||||
property.setLabel(handler.getPropertyLabel(StringUtils.trimToNull(label)));
|
||||
property.setDisplayName(StringUtils.trimToNull(label));
|
||||
repositoryFactory.save(item, true);
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
return ExecutionResult.FAILURE;
|
||||
}
|
||||
|
||||
return ExecutionResult.SUCCESS_WITH_ALERT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ERepositoryObjectType> getTypes() {
|
||||
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
|
||||
toReturn.add(ERepositoryObjectType.CONTEXT);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user