Compare commits
86 Commits
patch/TPS-
...
patch/7.0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a85f88b9ae | ||
|
|
72bc68a5a3 | ||
|
|
5b54b36993 | ||
|
|
fa8b4f0527 | ||
|
|
2e73891eaf | ||
|
|
b3d4649f7c | ||
|
|
f7eeff285a | ||
|
|
f2d74d39e2 | ||
|
|
077eb35d81 | ||
|
|
453514f91e | ||
|
|
58cfc176eb | ||
|
|
cb47feb3a6 | ||
|
|
136dee79ee | ||
|
|
f5e0ba2a85 | ||
|
|
30456071f4 | ||
|
|
0e92a6e63d | ||
|
|
b6e4feb75c | ||
|
|
01b48554f1 | ||
|
|
bdb5d74ec5 | ||
|
|
516a30ea88 | ||
|
|
8e9f2fe0ed | ||
|
|
6135222d08 | ||
|
|
9daf281c36 | ||
|
|
1b128697e9 | ||
|
|
db7478d39e | ||
|
|
ef2b5c4585 | ||
|
|
d1d339951b | ||
|
|
c10bfb7081 | ||
|
|
9381e43254 | ||
|
|
dfb2a2d9b0 | ||
|
|
5dad832ea8 | ||
|
|
9a18883b05 | ||
|
|
f97759d303 | ||
|
|
a199ac5bca | ||
|
|
3b925e8ccb | ||
|
|
36111d561c | ||
|
|
6810d2efac | ||
|
|
9c5ace50db | ||
|
|
b4300999d3 | ||
|
|
9e56d4fb1b | ||
|
|
d7ab17a146 | ||
|
|
f39c5c24e7 | ||
|
|
85e3ed0023 | ||
|
|
f4a8133657 | ||
|
|
5fc7e4bf17 | ||
|
|
b0104a008f | ||
|
|
13a67cfdd2 | ||
|
|
374f1e259d | ||
|
|
036b3d8c45 | ||
|
|
dc685f91c1 | ||
|
|
7afb7c4bf5 | ||
|
|
4450bd0bff | ||
|
|
a8d46bec17 | ||
|
|
e5b73dff0e | ||
|
|
c306520690 | ||
|
|
0f58b49a91 | ||
|
|
c9c983ff66 | ||
|
|
9ffeacd193 | ||
|
|
40a579f2d8 | ||
|
|
5304d090a5 | ||
|
|
480ff02083 | ||
|
|
a40d8869fd | ||
|
|
cd90db66c2 | ||
|
|
cb010e13de | ||
|
|
488af98793 | ||
|
|
bd5ac02ab1 | ||
|
|
8b3d78a8ed | ||
|
|
84f0c26c2c | ||
|
|
1d2e5cb6c3 | ||
|
|
ba5d87d2a8 | ||
|
|
7e7ff7ebeb | ||
|
|
3b8bd49929 | ||
|
|
117abe27d1 | ||
|
|
cee7b6cae0 | ||
|
|
fa2123a1f1 | ||
|
|
54a786b27c | ||
|
|
9287f1d803 | ||
|
|
1c69ee668b | ||
|
|
7c18b0a2bb | ||
|
|
2047c1e0c1 | ||
|
|
f29b192dec | ||
|
|
fa8aa8d024 | ||
|
|
1376766caf | ||
|
|
0a2cd96f37 | ||
|
|
3d1c3a1775 | ||
|
|
d0b54bbaab |
59
PATCH_RELEASE_NOTE.md
Normal file
59
PATCH_RELEASE_NOTE.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
version: 7.0.1
|
||||
module: https://talend.poolparty.biz/coretaxonomy/42
|
||||
product:
|
||||
- https://talend.poolparty.biz/coretaxonomy/23
|
||||
---
|
||||
|
||||
# TPS-3577
|
||||
|
||||
| Info | Value |
|
||||
| ---------------- | ---------------- |
|
||||
| Patch Name | Patch\_20191128\_TPS-3577\_v1-7.0.1 |
|
||||
| Release Date | 2019-11-28 |
|
||||
| Target Version | 20180411_1414-V7.0.1 |
|
||||
| Product affected | Talend Studio |
|
||||
|
||||
## Introduction
|
||||
This is a self-contained patch.
|
||||
|
||||
|
||||
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
|
||||
|
||||
## Fixed issues
|
||||
|
||||
This patch contains the following fixes:
|
||||
|
||||
- TPS-3577 [7.0.1] Google Cloud Storage with Proxy (TDI-40854)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Consider the following requirements for your system:
|
||||
|
||||
- Talend Studio 7.0.1 must be installed.
|
||||
|
||||
## Installation
|
||||
|
||||
### Installing the patch using Software update
|
||||
**NOTE**: If the customer has not yet installed any patch before with Nexus3, a TUP patch named Patch_20180510_TPS-2482_v1-7.0.1.zip must be deployed first in the appoarch "Installing the patch using Talend Studio".
|
||||
|
||||
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
|
||||
|
||||
2) Switch to Software update page, where the new patch will be listed. The patch can be downloaded from here into the nexus repository.
|
||||
|
||||
3) On Studio Side: Logon Studio with remote mode, on the logon page the Update button is displayed: click this button to install the patch.
|
||||
|
||||
### Installing the patch using Talend Studio
|
||||
|
||||
1) Create a folder named "patches" under your studio installer directory and copy the patch .zip file to this folder.
|
||||
|
||||
2) Restart your studio: a window pops up, then click OK to install the patch, or restart the commandline and the patch will be installed automatically.
|
||||
|
||||
### Installing the patch using Commandline
|
||||
|
||||
Execute the following commands:
|
||||
|
||||
1. Talend-Studio-win-x86_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
|
||||
2. initRemote {tac_url} -ul {TAC login username} -up {TAC login password}
|
||||
3. checkAndUpdate -tu {TAC login username} -tup {TAC login password}
|
||||
|
||||
@@ -66,25 +66,27 @@ if(hasInput){
|
||||
if (writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback) {
|
||||
org.talend.components.api.component.runtime.WriterWithFeedback writerWithFeedbackMain_<%=cid%> = (org.talend.components.api.component.runtime.WriterWithFeedback) writer_<%=cid%>;
|
||||
writerWithFeedbackMain_<%=cid%> = new org.talend.codegen.flowvariables.runtime.FlowVariablesWriter(writerWithFeedbackMain_<%=cid%>, container_<%=cid%>);
|
||||
java.lang.Iterable<?> outgoingRecs = writerWithFeedbackMain_<%=cid%>.getSuccessfulWrites();
|
||||
java.util.Iterator outgoingMainRecords_<%=cid%> = outgoingRecs.iterator();
|
||||
java.lang.Iterable<?> outgoingRecs_<%=cid%> = writerWithFeedbackMain_<%=cid%>.getSuccessfulWrites();
|
||||
java.util.Iterator outgoingMainRecords_<%=cid%> = outgoingRecs_<%=cid%>.iterator();
|
||||
Object outgoingMain_<%=cid%> = null;
|
||||
if (outgoingMainRecords_<%=cid%>.hasNext()) {
|
||||
outgoingMainRecordsList_<%=cid%> = outgoingRecs;
|
||||
outgoingMainRecordsList_<%=cid%> = outgoingRecs_<%=cid%>;
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (rejectIrToRow != null) {
|
||||
%>
|
||||
java.lang.Iterable<?> outgoingRejectRecordsList_<%=cid%> = new java.util.ArrayList<Object>();
|
||||
org.talend.components.api.component.runtime.WriterWithFeedback writerWithFeedbackReject_<%=cid%> = (org.talend.components.api.component.runtime.WriterWithFeedback) writer_<%=cid%>;
|
||||
writerWithFeedbackReject_<%=cid%> = new org.talend.codegen.flowvariables.runtime.FlowVariablesWriter(writerWithFeedbackReject_<%=cid%>, container_<%=cid%>);
|
||||
java.lang.Iterable<?> outgoingRejectRecs = writerWithFeedbackReject_<%=cid%>.getRejectedWrites();
|
||||
java.util.Iterator outgoingRejectRecords_<%=cid%> = outgoingRejectRecs.iterator();
|
||||
java.lang.Iterable<?> outgoingRejectRecordsList_<%=cid%> = new java.util.ArrayList<Object>();
|
||||
if (writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback) {
|
||||
org.talend.components.api.component.runtime.WriterWithFeedback writerWithFeedbackReject_<%=cid%> = (org.talend.components.api.component.runtime.WriterWithFeedback) writer_<%=cid%>;
|
||||
writerWithFeedbackReject_<%=cid%> = new org.talend.codegen.flowvariables.runtime.FlowVariablesWriter(writerWithFeedbackReject_<%=cid%>, container_<%=cid%>);
|
||||
java.lang.Iterable<?> outgoingRejectRecs_<%=cid%> = writerWithFeedbackReject_<%=cid%>.getRejectedWrites();
|
||||
java.util.Iterator outgoingRejectRecords_<%=cid%> = outgoingRejectRecs_<%=cid%>.iterator();
|
||||
if (outgoingRejectRecords_<%=cid%>.hasNext()) {
|
||||
outgoingRejectRecordsList_<%=cid%> = outgoingRejectRecs;
|
||||
outgoingRejectRecordsList_<%=cid%> = outgoingRejectRecs_<%=cid%>;
|
||||
}
|
||||
}
|
||||
<%
|
||||
}
|
||||
if(mainIrToRow != null) {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
private final Component component;
|
||||
|
||||
private int schemaIndex = 0;
|
||||
|
||||
public ProcessPropertiesGenerator(String cid, Component component) {
|
||||
this.cid = cid;
|
||||
this.component = component;
|
||||
@@ -23,7 +25,9 @@
|
||||
|
||||
Object value = property.getStoredValue();
|
||||
if (value != null) {
|
||||
if (setDynamicTags && (value instanceof String) && isDynamicValue(String.valueOf(value), connName)) {
|
||||
boolean isSchemaProperty = property instanceof org.talend.daikon.properties.property.SchemaProperty;
|
||||
|
||||
if (!isSchemaProperty && setDynamicTags && (value instanceof String) && isDynamicValue(String.valueOf(value), connName)) {
|
||||
property.setTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE, "true");
|
||||
}
|
||||
if (value instanceof List) { // if
|
||||
@@ -77,10 +81,64 @@
|
||||
props_<%=cid %><%=propInfo.fieldName%>.setValue("<%=property.getName()%>",
|
||||
<%=property.getType().replaceAll("<.*>", "")%>.<%=property.getValue()%>);
|
||||
<%
|
||||
} else if (property instanceof org.talend.daikon.properties.property.SchemaProperty) {
|
||||
} else if (isSchemaProperty) {
|
||||
String schemaValue = component.getCodegenValue(property, property.getStringValue());
|
||||
String[] splits = schemaValue.split("(?=\\\\\"name\\\\\":)");
|
||||
|
||||
String classNameTail = "fisrt";
|
||||
if(!firstCall) {
|
||||
classNameTail = "second";
|
||||
}
|
||||
%>
|
||||
class SchemaSettingTool_<%=cid%>_<%=++schemaIndex%>_<%=classNameTail%> {
|
||||
|
||||
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%>_<%=classNameTail%> sst_<%=cid%>_<%=schemaIndex%>_<%=classNameTail%> = new SchemaSettingTool_<%=cid%>_<%=schemaIndex%>_<%=classNameTail%>();
|
||||
|
||||
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%>_<%=classNameTail%>.getSchemaValue()));
|
||||
<%
|
||||
} else if (!(value instanceof String) || !((String)value).equals("")) {
|
||||
%>
|
||||
|
||||
@@ -137,8 +137,8 @@ for (INode node : process.getNodesOfType("tRESTClient")) {
|
||||
}
|
||||
}
|
||||
|
||||
boolean talendEsbJob = actAsProvider || actAsConsumer || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
boolean talendEsbJobFactory = actAsProvider || !process.getNodesOfType("tRouteInput").isEmpty();
|
||||
boolean talendEsbJob = talendEsbJobFactory || actAsConsumer;
|
||||
|
||||
boolean talendStepTemplate = !process.getNodesOfType("tActionInput").isEmpty() || !process.getNodesOfType("tActionOutput").isEmpty() || !process.getNodesOfType("tJobReject").isEmpty();
|
||||
|
||||
@@ -209,11 +209,6 @@ protected static void logIgnoredError(String message, Throwable cause) {
|
||||
// fix for TESB-7714
|
||||
talendESBJob.setEndpointRegistry(registry);
|
||||
|
||||
// TESB-15920 tRESTClient and SAM not working
|
||||
<% if (hasSAM4RS) { %>
|
||||
talendESBJob.setEventFeature(eventFeature);
|
||||
<% } %>
|
||||
|
||||
return talendESBJob;
|
||||
}
|
||||
<% } %>
|
||||
|
||||
@@ -147,7 +147,8 @@ public class JavaRoutineSynchronizer extends AbstractRoutineSynchronizer {
|
||||
*/
|
||||
private static void syncModule(Project project, File[] modules) throws SystemException {
|
||||
IRunProcessService service = CodeGeneratorActivator.getDefault().getRunProcessService();
|
||||
ITalendProcessJavaProject talenCodeJavaProject = service.getTalendCodeJavaProject(ERepositoryObjectType.ROUTINES, project);
|
||||
ITalendProcessJavaProject talenCodeJavaProject = service.getTalendCodeJavaProject(ERepositoryObjectType.ROUTINES,
|
||||
project.getTechnicalLabel());
|
||||
if (talenCodeJavaProject == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>fluent-hc</artifactId>
|
||||
<version>4.2.6</version>
|
||||
<version>4.5.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talend_DB_mssqlUtil-1.2-20171017</artifactId>
|
||||
<artifactId>talend_DB_mssqlUtil-1.3-20190523</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -50,9 +50,9 @@
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->
|
||||
<dependency>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>jtds-1.3.1-patch</artifactId>
|
||||
<version>6.1.1</version>
|
||||
<groupId>net.sourceforge.jtds</groupId>
|
||||
<artifactId>jtds</artifactId>
|
||||
<version>1.3.1-patch-20190523</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<project
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>net.sourceforge.jtds</groupId>
|
||||
<artifactId>jtds</artifactId>
|
||||
<version>1.3.1-patch-20190523</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>talend_jtds</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<talend.nexus.url>https://artifacts-oss.talend.com</talend.nexus.url>
|
||||
<java.source.version>1.7</java.source.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>org.talend.studio</id>
|
||||
<name>talend-update</name>
|
||||
<url>https://talend-update.talend.com/nexus/content/repositories/libraries/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceSnapshot/</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>talend_nexus_deployment</id>
|
||||
<url>${talend.nexus.url}/nexus/content/repositories/TalendOpenSourceRelease/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->
|
||||
<dependency>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>jtds-1.3.1-patch</artifactId>
|
||||
<version>6.1.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>unpack</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>unpack</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>jtds-1.3.1-patch</artifactId>
|
||||
<version>6.1.1</version>
|
||||
<type>jar</type>
|
||||
<overWrite>true</overWrite>
|
||||
<outputDirectory>target/classes</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>${java.source.version}</source>
|
||||
<target>${java.source.version}</target>
|
||||
<showDeprecation>true</showDeprecation>
|
||||
<showWarnings>true</showWarnings>
|
||||
<compilerArgument>-XDignore.symbol.file</compilerArgument>
|
||||
<fork>true</fork>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -776,7 +776,7 @@
|
||||
<IMPORT NAME="Driver-DB2-LICENSE-CISUZ" MODULE="db2jcc_license_cisuz.jar" MVN="mvn:org.talend.libraries/db2jcc_license_cisuz/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='DB2')" />
|
||||
<IMPORT NAME="Driver-DB2-LICENSE-CU" MODULE="db2jcc_license_cu.jar" MVN="mvn:org.talend.libraries/db2jcc_license_cu/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='DB2')" />
|
||||
<IMPORT NAME="Driver_MaxDB" MODULE="sapdbc.jar" MVN="mvn:org.talend.libraries/sapdbc/6.0.0" REQUIRED_IF="DBTYPE=='MAXDB'" />
|
||||
<IMPORT NAME="Driver-MSSQL" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='MSSQL') AND (MSSQL_DRIVER=='JTDS')" />
|
||||
<IMPORT NAME="Driver-MSSQL" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='MSSQL') AND (MSSQL_DRIVER=='JTDS')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-MSSQL-prop" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='MSSQL') AND (MSSQL_DRIVER=='MSSQL_PROP')" />
|
||||
<IMPORT NAME="Driver-MYSQL4" MODULE="mysql-connector-java-3.1.14-bin.jar" MVN="mvn:org.talend.libraries/mysql-connector-java-3.1.14-bin/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') and (DBTYPE=='MYSQL') and (DB_MYSQL_VERSION=='MYSQL_4')"/>
|
||||
<IMPORT NAME="Driver-MYSQL5" MODULE="mysql-connector-java-5.1.30-bin.jar" MVN="mvn:org.talend.libraries/mysql-connector-java-5.1.30-bin/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') and (DBTYPE=='MYSQL') and (DB_MYSQL_VERSION=='MYSQL_5')"/>
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -8,8 +8,9 @@ String loopPath_<%=cid%> = <%=loopQuery%>;
|
||||
java.util.List<Object> resultset_<%=cid%> = new java.util.ArrayList<Object>();
|
||||
|
||||
boolean isStructError_<%=cid %> = true;
|
||||
com.jayway.jsonpath.ReadContext document_<%=cid%> = null;
|
||||
try {
|
||||
com.jayway.jsonpath.ReadContext document_<%=cid%> = com.jayway.jsonpath.JsonPath.parse(jsonStr_<%=cid%>);
|
||||
document_<%=cid%> = com.jayway.jsonpath.JsonPath.parse(jsonStr_<%=cid%>);
|
||||
com.jayway.jsonpath.JsonPath compiledLoopPath_<%=cid%> = jsonPathCache_<%=cid%>.getCompiledJsonPath(loopPath_<%=cid%>);
|
||||
Object result_<%=cid%> = document_<%=cid%>.read(compiledLoopPath_<%=cid%>,net.minidev.json.JSONObject.class);
|
||||
if (result_<%=cid%> instanceof net.minidev.json.JSONArray) {
|
||||
@@ -64,6 +65,7 @@ com.jayway.jsonpath.JsonPath compiledJsonPath_<%=cid%> = null;
|
||||
|
||||
Object value_<%=cid%> = null;
|
||||
|
||||
Object root_<%=cid%> = null;
|
||||
for(int i_<%=cid %>=0; isStructError_<%=cid %> || (i_<%=cid %> < resultset_<%=cid %>.size());i_<%=cid %>++){
|
||||
if(!isStructError_<%=cid %>){
|
||||
Object row_<%=cid%> = resultset_<%=cid %>.get(i_<%=cid %>);
|
||||
@@ -82,6 +84,7 @@ if(outConns!=null){
|
||||
nb_line_<%=cid%>++;
|
||||
try {
|
||||
<%
|
||||
boolean useLoopAsRoot = "true".equals(ElementParameterParser.getValue(node, "__USE_LOOP_AS_ROOT__"));
|
||||
boolean splitList = "true".equals(ElementParameterParser.getValue(node, "__SPLIT_LIST__"));
|
||||
for (int i=0;i<mapping.size();i++) {
|
||||
for(IMetadataColumn column : outConn.getMetadataTable().getListColumns()) {
|
||||
@@ -113,8 +116,23 @@ for (int i=0;i<mapping.size();i++) {
|
||||
compiledJsonPath_<%=cid%> = jsonPathCache_<%=cid%>.getCompiledJsonPath(jsonPath_<%=cid%>);
|
||||
|
||||
try {
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
<%
|
||||
if(useLoopAsRoot){
|
||||
%>
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
if(jsonPath_<%=cid%>.startsWith("$")){
|
||||
if(root_<%=cid%> == null){
|
||||
root_<%=cid%> = document_<%=cid%>.read(jsonPathCache_<%=cid%>.getCompiledJsonPath("$"));
|
||||
}
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(root_<%=cid%>);
|
||||
}else{
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
if(javaType == JavaTypesManager.STRING){
|
||||
%>
|
||||
<%=firstConnName%>.<%=column.getLabel() %> = value_<%=cid%> == null ? <%@ include file="./set_default_value.javajet"%> : value_<%=cid%>.toString();
|
||||
|
||||
@@ -163,6 +163,11 @@
|
||||
REQUIRED="true" SHOW_IF="READ_BY=='XPATH'">
|
||||
<DEFAULT>"UTF-8"</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USE_LOOP_AS_ROOT" FIELD="CHECK" NUM_ROW="25" SHOW_IF="READ_BY=='JSONPATH'" REPOSITORY_VALUE="USE_LOOP_AS_ROOT">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<!-- For migration only -->
|
||||
<PARAMETER NAME="SPLIT_LIST" FIELD="CHECK" NUM_ROW="100" SHOW="false">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
|
||||
@@ -24,4 +24,6 @@ JSON_PATH_VERSION.ITEM.1_2_0=1.2.0
|
||||
|
||||
MAPPING_4_JSONPATH.NAME=Mapping
|
||||
MAPPING_4_JSONPATH.ITEM.QUERY=Json query
|
||||
JSON_LOOP_QUERY.NAME=Loop Jsonpath query
|
||||
JSON_LOOP_QUERY.NAME=Loop Jsonpath query
|
||||
|
||||
USE_LOOP_AS_ROOT.NAME=Use the loop node as root
|
||||
@@ -7,6 +7,7 @@ String firstConnName = "";
|
||||
List<IMetadataTable> metadatas = node.getMetadataList();
|
||||
|
||||
String loopPath = ElementParameterParser.getValue(node, "__JSON_LOOP_QUERY__");
|
||||
boolean useLoopAsRoot = "true".equals(ElementParameterParser.getValue(node, "__USE_LOOP_AS_ROOT__"));
|
||||
%>
|
||||
class JsonPathCache_<%=cid%> {
|
||||
final java.util.Map<String,com.jayway.jsonpath.JsonPath> jsonPathString2compiledJsonPath = new java.util.HashMap<String,com.jayway.jsonpath.JsonPath>();
|
||||
@@ -51,6 +52,7 @@ Object filenameOrStream_<%=cid %> = null;
|
||||
%>
|
||||
}
|
||||
|
||||
com.jayway.jsonpath.ReadContext document_<%=cid%> = null;
|
||||
try {
|
||||
if(filenameOrStream_<%=cid %> instanceof java.io.InputStream){
|
||||
is_<%=cid%> = (java.io.InputStream)filenameOrStream_<%=cid %>;
|
||||
@@ -65,7 +67,7 @@ try {
|
||||
}
|
||||
|
||||
|
||||
com.jayway.jsonpath.ReadContext document_<%=cid%> = parseContext_<%=cid%>.parse(is_<%=cid%>,<%=encoding %>);
|
||||
document_<%=cid%> = parseContext_<%=cid%>.parse(is_<%=cid%>,<%=encoding %>);
|
||||
com.jayway.jsonpath.JsonPath compiledLoopPath_<%=cid%> = jsonPathCache_<%=cid%>.getCompiledJsonPath(loopPath_<%=cid%>);
|
||||
Object result_<%=cid%> = document_<%=cid%>.read(compiledLoopPath_<%=cid%>,net.minidev.json.JSONObject.class);
|
||||
if (result_<%=cid%> instanceof net.minidev.json.JSONArray) {
|
||||
@@ -100,6 +102,7 @@ Object value_<%=cid%> = null;
|
||||
<%if(isLog4jEnabled){%>
|
||||
log.info("<%=cid%> - Retrieving records from data.");
|
||||
<%}%>
|
||||
Object root_<%=cid%> = null;
|
||||
for(Object row_<%=cid%> : resultset_<%=cid%>) {
|
||||
nb_line_<%=cid%>++;
|
||||
<%
|
||||
@@ -173,8 +176,23 @@ for(Object row_<%=cid%> : resultset_<%=cid%>) {
|
||||
compiledJsonPath_<%=cid%> = jsonPathCache_<%=cid%>.getCompiledJsonPath(jsonPath_<%=cid%>);
|
||||
|
||||
try {
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
<%
|
||||
if(useLoopAsRoot){
|
||||
%>
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
<%
|
||||
}else{
|
||||
%>
|
||||
if(jsonPath_<%=cid%>.startsWith("$")){
|
||||
if(root_<%=cid%> == null){
|
||||
root_<%=cid%> = document_<%=cid%>.read(jsonPathCache_<%=cid%>.getCompiledJsonPath("$"));
|
||||
}
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(root_<%=cid%>);
|
||||
}else{
|
||||
value_<%=cid%> = compiledJsonPath_<%=cid%>.read(row_<%=cid%>);
|
||||
}
|
||||
<%
|
||||
}
|
||||
if(javaType == JavaTypesManager.STRING){
|
||||
%>
|
||||
<%=firstConnName%>.<%=column.getLabel() %> = value_<%=cid%> == null ? <%@ include file="./set_default_value.javajet"%> : value_<%=cid%>.toString();
|
||||
|
||||
@@ -141,6 +141,10 @@
|
||||
<PARAMETER NAME="CHECK_DATE" FIELD="CHECK" NUM_ROW="20" SHOW_IF="READ_BY=='XPATH'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="USE_LOOP_AS_ROOT" FIELD="CHECK" NUM_ROW="25" SHOW_IF="READ_BY=='JSONPATH'" REPOSITORY_VALUE="USE_LOOP_AS_ROOT">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="ENCODING" FIELD="ENCODING_TYPE" NUM_ROW="30"
|
||||
REQUIRED="true" REPOSITORY_VALUE="ENCODING">
|
||||
|
||||
@@ -35,4 +35,5 @@ JSON_PATH_VERSION.ITEM.1_2_0=1.2.0
|
||||
JSON_LOOP_QUERY.NAME=Loop Json query
|
||||
|
||||
MAPPING_JSONPATH.NAME=Mapping
|
||||
MAPPING_JSONPATH.ITEM.QUERY=Json query
|
||||
MAPPING_JSONPATH.ITEM.QUERY=Json query
|
||||
USE_LOOP_AS_ROOT.NAME=Use the loop node as root
|
||||
@@ -17,7 +17,7 @@ final String GoogleTracker = org.talend.core.utils.TrackerUtil.getGoogleTracker(
|
||||
|
||||
<%@ include file="@{org.talend.designer.components.localprovider}/components/templates/password.javajet"%>
|
||||
|
||||
org.jets3t.service.Jets3tProperties jets3tProperties = new org.jets3t.service.Jets3tProperties();
|
||||
org.jets3t.service.Jets3tProperties jets3tProperties = org.jets3t.service.Jets3tProperties.getInstance(org.jets3t.service.Constants.JETS3T_PROPERTIES_FILENAME);
|
||||
jets3tProperties.setProperty("httpclient.useragent", "<%=AWSTracker%>");
|
||||
org.jets3t.service.security.GSCredentials credentials_<%=cid%> = new org.jets3t.service.security.GSCredentials(<%=accessKey%>,decryptedPassword_<%=cid%>);
|
||||
org.jets3t.service.impl.rest.httpclient.GoogleStorageService service_<%=cid%> = new org.jets3t.service.impl.rest.httpclient.GoogleStorageService(credentials_<%=cid%>," <%=GoogleTracker%>", null, jets3tProperties);
|
||||
|
||||
@@ -226,7 +226,7 @@ if(hiveDistrib.isExecutedThroughWebHCat()) {
|
||||
}
|
||||
}
|
||||
%>
|
||||
log.info("Query sent to HiveServer2 to be executed with [Application Name(MapReduce)/DAG Name(Tez): " + queryIdentifier + "]");
|
||||
log.info("Query sent to HiveServer2 to be executed with [Application Name(MapReduce)/DAG Name(Tez): " + queryIdentifier_<%=cid %> + "]");
|
||||
} catch (java.lang.Exception e) {
|
||||
whetherReject_<%=cid%> = true;
|
||||
<%
|
||||
|
||||
@@ -354,7 +354,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="DRIVER=='JTDS'" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="DRIVER=='JTDS'" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="DRIVER=='MSSQL_PROP'" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -258,9 +258,9 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Talend_MssqlUtil" MODULE="talend_DB_mssqlUtil-1.2-20171017.jar" MVN="mvn:org.talend.libraries/talend_DB_mssqlUtil-1.2-20171017/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_DB_mssqlUtil-1.2-20171017.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Talend_MssqlUtil" MODULE="talend_DB_mssqlUtil-1.3-20190523.jar" MVN="mvn:org.talend.libraries/talend_DB_mssqlUtil-1.3-20190523/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_DB_mssqlUtil-1.3-20190523.jar" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -332,8 +332,8 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar"
|
||||
REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523"
|
||||
REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER=='JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(DRIVER=='JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER=='MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -513,9 +513,9 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Talend_MssqlUtil" MODULE="talend_DB_mssqlUtil-1.2-20171017.jar" MVN="mvn:org.talend.libraries/talend_DB_mssqlUtil-1.2-20171017/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_DB_mssqlUtil-1.2-20171017.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Talend_MssqlUtil" MODULE="talend_DB_mssqlUtil-1.3-20190523.jar" MVN="mvn:org.talend.libraries/talend_DB_mssqlUtil-1.3-20190523/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_DB_mssqlUtil-1.3-20190523.jar" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" BundleID=""/>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
@@ -336,7 +336,7 @@
|
||||
<IMPORT NAME="Driver-DB2-LICENSE-CISUZ" MODULE="db2jcc_license_cisuz.jar" MVN="mvn:org.talend.libraries/db2jcc_license_cisuz/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-DB2-LICENSE-CU" MODULE="db2jcc_license_cu.jar" MVN="mvn:org.talend.libraries/db2jcc_license_cu/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver_MaxDB" MODULE="sapdbc.jar" MVN="mvn:org.talend.libraries/sapdbc/6.0.0" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-MSSQL" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-MSSQL" MODULE="jtds-1.3.1-patch-20190523.jar" MVN="mvn:net.sourceforge.jtds/jtds/1.3.1-patch-20190523" REQUIRED="true" BundleID=""/>
|
||||
<IMPORT NAME="Driver-Oracle11g-2" MODULE="ojdbc6.jar" MVN="mvn:org.talend.libraries/ojdbc6/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jdbc.oracle/lib/ojdbc6.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-POSTGRESQL" MODULE="postgresql-8.3-603.jdbc3.jar" MVN="mvn:org.talend.libraries/postgresql-8.3-603.jdbc3/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jdbc.postgresql/lib/postgresql-8.3-603.jdbc3.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Driver-FIREBIRD" MODULE="jaybird-full-2.1.1.jar" MVN="mvn:org.talend.libraries/jaybird-full-2.1.1/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.jdbc.firebird/lib/jaybird-full-2.1.1.jar" REQUIRED="true" />
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
|
||||
<IMPORT NAME="Talend_MssqlUtil" MODULE="talend_DB_mssqlUtil-1.2-20171017.jar" MVN="mvn:org.talend.libraries/talend_DB_mssqlUtil-1.2-20171017/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_DB_mssqlUtil-1.2-20171017.jar" REQUIRED="true" />
|
||||
<IMPORT NAME="Talend_MssqlUtil" MODULE="talend_DB_mssqlUtil-1.3-20190523.jar" MVN="mvn:org.talend.libraries/talend_DB_mssqlUtil-1.3-20190523/6.0.0" UrlPath="platform:/plugin/org.talend.libraries.custom/lib/talend_DB_mssqlUtil-1.3-20190523.jar" REQUIRED="true" />
|
||||
</IMPORTS>
|
||||
</CODEGENERATION>
|
||||
|
||||
|
||||
@@ -1,548 +1,554 @@
|
||||
<%@ jet
|
||||
imports="
|
||||
java.util.ArrayList
|
||||
java.util.List
|
||||
java.util.Map
|
||||
<%@ jet
|
||||
imports="
|
||||
java.util.ArrayList
|
||||
java.util.List
|
||||
java.util.Map
|
||||
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
org.talend.core.model.metadata.types.JavaType
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
"
|
||||
org.talend.core.model.metadata.IMetadataColumn
|
||||
org.talend.core.model.metadata.types.JavaType
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.core.model.process.IConnection
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
"
|
||||
%>
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
final INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
final INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
|
||||
/*in shema:*/
|
||||
List<? extends IConnection> listInConns = node.getIncomingConnections();
|
||||
String sInConnName = null;
|
||||
IConnection inConn = null;
|
||||
List<IMetadataColumn> listInColumns = null;
|
||||
/*in shema:*/
|
||||
List<? extends IConnection> listInConns = node.getIncomingConnections();
|
||||
String sInConnName = null;
|
||||
IConnection inConn = null;
|
||||
List<IMetadataColumn> listInColumns = null;
|
||||
|
||||
if (listInConns != null && listInConns.size() > 0) {
|
||||
IConnection inConnTemp = listInConns.get(0);
|
||||
sInConnName = inConnTemp.getName();
|
||||
if(inConnTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)){
|
||||
inConn = inConnTemp;
|
||||
listInColumns = inConnTemp.getMetadataTable().getListColumns();
|
||||
}
|
||||
}
|
||||
if (listInConns != null && listInConns.size() > 0) {
|
||||
IConnection inConnTemp = listInConns.get(0);
|
||||
sInConnName = inConnTemp.getName();
|
||||
if(inConnTemp.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)){
|
||||
inConn = inConnTemp;
|
||||
listInColumns = inConnTemp.getMetadataTable().getListColumns();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* get the schema of itself (maybe no output flow)*/
|
||||
List<IMetadataColumn> listColumsToTest = node.getMetadataList().get(0).getListColumns();
|
||||
|
||||
String anotherChecked = ElementParameterParser.getValue(node, "__CHECK_ANOTHER__");
|
||||
String checkAll = ElementParameterParser.getValue(node, "__CHECK_ALL__");
|
||||
final boolean bIsTrim = "true".equals(ElementParameterParser.getValue(node, "__SUB_STRING__"));
|
||||
final boolean useFasteDateChecker = "true".equals(ElementParameterParser.getValue(node, "__FAST_DATE_CHECK__"));
|
||||
final boolean emptyIsNull = "true".equals(ElementParameterParser.getValue(node, "__EMPTY_IS_NULL__"));
|
||||
final boolean allEmptyAreNull = "true".equals(ElementParameterParser.getValue(node, "__ALL_EMPTY_ARE_NULL__"));
|
||||
|
||||
List<Map<String, String>> list = (List<Map<String, String>>)ElementParameterParser.getObjectValue(node, "__EMPTY_NULL_TABLE__");
|
||||
final List<String> listEmptyAsNull = new ArrayList<String>();
|
||||
for(Map<String, String> map : list){
|
||||
if("true".equals(map.get("EMPTY_NULL"))){
|
||||
listEmptyAsNull.add(map.get("SCHEMA_COLUMN"));
|
||||
}
|
||||
}
|
||||
/* get the schema of itself (maybe no output flow)*/
|
||||
List<IMetadataColumn> listColumsToTest = node.getMetadataList().get(0).getListColumns();
|
||||
|
||||
class SchemaChecker { //CLASS SCHEMACHECKER START
|
||||
boolean anotherChecked = "true".equals(ElementParameterParser.getValue(node, "__CHECK_ANOTHER__"));
|
||||
boolean ignoreTimeZone = "true".equals(ElementParameterParser.getValue(node, "__IGNORE_TIMEZONE__"));
|
||||
String anotherChecked = ElementParameterParser.getValue(node, "__CHECK_ANOTHER__");
|
||||
String checkAll = ElementParameterParser.getValue(node, "__CHECK_ALL__");
|
||||
final boolean bIsTrim = "true".equals(ElementParameterParser.getValue(node, "__SUB_STRING__"));
|
||||
final boolean useFasteDateChecker = "true".equals(ElementParameterParser.getValue(node, "__FAST_DATE_CHECK__"));
|
||||
final boolean useStrictDateChecker = "true".equals(ElementParameterParser.getValue(node, "__STRICT_DATE_CHECK__"));
|
||||
final boolean emptyIsNull = "true".equals(ElementParameterParser.getValue(node, "__EMPTY_IS_NULL__"));
|
||||
final boolean allEmptyAreNull = "true".equals(ElementParameterParser.getValue(node, "__ALL_EMPTY_ARE_NULL__"));
|
||||
|
||||
public void testDataType(boolean _bNullable, String _sInConnName, IMetadataColumn metadataColumn, String typeSelected, String cid) { //METHOD_TESTDATATYPE START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType( javaType, metadataColumn.isNullable());
|
||||
String colName = metadataColumn.getLabel();
|
||||
List<Map<String, String>> list = (List<Map<String, String>>)ElementParameterParser.getObjectValue(node, "__EMPTY_NULL_TABLE__");
|
||||
final List<String> listEmptyAsNull = new ArrayList<String>();
|
||||
for(Map<String, String> map : list){
|
||||
if("true".equals(map.get("EMPTY_NULL"))){
|
||||
listEmptyAsNull.add(map.get("SCHEMA_COLUMN"));
|
||||
}
|
||||
}
|
||||
|
||||
if (javaType == JavaTypesManager.OBJECT || javaType == JavaTypesManager.STRING) { //CONDITION_00100 START
|
||||
%>
|
||||
try {
|
||||
if(
|
||||
<%
|
||||
if (_bNullable){ //CONDITION_00110 START
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
if(allEmptyAreNull || listEmptyAsNull.contains(metadataColumn.getLabel())) {
|
||||
%>
|
||||
&& (!"".equals(<%=_sInConnName%>.<%=colName%>))
|
||||
<%
|
||||
}
|
||||
}else if(!isPrimitive){ //CONDITION_00110 ELSE IF
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
}else{ //CONDITION_00110 ELSE
|
||||
%>
|
||||
true
|
||||
<%
|
||||
} //CONDITION_00110 STOP
|
||||
%>
|
||||
) {
|
||||
<%
|
||||
if(typeSelected.equals("Boolean") ) { //CONDITION_00120 START
|
||||
%>
|
||||
if(!("true".equals(<%=_sInConnName%>.<%=colName%>) || "false".equals(<%=_sInConnName%>.<%=colName%>))){
|
||||
throw new java.lang.Exception("Wrong Boolean type!");
|
||||
}
|
||||
<%
|
||||
} else if(typeSelected.equals("Character")) { //CONDITION_00120 ELSE IF
|
||||
%>
|
||||
if(<%=_sInConnName%>.<%=colName%>.toCharArray().length != 1){
|
||||
throw new java.lang.Exception("Wrong Character type!");
|
||||
}
|
||||
<%
|
||||
} else if(typeSelected.equals("BigDecimal")) { //CONDITION_00120 ELSE IF
|
||||
%>
|
||||
<%=typeSelected%> tester_<%=cid%> = new <%=typeSelected%>(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} else if(typeSelected.equals("Object")){ //CONDITION_00120 ELSE IF
|
||||
%>
|
||||
<%=typeSelected%> tester_<%=cid%> = new <%=typeSelected%>();
|
||||
<%
|
||||
} else { //CONDITION_00120 ELSE
|
||||
%>
|
||||
<%=typeSelected%> tester_<%=cid%> = <%=typeSelected%>.valueOf(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} //CONDITION_00120 STOP
|
||||
%>
|
||||
}
|
||||
} catch(java.lang.Exception e) {
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|wrong type";
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00100 STOP
|
||||
} //METHOD_TESTDATATYPE STOP
|
||||
class SchemaChecker { //CLASS SCHEMACHECKER START
|
||||
boolean anotherChecked = "true".equals(ElementParameterParser.getValue(node, "__CHECK_ANOTHER__"));
|
||||
boolean ignoreTimeZone = "true".equals(ElementParameterParser.getValue(node, "__IGNORE_TIMEZONE__"));
|
||||
|
||||
public void testPrecision(int _maxLength, int iPrecision, String _sInConnName, IMetadataColumn metadataColumn, String typeSelected, String cid) { //METHOD_TESTPRECISION START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
String colName = metadataColumn.getLabel();
|
||||
boolean needCheck = false;
|
||||
if(anotherChecked) {
|
||||
if("BigDecimal".equalsIgnoreCase(typeSelected)) {
|
||||
needCheck = true;
|
||||
}
|
||||
} else if (javaType == JavaTypesManager.BIGDECIMAL) {
|
||||
/* NULLable, in case input value is Null, do nothing...
|
||||
Non-NULLable,
|
||||
(1) in case input value is Non-null, go into...;
|
||||
(2) in case input value is Null, do nothing and warning by NULL-CHECKER.
|
||||
*/
|
||||
/*
|
||||
if precision value is not empty or Null, checking "Precision" at first, if passed then checking "Length"
|
||||
*/
|
||||
needCheck = true;
|
||||
}
|
||||
if(needCheck) { //CONDITION_00130 START
|
||||
%>
|
||||
if (<%=_sInConnName%>.<%=colName%> != null){
|
||||
<%
|
||||
if(javaType == JavaTypesManager.BIGDECIMAL) { //CONDITION_00131 START
|
||||
%>
|
||||
handleBigdecimalPrecision((<%=_sInConnName%>.<%=colName%>).toPlainString(), <%=iPrecision%>, <%=_maxLength%>);
|
||||
<%
|
||||
} else { //CONDITION_00131 ELSE
|
||||
%>
|
||||
handleBigdecimalPrecision(String.valueOf(<%=_sInConnName%>.<%=colName%>), <%=iPrecision%>, <%=_maxLength%>);
|
||||
<%
|
||||
} //CONDITION_00131 STOP
|
||||
%>
|
||||
ifPassedThrough = ifPassedThrough?ifPassed:false;
|
||||
errorCodeThrough += errorCode;
|
||||
errorMessageThrough += errorMessage;
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00130 STOP
|
||||
} //METHOD_TESTPRECISION STOP
|
||||
public void testDataType(boolean _bNullable, String _sInConnName, IMetadataColumn metadataColumn, String typeSelected, String cid) { //METHOD_TESTDATATYPE START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType( javaType, metadataColumn.isNullable());
|
||||
String colName = metadataColumn.getLabel();
|
||||
|
||||
public void testDataLength(boolean _bNullable, String _sInConnName,IMetadataColumn inColumn, IMetadataColumn metadataColumn, int maxLength, String cid) { //METHOD_TESTDATALENGTH START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType(javaType, metadataColumn.isNullable());
|
||||
boolean bIsStringType = (javaType == JavaTypesManager.STRING), bIsIntegerType = (javaType == JavaTypesManager.INTEGER);
|
||||
String colName = inColumn.getLabel();
|
||||
if (javaType == JavaTypesManager.OBJECT || javaType == JavaTypesManager.STRING) { //CONDITION_00100 START
|
||||
%>
|
||||
try {
|
||||
if(
|
||||
<%
|
||||
if (_bNullable){ //CONDITION_00110 START
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
if(allEmptyAreNull || listEmptyAsNull.contains(metadataColumn.getLabel())) {
|
||||
%>
|
||||
&& (!"".equals(<%=_sInConnName%>.<%=colName%>))
|
||||
<%
|
||||
}
|
||||
}else if(!isPrimitive){ //CONDITION_00110 ELSE IF
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
}else{ //CONDITION_00110 ELSE
|
||||
%>
|
||||
true
|
||||
<%
|
||||
} //CONDITION_00110 STOP
|
||||
%>
|
||||
) {
|
||||
<%
|
||||
if(typeSelected.equals("Boolean") ) { //CONDITION_00120 START
|
||||
%>
|
||||
if(!("true".equals(<%=_sInConnName%>.<%=colName%>) || "false".equals(<%=_sInConnName%>.<%=colName%>))){
|
||||
throw new java.lang.Exception("Wrong Boolean type!");
|
||||
}
|
||||
<%
|
||||
} else if(typeSelected.equals("Character")) { //CONDITION_00120 ELSE IF
|
||||
%>
|
||||
if(<%=_sInConnName%>.<%=colName%>.toCharArray().length != 1){
|
||||
throw new java.lang.Exception("Wrong Character type!");
|
||||
}
|
||||
<%
|
||||
} else if(typeSelected.equals("BigDecimal")) { //CONDITION_00120 ELSE IF
|
||||
%>
|
||||
<%=typeSelected%> tester_<%=cid%> = new <%=typeSelected%>(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} else if(typeSelected.equals("Object")){ //CONDITION_00120 ELSE IF
|
||||
%>
|
||||
<%=typeSelected%> tester_<%=cid%> = new <%=typeSelected%>();
|
||||
<%
|
||||
} else { //CONDITION_00120 ELSE
|
||||
%>
|
||||
<%=typeSelected%> tester_<%=cid%> = <%=typeSelected%>.valueOf(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} //CONDITION_00120 STOP
|
||||
%>
|
||||
}
|
||||
} catch(java.lang.Exception e) {
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|wrong type";
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00100 STOP
|
||||
} //METHOD_TESTDATATYPE STOP
|
||||
|
||||
if (maxLength > 0 && ( bIsStringType || bIsIntegerType )){ //CONDITION_00140 START
|
||||
public void testPrecision(int _maxLength, int iPrecision, String _sInConnName, IMetadataColumn metadataColumn, String typeSelected, String cid) { //METHOD_TESTPRECISION START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
String colName = metadataColumn.getLabel();
|
||||
boolean needCheck = false;
|
||||
if(anotherChecked) {
|
||||
if("BigDecimal".equalsIgnoreCase(typeSelected)) {
|
||||
needCheck = true;
|
||||
}
|
||||
} else if (javaType == JavaTypesManager.BIGDECIMAL) {
|
||||
/* NULLable, in case input value is Null, do nothing...
|
||||
Non-NULLable,
|
||||
(1) in case input value is Non-null, go into...;
|
||||
(2) in case input value is Null, do nothing and warning by NULL-CHECKER.
|
||||
*/
|
||||
/*
|
||||
if precision value is not empty or Null, checking "Precision" at first, if passed then checking "Length"
|
||||
*/
|
||||
needCheck = true;
|
||||
}
|
||||
if(needCheck) { //CONDITION_00130 START
|
||||
%>
|
||||
if (
|
||||
if (<%=_sInConnName%>.<%=colName%> != null){
|
||||
<%
|
||||
if (_bNullable){ //CONDITION_00141 START
|
||||
if(javaType == JavaTypesManager.BIGDECIMAL) { //CONDITION_00131 START
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
handleBigdecimalPrecision((<%=_sInConnName%>.<%=colName%>).toPlainString(), <%=iPrecision%>, <%=_maxLength%>);
|
||||
<%
|
||||
if(allEmptyAreNull || listEmptyAsNull.contains(metadataColumn.getLabel())) {
|
||||
} else { //CONDITION_00131 ELSE
|
||||
%>
|
||||
&& (!"".equals(<%=_sInConnName%>.<%=colName%>))
|
||||
handleBigdecimalPrecision(String.valueOf(<%=_sInConnName%>.<%=colName%>), <%=iPrecision%>, <%=_maxLength%>);
|
||||
<%
|
||||
}
|
||||
}else if (!isPrimitive){ //CONDITION_00141 ELSE IF
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
}else { //CONDITION_00141 ELSE
|
||||
%>
|
||||
true
|
||||
<%
|
||||
} //CONDITION_00141 STOP
|
||||
} //CONDITION_00131 STOP
|
||||
%>
|
||||
) {
|
||||
ifPassedThrough = ifPassedThrough?ifPassed:false;
|
||||
errorCodeThrough += errorCode;
|
||||
errorMessageThrough += errorMessage;
|
||||
}
|
||||
<%
|
||||
if ( bIsTrim ){ //CONDITION_00142 START
|
||||
if (bIsStringType) { //CONDITION_001421 START
|
||||
} //CONDITION_00130 STOP
|
||||
} //METHOD_TESTPRECISION STOP
|
||||
|
||||
public void testDataLength(boolean _bNullable, String _sInConnName,IMetadataColumn inColumn, IMetadataColumn metadataColumn, int maxLength, String cid) { //METHOD_TESTDATALENGTH START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType(javaType, metadataColumn.isNullable());
|
||||
boolean bIsStringType = (javaType == JavaTypesManager.STRING), bIsIntegerType = (javaType == JavaTypesManager.INTEGER);
|
||||
String colName = inColumn.getLabel();
|
||||
|
||||
if (maxLength > 0 && ( bIsStringType || bIsIntegerType )){ //CONDITION_00140 START
|
||||
%>
|
||||
if( <%=_sInConnName%>.<%=colName%>.length() > <%=maxLength%> )
|
||||
<%=_sInConnName%>.<%=colName%> = <%=_sInConnName%>.<%=colName%>.substring(0, <%=maxLength%>);
|
||||
if (
|
||||
<%
|
||||
} else if ( bIsIntegerType ){//CONDITION_001421 ELSE IF
|
||||
String generatedType = JavaTypesManager.getTypeToGenerate(metadataColumn.getTalendType(), metadataColumn.isNullable());
|
||||
if ("int".equals(generatedType)) { //CONDITION_0014211 START
|
||||
if (_bNullable){ //CONDITION_00141 START
|
||||
%>
|
||||
tmpContentThrough = String.valueOf(<%=_sInConnName%>.<%=colName%>);
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
} else{ //CONDITION_0014211 ELSE
|
||||
if(allEmptyAreNull || listEmptyAsNull.contains(metadataColumn.getLabel())) {
|
||||
%>
|
||||
tmpContentThrough = <%=_sInConnName%>.<%=colName%>.toString();
|
||||
&& (!"".equals(<%=_sInConnName%>.<%=colName%>))
|
||||
<%
|
||||
} //CONDITION_0014211 STOP
|
||||
}
|
||||
}else if (!isPrimitive){ //CONDITION_00141 ELSE IF
|
||||
%>
|
||||
if (tmpContentThrough.length() > <%=maxLength%>)
|
||||
<%=_sInConnName%>.<%=colName%> = <%=_sInConnName%>.<%=colName%>.substring(0, <%=maxLength%>);
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
} //CONDITION_001421 STOP
|
||||
} else{ //CONDITION_00142 ELSE
|
||||
if (bIsStringType) { //CONDITION_001422 START
|
||||
}else { //CONDITION_00141 ELSE
|
||||
%>
|
||||
if (<%=_sInConnName%>.<%=colName%>.length() > <%=maxLength%>) {
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 8;
|
||||
errorMessageThrough += "|exceed max length";
|
||||
}
|
||||
true
|
||||
<%
|
||||
} else if (bIsIntegerType) { //CONDITION_001422 ELSE IF
|
||||
String generatedType = JavaTypesManager.getTypeToGenerate(metadataColumn.getTalendType(), metadataColumn.isNullable());
|
||||
if ("int".equals(generatedType)) { //CONDITION_0014221 START
|
||||
} //CONDITION_00141 STOP
|
||||
%>
|
||||
tmpContentThrough = String.valueOf(<%=_sInConnName%>.<%=colName%>);
|
||||
) {
|
||||
<%
|
||||
} else { //CONDITION_0014221 ELSE
|
||||
if ( bIsTrim ){ //CONDITION_00142 START
|
||||
if (bIsStringType) { //CONDITION_001421 START
|
||||
%>
|
||||
tmpContentThrough = <%=_sInConnName%>.<%=colName%>.toString();
|
||||
if( <%=_sInConnName%>.<%=colName%>.length() > <%=maxLength%> )
|
||||
<%=_sInConnName%>.<%=colName%> = <%=_sInConnName%>.<%=colName%>.substring(0, <%=maxLength%>);
|
||||
<%
|
||||
} //CONDITION_0014221 STOP
|
||||
} else if ( bIsIntegerType ){//CONDITION_001421 ELSE IF
|
||||
String generatedType = JavaTypesManager.getTypeToGenerate(metadataColumn.getTalendType(), metadataColumn.isNullable());
|
||||
if ("int".equals(generatedType)) { //CONDITION_0014211 START
|
||||
%>
|
||||
tmpContentThrough = String.valueOf(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} else{ //CONDITION_0014211 ELSE
|
||||
%>
|
||||
tmpContentThrough = <%=_sInConnName%>.<%=colName%>.toString();
|
||||
<%
|
||||
} //CONDITION_0014211 STOP
|
||||
%>
|
||||
if (tmpContentThrough.length() > <%=maxLength%>)
|
||||
<%=_sInConnName%>.<%=colName%> = <%=_sInConnName%>.<%=colName%>.substring(0, <%=maxLength%>);
|
||||
<%
|
||||
} //CONDITION_001421 STOP
|
||||
} else{ //CONDITION_00142 ELSE
|
||||
if (bIsStringType) { //CONDITION_001422 START
|
||||
%>
|
||||
if (<%=_sInConnName%>.<%=colName%>.length() > <%=maxLength%>) {
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 8;
|
||||
errorMessageThrough += "|exceed max length";
|
||||
}
|
||||
<%
|
||||
} else if (bIsIntegerType) { //CONDITION_001422 ELSE IF
|
||||
String generatedType = JavaTypesManager.getTypeToGenerate(metadataColumn.getTalendType(), metadataColumn.isNullable());
|
||||
if ("int".equals(generatedType)) { //CONDITION_0014221 START
|
||||
%>
|
||||
tmpContentThrough = String.valueOf(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} else { //CONDITION_0014221 ELSE
|
||||
%>
|
||||
tmpContentThrough = <%=_sInConnName%>.<%=colName%>.toString();
|
||||
<%
|
||||
} //CONDITION_0014221 STOP
|
||||
%>
|
||||
|
||||
if (tmpContentThrough.length() > <%=maxLength%>) {
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 8;
|
||||
errorMessageThrough += "|exceed max length";
|
||||
}
|
||||
if (tmpContentThrough.length() > <%=maxLength%>) {
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 8;
|
||||
errorMessageThrough += "|exceed max length";
|
||||
}
|
||||
<%
|
||||
}//CONDITION_001422 STOP
|
||||
} //CONDITION_00142 STOP
|
||||
}//CONDITION_001422 STOP
|
||||
} //CONDITION_00142 STOP
|
||||
%>
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00140 STOP
|
||||
} //METHOD_TESTDATALENGTH STOP
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00140 STOP
|
||||
} //METHOD_TESTDATALENGTH STOP
|
||||
|
||||
public void testDate(boolean _bNullable, String _sInConnName, IMetadataColumn metadataColumn, String pattern, String cid) { //METHOD_TESTDATE START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType( javaType, metadataColumn.isNullable());
|
||||
String colName = metadataColumn.getLabel();
|
||||
public void testDate(boolean _bNullable, String _sInConnName, IMetadataColumn metadataColumn, String pattern, String cid) { //METHOD_TESTDATE START
|
||||
JavaType javaType = JavaTypesManager.getJavaTypeFromId(metadataColumn.getTalendType());
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType( javaType, metadataColumn.isNullable());
|
||||
String colName = metadataColumn.getLabel();
|
||||
|
||||
if ("".equals(pattern)){ //CONDITION_00150 START
|
||||
if ("".equals(pattern)){ //CONDITION_00150 START
|
||||
%>
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|Date format not defined";
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|Date format not defined";
|
||||
<%
|
||||
} else { //CONDITION_00150 ELSE
|
||||
if (javaType == JavaTypesManager.OBJECT || javaType == JavaTypesManager.STRING) { //CONDITION_00151 START
|
||||
} else { //CONDITION_00150 ELSE
|
||||
if (javaType == JavaTypesManager.OBJECT || javaType == JavaTypesManager.STRING) { //CONDITION_00151 START
|
||||
%>
|
||||
try{
|
||||
if (
|
||||
try{
|
||||
if (
|
||||
<%
|
||||
if (_bNullable){ //CONDITION_001511 START
|
||||
if (_bNullable){ //CONDITION_001511 START
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
if(allEmptyAreNull || listEmptyAsNull.contains(metadataColumn.getLabel())) {
|
||||
if(allEmptyAreNull || listEmptyAsNull.contains(metadataColumn.getLabel())) {
|
||||
%>
|
||||
&& (!"".equals(<%=_sInConnName%>.<%=colName%>))
|
||||
&& (!"".equals(<%=_sInConnName%>.<%=colName%>))
|
||||
<%
|
||||
}
|
||||
}else if (!isPrimitive){ //CONDITION_001511 ELSE IF
|
||||
%>
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
}else { //CONDITION_001511 ELSE
|
||||
%>
|
||||
true
|
||||
<%
|
||||
} //CONDITION_001511 STOP
|
||||
}
|
||||
}else if (!isPrimitive){ //CONDITION_001511 ELSE IF
|
||||
%>
|
||||
){
|
||||
<%=_sInConnName%>.<%=colName%> != null
|
||||
<%
|
||||
if (!useFasteDateChecker) { //CONDITION_001512 START
|
||||
}else { //CONDITION_001511 ELSE
|
||||
%>
|
||||
if (!TalendDate.isDate((<%=_sInConnName%>.<%=colName%>).toString(), <%=pattern%>,<%if(ignoreTimeZone){%>true<%}else{%>false<%}%>))
|
||||
throw new IllegalArgumentException("Data format not matches");
|
||||
true
|
||||
<%
|
||||
} else { //CONDITION_001512 ELSE
|
||||
} //CONDITION_001511 STOP
|
||||
%>
|
||||
FastDateParser.getInstance(<%=pattern%>, false).parse(<%=_sInConnName%>.<%=colName%>);
|
||||
){
|
||||
<%
|
||||
} //CONDITION_001512 STOP
|
||||
if (!useFasteDateChecker && !useStrictDateChecker) { //CONDITION_001512 START
|
||||
%>
|
||||
}
|
||||
} catch(java.lang.Exception e){
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|wrong DATE pattern or wrong DATE data";
|
||||
}
|
||||
if (!TalendDate.isDate((<%=_sInConnName%>.<%=colName%>).toString(), <%=pattern%>,<%if(ignoreTimeZone){%>true<%}else{%>false<%}%>))
|
||||
throw new IllegalArgumentException("Data format not matches");
|
||||
<%
|
||||
// date type need check also (some inputting data not legal, beacause original data is not suite with pattern and has be converted)
|
||||
} else if (javaType == JavaTypesManager.DATE){ //CONDITION_00151 ELSE IF
|
||||
if (!metadataColumn.getPattern().equals(pattern)){ //CONDITION_001513 START
|
||||
} else if (useFasteDateChecker){ //CONDITION_001512 ELSE
|
||||
%>
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|wrong DATE pattern or wrong DATE data";
|
||||
FastDateParser.getInstance(<%=pattern%>, false).parse(<%=_sInConnName%>.<%=colName%>);
|
||||
<%
|
||||
} //CONDITION_001513 STOP
|
||||
} else{ //CONDITION_00151 ELSE
|
||||
} else {//CONDITION_001512 STOP
|
||||
%>
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|The TYPE of inputting data is error. (one of OBJECT, STRING, DATE)";
|
||||
if(!TalendDate.isDateStrict((<%=_sInConnName%>.<%=colName%>).toString(), <%=pattern%>))
|
||||
throw new IllegalArgumentException("Data format not matches");
|
||||
<%
|
||||
} //CONDITION_00151 STOP
|
||||
} //CONDITION_00150 STOP
|
||||
} //METHOD_TESTDATE STOP
|
||||
}
|
||||
%>
|
||||
}
|
||||
} catch(java.lang.Exception e){
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|wrong DATE pattern or wrong DATE data";
|
||||
}
|
||||
<%
|
||||
// date type need check also (some inputting data not legal, beacause original data is not suite with pattern and has be converted)
|
||||
} else if (javaType == JavaTypesManager.DATE){ //CONDITION_00151 ELSE IF
|
||||
if (!metadataColumn.getPattern().equals(pattern)){ //CONDITION_001513 START
|
||||
%>
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|wrong DATE pattern or wrong DATE data";
|
||||
<%
|
||||
} //CONDITION_001513 STOP
|
||||
} else{ //CONDITION_00151 ELSE
|
||||
%>
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 2;
|
||||
errorMessageThrough += "|The TYPE of inputting data is error. (one of OBJECT, STRING, DATE)";
|
||||
<%
|
||||
} //CONDITION_00151 STOP
|
||||
} //CONDITION_00150 STOP
|
||||
} //METHOD_TESTDATE STOP
|
||||
|
||||
public void testNull(String _sInConnName, IMetadataColumn metadataColumn, String cid){ //METHOD_TESTNULL START
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType(metadataColumn.getTalendType(), metadataColumn.isNullable());
|
||||
if (!isPrimitive){ //CONDITION_00160 START
|
||||
if(emptyIsNull && !allEmptyAreNull){ //CONDITION_001601 START - for the migration task
|
||||
if(listEmptyAsNull.contains(metadataColumn.getLabel())){ //CONDITION_0016011 START
|
||||
public void testNull(String _sInConnName, IMetadataColumn metadataColumn, String cid){ //METHOD_TESTNULL START
|
||||
boolean isPrimitive = JavaTypesManager.isJavaPrimitiveType(metadataColumn.getTalendType(), metadataColumn.isNullable());
|
||||
if (!isPrimitive){ //CONDITION_00160 START
|
||||
if(emptyIsNull && !allEmptyAreNull){ //CONDITION_001601 START - for the migration task
|
||||
if(listEmptyAsNull.contains(metadataColumn.getLabel())){ //CONDITION_0016011 START
|
||||
%>
|
||||
// validate nullable (empty as null)
|
||||
if ((<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) || ("".equals(<%=_sInConnName%>.<%=metadataColumn.getLabel()%>))) {
|
||||
// validate nullable (empty as null)
|
||||
if ((<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) || ("".equals(<%=_sInConnName%>.<%=metadataColumn.getLabel()%>))) {
|
||||
<%
|
||||
}else{ //CONDITION_0016011 ELSE
|
||||
}else{ //CONDITION_0016011 ELSE
|
||||
%>
|
||||
// validate nullable
|
||||
if (<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) {
|
||||
// validate nullable
|
||||
if (<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) {
|
||||
<%
|
||||
} //CONDITION_0016011 STOP
|
||||
}else{ //CONDITION_001601 ELSE
|
||||
if(allEmptyAreNull){ //CONDITION_0016012 START
|
||||
} //CONDITION_0016011 STOP
|
||||
}else{ //CONDITION_001601 ELSE
|
||||
if(allEmptyAreNull){ //CONDITION_0016012 START
|
||||
%>
|
||||
// validate nullable (empty as null)
|
||||
if ((<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) || ("".equals(<%=_sInConnName%>.<%=metadataColumn.getLabel()%>))) {
|
||||
// validate nullable (empty as null)
|
||||
if ((<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) || ("".equals(<%=_sInConnName%>.<%=metadataColumn.getLabel()%>))) {
|
||||
<%
|
||||
}else if(listEmptyAsNull.contains(metadataColumn.getLabel())){ //CONDITION_0016012 ELSE IF
|
||||
}else if(listEmptyAsNull.contains(metadataColumn.getLabel())){ //CONDITION_0016012 ELSE IF
|
||||
%>
|
||||
// validate nullable (empty as null)
|
||||
if ((<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) || ("".equals(<%=_sInConnName%>.<%=metadataColumn.getLabel()%>))) {
|
||||
// validate nullable (empty as null)
|
||||
if ((<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) || ("".equals(<%=_sInConnName%>.<%=metadataColumn.getLabel()%>))) {
|
||||
<%
|
||||
}else{ //CONDITION_0016012 ELSE
|
||||
}else{ //CONDITION_0016012 ELSE
|
||||
%>
|
||||
// validate nullable
|
||||
if (<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) {
|
||||
// validate nullable
|
||||
if (<%=_sInConnName%>.<%=metadataColumn.getLabel()%> == null) {
|
||||
<%
|
||||
} //CONDITION_0016012 STOP
|
||||
} //CONDITION_001601 STOP
|
||||
} //CONDITION_0016012 STOP
|
||||
} //CONDITION_001601 STOP
|
||||
%>
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 4;
|
||||
errorMessageThrough += "|empty or null";
|
||||
}
|
||||
ifPassedThrough = false;
|
||||
errorCodeThrough += 4;
|
||||
errorMessageThrough += "|empty or null";
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00160 STOP
|
||||
} //METHOD_TESTNULL STOP
|
||||
} //CLASS SCHEMACHECKER STOP
|
||||
} //CONDITION_00160 STOP
|
||||
} //METHOD_TESTNULL STOP
|
||||
} //CLASS SCHEMACHECKER STOP
|
||||
|
||||
SchemaChecker checker = new SchemaChecker();
|
||||
List<Map<String, String>> listCheckedColumns = (List<Map<String, String>>)ElementParameterParser.getObjectValue(node, "__CHECKCOLS__");
|
||||
boolean bNeedReferSchema = false;
|
||||
SchemaChecker checker = new SchemaChecker();
|
||||
List<Map<String, String>> listCheckedColumns = (List<Map<String, String>>)ElementParameterParser.getObjectValue(node, "__CHECKCOLS__");
|
||||
boolean bNeedReferSchema = false;
|
||||
|
||||
if ("true".equals(anotherChecked)){
|
||||
if (node.getMetadataFromConnector("OTHER") != null)
|
||||
listColumsToTest = node.getMetadataFromConnector("OTHER").getListColumns();
|
||||
} else if ("true".equals(checkAll)){
|
||||
;
|
||||
} else{
|
||||
bNeedReferSchema = true;
|
||||
}
|
||||
if ("true".equals(anotherChecked)){
|
||||
if (node.getMetadataFromConnector("OTHER") != null)
|
||||
listColumsToTest = node.getMetadataFromConnector("OTHER").getListColumns();
|
||||
} else if ("true".equals(checkAll)){
|
||||
;
|
||||
} else{
|
||||
bNeedReferSchema = true;
|
||||
}
|
||||
|
||||
%>
|
||||
class RowSetValueUtil_<%=cid %> {
|
||||
class RowSetValueUtil_<%=cid %> {
|
||||
|
||||
boolean ifPassedThrough = true;
|
||||
int errorCodeThrough = 0;
|
||||
String errorMessageThrough = "";
|
||||
int resultErrorCodeThrough = 0;
|
||||
String resultErrorMessageThrough = "";
|
||||
String tmpContentThrough = null;
|
||||
boolean ifPassedThrough = true;
|
||||
int errorCodeThrough = 0;
|
||||
String errorMessageThrough = "";
|
||||
int resultErrorCodeThrough = 0;
|
||||
String resultErrorMessageThrough = "";
|
||||
String tmpContentThrough = null;
|
||||
|
||||
boolean ifPassed = true;
|
||||
int errorCode = 0;
|
||||
String errorMessage = "";
|
||||
boolean ifPassed = true;
|
||||
int errorCode = 0;
|
||||
String errorMessage = "";
|
||||
|
||||
void handleBigdecimalPrecision(String data, int iPrecision, int maxLength){
|
||||
//number of digits before the decimal point(ignoring frontend zeroes)
|
||||
int len1 = 0;
|
||||
int len2 = 0;
|
||||
ifPassed = true;
|
||||
errorCode = 0;
|
||||
errorMessage = "";
|
||||
if(data.startsWith("-")){
|
||||
data = data.substring(1);
|
||||
}
|
||||
data = org.apache.commons.lang.StringUtils.stripStart(data, "0");
|
||||
void handleBigdecimalPrecision(String data, int iPrecision, int maxLength){
|
||||
//number of digits before the decimal point(ignoring frontend zeroes)
|
||||
int len1 = 0;
|
||||
int len2 = 0;
|
||||
ifPassed = true;
|
||||
errorCode = 0;
|
||||
errorMessage = "";
|
||||
if(data.startsWith("-")){
|
||||
data = data.substring(1);
|
||||
}
|
||||
data = org.apache.commons.lang.StringUtils.stripStart(data, "0");
|
||||
|
||||
if(data.indexOf(".") >= 0){
|
||||
len1 = data.indexOf(".");
|
||||
data = org.apache.commons.lang.StringUtils.stripEnd(data, "0");
|
||||
len2 = data.length() - (len1 + 1);
|
||||
}else{
|
||||
len1 = data.length();
|
||||
}
|
||||
if(data.indexOf(".") >= 0){
|
||||
len1 = data.indexOf(".");
|
||||
data = org.apache.commons.lang.StringUtils.stripEnd(data, "0");
|
||||
len2 = data.length() - (len1 + 1);
|
||||
}else{
|
||||
len1 = data.length();
|
||||
}
|
||||
|
||||
if (iPrecision < len2) {
|
||||
ifPassed = false;
|
||||
errorCode += 8;
|
||||
errorMessage += "|precision Non-matches";
|
||||
} else if (maxLength < len1 + iPrecision) {
|
||||
ifPassed = false;
|
||||
errorCode += 8;
|
||||
errorMessage += "|invalid Length setting is unsuitable for Precision";
|
||||
}
|
||||
}
|
||||
if (iPrecision < len2) {
|
||||
ifPassed = false;
|
||||
errorCode += 8;
|
||||
errorMessage += "|precision Non-matches";
|
||||
} else if (maxLength < len1 + iPrecision) {
|
||||
ifPassed = false;
|
||||
errorCode += 8;
|
||||
errorMessage += "|invalid Length setting is unsuitable for Precision";
|
||||
}
|
||||
}
|
||||
|
||||
int handleErrorCode(int errorCode, int resultErrorCode){
|
||||
if (errorCode > 0) {
|
||||
if (resultErrorCode > 0) {
|
||||
resultErrorCode = 16;
|
||||
} else {
|
||||
resultErrorCode = errorCode;
|
||||
}
|
||||
}
|
||||
return resultErrorCode;
|
||||
}
|
||||
int handleErrorCode(int errorCode, int resultErrorCode){
|
||||
if (errorCode > 0) {
|
||||
if (resultErrorCode > 0) {
|
||||
resultErrorCode = 16;
|
||||
} else {
|
||||
resultErrorCode = errorCode;
|
||||
}
|
||||
}
|
||||
return resultErrorCode;
|
||||
}
|
||||
|
||||
String handleErrorMessage(String errorMessage, String resultErrorMessage, String columnLabel){
|
||||
if (errorMessage.length() > 0) {
|
||||
if (resultErrorMessage.length() > 0) {
|
||||
resultErrorMessage += ";"+ errorMessage.replaceFirst("\\|", columnLabel);
|
||||
} else {
|
||||
resultErrorMessage = errorMessage.replaceFirst("\\|", columnLabel);
|
||||
}
|
||||
}
|
||||
return resultErrorMessage;
|
||||
}
|
||||
String handleErrorMessage(String errorMessage, String resultErrorMessage, String columnLabel){
|
||||
if (errorMessage.length() > 0) {
|
||||
if (resultErrorMessage.length() > 0) {
|
||||
resultErrorMessage += ";"+ errorMessage.replaceFirst("\\|", columnLabel);
|
||||
} else {
|
||||
resultErrorMessage = errorMessage.replaceFirst("\\|", columnLabel);
|
||||
}
|
||||
}
|
||||
return resultErrorMessage;
|
||||
}
|
||||
|
||||
void reset(){
|
||||
ifPassedThrough = true;
|
||||
errorCodeThrough = 0;
|
||||
errorMessageThrough = "";
|
||||
resultErrorCodeThrough = 0;
|
||||
resultErrorMessageThrough = "";
|
||||
tmpContentThrough = null;
|
||||
void reset(){
|
||||
ifPassedThrough = true;
|
||||
errorCodeThrough = 0;
|
||||
errorMessageThrough = "";
|
||||
resultErrorCodeThrough = 0;
|
||||
resultErrorMessageThrough = "";
|
||||
tmpContentThrough = null;
|
||||
|
||||
ifPassed = true;
|
||||
errorCode = 0;
|
||||
errorMessage = "";
|
||||
}
|
||||
ifPassed = true;
|
||||
errorCode = 0;
|
||||
errorMessage = "";
|
||||
}
|
||||
|
||||
<%
|
||||
for (IMetadataColumn inColumn : listInColumns) { //LOOP_00100 START
|
||||
int iInColIndex = listInColumns.indexOf(inColumn);
|
||||
if(iInColIndex % 100 == 0){ //CONDITION_00170 START
|
||||
for (IMetadataColumn inColumn : listInColumns) { //LOOP_00100 START
|
||||
int iInColIndex = listInColumns.indexOf(inColumn);
|
||||
if(iInColIndex % 100 == 0){ //CONDITION_00170 START
|
||||
%>
|
||||
void setRowValue_<%=(iInColIndex/100) %>(<%=NodeUtil.getPrivateConnClassName(inConn) %>Struct <%=sInConnName %>) {
|
||||
void setRowValue_<%=(iInColIndex/100) %>(<%=NodeUtil.getPrivateConnClassName(inConn) %>Struct <%=sInConnName %>) {
|
||||
<%
|
||||
} //CONDITION_00170 STOP
|
||||
// when using another schema, it's size may less than listInColumns
|
||||
if (iInColIndex >= listColumsToTest.size()){
|
||||
break;
|
||||
}
|
||||
} //CONDITION_00170 STOP
|
||||
// when using another schema, it's size may less than listInColumns
|
||||
if (iInColIndex >= listColumsToTest.size()){
|
||||
break;
|
||||
}
|
||||
|
||||
Object pre_iPrecision = null;
|
||||
String sInColumnName = inColumn.getLabel(), sTestColName = null, sTestColType = null, sTestColPattern = null;
|
||||
boolean bNullable = true, bMaxLenLimited = true;
|
||||
/* use setting of tSchemaComplianceCheck schema (it is synchronize with inputting schema, but length value can be different) */
|
||||
Object pre_maxLength = listColumsToTest.get(iInColIndex).getLength();
|
||||
int maxLength = (pre_maxLength == null) ? 0 : Integer.parseInt(pre_maxLength.toString());
|
||||
IMetadataColumn schemaColumn = null;
|
||||
Object pre_iPrecision = null;
|
||||
String sInColumnName = inColumn.getLabel(), sTestColName = null, sTestColType = null, sTestColPattern = null;
|
||||
boolean bNullable = true, bMaxLenLimited = true;
|
||||
/* use setting of tSchemaComplianceCheck schema (it is synchronize with inputting schema, but length value can be different) */
|
||||
Object pre_maxLength = listColumsToTest.get(iInColIndex).getLength();
|
||||
int maxLength = (pre_maxLength == null) ? 0 : Integer.parseInt(pre_maxLength.toString());
|
||||
IMetadataColumn schemaColumn = null;
|
||||
|
||||
if (bNeedReferSchema) {
|
||||
Map<String, String> checkedColumn = listCheckedColumns.get(iInColIndex);
|
||||
sTestColName = checkedColumn.get("SCHEMA_COLUMN");
|
||||
sTestColType = checkedColumn.get("SELECTED_TYPE");
|
||||
sTestColPattern = checkedColumn.get("DATEPATTERN");
|
||||
bNullable = "true".equals(checkedColumn.get("NULLABLE"));
|
||||
bMaxLenLimited = "true".equals(checkedColumn.get("MAX_LENGTH"));
|
||||
} else{
|
||||
schemaColumn = listColumsToTest.get(iInColIndex);
|
||||
sTestColName = schemaColumn.getLabel();
|
||||
sTestColType = JavaTypesManager.getTypeToGenerate(schemaColumn.getTalendType(), true);
|
||||
sTestColPattern = schemaColumn.getPattern();
|
||||
bNullable = schemaColumn.isNullable();
|
||||
pre_iPrecision = schemaColumn.getPrecision();
|
||||
}
|
||||
if (bNeedReferSchema) {
|
||||
Map<String, String> checkedColumn = listCheckedColumns.get(iInColIndex);
|
||||
sTestColName = checkedColumn.get("SCHEMA_COLUMN");
|
||||
sTestColType = checkedColumn.get("SELECTED_TYPE");
|
||||
sTestColPattern = checkedColumn.get("DATEPATTERN");
|
||||
bNullable = "true".equals(checkedColumn.get("NULLABLE"));
|
||||
bMaxLenLimited = "true".equals(checkedColumn.get("MAX_LENGTH"));
|
||||
} else{
|
||||
schemaColumn = listColumsToTest.get(iInColIndex);
|
||||
sTestColName = schemaColumn.getLabel();
|
||||
sTestColType = JavaTypesManager.getTypeToGenerate(schemaColumn.getTalendType(), true);
|
||||
sTestColPattern = schemaColumn.getPattern();
|
||||
bNullable = schemaColumn.isNullable();
|
||||
pre_iPrecision = schemaColumn.getPrecision();
|
||||
}
|
||||
|
||||
// NULL checking
|
||||
if (!bNullable){
|
||||
checker.testNull(sInConnName, inColumn, cid);
|
||||
}
|
||||
// NULL checking
|
||||
if (!bNullable){
|
||||
checker.testNull(sInConnName, inColumn, cid);
|
||||
}
|
||||
|
||||
// type checking
|
||||
if (sTestColType != null){
|
||||
if (sTestColType.indexOf("Date") >= 0){
|
||||
checker.testDate(bNullable, sInConnName, inColumn, sTestColPattern, cid);
|
||||
} else{
|
||||
checker.testDataType(bNullable, sInConnName, inColumn, sTestColType, cid);
|
||||
}
|
||||
}
|
||||
// type checking
|
||||
if (sTestColType != null){
|
||||
if (sTestColType.indexOf("Date") >= 0){
|
||||
checker.testDate(bNullable, sInConnName, inColumn, sTestColPattern, cid);
|
||||
} else{
|
||||
checker.testDataType(bNullable, sInConnName, inColumn, sTestColType, cid);
|
||||
}
|
||||
}
|
||||
|
||||
// length checking
|
||||
if (bMaxLenLimited){
|
||||
checker.testDataLength(bNullable, sInConnName,inColumn, "true".equals(anotherChecked)?schemaColumn:inColumn, maxLength, cid);
|
||||
}
|
||||
// length checking
|
||||
if (bMaxLenLimited){
|
||||
checker.testDataLength(bNullable, sInConnName,inColumn, "true".equals(anotherChecked)?schemaColumn:inColumn, maxLength, cid);
|
||||
}
|
||||
|
||||
// precision checking
|
||||
if (pre_iPrecision != null){
|
||||
checker.testPrecision(maxLength, Integer.parseInt(pre_iPrecision.toString()), sInConnName, inColumn, sTestColType, cid);
|
||||
}
|
||||
// precision checking
|
||||
if (pre_iPrecision != null){
|
||||
checker.testPrecision(maxLength, Integer.parseInt(pre_iPrecision.toString()), sInConnName, inColumn, sTestColType, cid);
|
||||
}
|
||||
%>
|
||||
resultErrorCodeThrough = handleErrorCode(errorCodeThrough,resultErrorCodeThrough);
|
||||
errorCodeThrough = 0;
|
||||
resultErrorMessageThrough = handleErrorMessage(errorMessageThrough,resultErrorMessageThrough,"<%=inColumn.getLabel()%>:");
|
||||
errorMessageThrough = "";
|
||||
resultErrorCodeThrough = handleErrorCode(errorCodeThrough,resultErrorCodeThrough);
|
||||
errorCodeThrough = 0;
|
||||
resultErrorMessageThrough = handleErrorMessage(errorMessageThrough,resultErrorMessageThrough,"<%=inColumn.getLabel()%>:");
|
||||
errorMessageThrough = "";
|
||||
<%
|
||||
if((iInColIndex + 1) % 100 == 0){ //CONDITION_00171 START
|
||||
if((iInColIndex + 1) % 100 == 0){ //CONDITION_00171 START
|
||||
%>
|
||||
}
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00171 STOP
|
||||
} //LOOP_00100 STOP
|
||||
if(listInColumns.size() > 0 && listInColumns.size() % 100 > 0){ //CONDITION_00180 START
|
||||
} //CONDITION_00171 STOP
|
||||
} //LOOP_00100 STOP
|
||||
if(listInColumns.size() > 0 && listInColumns.size() % 100 > 0){ //CONDITION_00180 START
|
||||
%>
|
||||
}
|
||||
}
|
||||
<%
|
||||
} //CONDITION_00180 STOP
|
||||
} //CONDITION_00180 STOP
|
||||
%>
|
||||
}
|
||||
RowSetValueUtil_<%=cid %> rsvUtil_<%=cid %> = new RowSetValueUtil_<%=cid %>();
|
||||
}
|
||||
RowSetValueUtil_<%=cid %> rsvUtil_<%=cid %> = new RowSetValueUtil_<%=cid %>();
|
||||
|
||||
@@ -107,28 +107,31 @@
|
||||
</PARAMETER>
|
||||
|
||||
</PARAMETERS>
|
||||
<ADVANCED_PARAMETERS>
|
||||
<PARAMETER NAME="FAST_DATE_CHECK" FIELD="CHECK" NUM_ROW="1" REQUIRED="true">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="NOTE" FIELD="LABEL" NUM_ROW="1">
|
||||
<DEFAULT>(Not compatible with multi-threaded jobs)</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="IGNORE_TIMEZONE" FIELD="CHECK" NUM_ROW="3" REQUIRED="true" SHOW_IF="(CUSTOMER == 'true' OR CHECK_ANOTHER == 'true') AND (FAST_DATE_CHECK == 'false')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="EMPTY_IS_NULL" FIELD="CHECK" NUM_ROW="9" REQUIRED="true" SHOW="false">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="ALL_EMPTY_ARE_NULL" FIELD="CHECK" NUM_ROW="10" REQUIRED="true">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="EMPTY_NULL_TABLE" FIELD="TABLE" REQUIRED="true" NUM_ROW="11" NB_LINES="3" SHOW_IF="ALL_EMPTY_ARE_NULL == 'false'">
|
||||
<ITEMS BASED_ON_SCHEMA="true">
|
||||
<ITEM NAME="EMPTY_NULL" FIELD="CHECK" VALUE="false" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
<ADVANCED_PARAMETERS>
|
||||
<PARAMETER NAME="FAST_DATE_CHECK" FIELD="CHECK" NUM_ROW="1" REQUIRED="true" SHOW_IF="STRICT_DATE_CHECK == 'false'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="NOTE" FIELD="LABEL" NUM_ROW="1" SHOW_IF="STRICT_DATE_CHECK == 'false'">
|
||||
<DEFAULT>(Not compatible with multi-threaded jobs)</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="STRICT_DATE_CHECK" FIELD="CHECK" NUM_ROW="3" REQUIRED="true" SHOW_IF="FAST_DATE_CHECK == 'false'">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="IGNORE_TIMEZONE" FIELD="CHECK" NUM_ROW="5" REQUIRED="true" SHOW_IF="(CUSTOMER == 'true' OR CHECK_ANOTHER == 'true') AND (FAST_DATE_CHECK == 'false') AND (STRICT_DATE_CHECK == 'false')">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="EMPTY_IS_NULL" FIELD="CHECK" NUM_ROW="11" REQUIRED="true" SHOW="false">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="ALL_EMPTY_ARE_NULL" FIELD="CHECK" NUM_ROW="12" REQUIRED="true">
|
||||
<DEFAULT>true</DEFAULT>
|
||||
</PARAMETER>
|
||||
<PARAMETER NAME="EMPTY_NULL_TABLE" FIELD="TABLE" REQUIRED="true" NUM_ROW="13" NB_LINES="3" SHOW_IF="ALL_EMPTY_ARE_NULL == 'false'">
|
||||
<ITEMS BASED_ON_SCHEMA="true">
|
||||
<ITEM NAME="EMPTY_NULL" FIELD="CHECK" VALUE="false" />
|
||||
</ITEMS>
|
||||
</PARAMETER>
|
||||
</ADVANCED_PARAMETERS>
|
||||
|
||||
<CODEGENERATION>
|
||||
<IMPORTS>
|
||||
|
||||
@@ -58,6 +58,7 @@ DATE_FORMAT.ITEM.US=US format : 12/10 is Dec. 10
|
||||
DATE_FORMAT.ITEM.NON-US=Other format : 12/10 is Oct. 12
|
||||
#advance options
|
||||
FAST_DATE_CHECK.NAME=Use Fastest Date check
|
||||
STRICT_DATE_CHECK.NAME=Use Strict Date check
|
||||
ALL_EMPTY_ARE_NULL.NAME=Treat all empty string as NULL
|
||||
EMPTY_NULL_TABLE.NAME=Choose Column(s)
|
||||
EMPTY_NULL_TABLE.ITEM.COLUMN=Column
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
<%@ jet %>
|
||||
|
||||
java.text.DateFormat dateStrFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
|
||||
final String queryIdentifier = projectName + "_" + jobName + "_" + jobVersion.replace(".", "_") + "_<%=cid%>_" + dateStrFormat.format(new Date(startTime));
|
||||
java.text.DateFormat dateStrFormat_<%=cid %> = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
|
||||
final String queryIdentifier_<%=cid %> = projectName + "_" + jobName + "_" + jobVersion.replace(".", "_") + "_<%=cid%>_" + dateStrFormat_<%=cid %>.format(new Date(startTime));
|
||||
// For MapReduce Mode
|
||||
stmt_<%=cid %>.execute("set mapred.job.name=" + queryIdentifier);
|
||||
// For Tez Mode
|
||||
stmt_<%=cid %>.execute("set hive.query.name=" + queryIdentifier);
|
||||
stmt_<%=cid %>.execute("set mapred.job.name=" + queryIdentifier_<%=cid %>);
|
||||
<%
|
||||
if(hiveDistrib.doSupportTezForHive()) {
|
||||
%>
|
||||
// For Tez Mode
|
||||
stmt_<%=cid %>.execute("set hive.query.name=" + queryIdentifier_<%=cid %>);
|
||||
<%
|
||||
}
|
||||
%>
|
||||
@@ -1665,7 +1665,7 @@ public class Component extends AbstractBasicComponent {
|
||||
if (wizardService != null) {
|
||||
propertiesStr = wizardService.getConnectionProperties(connection);
|
||||
}
|
||||
ComponentProperties properties = ComponentsUtils.getComponentPropertiesFromSerialized(propertiesStr, connection, false);
|
||||
ComponentProperties properties = ComponentsUtils.getComponentPropertiesFromSerialized(propertiesStr, connection, true);
|
||||
if (properties != null) {
|
||||
ComponentWizardDefinition wizardDefinition = getWizardDefinition(properties);
|
||||
if (wizardDefinition != null) {
|
||||
|
||||
@@ -19,8 +19,13 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.components.api.component.ComponentDefinition;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.components.api.properties.ComponentReferenceProperties;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.runtime.services.IGenericService;
|
||||
import org.talend.daikon.properties.Properties;
|
||||
import org.talend.designer.core.generic.model.GenericElementParameter;
|
||||
import org.talend.designer.core.generic.utils.ComponentsUtils;
|
||||
|
||||
@@ -52,5 +57,56 @@ public class GenericService implements IGenericService {
|
||||
}
|
||||
return genericComponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetReferenceValue(INode curNode, String oldConnectionName, String newConnectionName) {
|
||||
ComponentReferenceProperties comPro = null;
|
||||
IElementParameter refPara = curNode.getElementParameterFromField(EParameterFieldType.COMPONENT_REFERENCE);
|
||||
if(refPara != null){
|
||||
comPro = ComponentsUtils.getReferencedComponent(refPara);
|
||||
}
|
||||
if(comPro != null){
|
||||
Object sValue = comPro.componentInstanceId.getStoredValue();
|
||||
if (oldConnectionName.equals(sValue)) {
|
||||
comPro.componentInstanceId.setValue(newConnectionName);
|
||||
return;
|
||||
}
|
||||
if (sValue != null && ((String)sValue).startsWith(oldConnectionName + "_")) { //$NON-NLS-1$
|
||||
comPro.componentInstanceId.setValue(((String)sValue).replaceFirst(oldConnectionName + "_", newConnectionName + "_")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
comPro = getComponentReferenceProperties(curNode);
|
||||
if(comPro == null){
|
||||
return;
|
||||
}
|
||||
Object sValue = comPro.componentInstanceId.getStoredValue();
|
||||
if (oldConnectionName.equals(sValue)) {
|
||||
comPro.componentInstanceId.setValue(newConnectionName);
|
||||
} else if (sValue != null && ((String)sValue).startsWith(oldConnectionName + "_")) { //$NON-NLS-1$
|
||||
comPro.componentInstanceId.setValue(((String)sValue).replaceFirst(oldConnectionName + "_", newConnectionName + "_")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private ComponentReferenceProperties getComponentReferenceProperties(INode curNode){
|
||||
ComponentProperties pros = curNode.getComponentProperties();
|
||||
if(pros == null){
|
||||
return null;
|
||||
}
|
||||
Properties ps = pros.getProperties("referencedComponent"); //$NON-NLS-1$
|
||||
if(ps == null){
|
||||
Properties conn = pros.getProperties("connection"); //$NON-NLS-1$
|
||||
if(conn != null){
|
||||
ps = conn.getProperties("referencedComponent"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if(ps == null){
|
||||
return null;
|
||||
}
|
||||
if(ps instanceof ComponentReferenceProperties){
|
||||
return (ComponentReferenceProperties)ps;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -837,6 +837,20 @@ public class ComponentsUtils {
|
||||
}
|
||||
return nals;
|
||||
}
|
||||
|
||||
public static ComponentReferenceProperties getReferencedComponent(IElementParameter refPara){
|
||||
if (!(refPara instanceof GenericElementParameter)) {
|
||||
return null;
|
||||
}
|
||||
Widget widget = ((GenericElementParameter) refPara).getWidget();
|
||||
NamedThing widgetProperty = widget.getContent();
|
||||
if (widgetProperty instanceof ComponentReferenceProperties
|
||||
&& Widget.COMPONENT_REFERENCE_WIDGET_TYPE.equals(widget.getWidgetType())) {
|
||||
ComponentReferenceProperties props = (ComponentReferenceProperties) widgetProperty;
|
||||
return props;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void initReferencedComponent(IElementParameter refPara, String newValue) {
|
||||
|
||||
|
||||
@@ -505,6 +505,7 @@ Node.canNotMultiKindTableOutput=This component can not use the "{0}" and "{1}" t
|
||||
Node.ELTDBMap.canNotHaveMultiStartNode=The Link type between "{0}" and "{1}" should be use "{2}".
|
||||
Node.checkHasMultiPrejobOrPostJobComponents="{0}" component found in this job,there must be only one totally,Please check it.
|
||||
Node.checkTRunjobwithMRProcess=The {1} job is only compatible with independant execution({0}).
|
||||
Node.checkDynamicJobUsageWarning=Usage of dynamic job is not discouraged in joblets, not compatible with continuous integration.
|
||||
Node.checkSparkMLComponentVersion14=This component requires Spark 1.4 or higher.
|
||||
Node.checkSparkMLComponentVersion15=This component requires Spark 1.5 or higher.
|
||||
Node.notSupportDepartition=this component not support departition row now.
|
||||
@@ -581,6 +582,7 @@ Process.componentsUnloaded=There are some components unloaded
|
||||
Process.errorLoadingConnectionMessage=Some errors appear after the migration in the following connections, please check them\:
|
||||
Process.errorLoadingConnectionTitle=Error when loading the job
|
||||
Process.metadataModificationDetected=Metadata Modification Detected
|
||||
Process.errorCircleConnectionDetected=Circle connection detected. The connection is <{0}>, source is <{1}> and target is <{2}>.
|
||||
ProcessUpdateManager.ReadOnlyProcessUpdateWarningMessages=This job requires update from repository, but can't be updated when the job is read only.
|
||||
ProcessUpdateManager.Question=Question
|
||||
ProcessUpdateManager.QuestionString=set the new column as Used in the jobs?
|
||||
|
||||
@@ -374,6 +374,8 @@ public enum EParameterName {
|
||||
|
||||
UNIFIED_COMPONENTS("Database"),
|
||||
|
||||
ACTIVE_DATABASE_DELIMITED_IDENTIFIERS("Active database delimited identifiers"), //$NON-NLS-1$
|
||||
|
||||
// for tDataprepRun
|
||||
PREPARATION_ID("PREPARATION_ID");
|
||||
|
||||
|
||||
@@ -800,7 +800,7 @@ public class ConnectionManager {
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
private static boolean checkCircle(INode source, INode newTarget) {
|
||||
public static boolean checkCircle(INode source, INode newTarget) {
|
||||
// get All the source nodes of the source
|
||||
List<INode> list = new ArrayList<INode>();
|
||||
getAllSourceNode(source, list);
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.designer.core.model.process;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -34,6 +35,7 @@ import org.talend.components.api.properties.ComponentReferenceProperties;
|
||||
import org.talend.components.api.properties.VirtualComponentProperties;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
@@ -64,6 +66,7 @@ import org.talend.core.model.process.IElement;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IExternalData;
|
||||
import org.talend.core.model.process.IExternalNode;
|
||||
import org.talend.core.model.process.IGenericElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.INodeConnector;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
@@ -87,6 +90,7 @@ import org.talend.core.ui.IJobletProviderService;
|
||||
import org.talend.core.ui.component.ComponentsFactoryProvider;
|
||||
import org.talend.daikon.properties.Properties;
|
||||
import org.talend.daikon.properties.PropertiesVisitor;
|
||||
import org.talend.daikon.properties.property.PropertyValueEvaluator;
|
||||
import org.talend.designer.core.i18n.Messages;
|
||||
import org.talend.designer.core.model.components.AbstractBasicComponent;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
@@ -171,7 +175,7 @@ public class DataProcess implements IGeneratingProcess {
|
||||
shortUniqueNameList = new ArrayList<String>();
|
||||
}
|
||||
|
||||
private void copyElementParametersValue(IElement sourceElement, IElement targetElement) {
|
||||
protected void copyElementParametersValue(IElement sourceElement, IElement targetElement) {
|
||||
if (IAdditionalInfo.class.isInstance(sourceElement) && IAdditionalInfo.class.isInstance(targetElement)) {
|
||||
IAdditionalInfo.class.cast(sourceElement).cloneAddionalInfoTo((IAdditionalInfo) targetElement);
|
||||
}
|
||||
@@ -187,6 +191,20 @@ public class DataProcess implements IGeneratingProcess {
|
||||
|
||||
targetParam.setContextMode(sourceParam.isContextMode());
|
||||
targetParam.setValue(sourceParam.getValue());
|
||||
if (sourceElement instanceof INode && sourceParam instanceof IGenericElementParameter) {
|
||||
IComponent component = ((INode) sourceElement).getComponent();
|
||||
if (component instanceof AbstractBasicComponent
|
||||
&& EComponentType.GENERIC.equals(component.getComponentType())) {
|
||||
org.talend.daikon.properties.property.Property property = ((IGenericElementParameter) sourceParam)
|
||||
.getProperty();
|
||||
if (sourceParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST) && property != null) {
|
||||
PropertyValueEvaluator evaluator = property.getValueEvaluator();
|
||||
if (evaluator != null) {
|
||||
targetParam.setValue(evaluator.evaluate(property, sourceParam.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sourceParam.getValue() instanceof List) {
|
||||
List sourceList = (List) sourceParam.getValue();
|
||||
List targetList = new ArrayList();
|
||||
@@ -277,8 +295,207 @@ public class DataProcess implements IGeneratingProcess {
|
||||
return buildCheckMap.get(graphicalNode);
|
||||
}
|
||||
|
||||
AbstractNode dataNode;
|
||||
AbstractNode dataNode = createDataNode(graphicalNode, prefix);
|
||||
|
||||
INode addedNode = addDataNode(dataNode);
|
||||
buildCheckMap.put(graphicalNode, addedNode);
|
||||
|
||||
List<IConnection> outgoingConnections = new ArrayList<IConnection>();
|
||||
List<IConnection> incomingConnections = new ArrayList<IConnection>();
|
||||
dataNode.setIncomingConnections(incomingConnections);
|
||||
dataNode.setOutgoingConnections(outgoingConnections);
|
||||
|
||||
// if the component is a hash, and that there is a lookup connection just after, don't generate the node.
|
||||
// if (graphicalNode.getComponent().isHashComponent()) {
|
||||
// if (graphicalNode.getOutgoingConnections(EConnectionType.FLOW_REF).size() != 0) {
|
||||
// dataNode.setSubProcessStart(false);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (IConnection connection : graphicalNode.getOutgoingConnections()) {
|
||||
if (!connection.isActivate()) {
|
||||
continue;
|
||||
}
|
||||
IElementParameter monitorParam = connection.getElementParameter(EParameterName.MONITOR_CONNECTION.getName());
|
||||
if (monitorParam != null && (!connection.getLineStyle().equals(EConnectionType.FLOW_REF))
|
||||
&& ((Boolean) monitorParam.getValue())) {
|
||||
addvFlowMeterBetween(dataNode, buildDataNodeFromNode(connection.getTarget(), prefix), connection,
|
||||
graphicalNode.getProcess(), connection.getElementParameters());
|
||||
} else {
|
||||
INode target = buildDataNodeFromNode(connection.getTarget(), prefix);
|
||||
createDataConnection(dataNode, (AbstractNode) target, connection, prefix);
|
||||
}
|
||||
}
|
||||
|
||||
dataNode.setRealGraphicalNode(graphicalNode);
|
||||
|
||||
return dataNode;
|
||||
}
|
||||
|
||||
private DataConnection createDataConnection(AbstractNode sourceDataNode, AbstractNode targetDataNode, IConnection connection,
|
||||
String prefix) {
|
||||
DataConnection dataConnec = new DataConnection();
|
||||
dataConnec.setActivate(connection.isActivate());
|
||||
dataConnec.setLineStyle(connection.getLineStyle());
|
||||
dataConnec.setTraceConnection(connection.isTraceConnection());
|
||||
dataConnec.setTracesCondition(connection.getTracesCondition());
|
||||
dataConnec.setMonitorConnection(connection.isMonitorConnection());
|
||||
dataConnec.setEnabledTraceColumns(connection.getEnabledTraceColumns());
|
||||
if ((connection.getLineStyle().hasConnectionCategory(IConnectionCategory.EXECUTION_ORDER))
|
||||
&& (connection.getTarget().getMetadataList().size() > 0)) {
|
||||
dataConnec.setMetadataTable(connection.getTarget().getMetadataList().get(0));
|
||||
} else {
|
||||
dataConnec.setMetadataTable(connection.getMetadataTable());
|
||||
}
|
||||
String name = connection.getName();
|
||||
if (prefix != null) {
|
||||
name = prefix + name;
|
||||
}
|
||||
dataConnec.setName(name);
|
||||
String uniqueName2 = connection.getUniqueName();
|
||||
if (prefix != null) {
|
||||
uniqueName2 = prefix + uniqueName2;
|
||||
}
|
||||
dataConnec.setUniqueName(uniqueName2);
|
||||
dataConnec.setSource(sourceDataNode);
|
||||
dataConnec.setCondition(connection.getCondition());
|
||||
dataConnec.setRouteConnectionType(connection.getRouteConnectionType());
|
||||
dataConnec.setEndChoice(connection.getEndChoice());// TESB-8043
|
||||
dataConnec.setExceptionList(connection.getExceptionList());
|
||||
dataConnec.setConnectorName(connection.getConnectorName());
|
||||
dataConnec.setInputId(connection.getInputId());
|
||||
dataConnec.setOutputId(connection.getOutputId());
|
||||
if (connection.getLineStyle().equals(EConnectionType.ITERATE)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.BASIC);
|
||||
param.setValue(Boolean.FALSE);
|
||||
param.setName("ENABLE_PARALLEL"); //$NON-NLS-1$
|
||||
param.setDisplayName(Messages.getString("DataProcess.enableParallel")); //$NON-NLS-1$
|
||||
param.setShow(true);
|
||||
param.setNumRow(1);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
|
||||
param = new ElementParameter(dataConnec);
|
||||
param.setFieldType(EParameterFieldType.TEXT);
|
||||
param.setCategory(EComponentCategory.BASIC);
|
||||
// param.setListItemsDisplayName(new String[] { "2", "3", "4" });
|
||||
// param.setListItemsDisplayCodeName(new String[] { "2", "3", "4" });
|
||||
// param.setListItemsValue(new String[] { "2", "3", "4" });
|
||||
param.setValue("2"); //$NON-NLS-1$
|
||||
param.setName("NUMBER_PARALLEL"); //$NON-NLS-1$
|
||||
param.setDisplayName(Messages.getString("DataProcess.numberParallel")); //$NON-NLS-1$
|
||||
param.setShow(true);
|
||||
param.setShowIf("ENABLE_PARALLEL == 'true'"); //$NON-NLS-1$
|
||||
param.setNumRow(1);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
}
|
||||
if (dataConnec.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setName(EParameterName.TRACES_CONNECTION_ENABLE.getName());
|
||||
param.setDisplayName(EParameterName.TRACES_CONNECTION_ENABLE.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setValue(Boolean.FALSE);
|
||||
param.setCategory(EComponentCategory.ADVANCED);
|
||||
param.setShow(false);
|
||||
param.setNumRow(1);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
}
|
||||
if (PluginChecker.isTeamEdition()) {
|
||||
|
||||
if ((connection.getLineStyle() == EConnectionType.ON_SUBJOB_OK
|
||||
|| connection.getLineStyle() == EConnectionType.ON_SUBJOB_ERROR
|
||||
|| connection.getLineStyle() == EConnectionType.RUN_IF
|
||||
|| connection.getLineStyle() == EConnectionType.ROUTE_WHEN
|
||||
|| connection.getLineStyle() == EConnectionType.ROUTE_CATCH
|
||||
|| connection.getLineStyle() == EConnectionType.ON_COMPONENT_OK
|
||||
|| connection.getLineStyle() == EConnectionType.ON_COMPONENT_ERROR)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setName(EParameterName.RESUMING_CHECKPOINT.getName());
|
||||
param.setValue(Boolean.FALSE);
|
||||
param.setDisplayName(EParameterName.RESUMING_CHECKPOINT.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.RESUMING);
|
||||
param.setNumRow(2);
|
||||
param.setShow(true);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param); // breakpoint
|
||||
}
|
||||
|
||||
if (dataConnec.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setName(EParameterName.ACTIVEBREAKPOINT.getName());
|
||||
param.setDisplayName(EParameterName.ACTIVEBREAKPOINT.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.BREAKPOINT);
|
||||
param.setNumRow(13);
|
||||
param.setValue(false);
|
||||
param.setContextMode(false);
|
||||
param.setShow(true);
|
||||
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
IComponent component = ComponentsFactoryProvider.getInstance().get("tFilterRow",
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
DataNode tmpNode = new DataNode(component, "breakpointNode");
|
||||
IElementParameter tmpParam = tmpNode.getElementParameter("LOGICAL_OP");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(14);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
tmpParam = tmpNode.getElementParameter("CONDITIONS");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(15);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
|
||||
tmpParam = tmpNode.getElementParameter("USE_ADVANCED");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(16);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
tmpParam = tmpNode.getElementParameter("ADVANCED_COND");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(17);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
copyElementParametersValue(connection, dataConnec);
|
||||
|
||||
dataConnec.setTarget(targetDataNode);
|
||||
List<IConnection> incomingConnections = (List<IConnection>) targetDataNode.getIncomingConnections();
|
||||
if (incomingConnections == null) {
|
||||
incomingConnections = new ArrayList<IConnection>();
|
||||
targetDataNode.setIncomingConnections(incomingConnections);
|
||||
}
|
||||
List<IConnection> outgoingConnections = (List<IConnection>) sourceDataNode.getOutgoingConnections();
|
||||
if (outgoingConnections == null) {
|
||||
outgoingConnections = new ArrayList<IConnection>();
|
||||
sourceDataNode.setOutgoingConnections(outgoingConnections);
|
||||
}
|
||||
|
||||
outgoingConnections.add(dataConnec);
|
||||
incomingConnections.add(dataConnec);
|
||||
|
||||
if (!connection.getName().equals(name)) {
|
||||
if (targetDataNode instanceof AbstractExternalNode) {
|
||||
// System.out.println("dataProcess: rename input:" + connection.getName() + " to " + name);
|
||||
((AbstractExternalNode) targetDataNode).renameInputConnection(connection.getName(), name);
|
||||
}
|
||||
if (sourceDataNode instanceof AbstractExternalNode) {
|
||||
// System.out.println("dataProcess: rename output:" + connection.getName() + " to " + name);
|
||||
((AbstractExternalNode) sourceDataNode).renameOutputConnection(connection.getName(), name);
|
||||
}
|
||||
}
|
||||
|
||||
return dataConnec;
|
||||
}
|
||||
|
||||
private AbstractNode createDataNode(final INode graphicalNode, String prefix) {
|
||||
AbstractNode dataNode;
|
||||
if (graphicalNode.getExternalNode() == null) {
|
||||
dataNode = new DataNode();
|
||||
} else {
|
||||
@@ -353,184 +570,6 @@ public class DataProcess implements IGeneratingProcess {
|
||||
}
|
||||
}
|
||||
dataNode.setDesignSubjobStartNode(graphicalNode.getDesignSubjobStartNode());
|
||||
|
||||
INode addedNode = addDataNode(dataNode);
|
||||
buildCheckMap.put(graphicalNode, addedNode);
|
||||
|
||||
List<IConnection> outgoingConnections = new ArrayList<IConnection>();
|
||||
List<IConnection> incomingConnections = new ArrayList<IConnection>();
|
||||
dataNode.setIncomingConnections(incomingConnections);
|
||||
dataNode.setOutgoingConnections(outgoingConnections);
|
||||
|
||||
// if the component is a hash, and that there is a lookup connection just after, don't generate the node.
|
||||
// if (graphicalNode.getComponent().isHashComponent()) {
|
||||
// if (graphicalNode.getOutgoingConnections(EConnectionType.FLOW_REF).size() != 0) {
|
||||
// dataNode.setSubProcessStart(false);
|
||||
// }
|
||||
// }
|
||||
|
||||
DataConnection dataConnec;
|
||||
for (IConnection connection : graphicalNode.getOutgoingConnections()) {
|
||||
if (!connection.isActivate()) {
|
||||
continue;
|
||||
}
|
||||
IElementParameter monitorParam = connection.getElementParameter(EParameterName.MONITOR_CONNECTION.getName());
|
||||
if (monitorParam != null && (!connection.getLineStyle().equals(EConnectionType.FLOW_REF))
|
||||
&& ((Boolean) monitorParam.getValue())) {
|
||||
addvFlowMeterBetween(dataNode, buildDataNodeFromNode(connection.getTarget(), prefix), connection,
|
||||
graphicalNode.getProcess(), connection.getElementParameters());
|
||||
} else {
|
||||
dataConnec = new DataConnection();
|
||||
dataConnec.setActivate(connection.isActivate());
|
||||
dataConnec.setLineStyle(connection.getLineStyle());
|
||||
dataConnec.setTraceConnection(connection.isTraceConnection());
|
||||
dataConnec.setTracesCondition(connection.getTracesCondition());
|
||||
dataConnec.setMonitorConnection(connection.isMonitorConnection());
|
||||
dataConnec.setEnabledTraceColumns(connection.getEnabledTraceColumns());
|
||||
if ((connection.getLineStyle().hasConnectionCategory(IConnectionCategory.EXECUTION_ORDER))
|
||||
&& (connection.getTarget().getMetadataList().size() > 0)) {
|
||||
dataConnec.setMetadataTable(connection.getTarget().getMetadataList().get(0));
|
||||
} else {
|
||||
dataConnec.setMetadataTable(connection.getMetadataTable());
|
||||
}
|
||||
String name = connection.getName();
|
||||
if (prefix != null) {
|
||||
name = prefix + name;
|
||||
}
|
||||
dataConnec.setName(name);
|
||||
String uniqueName2 = connection.getUniqueName();
|
||||
if (prefix != null) {
|
||||
uniqueName2 = prefix + uniqueName2;
|
||||
}
|
||||
dataConnec.setUniqueName(uniqueName2);
|
||||
dataConnec.setSource(dataNode);
|
||||
dataConnec.setCondition(connection.getCondition());
|
||||
dataConnec.setRouteConnectionType(connection.getRouteConnectionType());
|
||||
dataConnec.setEndChoice(connection.getEndChoice());// TESB-8043
|
||||
dataConnec.setExceptionList(connection.getExceptionList());
|
||||
dataConnec.setConnectorName(connection.getConnectorName());
|
||||
dataConnec.setInputId(connection.getInputId());
|
||||
dataConnec.setOutputId(connection.getOutputId());
|
||||
if (connection.getLineStyle().equals(EConnectionType.ITERATE)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.BASIC);
|
||||
param.setValue(Boolean.FALSE);
|
||||
param.setName("ENABLE_PARALLEL"); //$NON-NLS-1$
|
||||
param.setDisplayName(Messages.getString("DataProcess.enableParallel")); //$NON-NLS-1$
|
||||
param.setShow(true);
|
||||
param.setNumRow(1);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
|
||||
param = new ElementParameter(dataConnec);
|
||||
param.setFieldType(EParameterFieldType.TEXT);
|
||||
param.setCategory(EComponentCategory.BASIC);
|
||||
// param.setListItemsDisplayName(new String[] { "2", "3", "4" });
|
||||
// param.setListItemsDisplayCodeName(new String[] { "2", "3", "4" });
|
||||
// param.setListItemsValue(new String[] { "2", "3", "4" });
|
||||
param.setValue("2"); //$NON-NLS-1$
|
||||
param.setName("NUMBER_PARALLEL"); //$NON-NLS-1$
|
||||
param.setDisplayName(Messages.getString("DataProcess.numberParallel")); //$NON-NLS-1$
|
||||
param.setShow(true);
|
||||
param.setShowIf("ENABLE_PARALLEL == 'true'"); //$NON-NLS-1$
|
||||
param.setNumRow(1);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
}
|
||||
if (dataConnec.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setName(EParameterName.TRACES_CONNECTION_ENABLE.getName());
|
||||
param.setDisplayName(EParameterName.TRACES_CONNECTION_ENABLE.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setValue(Boolean.FALSE);
|
||||
param.setCategory(EComponentCategory.ADVANCED);
|
||||
param.setShow(false);
|
||||
param.setNumRow(1);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
}
|
||||
if (PluginChecker.isTeamEdition()) {
|
||||
|
||||
if ((connection.getLineStyle() == EConnectionType.ON_SUBJOB_OK
|
||||
|| connection.getLineStyle() == EConnectionType.ON_SUBJOB_ERROR
|
||||
|| connection.getLineStyle() == EConnectionType.RUN_IF
|
||||
|| connection.getLineStyle() == EConnectionType.ROUTE_WHEN
|
||||
|| connection.getLineStyle() == EConnectionType.ROUTE_CATCH
|
||||
|| connection.getLineStyle() == EConnectionType.ON_COMPONENT_OK || connection.getLineStyle() == EConnectionType.ON_COMPONENT_ERROR)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setName(EParameterName.RESUMING_CHECKPOINT.getName());
|
||||
param.setValue(Boolean.FALSE);
|
||||
param.setDisplayName(EParameterName.RESUMING_CHECKPOINT.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.RESUMING);
|
||||
param.setNumRow(2);
|
||||
param.setShow(true);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param); // breakpoint
|
||||
}
|
||||
|
||||
if (dataConnec.getLineStyle().hasConnectionCategory(IConnectionCategory.FLOW)) {
|
||||
IElementParameter param = new ElementParameter(dataConnec);
|
||||
param.setName(EParameterName.ACTIVEBREAKPOINT.getName());
|
||||
param.setDisplayName(EParameterName.ACTIVEBREAKPOINT.getDisplayName());
|
||||
param.setFieldType(EParameterFieldType.CHECK);
|
||||
param.setCategory(EComponentCategory.BREAKPOINT);
|
||||
param.setNumRow(13);
|
||||
param.setValue(false);
|
||||
param.setContextMode(false);
|
||||
param.setShow(true);
|
||||
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(param);
|
||||
IComponent component = ComponentsFactoryProvider.getInstance().get("tFilterRow",
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
DataNode tmpNode = new DataNode(component, "breakpointNode");
|
||||
IElementParameter tmpParam = tmpNode.getElementParameter("LOGICAL_OP");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(14);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
tmpParam = tmpNode.getElementParameter("CONDITIONS");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(15);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
|
||||
tmpParam = tmpNode.getElementParameter("USE_ADVANCED");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(16);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
tmpParam = tmpNode.getElementParameter("ADVANCED_COND");
|
||||
if (tmpParam != null) {
|
||||
tmpParam.setCategory(EComponentCategory.BREAKPOINT);
|
||||
tmpParam.setNumRow(17);
|
||||
((List<IElementParameter>) dataConnec.getElementParameters()).add(tmpParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
copyElementParametersValue(connection, dataConnec);
|
||||
INode target = buildDataNodeFromNode(connection.getTarget(), prefix);
|
||||
dataConnec.setTarget(target);
|
||||
incomingConnections = (List<IConnection>) target.getIncomingConnections();
|
||||
if (incomingConnections == null) {
|
||||
incomingConnections = new ArrayList<IConnection>();
|
||||
}
|
||||
outgoingConnections.add(dataConnec);
|
||||
incomingConnections.add(dataConnec);
|
||||
|
||||
if (!connection.getName().equals(name)) {
|
||||
if (target instanceof AbstractExternalNode) {
|
||||
// System.out.println("dataProcess: rename input:" + connection.getName() + " to " + name);
|
||||
((AbstractExternalNode) target).renameInputConnection(connection.getName(), name);
|
||||
}
|
||||
if (dataNode instanceof AbstractExternalNode) {
|
||||
// System.out.println("dataProcess: rename output:" + connection.getName() + " to " + name);
|
||||
((AbstractExternalNode) dataNode).renameOutputConnection(connection.getName(), name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dataNode;
|
||||
}
|
||||
|
||||
@@ -2255,15 +2294,8 @@ public class DataProcess implements IGeneratingProcess {
|
||||
inputNode.setProcess(node.getProcess());
|
||||
inputNode.setElementParameters(inputComponent.createElementParameters(inputNode));
|
||||
|
||||
// temporary :
|
||||
String query = TalendTextUtils.addQuotes("select * from " + tabName + ";"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
// to change to:
|
||||
// String query = TextUtil.addSqlQuots(DBTYPE, QUERY_WITH_ALL_COLUMNS!, refSchema);
|
||||
|
||||
inputNode.getElementParameter("QUERY").setValue(query); //$NON-NLS-1$
|
||||
|
||||
updateInputParametersWithDBConnection(inputNode, dbConnection);
|
||||
updateInputParametersWithDBConnection(inputNode, dbConnection, tabName);
|
||||
addDataNode(inputNode);
|
||||
List<IConnection> inputNode_outgoingConnections = new ArrayList<IConnection>();
|
||||
inputNode.setOutgoingConnections(inputNode_outgoingConnections);
|
||||
@@ -2706,7 +2738,10 @@ public class DataProcess implements IGeneratingProcess {
|
||||
node.getElementParameter("JOIN_KEY").setValue(list);//$NON-NLS-1$
|
||||
}
|
||||
|
||||
private void updateInputParametersWithDBConnection(INode node, DatabaseConnection dbConnection) {
|
||||
private void updateInputParametersWithDBConnection(INode node, DatabaseConnection dbConnection, String tabName) {
|
||||
EDatabaseTypeName typeFromDbType = EDatabaseTypeName.getTypeFromDbType(dbConnection.getDatabaseType());
|
||||
String query = TalendTextUtils.addQuotes("select * from " + tabName + ";"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
node.getElementParameter("QUERY").setValue(query); //$NON-NLS-1$
|
||||
if (dbConnection.isContextMode()) {
|
||||
node.getElementParameter("HOST").setValue(dbConnection.getServerName());//$NON-NLS-1$
|
||||
node.getElementParameter("PORT").setValue(dbConnection.getPort());//$NON-NLS-1$
|
||||
@@ -2714,6 +2749,13 @@ public class DataProcess implements IGeneratingProcess {
|
||||
node.getElementParameter("TYPE").setValue(dbConnection.getDatabaseType());//$NON-NLS-1$
|
||||
node.getElementParameter("USER").setValue(dbConnection.getUsername());//$NON-NLS-1$
|
||||
node.getElementParameter("PASS").setValue(dbConnection.getPassword());//$NON-NLS-1$
|
||||
if (typeFromDbType != null && EDatabaseTypeName.ORACLESN.getProduct().equals(typeFromDbType.getProduct())) {
|
||||
if (EDatabaseTypeName.ORACLE_OCI == typeFromDbType) {
|
||||
node.getElementParameter("LOCAL_SERVICE_NAME").setValue(dbConnection.getSID());//$NON-NLS-1$
|
||||
} else if (EDatabaseTypeName.ORACLE_CUSTOM == typeFromDbType) {
|
||||
node.getElementParameter("RAC_URL").setValue(dbConnection.getURL());//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
} else {
|
||||
node.getElementParameter("HOST").setValue(TalendTextUtils.addQuotes(dbConnection.getServerName()));//$NON-NLS-1$
|
||||
node.getElementParameter("PORT").setValue(TalendTextUtils.addQuotes(dbConnection.getPort()));//$NON-NLS-1$
|
||||
@@ -2721,6 +2763,24 @@ public class DataProcess implements IGeneratingProcess {
|
||||
node.getElementParameter("TYPE").setValue(TalendTextUtils.addQuotes(dbConnection.getDatabaseType()));//$NON-NLS-1$
|
||||
node.getElementParameter("USER").setValue(TalendTextUtils.addQuotes(dbConnection.getUsername()));//$NON-NLS-1$
|
||||
node.getElementParameter("PASS").setValue(TalendTextUtils.addQuotes(dbConnection.getRawPassword()));//$NON-NLS-1$
|
||||
if (typeFromDbType != null && EDatabaseTypeName.ORACLESN.getProduct().equals(typeFromDbType.getProduct())) {
|
||||
if (EDatabaseTypeName.ORACLE_OCI == typeFromDbType) {
|
||||
node.getElementParameter("LOCAL_SERVICE_NAME").setValue(TalendTextUtils.addQuotes(dbConnection.getSID()));//$NON-NLS-1$
|
||||
} else if (EDatabaseTypeName.ORACLE_CUSTOM == typeFromDbType) {
|
||||
node.getElementParameter("RAC_URL").setValue(TalendTextUtils.addQuotes(dbConnection.getURL()));//$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeFromDbType != null) {
|
||||
if (EDatabaseTypeName.MSSQL.getProduct().equals(typeFromDbType.getProduct())) {
|
||||
node.getElementParameter("DRIVER").setValue(dbConnection.getDbVersionString());//$NON-NLS-1$
|
||||
} else if (EDatabaseTypeName.ORACLESN.getProduct().equals(typeFromDbType.getProduct())) {
|
||||
node.getElementParameter("CONNECTION_TYPE") //$NON-NLS-1$
|
||||
.setValue(typeFromDbType.getXmlName());
|
||||
node.getElementParameter("DB_VERSION").setValue(dbConnection.getDbVersionString());//$NON-NLS-1$
|
||||
// fix for java.sql.SQLSyntaxErrorException: ORA-00911: invalid character
|
||||
node.getElementParameter("QUERY").setValue(TalendTextUtils.addQuotes("select * from " + tabName)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3163,6 +3223,40 @@ public class DataProcess implements IGeneratingProcess {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Node cloneGraphicalNode(IProcess process, INode node) {
|
||||
IComponent component = node.getComponent();
|
||||
Node newGraphicalNode = null;
|
||||
if (EComponentType.GENERIC.equals(component.getComponentType())) {
|
||||
newGraphicalNode = new Node(node, (IProcess2) process);
|
||||
} else {
|
||||
newGraphicalNode = new Node(node.getComponent(), (IProcess2) process);
|
||||
}
|
||||
newGraphicalNode.setMetadataList(node.getMetadataList());
|
||||
|
||||
IExternalNode externalNode = node.getExternalNode();
|
||||
if (externalNode != null) {
|
||||
AbstractExternalData externalEmfData = externalNode.getExternalEmfData();
|
||||
newGraphicalNode.getExternalNode().setExternalEmfData(externalEmfData);
|
||||
newGraphicalNode.getExternalNode().setInternalMapperModel(externalNode.getInternalMapperModel());
|
||||
}
|
||||
// fwang fixed bug TDI-8027
|
||||
IExternalData externalData = node.getExternalData();
|
||||
if (externalData != null) {
|
||||
try {
|
||||
newGraphicalNode.setExternalData(externalData.clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
newGraphicalNode.setExternalData(externalData);
|
||||
}
|
||||
}
|
||||
|
||||
copyElementParametersValue(node, newGraphicalNode);
|
||||
newGraphicalNode.setDummy(node.isDummy());
|
||||
|
||||
ValidationRulesUtil.createRejectConnector(newGraphicalNode);
|
||||
ValidationRulesUtil.updateRejectMetatable(newGraphicalNode, node);
|
||||
return newGraphicalNode;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public INode buildNodeFromNode(final INode graphicalNode, final IProcess process) {
|
||||
if (buildCheckMap == null) {
|
||||
@@ -3172,54 +3266,15 @@ public class DataProcess implements IGeneratingProcess {
|
||||
return (INode) buildGraphicalMap.get(graphicalNode);
|
||||
}
|
||||
|
||||
IComponent component = graphicalNode.getComponent();
|
||||
Node newGraphicalNode = null;
|
||||
if (EComponentType.GENERIC.equals(component.getComponentType())) {
|
||||
newGraphicalNode = new Node(graphicalNode, (IProcess2) process);
|
||||
} else {
|
||||
newGraphicalNode = new Node(graphicalNode.getComponent(), (IProcess2) process);
|
||||
}
|
||||
newGraphicalNode.setMetadataList(graphicalNode.getMetadataList());
|
||||
|
||||
// // for bug 11771
|
||||
// IExternalData externalData = graphicalNode.getExternalData();
|
||||
// if (externalData != null) {
|
||||
// newGraphicalNode.setExternalData(externalData);
|
||||
// }
|
||||
|
||||
// IExternalData externalData = graphicalNode.getExternalData();
|
||||
|
||||
IExternalNode externalNode = graphicalNode.getExternalNode();
|
||||
if (externalNode != null) {
|
||||
AbstractExternalData externalEmfData = externalNode.getExternalEmfData();
|
||||
newGraphicalNode.getExternalNode().setExternalEmfData(externalEmfData);
|
||||
newGraphicalNode.getExternalNode().setInternalMapperModel(externalNode.getInternalMapperModel());
|
||||
}
|
||||
// fwang fixed bug TDI-8027
|
||||
IExternalData externalData = graphicalNode.getExternalData();
|
||||
if (externalData != null) {
|
||||
try {
|
||||
newGraphicalNode.setExternalData(externalData.clone());
|
||||
} catch (CloneNotSupportedException e) {
|
||||
newGraphicalNode.setExternalData(externalData);
|
||||
}
|
||||
}
|
||||
|
||||
copyElementParametersValue(graphicalNode, newGraphicalNode);
|
||||
newGraphicalNode.setDummy(graphicalNode.isDummy());
|
||||
|
||||
ValidationRulesUtil.createRejectConnector(newGraphicalNode);
|
||||
ValidationRulesUtil.updateRejectMetatable(newGraphicalNode, graphicalNode);
|
||||
|
||||
Node newGraphicalNode = cloneGraphicalNode(process, graphicalNode);
|
||||
NodeContainer nc = ((Process) process).loadNodeContainer(newGraphicalNode, false);
|
||||
|
||||
((Process) process).addNodeContainer(nc);
|
||||
|
||||
if(buildGraphicalMap == null){
|
||||
initialize();
|
||||
}
|
||||
buildGraphicalMap.put(graphicalNode, newGraphicalNode);
|
||||
|
||||
IConnection dataConnec;
|
||||
for (IConnection connection : (List<IConnection>) graphicalNode.getOutgoingConnections()) {
|
||||
if (!connection.isActivate()) {
|
||||
continue;
|
||||
@@ -3230,8 +3285,9 @@ public class DataProcess implements IGeneratingProcess {
|
||||
}
|
||||
INode target = buildNodeFromNode(connTarget, process);
|
||||
|
||||
dataConnec = new Connection(newGraphicalNode, target, connection.getLineStyle(), connection.getConnectorName(),
|
||||
connection.getMetaName(), connection.getName(), connection.getUniqueName(), connection.isMonitorConnection());
|
||||
IConnection dataConnec = new Connection(newGraphicalNode, target, connection.getLineStyle(),
|
||||
connection.getConnectorName(), connection.getMetaName(), connection.getName(), connection.getUniqueName(),
|
||||
connection.isMonitorConnection());
|
||||
if (IAdditionalInfo.class.isInstance(connection) && IAdditionalInfo.class.isInstance(dataConnec)) {
|
||||
IAdditionalInfo.class.cast(connection).cloneAddionalInfoTo((IAdditionalInfo) dataConnec);
|
||||
}
|
||||
@@ -3244,12 +3300,50 @@ public class DataProcess implements IGeneratingProcess {
|
||||
copyElementParametersValue(connection, dataConnec);
|
||||
dataConnec.setTraceConnection(connection.isTraceConnection());
|
||||
}
|
||||
|
||||
newGraphicalNode.setActivate(graphicalNode.isActivate());
|
||||
newGraphicalNode.setStart(graphicalNode.isStart());
|
||||
|
||||
return newGraphicalNode;
|
||||
}
|
||||
|
||||
private void buildGraphicalNodeForInputConnections(IProcess process, INode graphicalNode, INode newGraphicalNode,
|
||||
Set<INode> visitedNodes) {
|
||||
if (visitedNodes.contains(graphicalNode)) {
|
||||
return;
|
||||
} else {
|
||||
visitedNodes.add(graphicalNode);
|
||||
}
|
||||
List<IConnection> connections = (List<IConnection>) graphicalNode.getIncomingConnections();
|
||||
if (connections == null || connections.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (IConnection connection : connections) {
|
||||
if (!connection.isActivate()) {
|
||||
continue;
|
||||
}
|
||||
INode sourceNode = connection.getSource();
|
||||
// if it exists in the essential nodes, means the input and output are already both created, then no need to
|
||||
// create it again
|
||||
INode newSourceNode = (INode) buildGraphicalMap.get(sourceNode);
|
||||
if (newSourceNode == null) {
|
||||
// if it not exists in the essential nodes, create a new one, and don't put it into the Map!
|
||||
newSourceNode = cloneGraphicalNode(process, sourceNode);
|
||||
NodeContainer nc = ((Process) process).loadNodeContainer((Node) newSourceNode, false);
|
||||
((Process) process).addNodeContainer(nc);
|
||||
IConnection dataConnec = new Connection(newSourceNode, newGraphicalNode, connection.getLineStyle(),
|
||||
connection.getConnectorName(), connection.getMetaName(), connection.getName(), connection.getUniqueName(),
|
||||
connection.isMonitorConnection());
|
||||
if (IAdditionalInfo.class.isInstance(connection) && IAdditionalInfo.class.isInstance(dataConnec)) {
|
||||
IAdditionalInfo.class.cast(connection).cloneAddionalInfoTo((IAdditionalInfo) dataConnec);
|
||||
}
|
||||
copyElementParametersValue(connection, dataConnec);
|
||||
dataConnec.setTraceConnection(connection.isTraceConnection());
|
||||
buildGraphicalNodeForInputConnections(process, sourceNode, newSourceNode, visitedNodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nrousseau Comment method "buildCopyOfGraphicalNodeList".
|
||||
*
|
||||
@@ -3298,6 +3392,13 @@ public class DataProcess implements IGeneratingProcess {
|
||||
buildNodeFromNode(node, duplicatedProcess);
|
||||
}
|
||||
}
|
||||
Set<INode> visitedNodes = new HashSet<INode>();
|
||||
Set<Map.Entry> entrySet = buildGraphicalMap.entrySet();
|
||||
for (Map.Entry entry : entrySet) {
|
||||
INode node = (INode) entry.getKey();
|
||||
INode newNode = (INode) entry.getValue();
|
||||
buildGraphicalNodeForInputConnections(duplicatedProcess, node, newNode, visitedNodes);
|
||||
}
|
||||
|
||||
// make sure the new tUnite incomingConnections order is the same as the old one. @see
|
||||
// Connection.setInputId(int id)
|
||||
|
||||
@@ -92,7 +92,7 @@ public class EditProcess extends AbstractProcessAction implements IIntroAction {
|
||||
if (IRepositoryNode.ENodeType.REPOSITORY_ELEMENT == node.getType() && node.getObjectType() == getProcessType()) {
|
||||
final IProxyRepositoryFactory repFactory = DesignerPlugin.getDefault().getRepositoryService()
|
||||
.getProxyRepositoryFactory();
|
||||
this.setText(getLabel(repFactory.isPotentiallyEditable(node.getObject())));
|
||||
this.setText(getLabel(repFactory.isPotentiallyEditable(node.getObject())) + " : " + node.getLabel());
|
||||
} else {
|
||||
canWork = false;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ITDQPatternService;
|
||||
import org.talend.core.hadoop.HadoopConstants;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.components.IODataComponent;
|
||||
import org.talend.core.model.context.ContextUtils;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
@@ -304,7 +303,7 @@ public class ChangeValuesFromRepository extends ChangeMetadataCommand {
|
||||
.getService(IGenericWizardService.class);
|
||||
}
|
||||
if (wizardService != null && wizardService.isGenericConnection(connection)) {
|
||||
componentProperties = wizardService.getAllComponentProperties(connection, null);
|
||||
componentProperties = wizardService.getAllComponentProperties(connection, null, true);
|
||||
}
|
||||
IElementParameter propertyParam = elem.getElementParameter(propertyName);
|
||||
List<IElementParameter> elementParameters = new ArrayList<>(elem.getElementParameters());
|
||||
@@ -326,7 +325,7 @@ public class ChangeValuesFromRepository extends ChangeMetadataCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<Object, Object> contextMap = new HashMap<Object, Object>();
|
||||
for (IElementParameter param : elementParameters) {
|
||||
String repositoryValue = param.getRepositoryValue();
|
||||
if (param.getFieldType() == EParameterFieldType.PROPERTY_TYPE) {
|
||||
@@ -417,7 +416,7 @@ public class ChangeValuesFromRepository extends ChangeMetadataCommand {
|
||||
}
|
||||
}
|
||||
objectValue = RepositoryToComponentProperty.getValue(connection, repositoryValue, metaTable,
|
||||
componentName);
|
||||
componentName, contextMap);
|
||||
}
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IJsonFileService.class)) {
|
||||
|
||||
@@ -260,7 +260,7 @@ public class RepositoryChangeMetadataCommand extends ChangeMetadataCommand {
|
||||
}
|
||||
if (repositoryValue != null) {
|
||||
Object objectValue = RepositoryToComponentProperty.getValue(getConnection(),
|
||||
repositoryValue, newOutputMetadata, node.getComponent().getName());
|
||||
repositoryValue, newOutputMetadata, node.getComponent().getName(), null);
|
||||
if (objectValue != null) {
|
||||
module.setValue(objectValue);
|
||||
}
|
||||
|
||||
@@ -92,8 +92,10 @@ import org.talend.core.model.process.Problem;
|
||||
import org.talend.core.model.process.Problem.ProblemStatus;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.ExternalNodesFactory;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.ContextParameterUtils;
|
||||
import org.talend.core.model.utils.NodeUtil;
|
||||
import org.talend.core.model.utils.TalendTextUtils;
|
||||
import org.talend.core.prefs.ITalendCorePrefConstants;
|
||||
@@ -1880,6 +1882,7 @@ public class Node extends Element implements IGraphicalNode {
|
||||
|
||||
if (id.equals(EParameterName.CONNECTION_FORMAT.getName())) {
|
||||
connectionToParse = (String) value;
|
||||
setConnectionName(ElementParameterParser.parse(this, connectionToParse));
|
||||
// to check
|
||||
// String newValue = ElementParameterParser.parse(this, connectionToParse);
|
||||
// setConnectionName(newValue);
|
||||
@@ -2877,7 +2880,16 @@ public class Node extends Element implements IGraphicalNode {
|
||||
break;
|
||||
}
|
||||
if (!NodeQueryCheckUtil.checkQueryOK(this, currentQuery)) {
|
||||
Problems.add(ProblemStatus.WARNING, this, errMessage);
|
||||
boolean show = true;
|
||||
// match the query and check again
|
||||
if (NodeQueryCheckUtil.isNeedMatchQuery()) {
|
||||
String matchSql = NodeQueryCheckUtil.matchQueryComments(this, currentQuery);
|
||||
NodeQueryCheckUtil.checkQueryOK(this, matchSql);
|
||||
show = NodeQueryCheckUtil.isNeedMatchQuery();
|
||||
}
|
||||
if (show) {
|
||||
Problems.add(ProblemStatus.WARNING, this, errMessage);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2895,7 +2907,9 @@ public class Node extends Element implements IGraphicalNode {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
boolean isContextValue = ContextParameterUtils
|
||||
.isContainContextParam(String.valueOf(param.getValue()));
|
||||
if (!found && !isContextValue) {
|
||||
String errorMessage = Messages.getString("Node.parameterNotExist", param.getDisplayName(), value); //$NON-NLS-1$
|
||||
Problems.add(ProblemStatus.ERROR, this, errorMessage);
|
||||
}
|
||||
@@ -2987,6 +3001,7 @@ public class Node extends Element implements IGraphicalNode {
|
||||
|
||||
checktAggregateRow(param);
|
||||
|
||||
checkDynamicJobUsage(param);
|
||||
}
|
||||
|
||||
checkJobletConnections();
|
||||
@@ -3110,6 +3125,25 @@ public class Node extends Element implements IGraphicalNode {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDynamicJobUsage(IElementParameter param) {
|
||||
if (!EParameterName.USE_DYNAMIC_JOB.getName().equals(param.getName())) {
|
||||
return;
|
||||
}
|
||||
boolean isSelectUseDynamic = false;
|
||||
Object paramValue = param.getValue();
|
||||
if (paramValue != null && paramValue instanceof Boolean) {
|
||||
isSelectUseDynamic = (Boolean) paramValue;
|
||||
}
|
||||
if (isSelectUseDynamic) {
|
||||
ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(process.getProperty().getItem());
|
||||
if (ERepositoryObjectType.getAllTypesOfJoblet().contains(itemType)) {
|
||||
String warningMessage = Messages.getString("Node.checkDynamicJobUsageWarning");
|
||||
Problems.add(ProblemStatus.WARNING, this, warningMessage);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkJobletConnections() {
|
||||
if (this.isJoblet()) {
|
||||
IProcess2 comProcess = (IProcess2) component.getProcess();
|
||||
|
||||
@@ -141,6 +141,7 @@ import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.components.ElementParameter;
|
||||
import org.talend.designer.core.model.components.EmfComponent;
|
||||
import org.talend.designer.core.model.metadata.MetadataEmfFactory;
|
||||
import org.talend.designer.core.model.process.ConnectionManager;
|
||||
import org.talend.designer.core.model.process.DataProcess;
|
||||
import org.talend.designer.core.model.process.IGeneratingProcess;
|
||||
import org.talend.designer.core.model.process.jobsettings.JobSettingsConstants;
|
||||
@@ -1360,6 +1361,34 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
}
|
||||
}
|
||||
loadElementParameters(elemParam, pType, param, pType.getName(), paraValue, false);
|
||||
} else {
|
||||
boolean canAddElementParameter = false;
|
||||
String paramName = pType.getName();
|
||||
if (EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName().equals(paramName)) {
|
||||
canAddElementParameter = true;
|
||||
}
|
||||
if (canAddElementParameter) {
|
||||
param = new ElementParameter(elemParam);
|
||||
param.setValue(pType.getValue());
|
||||
param.setName(pType.getName());
|
||||
param.setCategory(EComponentCategory.TECHNICAL);
|
||||
String fieldName = pType.getField();
|
||||
EParameterFieldType fieldType = null;
|
||||
if (StringUtils.isNotBlank(fieldName)) {
|
||||
fieldType = EParameterFieldType.valueOf(fieldName);
|
||||
}
|
||||
if (fieldType == null) {
|
||||
ExceptionHandler.process(new Exception("Can't find filed of " + fieldName));
|
||||
continue;
|
||||
}
|
||||
param.setFieldType(fieldType);
|
||||
param.setNumRow(99);
|
||||
param.setShow(false);
|
||||
param.setReadOnly(false);
|
||||
elemParam.addElementParameter(param);
|
||||
param = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2668,7 +2697,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
EList connecList;
|
||||
ConnectionType cType;
|
||||
connecList = process.getConnection();
|
||||
Connection connec;
|
||||
Connection connec = null;
|
||||
Node source, target;
|
||||
|
||||
List<String> connectionsProblems = new ArrayList<String>();
|
||||
@@ -2722,8 +2751,12 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
|
||||
boolean monitorConnection = getConnectionMonitorProperty(cType);
|
||||
if (connectionTypeFound) {
|
||||
connec = new Connection(source, target, EConnectionType.getTypeFromId(lineStyleId), connectorName, metaname,
|
||||
cType.getLabel(), cType.getMetaname(), monitorConnection);
|
||||
if (!ConnectionManager.checkCircle(source, target)) {
|
||||
connec = new Connection(source, target, EConnectionType.getTypeFromId(lineStyleId), connectorName, metaname,
|
||||
cType.getLabel(), cType.getMetaname(), monitorConnection);
|
||||
} else {
|
||||
ExceptionHandler.process(new Exception(Messages.getString("Process.errorCircleConnectionDetected", cType.getLabel(), source.getLabel(), target.getLabel()))); //$NON-NLS-1$
|
||||
}
|
||||
} else {
|
||||
if (PluginChecker.isJobLetPluginLoaded()) { // bug 12764
|
||||
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
@@ -2736,6 +2769,9 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
connec = new Connection(source, target, type, source.getConnectorFromType(type).getName(), metaname,
|
||||
cType.getLabel(), cType.getMetaname(), monitorConnection);
|
||||
}
|
||||
if (connec == null) {
|
||||
continue;
|
||||
}
|
||||
connectionsHashtable.put(cType, connec);
|
||||
listParamType = cType.getElementParameter();
|
||||
loadElementParameters(connec, listParamType);
|
||||
@@ -4554,7 +4590,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
List<IRepositoryViewObject> routines;
|
||||
try {
|
||||
routines = ProxyRepositoryFactory.getInstance().getAll(ProjectManager.getInstance().getCurrentProject(), itemType);
|
||||
for (Project project : ProjectManager.getInstance().getAllReferencedProjects()) {
|
||||
for (Project project : ProjectManager.getInstance().getAllReferencedProjects(true)) {
|
||||
List<IRepositoryViewObject> routinesFromRef = ProxyRepositoryFactory.getInstance().getAll(project, itemType);
|
||||
for (IRepositoryViewObject routine : routinesFromRef) {
|
||||
if (!((RoutineItem) routine.getProperty().getItem()).isBuiltIn()) {
|
||||
|
||||
@@ -584,7 +584,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
/*
|
||||
* check job settings parameters.
|
||||
*/
|
||||
private List<UpdateResult> checkMainParameters(EUpdateItemType type, boolean onlySimpleShow) {
|
||||
private List<UpdateResult> checkMainParameters(EUpdateItemType type, boolean onlySimpleShow, Map<Object, Object> contextData) {
|
||||
List<UpdateResult> mainResults = new ArrayList<UpdateResult>();
|
||||
switch (type) {
|
||||
case JOB_PROPERTY_MAPREDUCE:
|
||||
@@ -775,9 +775,14 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
return jobSettingsResults;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<UpdateResult> checkJobSettingsParameters(EComponentCategory category, EUpdateItemType type,
|
||||
boolean onlySimpleShow) {
|
||||
return checkJobSettingsParameters(category, type, onlySimpleShow, new HashMap<Object, Object>());
|
||||
}
|
||||
|
||||
private List<UpdateResult> checkJobSettingsParameters(EComponentCategory category, EUpdateItemType type,
|
||||
boolean onlySimpleShow, Map<Object, Object> contextData) {
|
||||
List<UpdateResult> jobSettingsResults = new ArrayList<UpdateResult>();
|
||||
final IElementParameter propertyTypeParam = getProcess().getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE,
|
||||
category);
|
||||
@@ -896,7 +901,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
}
|
||||
// for context mode(bug 5198)
|
||||
List<UpdateResult> contextResults = checkParameterContextMode(getProcess().getElementParameters(),
|
||||
(ConnectionItem) lastVersion.getProperty().getItem(), category);
|
||||
(ConnectionItem) lastVersion.getProperty().getItem(), category, contextData);
|
||||
if (contextResults != null) {
|
||||
jobSettingsResults.addAll(contextResults);
|
||||
}
|
||||
@@ -923,7 +928,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
* check node parameters.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<UpdateResult> checkNodesParameters(EUpdateItemType type, boolean onlySimpleShow) {
|
||||
private List<UpdateResult> checkNodesParameters(EUpdateItemType type, boolean onlySimpleShow, Map<Object, Object> contextData) {
|
||||
List<UpdateResult> nodesResults = new ArrayList<UpdateResult>();
|
||||
for (Node node : (List<Node>) getProcess().getGraphicalNodes()) {
|
||||
switch (type) {
|
||||
@@ -931,7 +936,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
nodesResults.addAll(checkNodeSchemaFromRepository(node, onlySimpleShow));
|
||||
break;
|
||||
case NODE_PROPERTY:
|
||||
nodesResults.addAll(checkNodePropertiesFromRepository(node, onlySimpleShow));
|
||||
nodesResults.addAll(checkNodePropertiesFromRepository(node, onlySimpleShow, contextData));
|
||||
break;
|
||||
case NODE_QUERY:
|
||||
nodesResults.addAll(checkNodeQueryFromRepository(node, onlySimpleShow));
|
||||
@@ -1680,7 +1685,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
}
|
||||
return schemaResults;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* nrousseau Comment method "checkNodePropertiesFromRepository".
|
||||
@@ -1690,6 +1695,18 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<UpdateResult> checkNodePropertiesFromRepository(final Node node, boolean onlySimpleShow) {
|
||||
return checkNodePropertiesFromRepository(node, onlySimpleShow, new HashMap<Object, Object>());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* nrousseau Comment method "checkNodePropertiesFromRepository".
|
||||
*
|
||||
* @param node
|
||||
* @return true if the data have been modified
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<UpdateResult> checkNodePropertiesFromRepository(final Node node, boolean onlySimpleShow, Map<Object, Object> contextData) {
|
||||
if (node == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -1725,6 +1742,9 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
if (item != null && item instanceof ConnectionItem) {
|
||||
source = UpdateRepositoryUtils.getRepositorySourceName(item);
|
||||
repositoryConnection = ((ConnectionItem) item).getConnection();
|
||||
if(repositoryConnection != null && repositoryConnection.getId() == null){
|
||||
repositoryConnection.setId(((ConnectionItem) item).getProperty().getId());
|
||||
}
|
||||
}
|
||||
if (item != null && item instanceof FileItem) {
|
||||
if (item instanceof RulesItem) {
|
||||
@@ -1773,7 +1793,6 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the repository connection exists then test the values
|
||||
for (IElementParameter param : node.getElementParameters()) {
|
||||
if (needBuildIn) {
|
||||
@@ -1807,7 +1826,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
table = node.getMetadataList().get(0);
|
||||
}
|
||||
Object objectValue = RepositoryToComponentProperty.getValue(repositoryConnection,
|
||||
repositoryValue, table, relatedComponent);
|
||||
repositoryValue, table, relatedComponent, contextData);
|
||||
if (objectValue == null || "".equals(objectValue)) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
|
||||
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(
|
||||
@@ -2160,7 +2179,7 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
}
|
||||
// for context mode(bug 5198)
|
||||
List<UpdateResult> contextResults = checkParameterContextMode(node.getElementParameters(),
|
||||
(ConnectionItem) lastVersion.getProperty().getItem(), null);
|
||||
(ConnectionItem) lastVersion.getProperty().getItem(), null, contextData);
|
||||
if (contextResults != null) {
|
||||
propertiesResults.addAll(contextResults);
|
||||
}
|
||||
@@ -2353,14 +2372,14 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
* for bug 5198
|
||||
*/
|
||||
private List<UpdateResult> checkParameterContextMode(final List<? extends IElementParameter> parameters,
|
||||
ConnectionItem connItem, EComponentCategory category) {
|
||||
ConnectionItem connItem, EComponentCategory category, Map<Object, Object> contextData) {
|
||||
List<UpdateResult> contextResults = new ArrayList<UpdateResult>();
|
||||
|
||||
if (connItem != null && parameters != null) {
|
||||
ConnectionContextHelper.checkContextMode(connItem);
|
||||
Connection connection = connItem.getConnection();
|
||||
if (connection.isContextMode()) {
|
||||
Set<String> neededVars = ConnectionContextHelper.retrieveContextVar(parameters, connection, category);
|
||||
Set<String> neededVars = ConnectionContextHelper.retrieveContextVar(parameters, connection, category, contextData);
|
||||
if (neededVars != null && !neededVars.isEmpty()) {
|
||||
ContextItem contextItem = ContextUtils.getContextItemById2(connection.getContextId());
|
||||
EcoreUtil.resolveAll(contextItem);
|
||||
@@ -2613,10 +2632,14 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
public List<UpdateResult> getUpdatesNeeded(IUpdateItemType type) {
|
||||
return getUpdatesNeeded(type, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<UpdateResult> getUpdatesNeeded(IUpdateItemType itemType, boolean onlySimpleShow) {
|
||||
return getUpdatesNeeded(itemType, onlySimpleShow, new HashMap<Object, Object>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UpdateResult> getUpdatesNeeded(IUpdateItemType itemType, boolean onlySimpleShow, Map<Object, Object> contextData) {
|
||||
if (itemType == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -2630,14 +2653,14 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
|
||||
case NODE_SAP_IDOC:
|
||||
case NODE_SAP_FUNCTION:
|
||||
case NODE_VALIDATION_RULE:
|
||||
tmpResults = checkNodesParameters(type, onlySimpleShow);
|
||||
tmpResults = checkNodesParameters(type, onlySimpleShow, contextData);
|
||||
break;
|
||||
case JOB_PROPERTY_EXTRA:
|
||||
case JOB_PROPERTY_STATS_LOGS:
|
||||
case JOB_PROPERTY_HEADERFOOTER:
|
||||
case JOB_PROPERTY_STORM:
|
||||
case JOB_PROPERTY_MAPREDUCE:
|
||||
tmpResults = checkMainParameters(type, onlySimpleShow);
|
||||
tmpResults = checkMainParameters(type, onlySimpleShow, contextData);
|
||||
break;
|
||||
case CONTEXT:
|
||||
tmpResults = checkContext(onlySimpleShow);
|
||||
|
||||
@@ -58,7 +58,9 @@ public final class NodeQueryCheckUtil {
|
||||
// split the function
|
||||
private static final String FUNC_SPLIT = "(\\s)*(\\w*)\\((.*?)\\)(\\s+\\w*){0,1}"; //$NON-NLS-1$
|
||||
|
||||
private static final String COMMENT_REGX_PATTERN = ("(?ms)('(?:''|[^'])*')|--.*?$|/\\*.*?\\*/"); //$NON-NLS-1$
|
||||
private static final String COMMENT_REGX_PATTERN = ("(?ms)('(?:''|[^'])*')|--.*?$|/\\*.*?\\*/"); //$NON-NLS-1$
|
||||
|
||||
private static boolean needMatchQuery;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -69,14 +71,10 @@ public final class NodeQueryCheckUtil {
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkQueryOK(Node node, String sql) {
|
||||
setNeedMatchQuery(false);
|
||||
if (sql == null) {
|
||||
return false;
|
||||
}
|
||||
if (sql.contains("--") || sql.contains("*")) {//$NON-NLS-1$ //$NON-NLS-2$
|
||||
// match the query comments
|
||||
sql = sql.replaceAll(COMMENT_REGX_PATTERN, ""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// replace the new line char
|
||||
sql = sql.replaceAll("\r", " "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sql = sql.replaceAll("\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
@@ -105,17 +103,11 @@ public final class NodeQueryCheckUtil {
|
||||
if ("*".equals(columns)) { //$NON-NLS-1$
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
* add by wzhang
|
||||
*/
|
||||
boolean match = apacheRegexMatch(SQL_FUNC_REGX, REGX_FLAG, columns);
|
||||
if (!match) {
|
||||
// no function
|
||||
return compareNodeTableColumnsNoFunc(node, columns);
|
||||
} else {
|
||||
// contains function
|
||||
return compareNodeTableColumnsWithFunc(node, columns);
|
||||
boolean result = compareNodeTableColumns(node, columns);
|
||||
if (!result) {
|
||||
setNeedMatchQuery(!result);
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@@ -213,4 +205,33 @@ public final class NodeQueryCheckUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static String matchQueryComments(Node node, String sql) {
|
||||
if (sql == null) {
|
||||
return null;
|
||||
}
|
||||
if (sql.contains("--") || sql.contains("/*")) {//$NON-NLS-1$ //$NON-NLS-2$
|
||||
// match the query comments
|
||||
return sql.replaceAll(COMMENT_REGX_PATTERN, ""); //$NON-NLS-1$
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
private static boolean compareNodeTableColumns(Node node, String columns) {
|
||||
boolean match = apacheRegexMatch(SQL_FUNC_REGX, REGX_FLAG, columns);
|
||||
if (!match) {
|
||||
// no function
|
||||
return compareNodeTableColumnsNoFunc(node, columns);
|
||||
} else {
|
||||
// contains function
|
||||
return compareNodeTableColumnsWithFunc(node, columns);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNeedMatchQuery() {
|
||||
return needMatchQuery;
|
||||
}
|
||||
|
||||
public static void setNeedMatchQuery(boolean matchQuery) {
|
||||
needMatchQuery = matchQuery;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.talend.core.model.process.IElement;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.runtime.services.IGenericService;
|
||||
import org.talend.core.ui.IJobletProviderService;
|
||||
import org.talend.core.ui.process.IGraphicalNode;
|
||||
import org.talend.core.ui.properties.tab.IDynamicProperty;
|
||||
@@ -209,6 +210,20 @@ public class ComponentListController extends AbstractElementPropertySectionContr
|
||||
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
|
||||
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
|
||||
}
|
||||
}else if(curParam.getFieldType().equals(EParameterFieldType.COMPONENT_REFERENCE)){
|
||||
String value = (String)curParam.getValue();
|
||||
if (oldConnectionName.equals(value)) {
|
||||
curParam.setValue(newConnectionName);
|
||||
} else if (value != null && value.startsWith(oldConnectionName + "_")) {
|
||||
curParam.setValue(value.replaceFirst(oldConnectionName + "_", newConnectionName + "_"));
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericService.class)) {
|
||||
IGenericService genericService = (IGenericService) GlobalServiceRegister.getDefault().getService(
|
||||
IGenericService.class);
|
||||
if(genericService != null){
|
||||
genericService.resetReferenceValue(curNode, oldConnectionName, newConnectionName);
|
||||
}
|
||||
}
|
||||
} else if (curParam.getFieldType().equals(EParameterFieldType.TABLE)) {
|
||||
final Object[] itemsValue = curParam.getListItemsValue();
|
||||
for (Object element : itemsValue) {
|
||||
|
||||
@@ -613,8 +613,12 @@ public class JobSettingsView extends ViewPart implements IJobSettingsView, ISele
|
||||
.contains(((IRepositoryViewObject) obj).getRepositoryObjectType()))) {
|
||||
category.add(EComponentCategory.GITHISTORY);
|
||||
}
|
||||
if (((IRepositoryViewObject) obj).getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS_ROUTE) ||
|
||||
((IRepositoryViewObject) obj).getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS)) {
|
||||
if (((IRepositoryViewObject) obj).getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS)
|
||||
|| (ERepositoryObjectType.PROCESS_ROUTE != null && ((IRepositoryViewObject) obj).getRepositoryObjectType()
|
||||
.equals(ERepositoryObjectType.PROCESS_ROUTE))
|
||||
|| ((IRepositoryViewObject) obj).getRepositoryObjectType().getType().equals("SERVICES")
|
||||
|| ((IRepositoryViewObject) obj).getRepositoryObjectType().equals(ERepositoryObjectType.SERVICESPORT)
|
||||
|| ((IRepositoryViewObject) obj).getRepositoryObjectType().equals(ERepositoryObjectType.SERVICESOPERATION)) {
|
||||
category.add(EComponentCategory.DEPLOYMENT);
|
||||
}
|
||||
} else if (obj instanceof IEditorPart) {
|
||||
@@ -830,7 +834,7 @@ public class JobSettingsView extends ViewPart implements IJobSettingsView, ISele
|
||||
}
|
||||
Image jobSettingImage = null;
|
||||
ERepositoryObjectType repositoryObjectType = repositoryNode.getContentType();
|
||||
if(repositoryObjectType == null){
|
||||
if (repositoryObjectType == null) {
|
||||
repositoryObjectType = repositoryNode.getObjectType();
|
||||
}
|
||||
if (repositoryObjectType == ERepositoryObjectType.PROCESS_MR
|
||||
|
||||
@@ -12,7 +12,11 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.core.ui.views.jobsettings.tabs;
|
||||
|
||||
import static org.talend.repository.utils.MavenVersionUtils.*;
|
||||
import static org.talend.repository.utils.MavenVersionUtils.containsKey;
|
||||
import static org.talend.repository.utils.MavenVersionUtils.get;
|
||||
import static org.talend.repository.utils.MavenVersionUtils.getDefaultVersion;
|
||||
import static org.talend.repository.utils.MavenVersionUtils.isAdditionalPropertiesNull;
|
||||
import static org.talend.repository.utils.MavenVersionUtils.isValidMavenVersion;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -106,22 +110,26 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
private boolean isService;
|
||||
|
||||
private boolean isProcessItem;
|
||||
|
||||
|
||||
private boolean isServiceItem;
|
||||
|
||||
private boolean isDataServiceJob; // Is ESB SOAP Service Job
|
||||
|
||||
public DeploymentComposite(Composite parent, int style, TabbedPropertySheetWidgetFactory widgetFactory,
|
||||
IRepositoryViewObject repositoryViewObject) {
|
||||
super(parent, style, widgetFactory, repositoryViewObject);
|
||||
if (repositoryViewObject instanceof Process) {
|
||||
process = (Process) repositoryViewObject;
|
||||
} else if (repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS) ||
|
||||
repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS_ROUTE) ||
|
||||
repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS_ROUTE_MICROSERVICE)) {
|
||||
isProcessItem = true;
|
||||
ProcessItem i = (ProcessItem) repositoryViewObject.getProperty().getItem();
|
||||
try {
|
||||
process = (Process)(new ProcessEditorInput(i, true, null, false).getLoadedProcess());
|
||||
} catch (PersistenceException e) {}
|
||||
process = (Process) repositoryViewObject;
|
||||
} else if (repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS)
|
||||
|| repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS_ROUTE)
|
||||
|| repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.PROCESS_ROUTE_MICROSERVICE)) {
|
||||
isProcessItem = true;
|
||||
ProcessItem i = (ProcessItem) repositoryViewObject.getProperty().getItem();
|
||||
try {
|
||||
process = (new ProcessEditorInput(i, true, null, false).getLoadedProcess());
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
|
||||
esbService = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
|
||||
@@ -144,9 +152,16 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
}
|
||||
} else {
|
||||
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
|
||||
if (esbService != null && esbService.isWSDLEditor(editor)) {
|
||||
serviceItem = esbService.getWSDLEditorItem(editor);
|
||||
commandStack = (CommandStack) editor.getAdapter(CommandStack.class);
|
||||
if (esbService != null) {
|
||||
if (esbService.isWSDLEditor(editor)) {
|
||||
serviceItem = esbService.getWSDLEditorItem(editor);
|
||||
commandStack = (CommandStack) editor.getAdapter(CommandStack.class);
|
||||
} else if (repositoryViewObject.getRepositoryObjectType().getType().equals("SERVICES")
|
||||
|| repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.SERVICESPORT)
|
||||
|| repositoryViewObject.getRepositoryObjectType().equals(ERepositoryObjectType.SERVICESOPERATION)) {
|
||||
serviceItem = repositoryViewObject.getProperty().getItem();
|
||||
isServiceItem = true;
|
||||
}
|
||||
defaultVersion = getDefaultVersion(serviceItem.getProperty().getVersion());
|
||||
isService = true;
|
||||
}
|
||||
@@ -160,11 +175,11 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
private void checkReadOnly() {
|
||||
try {
|
||||
String currentVersion = isService ? serviceItem.getProperty().getVersion() : process.getVersion();
|
||||
IRepositoryViewObject obj = ProxyRepositoryFactory.getInstance().getLastVersion(
|
||||
isService ? serviceItem.getProperty().getId() : process.getId());
|
||||
IRepositoryViewObject obj = ProxyRepositoryFactory.getInstance()
|
||||
.getLastVersion(isService ? serviceItem.getProperty().getId() : process.getId());
|
||||
String latestVersion = obj.getVersion();
|
||||
|
||||
if (!currentVersion.equals(latestVersion) || isDataServiceJob || isProcessItem) {
|
||||
if (!currentVersion.equals(latestVersion) || isDataServiceJob || isProcessItem || isServiceItem) {
|
||||
groupIdCheckbox.setEnabled(false);
|
||||
groupIdText.setEnabled(false);
|
||||
versionCheckbox.setEnabled(false);
|
||||
@@ -174,7 +189,7 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
buildTypeCombo.getCCombo().setEnabled(false);
|
||||
}
|
||||
if (buildTypeLabel != null) {
|
||||
buildTypeLabel.setEnabled(false);
|
||||
buildTypeLabel.setEnabled(false);
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
@@ -264,7 +279,7 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
groupIdText.setText(groupId);
|
||||
groupIdCheckbox.setSelection(isCustomGroupId);
|
||||
groupIdText.setEnabled(isCustomGroupId);
|
||||
|
||||
|
||||
version = (String) get(getObject(), MavenConstants.NAME_USER_VERSION);
|
||||
boolean isCustomVersion = version != null;
|
||||
if (!isCustomVersion) {
|
||||
@@ -353,7 +368,8 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
}
|
||||
}
|
||||
// if empty, remove it from job, else will set the new value
|
||||
Command cmd = new MavenDeploymentValueChangeCommand(getObject(), MavenConstants.NAME_GROUP_ID, currentGroupId);
|
||||
Command cmd = new MavenDeploymentValueChangeCommand(getObject(), MavenConstants.NAME_GROUP_ID,
|
||||
currentGroupId);
|
||||
getCommandStack().execute(cmd);
|
||||
} else {
|
||||
groupIdText.setBackground(COLOR_RED);
|
||||
@@ -382,7 +398,8 @@ public class DeploymentComposite extends AbstractTabComposite {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
String currentVersion = versionText.getText();
|
||||
if (StringUtils.isBlank(currentVersion) || !isValidMavenVersion(currentVersion, snapshotCheckbox.getSelection())) {
|
||||
if (StringUtils.isBlank(currentVersion)
|
||||
|| !isValidMavenVersion(currentVersion, snapshotCheckbox.getSelection())) {
|
||||
versionText.setToolTipText(Messages.getString("DeploymentComposite.valueWarning")); //$NON-NLS-1$
|
||||
versionText.setBackground(COLOR_RED);
|
||||
} else {
|
||||
|
||||
@@ -348,7 +348,7 @@ public class OpenExistVersionProcessWizard extends Wizard {
|
||||
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
String lastVersion = factory.getLastVersion(routineItem.getProperty().getId()).getVersion();
|
||||
String curVersion = routineItem.getProperty().getVersion();
|
||||
routineSynchronizer.syncRoutine(routineItem, true, true);
|
||||
// routineSynchronizer.syncRoutine(routineItem, true, true);
|
||||
final IFile file;
|
||||
if (curVersion != null && curVersion.equals(lastVersion)) {
|
||||
file = routineSynchronizer.getFile(routineItem);
|
||||
|
||||
@@ -10,27 +10,29 @@
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.runprocess.bigdata;
|
||||
package org.talend.designer.core.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.hadoop.HadoopConstants;
|
||||
import org.talend.core.hadoop.version.EHadoopDistributions;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
|
||||
/**
|
||||
* created by nrousseau on Mar 24, 2018 Detailled comment
|
||||
@@ -38,10 +40,10 @@ import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
*/
|
||||
public class BigDataJobUtil {
|
||||
|
||||
private ProcessItem processItem;
|
||||
private IProcess process;
|
||||
|
||||
public BigDataJobUtil(ProcessItem processItem) {
|
||||
this.processItem = processItem;
|
||||
public BigDataJobUtil(IProcess process) {
|
||||
this.process = process;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,11 +70,10 @@ public class BigDataJobUtil {
|
||||
public boolean isSparkWithHDInsight() {
|
||||
boolean isSparkWithHDInsight = false;
|
||||
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_SPARK)
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM,
|
||||
HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM, HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
boolean modeParameterVisited = false;
|
||||
for (ElementParameterType pt : parameters) {
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (pt.getName().equals("SPARK_LOCAL_MODE")) { //$NON-NLS-1$
|
||||
modeParameterVisited = true;
|
||||
if ("true".equals(pt.getValue())) { //$NON-NLS-1$
|
||||
@@ -96,11 +97,11 @@ public class BigDataJobUtil {
|
||||
|
||||
public boolean isMRWithHDInsight() {
|
||||
Boolean isMRWithHDInsight = false;
|
||||
if (processItem != null) {
|
||||
if (process != null) {
|
||||
isMRWithHDInsight = false;
|
||||
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_MAPREDUCE)) {
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
for (ElementParameterType pt : parameters) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (pt.getName().equals("DISTRIBUTION") //$NON-NLS-1$
|
||||
&& EHadoopDistributions.MICROSOFT_HD_INSIGHT.getName().equals(pt.getValue())) {
|
||||
isMRWithHDInsight = true;
|
||||
@@ -119,11 +120,10 @@ public class BigDataJobUtil {
|
||||
Boolean isSparkInYarnClusterMode = false;
|
||||
// Test if we are in Spark or Spark streaming
|
||||
if (isBDJobWithFramework(ERepositoryObjectType.PROCESS_MR, HadoopConstants.FRAMEWORK_SPARK)
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM,
|
||||
HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
|| isBDJobWithFramework(ERepositoryObjectType.PROCESS_STORM, HadoopConstants.FRAMEWORK_SPARKSTREAMING)) {
|
||||
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
for (ElementParameterType pt : parameters) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (HadoopConstants.SPARK_MODE.equals(pt.getName())
|
||||
&& HadoopConstants.SPARK_MODE_YARN_CLUSTER.equals(pt.getValue())) {
|
||||
isSparkInYarnClusterMode = true;
|
||||
@@ -135,31 +135,23 @@ public class BigDataJobUtil {
|
||||
}
|
||||
|
||||
private boolean isBDJobWithFramework(ERepositoryObjectType objectType, String frameworkName) {
|
||||
if (processItem != null) {
|
||||
// Storm/SparkStreaming(PROCESS_STORM), MR/Spark(PROCESS_MR)
|
||||
if (ERepositoryObjectType.getItemType(processItem).equals(objectType)) { // have same type
|
||||
Property property = processItem.getProperty();
|
||||
if (property != null && property.getAdditionalProperties() != null
|
||||
&& frameworkName.equals(property.getAdditionalProperties().get(HadoopConstants.FRAMEWORK))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Storm/SparkStreaming(PROCESS_STORM), MR/Spark(PROCESS_MR)
|
||||
if (process != null && process instanceof IProcess2 && ((IProcess2) process).getAdditionalProperties() != null
|
||||
&& frameworkName.equals(((IProcess2) process).getAdditionalProperties().get(HadoopConstants.FRAMEWORK))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Find the distribution where the generated jar rquired to have the context files inside **/
|
||||
public boolean needsToHaveContextInsideJar() {
|
||||
if (processItem.getProcess() != null) {
|
||||
EList<ElementParameterType> parameters = processItem.getProcess().getParameters().getElementParameter();
|
||||
for (ElementParameterType pt : parameters) {
|
||||
List<? extends IElementParameter> parameters = process.getElementParametersWithChildrens();
|
||||
|
||||
if (process != null && parameters != null) {
|
||||
|
||||
for (IElementParameter pt : parameters) {
|
||||
if (pt.getName().equals("DISTRIBUTION")) { //$NON-NLS-1$
|
||||
String value = pt.getValue();
|
||||
if ("MICROSOFT_HD_INSIGHT".equals(value) //$NON-NLS-1$
|
||||
|| "GOOGLE_CLOUD_DATAPROC".equals(value) //$NON-NLS-1$
|
||||
|| "CLOUDERA_ALTUS".equals(value)) { //$NON-NLS-1$
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (isSparkWithYarnClusterMode()) {
|
||||
@@ -169,6 +161,27 @@ public class BigDataJobUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setExcludedModules(Collection<ModuleNeeded> modulesNeeded) {
|
||||
if (isMRWithHDInsight() || isSparkWithHDInsight()) {
|
||||
// we need to exclude every non-MR Required jars.
|
||||
for (ModuleNeeded currentModule : modulesNeeded) {
|
||||
if (currentModule.isMrRequired()) {
|
||||
currentModule.setExcluded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeExcludedModules(Collection<ModuleNeeded> modulesNeeded) {
|
||||
Iterator<ModuleNeeded> itModules = modulesNeeded.iterator();
|
||||
while (itModules.hasNext()) {
|
||||
ModuleNeeded module = itModules.next();
|
||||
if (module.isExcluded()) {
|
||||
itModules.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC nrousseau Comment method "getShadedModulesExclude".
|
||||
*
|
||||
@@ -182,6 +195,8 @@ public class BigDataJobUtil {
|
||||
for (ModuleNeeded currentModule : modulesNeeded) {
|
||||
if (!currentModule.isMrRequired()) {
|
||||
excludedModules.add(currentModule);
|
||||
} else {
|
||||
currentModule.setExcluded(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,21 +15,25 @@ package org.talend.designer.core.utils;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerService;
|
||||
import org.talend.core.hadoop.IHadoopClusterService;
|
||||
import org.talend.core.hadoop.repository.HadoopRepositoryUtil;
|
||||
import org.talend.core.model.components.EComponentType;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IContext;
|
||||
@@ -50,6 +54,7 @@ import org.talend.core.utils.BitwiseOptionUtils;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.components.EmfComponent;
|
||||
import org.talend.designer.maven.utils.MavenVersionHelper;
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.librariesmanager.model.ModulesNeededProvider;
|
||||
|
||||
@@ -93,7 +98,8 @@ public class JavaProcessUtil {
|
||||
if (!module.getModuleName().contains(".")) { //$NON-NLS-1$
|
||||
it.remove();
|
||||
} else if (dedupModulesList.contains(module.getModuleName())) {
|
||||
if (module.isMrRequired() && previousModule != null && previousModule.getModuleName().equals(module.getModuleName())) {
|
||||
if (module.isMrRequired() && previousModule != null
|
||||
&& previousModule.getModuleName().equals(module.getModuleName())) {
|
||||
previousModule.setMrRequired(Boolean.TRUE);
|
||||
}
|
||||
it.remove();
|
||||
@@ -103,6 +109,10 @@ public class JavaProcessUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)) {
|
||||
new BigDataJobUtil(process).removeExcludedModules(modulesNeeded);
|
||||
}
|
||||
|
||||
return new HashSet<ModuleNeeded>(modulesNeeded);
|
||||
}
|
||||
|
||||
@@ -117,6 +127,14 @@ public class JavaProcessUtil {
|
||||
return libsNeeded;
|
||||
}
|
||||
|
||||
public static Map<String, ModuleNeeded> getNeededLibrariesMap(List<ModuleNeeded> modulesNeeded) {
|
||||
Map<String, ModuleNeeded> libsNeeded = new HashMap<String, ModuleNeeded>();
|
||||
for (ModuleNeeded module : modulesNeeded) {
|
||||
libsNeeded.put(module.getModuleName(), module);
|
||||
}
|
||||
return libsNeeded;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void getNeededModules(final IProcess process, Set<ProcessItem> searchItems,
|
||||
List<ModuleNeeded> modulesNeeded, int options) {
|
||||
@@ -161,13 +179,16 @@ public class JavaProcessUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (ProcessUtils.isTestContainer(process)) {// if it is a test container, add junit jars.
|
||||
boolean isTestcaseProcess = ProcessUtils.isTestContainer(process);
|
||||
if (isTestcaseProcess) {// if it is a test container, add junit jars.
|
||||
addJunitNeededModules(modulesNeeded);
|
||||
}
|
||||
|
||||
String hadoopItemId = null;
|
||||
List<INode> nodeList = (List<INode>) process.getGeneratingNodes();
|
||||
|
||||
|
||||
Set<ModuleNeeded> highPriorityLinkedSet = new LinkedHashSet<ModuleNeeded>();
|
||||
Set<ModuleNeeded> jdbcCustomizeModulesSet = new HashSet<ModuleNeeded>();
|
||||
for (INode node : nodeList) {
|
||||
if (hadoopItemId == null) {
|
||||
String itemId = getHadoopClusterItemId(node);
|
||||
@@ -181,18 +202,48 @@ public class JavaProcessUtil {
|
||||
|
||||
Set<ModuleNeeded> nodeNeededModules = getNeededModules(node, searchItems, options);
|
||||
if (nodeNeededModules != null) {
|
||||
Map<String, ModuleNeeded> libsNeededMap = getNeededLibrariesMap(modulesNeeded);
|
||||
modulesNeeded.addAll(nodeNeededModules);
|
||||
if (node.getComponent().getName().equals("tLibraryLoad")) { //$NON-NLS-1$
|
||||
LastGenerationInfo.getInstance().getHighPriorityModuleNeeded().addAll(nodeNeededModules);
|
||||
if (node.getComponent().getName().equals("tLibraryLoad") && !isTestcaseProcess) { //$NON-NLS-1$
|
||||
Set<ModuleNeeded> highPriorityModuleNeeded = new HashSet<ModuleNeeded>();
|
||||
for (ModuleNeeded moduleNeeded : nodeNeededModules) {
|
||||
ModuleNeeded existModuleNeeded = libsNeededMap.get(moduleNeeded.getModuleName());
|
||||
if (existModuleNeeded != null) {
|
||||
highPriorityModuleNeeded.add(existModuleNeeded);
|
||||
} else {
|
||||
highPriorityModuleNeeded.add(moduleNeeded);
|
||||
}
|
||||
}
|
||||
highPriorityLinkedSet.addAll(highPriorityModuleNeeded);
|
||||
}
|
||||
|
||||
// for JDBC, user set the customize driver jars need the high Priority
|
||||
// but after tLibraryLoad
|
||||
if (isSetHighPriorityForJDBCCustomizeDriver()) {
|
||||
if (node.getComponent().getComponentType() == EComponentType.GENERIC && !isTestcaseProcess) {
|
||||
List<ModuleNeeded> jdbcNodeModuleNeededList = new ArrayList<ModuleNeeded>();
|
||||
for (IElementParameter curParam : node.getElementParameters()) {
|
||||
if (curParam.getFieldType() == EParameterFieldType.TABLE) {
|
||||
getModulesInTable(process, curParam, jdbcNodeModuleNeededList);
|
||||
}
|
||||
}
|
||||
jdbcCustomizeModulesSet.addAll(jdbcNodeModuleNeededList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// in case of multiple Version jars in customize modules, descendOrder
|
||||
if (isSetHighPriorityForJDBCCustomizeDriver()) {
|
||||
highPriorityLinkedSet.addAll(descendingOrderModuleList(jdbcCustomizeModulesSet));
|
||||
}
|
||||
LastGenerationInfo.getInstance().setHighPriorityModuleNeeded(process.getId(), process.getVersion(),
|
||||
highPriorityLinkedSet);
|
||||
|
||||
if (hadoopItemId == null) { // Incase it is a bigdata process.
|
||||
IElementParameter propertyParam = process.getElementParameter("MR_PROPERTY"); //$NON-NLS-1$
|
||||
if (propertyParam != null) {
|
||||
IElementParameter repositoryParam = propertyParam.getChildParameters()
|
||||
.get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
|
||||
IElementParameter repositoryParam =
|
||||
propertyParam.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
|
||||
if (repositoryParam != null) {
|
||||
hadoopItemId = String.valueOf(repositoryParam.getValue());
|
||||
}
|
||||
@@ -202,6 +253,62 @@ public class JavaProcessUtil {
|
||||
if (hadoopItemId != null) {
|
||||
useCustomConfsJarIfNeeded(modulesNeeded, hadoopItemId);
|
||||
}
|
||||
new BigDataJobUtil(process).setExcludedModules(modulesNeeded);
|
||||
}
|
||||
|
||||
private static boolean isSetHighPriorityForJDBCCustomizeDriver() {
|
||||
return Boolean.getBoolean("talend.JDBC.setHighPriorityForDriverJar"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static List<ModuleNeeded> descendingOrderModuleList(Set<ModuleNeeded> moduleList) {
|
||||
List<ModuleNeeded> orderedList = new ArrayList<ModuleNeeded>();
|
||||
Map<String, List<ModuleNeeded>> multipleVersionHM = new HashMap<String, List<ModuleNeeded>>();
|
||||
Set<ModuleNeeded> tmpModuleList = new HashSet<ModuleNeeded>(moduleList);
|
||||
Iterator<ModuleNeeded> it = tmpModuleList.iterator();
|
||||
Pattern pattern = Pattern.compile("(-\\d+\\.\\d.*)+?(.jar)"); //$NON-NLS-1$
|
||||
Pattern versionPattern = Pattern.compile("(?<=-)\\d+\\.\\d.*(?=.jar)"); //$NON-NLS-1$
|
||||
while (it.hasNext()) {
|
||||
ModuleNeeded module = it.next();
|
||||
String moduleName = module.getModuleName();
|
||||
Matcher matcher = pattern.matcher(moduleName);
|
||||
if (matcher.find()) {
|
||||
String matchStr = matcher.group();
|
||||
String key = moduleName.substring(0, moduleName.indexOf(matchStr));
|
||||
if (multipleVersionHM.get(key) == null) {
|
||||
multipleVersionHM.put(key, new ArrayList<ModuleNeeded>());
|
||||
}
|
||||
multipleVersionHM.get(key).add(module);
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
for (String key : multipleVersionHM.keySet()) {
|
||||
multipleVersionHM.get(key).sort(new Comparator<ModuleNeeded>() {
|
||||
|
||||
@Override
|
||||
public int compare(ModuleNeeded o1, ModuleNeeded o2) {
|
||||
String o1Version = "";
|
||||
String o2Version = "";
|
||||
String o1Name = o1.getModuleName();
|
||||
String o2Name = o2.getModuleName();
|
||||
Matcher o1Matcher = versionPattern.matcher(o1Name);
|
||||
if (o1Matcher.find()) {
|
||||
o1Version = o1Matcher.group();
|
||||
}
|
||||
Matcher o2Matcher = versionPattern.matcher(o2Name);
|
||||
if (o2Matcher.find()) {
|
||||
o2Version = o2Matcher.group();
|
||||
}
|
||||
return MavenVersionHelper.compareTo(o2Version, o1Version);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
orderedList.addAll(multipleVersionHM.get(key));
|
||||
}
|
||||
orderedList.addAll(tmpModuleList);
|
||||
|
||||
return orderedList;
|
||||
}
|
||||
|
||||
public static String getHadoopClusterItemId(INode node) {
|
||||
@@ -212,7 +319,8 @@ public class JavaProcessUtil {
|
||||
if (isUseExistingConnection(node)) {
|
||||
return null;
|
||||
}
|
||||
IElementParameter propertyElementParameter = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
|
||||
IElementParameter propertyElementParameter =
|
||||
node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
|
||||
if (propertyElementParameter == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -267,7 +375,8 @@ public class JavaProcessUtil {
|
||||
List<ModuleNeeded> modulesNeeded = new ArrayList<ModuleNeeded>();
|
||||
if (node.getComponent().getName().equals("tRunJob")) { //$NON-NLS-1$
|
||||
IElementParameter processIdparam = node.getElementParameter("PROCESS_TYPE_PROCESS"); //$NON-NLS-1$
|
||||
IElementParameter processVersionParam = node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
|
||||
IElementParameter processVersionParam =
|
||||
node.getElementParameter(EParameterName.PROCESS_TYPE_VERSION.getName());
|
||||
|
||||
ProcessItem processItem = null;
|
||||
if (processVersionParam != null) {
|
||||
@@ -281,14 +390,16 @@ public class JavaProcessUtil {
|
||||
if (processItem != null && !searchItems.contains(processItem)) {
|
||||
boolean seperated = getBooleanParamValue(node, "USE_INDEPENDENT_PROCESS") //$NON-NLS-1$
|
||||
|| getBooleanParamValue(node, "USE_DYNAMIC_JOB"); //$NON-NLS-1$
|
||||
if (!seperated || BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_WITH_INDEPENDENT)) {
|
||||
if (!seperated || BitwiseOptionUtils.containOption(options,
|
||||
TalendProcessOptionConstants.MODULES_WITH_INDEPENDENT)) {
|
||||
// avoid dead loop of method call
|
||||
searchItems.add(processItem);
|
||||
JobInfo subJobInfo = new JobInfo(processItem, context);
|
||||
IDesignerCoreService service = CorePlugin.getDefault().getDesignerCoreService();
|
||||
IProcess child = service.getProcessFromItem(subJobInfo.getProcessItem());
|
||||
|
||||
if (!BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_WITH_CHILDREN)) {
|
||||
|
||||
if (!BitwiseOptionUtils.containOption(options,
|
||||
TalendProcessOptionConstants.MODULES_WITH_CHILDREN)) {
|
||||
options |= TalendProcessOptionConstants.MODULES_WITH_CHILDREN;
|
||||
}
|
||||
getNeededModules(child, searchItems, modulesNeeded, options);
|
||||
@@ -357,7 +468,8 @@ public class JavaProcessUtil {
|
||||
if (curParamValue != null) {
|
||||
if (curParamValue instanceof String) {
|
||||
if (StringUtils.isNotEmpty((String) curParamValue)) {
|
||||
modulesNeeded.add(getModuleValue(process, (String) curParamValue));
|
||||
modulesNeeded
|
||||
.add(evaluateOsgiDependency(getModuleValue(process, (String) curParamValue), node));
|
||||
}
|
||||
} else if (curParamValue instanceof List) {
|
||||
getModulesInTable(process, curParam, modulesNeeded);
|
||||
@@ -377,13 +489,15 @@ public class JavaProcessUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static void getModulesInTable(final IProcess process, IElementParameter curParam, List<ModuleNeeded> modulesNeeded) {
|
||||
private static void getModulesInTable(final IProcess process, IElementParameter curParam,
|
||||
List<ModuleNeeded> modulesNeeded) {
|
||||
|
||||
if (!(curParam.getValue() instanceof List)) {
|
||||
return;
|
||||
}
|
||||
List<Map<String, Object>> values = (List<Map<String, Object>>) curParam.getValue();
|
||||
if (values != null && !values.isEmpty()) {
|
||||
boolean updateCustomMavenUri = false;
|
||||
Object[] listItemsValue = curParam.getListItemsValue();
|
||||
if (listItemsValue != null && listItemsValue.length > 0 && listItemsValue[0] instanceof IElementParameter) {
|
||||
for (Object o : listItemsValue) {
|
||||
@@ -397,11 +511,13 @@ public class JavaProcessUtil {
|
||||
if (isContextMode) {
|
||||
List<IContext> listContext = process.getContextManager().getListContext();
|
||||
for (IContext context : listContext) {
|
||||
List<IContextParameter> contextParameterList = context.getContextParameterList();
|
||||
List<IContextParameter> contextParameterList =
|
||||
context.getContextParameterList();
|
||||
for (IContextParameter contextPara : contextParameterList) {
|
||||
String var = ContextParameterUtils.getVariableFromCode(moduleName);
|
||||
if (var.equals(contextPara.getName())) {
|
||||
String value = context.getContextParameter(contextPara.getName()).getValue();
|
||||
String value =
|
||||
context.getContextParameter(contextPara.getName()).getValue();
|
||||
|
||||
if (curParam.getName().equals(EParameterName.DRIVER_JAR.getName())
|
||||
&& value.contains(";")) { //$NON-NLS-1$
|
||||
@@ -409,8 +525,17 @@ public class JavaProcessUtil {
|
||||
for (String jar2 : jars) {
|
||||
String jar = jar2;
|
||||
jar = jar.substring(jar.lastIndexOf("\\") + 1); //$NON-NLS-1$
|
||||
ModuleNeeded module = new ModuleNeeded(null,
|
||||
TalendTextUtils.removeQuotes(jar), null, true);
|
||||
ModuleNeeded module = null;
|
||||
String jarName = TalendTextUtils.removeQuotes(jar);
|
||||
if (!jarName.toLowerCase().endsWith(".jar")) {
|
||||
module = ModulesNeededProvider
|
||||
.getModuleNeededById(jarName);
|
||||
if (module == null) {
|
||||
module = new ModuleNeeded(null, jarName, null, true);
|
||||
}
|
||||
} else {
|
||||
module = new ModuleNeeded(null, jarName, null, true);
|
||||
}
|
||||
modulesNeeded.add(module);
|
||||
}
|
||||
} else if (curParam.getName().equals("connection.driverTable") //$NON-NLS-1$
|
||||
@@ -425,8 +550,9 @@ public class JavaProcessUtil {
|
||||
}
|
||||
} else {
|
||||
value = value.substring(value.lastIndexOf("\\") + 1); //$NON-NLS-1$
|
||||
|
||||
ModuleNeeded module = new ModuleNeeded(null, TalendTextUtils.removeQuotes(value), null, true);
|
||||
|
||||
ModuleNeeded module = new ModuleNeeded(null,
|
||||
TalendTextUtils.removeQuotes(value), null, true);
|
||||
modulesNeeded.add(module);
|
||||
}
|
||||
}
|
||||
@@ -434,17 +560,21 @@ public class JavaProcessUtil {
|
||||
}
|
||||
|
||||
} else {
|
||||
ModuleNeeded mn = getModuleValue(process, moduleName);
|
||||
ModuleNeeded mn = null;
|
||||
if (!moduleName.toLowerCase().endsWith(".jar")) {
|
||||
mn = ModulesNeededProvider.getModuleNeededById(moduleName);
|
||||
if (mn == null) {
|
||||
mn = getModuleValue(process, moduleName);
|
||||
}
|
||||
} else {
|
||||
mn = getModuleValue(process, moduleName);
|
||||
}
|
||||
|
||||
if (line.get("JAR_NEXUS_VERSION") != null) {
|
||||
String a = moduleName.replaceFirst("[.][^.]+$", "");
|
||||
mn.setMavenUri(
|
||||
"mvn:org.talend.libraries/" + a + "/" + line.get("JAR_NEXUS_VERSION") + "/jar");
|
||||
mn.setMavenUri("mvn:org.talend.libraries/" + a + "/"
|
||||
+ line.get("JAR_NEXUS_VERSION") + "/jar");
|
||||
|
||||
mn.setCustomMavenUri(mn.getMavenUri());
|
||||
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister
|
||||
.getDefault().getService(ILibraryManagerService.class);
|
||||
libManagerService.saveCustomMavenURIMap();
|
||||
}
|
||||
modulesNeeded.add(mn);
|
||||
}
|
||||
@@ -482,25 +612,27 @@ public class JavaProcessUtil {
|
||||
* @param neededLibraries
|
||||
* @param curParam
|
||||
*/
|
||||
public static void findMoreLibraries(final IProcess process, List<ModuleNeeded> modulesNeeded, IElementParameter curParam) {
|
||||
public static void findMoreLibraries(final IProcess process, List<ModuleNeeded> modulesNeeded,
|
||||
IElementParameter curParam) {
|
||||
Object value = curParam.getValue();
|
||||
String name = curParam.getName();
|
||||
if (name.equals("DRIVER_JAR") || name.equals("connection.driverTable")) { //$NON-NLS-1$
|
||||
// added for bug 13592. new parameter DRIVER_JAR was used for jdbc connection
|
||||
if (value != null && value instanceof List) {
|
||||
List list = (List) value;
|
||||
boolean updateCustomMavenUri = false;
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i) instanceof HashMap) {
|
||||
HashMap map = (HashMap) list.get(i); // JAR_NAME
|
||||
Object object = null;
|
||||
if(name.equals("DRIVER_JAR")){ //$NON-NLS-1$
|
||||
if (name.equals("DRIVER_JAR")) { //$NON-NLS-1$
|
||||
object = map.get("JAR_NAME"); //$NON-NLS-1$
|
||||
}else{
|
||||
} else {
|
||||
object = map.get("drivers");//$NON-NLS-1$
|
||||
}
|
||||
if (object != null && object instanceof String) {
|
||||
String driverName = (String) object;
|
||||
if (driverName != null && !"".equals(driverName)) { //$NON-NLS-1$
|
||||
if (!"".equals(driverName)) { //$NON-NLS-1$
|
||||
boolean isContextMode = ContextParameterUtils.containContextVariables(driverName);
|
||||
if (isContextMode) {
|
||||
getModulesInTable(process, curParam, modulesNeeded);
|
||||
@@ -510,15 +642,20 @@ public class JavaProcessUtil {
|
||||
if (StringUtils.isNotBlank((String) map.get("JAR_NEXUS_VERSION"))) {
|
||||
module = new ModuleNeeded(null, null, true,
|
||||
"mvn:org.talend.libraries/"
|
||||
+ TalendTextUtils.removeQuotes(driverName).replaceFirst("[.][^.]+$", "")
|
||||
+ TalendTextUtils.removeQuotes(driverName).replaceFirst(
|
||||
"[.][^.]+$", "")
|
||||
+ "/" + (String) map.get("JAR_NEXUS_VERSION") + "/jar");
|
||||
module.setCustomMavenUri(module.getMavenUri());
|
||||
ILibraryManagerService libManagerService = (ILibraryManagerService) GlobalServiceRegister
|
||||
.getDefault().getService(ILibraryManagerService.class);
|
||||
libManagerService.saveCustomMavenURIMap();
|
||||
|
||||
} else {
|
||||
module = new ModuleNeeded(null, TalendTextUtils.removeQuotes(driverName), null, true);
|
||||
String moduleName = TalendTextUtils.removeQuotes(driverName);
|
||||
if (!moduleName.toLowerCase().endsWith(".jar")) {
|
||||
module = ModulesNeededProvider.getModuleNeededById(moduleName);
|
||||
if (module == null) {
|
||||
module = new ModuleNeeded(null, moduleName, null, true);
|
||||
}
|
||||
} else {
|
||||
module = new ModuleNeeded(null, moduleName, null, true);
|
||||
}
|
||||
}
|
||||
modulesNeeded.add(module);
|
||||
}
|
||||
@@ -698,4 +835,40 @@ public class JavaProcessUtil {
|
||||
return value;
|
||||
}
|
||||
|
||||
private static ModuleNeeded evaluateOsgiDependency(ModuleNeeded module, INode node) {
|
||||
if (node == null) {
|
||||
return module;
|
||||
}
|
||||
IProcess rawProcess = node.getProcess();
|
||||
if (!(rawProcess instanceof IProcess2)) {
|
||||
return module;
|
||||
}
|
||||
IProcess2 process = (IProcess2) rawProcess;
|
||||
if (!"CAMEL".equals(process.getComponentsType())) {
|
||||
return module;
|
||||
}
|
||||
String uniqueName = node.getUniqueName();
|
||||
if (uniqueName == null || !uniqueName.startsWith("cMessagingEndpoint")) {
|
||||
return module;
|
||||
}
|
||||
String moduleName = module.getModuleName();
|
||||
if (moduleName == null) {
|
||||
return module;
|
||||
}
|
||||
Map<Object, Object> additionalProperties = process.getAdditionalProperties();
|
||||
if (additionalProperties != null) {
|
||||
Object bundleClassPath = additionalProperties.get("Bundle-ClassPath");
|
||||
if (bundleClassPath instanceof String) {
|
||||
StringTokenizer bcp = new StringTokenizer((String) bundleClassPath, ",", false);
|
||||
while (bcp.hasMoreTokens()) {
|
||||
String token = bcp.nextToken();
|
||||
if (token.startsWith(moduleName)) {
|
||||
return module;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
module.getExtraAttributes().put("IS_OSGI_EXCLUDED", "true");
|
||||
return module;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,9 @@ ToolbarInputZone.widgetTooltip.removeAlias=Remove alias
|
||||
ToolbarOutputZone.widgetTooltip.addOutputTable=Add output table
|
||||
ToolbarOutputZone.widgetTooltip.removeOutputTable=Remove selected output table
|
||||
ToolbarOutputZone.widgetTooltip.mapInputAndOutput=Map automatically inputs and outputs (for empty expressions only)
|
||||
ToolbarOutputZone.widgetTooltip.delimitedIdentifiers=Active me to add double quotes for schemas to support delimited identifiers.
|
||||
ToolbarOutputZone.widgetText.autoMap=Auto map\!
|
||||
ToolbarOutputZone.widgetText.delimitedIdentifiers=Delimited identifiers
|
||||
|
||||
EntryContentProposal.metadataColumn=Metadata column
|
||||
EntryContentProposal.properties=properties :
|
||||
|
||||
@@ -29,16 +29,21 @@ import org.talend.core.model.components.IODataComponentContainer;
|
||||
import org.talend.core.model.genhtml.HTMLDocUtils;
|
||||
import org.talend.core.model.metadata.ColumnNameChanged;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.process.EComponentCategory;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IComponentDocumentation;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IExternalData;
|
||||
import org.talend.core.model.process.IExternalNode;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.Problem;
|
||||
import org.talend.core.model.process.node.IExternalMapEntry;
|
||||
import org.talend.core.model.temp.ECodePart;
|
||||
import org.talend.designer.abstractmap.AbstractMapComponent;
|
||||
import org.talend.designer.codegen.ICodeGeneratorService;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.components.ElementParameter;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.AbstractExternalData;
|
||||
import org.talend.designer.core.ui.editor.connections.Connection;
|
||||
import org.talend.designer.dbmap.external.converter.ExternalNodeUtils;
|
||||
@@ -159,6 +164,23 @@ public class DbMapComponent extends AbstractMapComponent {
|
||||
*/
|
||||
@Override
|
||||
public void restoreMapperModelFromInternalData() {
|
||||
INode origNode = getOriginalNode();
|
||||
if (origNode != null) {
|
||||
IElementParameter activeDelimitedIdentifiersEP = origNode
|
||||
.getElementParameter(EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName());
|
||||
if (activeDelimitedIdentifiersEP == null) {
|
||||
activeDelimitedIdentifiersEP = new ElementParameter(origNode);
|
||||
activeDelimitedIdentifiersEP.setShow(false);
|
||||
activeDelimitedIdentifiersEP.setFieldType(EParameterFieldType.TEXT);
|
||||
activeDelimitedIdentifiersEP.setName(EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName());
|
||||
activeDelimitedIdentifiersEP.setCategory(EComponentCategory.TECHNICAL);
|
||||
activeDelimitedIdentifiersEP.setNumRow(99);
|
||||
activeDelimitedIdentifiersEP.setReadOnly(false);
|
||||
List<IElementParameter> elemParams = (List<IElementParameter>) origNode.getElementParameters();
|
||||
elemParams.add(activeDelimitedIdentifiersEP);
|
||||
}
|
||||
activeDelimitedIdentifiersEP.setValue(getGenerationManager().isUseDelimitedIdentifiers());
|
||||
}
|
||||
mapperMain.loadModelFromInternalData();
|
||||
metadataListOut = mapperMain.getMetadataListOut();
|
||||
externalData = mapperMain.buildExternalData();
|
||||
@@ -572,11 +594,37 @@ public class DbMapComponent extends AbstractMapComponent {
|
||||
} else {
|
||||
throw new IllegalArgumentException(Messages.getString("DbMapComponent.unknowValue") + value); //$NON-NLS-1$
|
||||
}
|
||||
updateUseDelimitedIdentifiersStatus();
|
||||
}
|
||||
|
||||
return generationManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOriginalNode(INode originalNode) {
|
||||
super.setOriginalNode(originalNode);
|
||||
updateUseDelimitedIdentifiersStatus();
|
||||
}
|
||||
|
||||
private void updateUseDelimitedIdentifiersStatus() {
|
||||
if (generationManager == null) {
|
||||
return;
|
||||
}
|
||||
INode oriNode = getOriginalNode();
|
||||
if (oriNode != null) {
|
||||
IElementParameter activeDelimitedIdentifiersEP = oriNode
|
||||
.getElementParameter(EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName());
|
||||
boolean activeDelimitedIdentifiers = false;
|
||||
if (activeDelimitedIdentifiersEP != null) {
|
||||
Object value = activeDelimitedIdentifiersEP.getValue();
|
||||
if (value != null) {
|
||||
activeDelimitedIdentifiers = Boolean.valueOf(value.toString());
|
||||
}
|
||||
}
|
||||
generationManager.setUseDelimitedIdentifiers(activeDelimitedIdentifiers);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -27,18 +27,25 @@ import java.util.regex.PatternSyntaxException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.StringUtils;
|
||||
import org.talend.commons.utils.data.text.StringHelper;
|
||||
import org.talend.core.database.EDatabaseTypeName;
|
||||
import org.talend.core.model.metadata.Dbms;
|
||||
import org.talend.core.model.metadata.IMetadataColumn;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MappingTypeRetriever;
|
||||
import org.talend.core.model.metadata.MetadataTalendType;
|
||||
import org.talend.core.model.metadata.MetadataToolHelper;
|
||||
import org.talend.core.model.process.EConnectionType;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IExternalNode;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.utils.ContextParameterUtils;
|
||||
import org.talend.core.model.utils.TalendTextUtils;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.dbmap.DbMapComponent;
|
||||
import org.talend.designer.dbmap.external.data.ExternalDbMapData;
|
||||
import org.talend.designer.dbmap.external.data.ExternalDbMapEntry;
|
||||
@@ -80,6 +87,8 @@ public abstract class DbGenerationManager {
|
||||
|
||||
protected DataMapExpressionParser parser;
|
||||
|
||||
private Boolean useDelimitedIdentifiers;
|
||||
|
||||
/**
|
||||
* DOC amaumont GenerationManager constructor comment.
|
||||
*
|
||||
@@ -259,13 +268,14 @@ public abstract class DbGenerationManager {
|
||||
* @param tabSpaceString
|
||||
* @return
|
||||
*/
|
||||
public String buildSqlSelect(DbMapComponent component, String outputTableName, String tabString) {
|
||||
public String buildSqlSelect(DbMapComponent dbMapComponent, String outputTableName, String tabString) {
|
||||
queryColumnsName = "\""; //$NON-NLS-1$
|
||||
aliasAlreadyDeclared.clear();
|
||||
queryColumnsSegments.clear();
|
||||
querySegments.clear();
|
||||
|
||||
this.tabSpaceString = tabString;
|
||||
DbMapComponent component = getDbMapComponent(dbMapComponent);
|
||||
|
||||
List<IConnection> outputConnections = (List<IConnection>) component.getOutgoingConnections();
|
||||
|
||||
@@ -364,15 +374,6 @@ public abstract class DbGenerationManager {
|
||||
|
||||
}
|
||||
|
||||
StringBuilder sbWhere = new StringBuilder();
|
||||
boolean isFirstClause = true;
|
||||
for (int i = 0; i < lstSizeInputTables; i++) {
|
||||
ExternalDbMapTable inputTable = inputTables.get(i);
|
||||
if (buildConditions(component, sbWhere, inputTable, false, isFirstClause)) {
|
||||
isFirstClause = false;
|
||||
}
|
||||
}
|
||||
|
||||
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
|
||||
appendSqlQuery(sb, tabSpaceString);
|
||||
IJoinType previousJoinType = null;
|
||||
@@ -423,7 +424,7 @@ public abstract class DbGenerationManager {
|
||||
appendSqlQuery(sb, DbMapSqlConstants.ON);
|
||||
appendSqlQuery(sb, DbMapSqlConstants.LEFT_BRACKET);
|
||||
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
|
||||
if (!buildConditions(component, sb, inputTable, true, true)) {
|
||||
if (!buildConditions(component, sb, inputTable, true, true, true)) {
|
||||
appendSqlQuery(sb, DbMapSqlConstants.LEFT_COMMENT);
|
||||
appendSqlQuery(sb, DbMapSqlConstants.SPACE);
|
||||
appendSqlQuery(sb, Messages.getString("DbGenerationManager.conditionNotSet"));//$NON-NLS-1$
|
||||
@@ -436,6 +437,16 @@ public abstract class DbGenerationManager {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sbWhere = new StringBuilder();
|
||||
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
|
||||
boolean isFirstClause = true;
|
||||
for (int i = 0; i < lstSizeInputTables; i++) {
|
||||
ExternalDbMapTable inputTable = inputTables.get(i);
|
||||
if (buildConditions(component, sbWhere, inputTable, false, isFirstClause, false)) {
|
||||
isFirstClause = false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* for addition conditions
|
||||
*/
|
||||
@@ -473,16 +484,19 @@ public abstract class DbGenerationManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ExternalDbMapEntry> customOtherConditionsEntries = outputTable.getCustomOtherConditionsEntries();
|
||||
if (customOtherConditionsEntries != null) {
|
||||
for (ExternalDbMapEntry entry : customOtherConditionsEntries) {
|
||||
String exp = initExpression(component, entry);
|
||||
if (exp != null && !DbMapSqlConstants.EMPTY.equals(exp.trim())) {
|
||||
exp = replaceVariablesForExpression(component, exp);
|
||||
otherAddition.add(exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.tabSpaceString = tabString;
|
||||
|
||||
String whereClauses = sbWhere.toString();
|
||||
|
||||
@@ -535,6 +549,42 @@ public abstract class DbGenerationManager {
|
||||
return sqlQuery;
|
||||
}
|
||||
|
||||
protected DbMapComponent getDbMapComponent(DbMapComponent dbMapComponent) {
|
||||
DbMapComponent component = dbMapComponent;
|
||||
INode realGraphicalNode = dbMapComponent.getRealGraphicalNode();
|
||||
if (realGraphicalNode != null) {
|
||||
IExternalNode externalNode = realGraphicalNode.getExternalNode();
|
||||
if (externalNode instanceof DbMapComponent) {
|
||||
component = (DbMapComponent) externalNode;
|
||||
}
|
||||
}
|
||||
checkParameters(component);
|
||||
return component;
|
||||
}
|
||||
|
||||
protected void checkParameters(DbMapComponent component) {
|
||||
checkUseDelimitedIdentifiers(component);
|
||||
}
|
||||
|
||||
protected void checkUseDelimitedIdentifiers(DbMapComponent component) {
|
||||
/**
|
||||
* in elt related component javajets(like tELTMSSqlMap_main.javajet), they don't get DbGenerationManager by
|
||||
* DbMapComponent#getGenerationManager() while they construct a new manager manually, so some parameters may not
|
||||
* be initialised, then need to check these parameters here manually to make sure they are initialised.
|
||||
*/
|
||||
if (this.useDelimitedIdentifiers == null) {
|
||||
this.useDelimitedIdentifiers = false;
|
||||
IElementParameter activeDelimitedIdentifiersEP = component
|
||||
.getElementParameter(EParameterName.ACTIVE_DATABASE_DELIMITED_IDENTIFIERS.getName());
|
||||
if (activeDelimitedIdentifiersEP != null) {
|
||||
Object value = activeDelimitedIdentifiersEP.getValue();
|
||||
if (value != null) {
|
||||
setUseDelimitedIdentifiers(Boolean.valueOf(value.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC wchen Comment method "replaceExpression".
|
||||
@@ -675,13 +725,27 @@ public abstract class DbGenerationManager {
|
||||
*/
|
||||
protected boolean buildConditions(DbMapComponent component, StringBuilder sb, ExternalDbMapTable inputTable,
|
||||
boolean writeForJoin, boolean isFirstClause) {
|
||||
return buildConditions(component, sb, inputTable, writeForJoin, isFirstClause, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "buildConditions".
|
||||
*
|
||||
* @param sb
|
||||
* @param inputTable
|
||||
* @param writeForJoin TODO
|
||||
* @param isFirstClause TODO
|
||||
* @param isSqlQuert TODO
|
||||
*/
|
||||
protected boolean buildConditions(DbMapComponent component, StringBuilder sb, ExternalDbMapTable inputTable,
|
||||
boolean writeForJoin, boolean isFirstClause, boolean isSqlQuert) {
|
||||
List<ExternalDbMapEntry> inputEntries = inputTable.getMetadataTableEntries();
|
||||
int lstSizeEntries = inputEntries.size();
|
||||
boolean atLeastOneConditionWritten = false;
|
||||
for (int j = 0; j < lstSizeEntries; j++) {
|
||||
ExternalDbMapEntry dbMapEntry = inputEntries.get(j);
|
||||
if (writeForJoin == dbMapEntry.isJoin()) {
|
||||
boolean conditionWritten = buildCondition(component, sb, inputTable, isFirstClause, dbMapEntry, !writeForJoin);
|
||||
boolean conditionWritten = buildCondition(component, sb, inputTable, isFirstClause, dbMapEntry, !writeForJoin, isSqlQuert);
|
||||
if (conditionWritten) {
|
||||
atLeastOneConditionWritten = true;
|
||||
}
|
||||
@@ -704,6 +768,20 @@ public abstract class DbGenerationManager {
|
||||
*/
|
||||
private boolean buildCondition(DbMapComponent component, StringBuilder sbWhere, ExternalDbMapTable table,
|
||||
boolean isFirstClause, ExternalDbMapEntry dbMapEntry, boolean writeCr) {
|
||||
return buildCondition(component, sbWhere, table, isFirstClause, dbMapEntry, writeCr, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC amaumont Comment method "buildCondition".
|
||||
*
|
||||
* @param sbWhere
|
||||
* @param table
|
||||
* @param isFirstClause
|
||||
* @param dbMapEntry
|
||||
* @param writeCr TODO
|
||||
*/
|
||||
private boolean buildCondition(DbMapComponent component, StringBuilder sbWhere, ExternalDbMapTable table,
|
||||
boolean isFirstClause, ExternalDbMapEntry dbMapEntry, boolean writeCr, boolean isSqlQuery) {
|
||||
String expression = dbMapEntry.getExpression();
|
||||
expression = initExpression(component, dbMapEntry);
|
||||
IDbOperator dbOperator = getOperatorsManager().getOperatorFromValue(dbMapEntry.getOperator());
|
||||
@@ -715,13 +793,14 @@ public abstract class DbGenerationManager {
|
||||
if (operatorIsSet) {
|
||||
|
||||
if (writeCr) {
|
||||
sbWhere.append(DbMapSqlConstants.NEW_LINE).append(tabSpaceString);
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.NEW_LINE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, tabSpaceString, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
}
|
||||
if (!isFirstClause) {
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
sbWhere.append(DbMapSqlConstants.AND);
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.AND, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
}
|
||||
String entryName = dbMapEntry.getName();
|
||||
entryName = getOriginalColumnName(entryName, component, table);
|
||||
@@ -731,32 +810,34 @@ public abstract class DbGenerationManager {
|
||||
} else {
|
||||
tableName = getHandledField(table.getAlias());
|
||||
}
|
||||
entryName = getColumnName(null, entryName);
|
||||
String locationInputEntry = language.getLocation(tableName, getHandledField(entryName));
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
sbWhere.append(locationInputEntry);
|
||||
sbWhere.append(getSpecialRightJoin(table));
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, locationInputEntry, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, getSpecialRightJoin(table), isSqlQuery);
|
||||
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
if (operatorIsSet) {
|
||||
sbWhere.append(dbOperator.getOperator()).append(DbMapSqlConstants.SPACE);
|
||||
appendSqlQuery(sbWhere, dbOperator.getOperator(), isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
} else if (!operatorIsSet && expressionIsSet) {
|
||||
sbWhere.append(DbMapSqlConstants.LEFT_COMMENT);
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
sbWhere.append(Messages.getString("DbGenerationManager.InputOperationSetMessage", entryName)); //$NON-NLS-1$
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
sbWhere.append(DbMapSqlConstants.RIGHT_COMMENT);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.LEFT_COMMENT, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, Messages.getString("DbGenerationManager.InputOperationSetMessage", entryName), isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.RIGHT_COMMENT, isSqlQuery);
|
||||
}
|
||||
if (operatorIsSet && !expressionIsSet && !dbOperator.isMonoOperand()) {
|
||||
String str = table.getName() + DbMapSqlConstants.DOT + entryName;
|
||||
sbWhere.append(DbMapSqlConstants.LEFT_COMMENT);
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
sbWhere.append(Messages.getString("DbGenerationManager.InputExpSetMessage", str)); //$NON-NLS-1$
|
||||
sbWhere.append(DbMapSqlConstants.SPACE);
|
||||
sbWhere.append(DbMapSqlConstants.RIGHT_COMMENT);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.LEFT_COMMENT, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, Messages.getString("DbGenerationManager.InputExpSetMessage", str), isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.SPACE, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, DbMapSqlConstants.RIGHT_COMMENT, isSqlQuery);
|
||||
} else if (expressionIsSet) {
|
||||
String exp = replaceVariablesForExpression(component, expression);
|
||||
sbWhere.append(exp);
|
||||
sbWhere.append(getSpecialLeftJoin(table));
|
||||
appendSqlQuery(sbWhere, exp, isSqlQuery);
|
||||
appendSqlQuery(sbWhere, getSpecialLeftJoin(table), isSqlQuery);
|
||||
}
|
||||
conditionWritten = true;
|
||||
|
||||
@@ -939,6 +1020,7 @@ public abstract class DbGenerationManager {
|
||||
}
|
||||
|
||||
protected String initExpression(DbMapComponent component, ExternalDbMapEntry dbMapEntry) {
|
||||
String quote = getQuote(component);
|
||||
String expression = dbMapEntry.getExpression();
|
||||
if (expression != null) {
|
||||
List<Map<String, String>> itemNameList = null;
|
||||
@@ -963,6 +1045,7 @@ public abstract class DbGenerationManager {
|
||||
itemNameList = mapParser2.parseInTableEntryLocations(expression);
|
||||
}
|
||||
|
||||
String quoParser = "[\\\\]?\\" + quote; //$NON-NLS-1$
|
||||
for (Map<String, String> itemNamemap : itemNameList) {
|
||||
Set<Entry<String, String>> set = itemNamemap.entrySet();
|
||||
Iterator<Entry<String, String>> ite = set.iterator();
|
||||
@@ -1027,19 +1110,33 @@ public abstract class DbGenerationManager {
|
||||
continue;
|
||||
}
|
||||
if (expression.trim().equals(tableValue + "." + oriName)) {
|
||||
expression = tableValue + "." + getColumnName(iconn, oriName, quote);
|
||||
if(TalendQuoteUtils.QUOTATION_MARK.equals(quote)){
|
||||
expression = expression.replaceAll(quoParser,"\\\\" +quote); //$NON-NLS-1$
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (expression.trim().equals(originaltableName + "." + oriName)) {
|
||||
expression = originaltableName + "." + getColumnName(iconn, oriName, quote);
|
||||
if(TalendQuoteUtils.QUOTATION_MARK.equals(quote)){
|
||||
expression = expression.replaceAll(quoParser,"\\\\" +quote); //$NON-NLS-1$
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// if it is temp delived table, use label to generate sql
|
||||
if (iconn.getLineStyle() == EConnectionType.TABLE_REF) {
|
||||
continue;
|
||||
}
|
||||
oriName = oriName.replaceAll("\\$", "\\\\\\$"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
expression = expression.replaceFirst("\\." + co.getLabel(), //$NON-NLS-1$
|
||||
"\\." + oriName); //$NON-NLS-1$
|
||||
expression = expression.replace("\"", "\\\"");
|
||||
if (!isRefTableConnection(iconn) && isUseDelimitedIdentifiers()) {
|
||||
oriName = getColumnName(iconn, oriName, quote);
|
||||
} else {
|
||||
oriName = oriName.replaceAll("\\$", "\\\\\\$"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
expression = expression.replaceFirst(tableValue + "\\." + co.getLabel(), //$NON-NLS-1$
|
||||
tableValue + "\\." + oriName); //$NON-NLS-1$
|
||||
if(TalendQuoteUtils.QUOTATION_MARK.equals(quote)){
|
||||
expression = replaceAuotes(expression, quoParser, quote);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1053,6 +1150,62 @@ public abstract class DbGenerationManager {
|
||||
|
||||
return expression;
|
||||
}
|
||||
|
||||
protected String replaceAuotes(String expression, String quoParser, String quote){
|
||||
if(!expression.contains("'")){
|
||||
return expression.replaceAll(quoParser,"\\\\" +quote); //$NON-NLS-1$
|
||||
}
|
||||
List<Integer> indexs = new ArrayList<>();
|
||||
for(int i=0;i<expression.length();i++){
|
||||
if("'".equals(String.valueOf(expression.charAt(i)))){
|
||||
indexs.add(i);
|
||||
}
|
||||
}
|
||||
StringBuffer result = new StringBuffer();
|
||||
int start = 0;
|
||||
for(int i=0;i<indexs.size();i++){
|
||||
if(i == 0){
|
||||
if(indexs.size() == 1 && indexs.get(i) == 0){
|
||||
result.append(expression.substring(0, indexs.get(i)+1));
|
||||
}else{
|
||||
String exp = expression.substring(start, indexs.get(i));
|
||||
result.append(exp.replaceAll(quoParser,"\\\\" +quote)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
if(i % 2 == 0 && i != indexs.size() - 1){
|
||||
result.append(expression.substring(indexs.get(i), indexs.get(i+1)+1));
|
||||
if (i < indexs.size() - 2) {
|
||||
String exp = expression.substring(indexs.get(i + 1) + 1, indexs.get(i + 2));
|
||||
result.append(exp.replaceAll(quoParser,"\\\\" +quote)); //$NON-NLS-1$
|
||||
}
|
||||
start = indexs.get(i+1)+1;
|
||||
}else if(i == indexs.size() - 1){
|
||||
String exp = expression.substring(indexs.get(i)+1, expression.length());
|
||||
result.append(exp.replaceAll(quoParser,"\\\\" +quote)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private String getQuote(DbMapComponent component){
|
||||
String quote = TalendQuoteUtils.QUOTATION_MARK;
|
||||
IElementParameter mappingPara = component.getElementParameter(EParameterName.MAPPING.getName());
|
||||
if(mappingPara == null){
|
||||
return quote;
|
||||
}
|
||||
String mapping = (String) mappingPara.getValue();
|
||||
if(mapping == null){
|
||||
return quote;
|
||||
}
|
||||
MappingTypeRetriever mappingTypeRetriever = MetadataTalendType.getMappingTypeRetriever(mapping);
|
||||
if (mappingTypeRetriever == null) {
|
||||
return quote;
|
||||
}
|
||||
Dbms dbms = mappingTypeRetriever.getDbms();
|
||||
String product = dbms.getProduct();
|
||||
EDatabaseTypeName type = EDatabaseTypeName.getTypeFromProductName(product);
|
||||
return TalendQuoteUtils.getQuoteByDBType(type);
|
||||
}
|
||||
|
||||
private String getOriginalColumnName(String entryName, DbMapComponent component, ExternalDbMapTable table) {
|
||||
List<IConnection> inputConnections = (List<IConnection>) component.getIncomingConnections();
|
||||
@@ -1154,8 +1307,58 @@ public abstract class DbGenerationManager {
|
||||
|
||||
}
|
||||
|
||||
protected String getColumnName(IConnection conn, String name) {
|
||||
if (!isRefTableConnection(conn) && isUseDelimitedIdentifiers()) {
|
||||
return getNameWithDelimitedIdentifier(name);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getColumnName(IConnection conn, String name, String quote) {
|
||||
if (!isRefTableConnection(conn) && isUseDelimitedIdentifiers()) {
|
||||
return getNameWithDelimitedIdentifier(name, quote);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isRefTableConnection(IConnection conn) {
|
||||
return conn != null && conn.getLineStyle() == EConnectionType.TABLE_REF;
|
||||
}
|
||||
|
||||
protected String getNameWithDelimitedIdentifier(String name) {
|
||||
final String delimitedIdentifier = getDelimitedIdentifiers();
|
||||
String newName = name;
|
||||
newName = newName.replaceAll("\"", "\"\"");
|
||||
newName = delimitedIdentifier + newName + delimitedIdentifier;
|
||||
return newName;
|
||||
}
|
||||
|
||||
protected String getNameWithDelimitedIdentifier(String name, String quote) {
|
||||
String newName = name;
|
||||
newName = newName.replaceAll("\"", "\"\"");
|
||||
newName = quote + newName + quote;
|
||||
return newName;
|
||||
}
|
||||
|
||||
protected String getDelimitedIdentifiers() {
|
||||
return "\""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
protected String getHandledField(String field) {
|
||||
if (field != null) {
|
||||
field = field.replace("\"", "\\\"");
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
||||
public boolean isUseDelimitedIdentifiers() {
|
||||
return Boolean.TRUE.equals(this.useDelimitedIdentifiers);
|
||||
}
|
||||
|
||||
public void setUseDelimitedIdentifiers(boolean useDelimitedIdentifiers) {
|
||||
this.useDelimitedIdentifiers = useDelimitedIdentifiers;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.dbmap.language.hive;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.designer.dbmap.DbMapComponent;
|
||||
import org.talend.designer.dbmap.external.data.ExternalDbMapData;
|
||||
import org.talend.designer.dbmap.external.data.ExternalDbMapTable;
|
||||
@@ -53,4 +56,36 @@ public class HiveGenerationManager extends DbGenerationManager {
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String replaceVariablesForExpression(DbMapComponent component, String expression) {
|
||||
if (expression == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> contextList = getContextList(component);
|
||||
boolean haveReplace = false;
|
||||
for (String context : contextList) {
|
||||
if (expression.contains(context)) {
|
||||
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
haveReplace = true;
|
||||
}
|
||||
}
|
||||
if (!haveReplace) {
|
||||
List<String> connContextList = getConnectionContextList(component);
|
||||
for (String context : connContextList) {
|
||||
if (expression.contains(context)) {
|
||||
expression = expression.replaceAll("\\b" + context + "\\b", "\" +" + context + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> globalMapList = getGlobalMapList(component, expression);
|
||||
for (String globalMapStr : globalMapList) {
|
||||
String regex = parser.getGlobalMapExpressionRegex(globalMapStr);
|
||||
String replacement = parser.getGlobalMapReplacement(globalMapStr);
|
||||
expression = expression.replaceAll(regex, "\" +" + replacement + "+ \""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
return expression;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,15 @@ public class OracleGenerationManager extends DbGenerationManager {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String buildSqlSelect(DbMapComponent component, String outputTableName, String tabString) {
|
||||
public String buildSqlSelect(DbMapComponent dbMapComponent, String outputTableName, String tabString) {
|
||||
queryColumnsName = "\""; //$NON-NLS-1$
|
||||
aliasAlreadyDeclared.clear();
|
||||
queryColumnsSegments.clear();
|
||||
querySegments.clear();
|
||||
this.tabSpaceString = tabString;
|
||||
|
||||
DbMapComponent component = getDbMapComponent(dbMapComponent);
|
||||
|
||||
List<IConnection> outputConnections = (List<IConnection>) component.getOutgoingConnections();
|
||||
|
||||
Map<String, IConnection> nameToOutputConnection = new HashMap<String, IConnection>();
|
||||
@@ -192,6 +194,7 @@ public class OracleGenerationManager extends DbGenerationManager {
|
||||
}
|
||||
|
||||
StringBuilder sbWhere = new StringBuilder();
|
||||
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
|
||||
boolean isFirstClause = true;
|
||||
for (int i = 0; i < lstSizeInputTables; i++) {
|
||||
ExternalDbMapTable inputTable = inputTables.get(i);
|
||||
@@ -199,6 +202,7 @@ public class OracleGenerationManager extends DbGenerationManager {
|
||||
isFirstClause = false;
|
||||
}
|
||||
}
|
||||
this.tabSpaceString = tabString;
|
||||
|
||||
appendSqlQuery(sb, DbMapSqlConstants.NEW_LINE);
|
||||
appendSqlQuery(sb, tabSpaceString);
|
||||
@@ -279,6 +283,7 @@ public class OracleGenerationManager extends DbGenerationManager {
|
||||
List<String> otherAddition = new ArrayList<String>();
|
||||
|
||||
if (outputTable != null) {
|
||||
this.tabSpaceString = DEFAULT_TAB_SPACE_STRING;
|
||||
List<ExternalDbMapEntry> customWhereConditionsEntries = outputTable.getCustomWhereConditionsEntries();
|
||||
if (customWhereConditionsEntries != null) {
|
||||
for (ExternalDbMapEntry entry : customWhereConditionsEntries) {
|
||||
@@ -306,10 +311,12 @@ public class OracleGenerationManager extends DbGenerationManager {
|
||||
for (ExternalDbMapEntry entry : customOtherConditionsEntries) {
|
||||
String exp = initExpression(component, entry);
|
||||
if (exp != null && !DbMapSqlConstants.EMPTY.equals(exp.trim())) {
|
||||
exp = replaceVariablesForExpression(component, exp);
|
||||
otherAddition.add(exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.tabSpaceString = tabString;
|
||||
}
|
||||
|
||||
String whereClauses = sbWhere.toString();
|
||||
|
||||
@@ -172,6 +172,11 @@ public class PostgresGenerationManager extends DbGenerationManager {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getColumnName(IConnection conn, String name) {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildTableDeclaration(DbMapComponent component, StringBuilder sb, ExternalDbMapTable inputTable) {
|
||||
sb.append(getHandledTableName(component, inputTable.getTableName(), inputTable.getAlias(), true));
|
||||
|
||||
@@ -776,6 +776,11 @@ public class MapperManager extends AbstractMapperManager {
|
||||
uiManager.refreshSqlExpression();
|
||||
}
|
||||
|
||||
public void useDelimitedIdentifiers(boolean useDelimitedIdentifiers) {
|
||||
getComponent().getGenerationManager().setUseDelimitedIdentifiers(useDelimitedIdentifiers);
|
||||
uiManager.refreshSqlExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for problemsManager.
|
||||
*
|
||||
|
||||
@@ -36,6 +36,8 @@ public class ToolbarOutputZone extends ToolbarZone {
|
||||
|
||||
private ToolItem guessItem;
|
||||
|
||||
private ToolItem delimitedIdentifiersItem;
|
||||
|
||||
public static final String MINIMIZE_TOOLTIP = Messages.getString("ToolbarOutputZone.minimizeTooltip"); //$NON-NLS-1$
|
||||
|
||||
public static final String RESTORE_TOOLTIP = Messages.getString("ToolbarOutputZone.restorTooltip"); //$NON-NLS-1$
|
||||
@@ -82,6 +84,11 @@ public class ToolbarOutputZone extends ToolbarZone {
|
||||
guessItem.setToolTipText(Messages.getString("ToolbarOutputZone.widgetTooltip.mapInputAndOutput")); //$NON-NLS-1$
|
||||
guessItem.setText(Messages.getString("ToolbarOutputZone.widgetText.autoMap")); //$NON-NLS-1$
|
||||
|
||||
delimitedIdentifiersItem = new ToolItem(getToolBarActions(), SWT.CHECK);
|
||||
delimitedIdentifiersItem.setToolTipText(Messages.getString("ToolbarOutputZone.widgetTooltip.delimitedIdentifiers")); //$NON-NLS-1$
|
||||
delimitedIdentifiersItem.setText(Messages.getString("ToolbarOutputZone.widgetText.delimitedIdentifiers")); //$NON-NLS-1$
|
||||
delimitedIdentifiersItem
|
||||
.setSelection(getMapperManager().getComponent().getGenerationManager().isUseDelimitedIdentifiers());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,6 +98,7 @@ public class ToolbarOutputZone extends ToolbarZone {
|
||||
// final UIManager uiManager = getMapperManager().getUiManager();
|
||||
addOutputItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
getMapperManager().addOutput();
|
||||
}
|
||||
@@ -99,6 +107,7 @@ public class ToolbarOutputZone extends ToolbarZone {
|
||||
|
||||
removeOutputItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
getMapperManager().removeSelectedOutputTable();
|
||||
}
|
||||
@@ -107,26 +116,40 @@ public class ToolbarOutputZone extends ToolbarZone {
|
||||
|
||||
guessItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
getMapperManager().mapAutomaticallly();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
delimitedIdentifiersItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
getMapperManager().useDelimitedIdentifiers(delimitedIdentifiersItem.getSelection());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMinimizeTooltipText() {
|
||||
return MINIMIZE_TOOLTIP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRestoreTooltipText() {
|
||||
return RESTORE_TOOLTIP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMoveUpTooltipText() {
|
||||
return MOVE_UP_TOOLTIP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMoveDownTooltipText() {
|
||||
return MOVE_DOWN_TOOLTIP;
|
||||
}
|
||||
|
||||
@@ -62,9 +62,11 @@ public class DataMapExpressionParser {
|
||||
|
||||
// ((String)globalMap.get("tableName")).columnName
|
||||
private final static String GLOBALMAP_EXPRESSION4 = "(" + GLOBALMAP_PATTERN + COLUMN_PATTERN + ")";
|
||||
|
||||
|
||||
private final static String GLOBALMAP_EXPRESSION5 = "\\s*(\\s*(\\w+)\\s*\\.\\\\\"\\s*(.+?)\\s*\\\\\")\\s*";
|
||||
|
||||
private final static String GLOBALMAP_EXPRESSION = GLOBALMAP_EXPRESSION1 + "|" + GLOBALMAP_EXPRESSION2 + "|"//$NON-NLS-1$//$NON-NLS-2$
|
||||
+ GLOBALMAP_EXPRESSION3 + "|" + GLOBALMAP_EXPRESSION4;//$NON-NLS-1$
|
||||
+ GLOBALMAP_EXPRESSION3 + "|" + GLOBALMAP_EXPRESSION4 + "|" + GLOBALMAP_EXPRESSION5;//$NON-NLS-1$
|
||||
|
||||
private final static String EXPRESSION_PATTERN = "(\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*)" //$NON-NLS-1$
|
||||
+ "|(\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*)" //$NON-NLS-1$
|
||||
@@ -143,6 +145,10 @@ public class DataMapExpressionParser {
|
||||
} else if (matchResult.group(35) != null) {
|
||||
// ((String)globalMap.get("tableName")).columnName
|
||||
location = new TableEntryLocation(matchResult.group(36), matchResult.group(38));
|
||||
}else if (matchResult.group(39) != null) {
|
||||
// table.\"column\"
|
||||
// Case NVL(Keys.\"ORG_SCD_ID\",-99) When -99 Then 'N' Else 'Y' End
|
||||
location = new TableEntryLocation(matchResult.group(40), matchResult.group(41));
|
||||
}
|
||||
if (location != null) {
|
||||
resultList.add(location);
|
||||
|
||||
@@ -173,11 +173,13 @@ public class ProblemsAnalyser {
|
||||
for (ExternalMapperTable table : lookupTables) {
|
||||
List<ExternalMapperTableEntry> columnEntries = table.getMetadataTableEntries();
|
||||
boolean atLeastOneExpressionFilled = false;
|
||||
for (ExternalMapperTableEntry entry : columnEntries) {
|
||||
if (!StringUtils.isEmpty(entry.getExpression())) {
|
||||
atLeastOneExpressionFilled = true;
|
||||
break;
|
||||
}
|
||||
if (columnEntries != null) {
|
||||
for (ExternalMapperTableEntry entry : columnEntries) {
|
||||
if (!StringUtils.isEmpty(entry.getExpression())) {
|
||||
atLeastOneExpressionFilled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!atLeastOneExpressionFilled) {
|
||||
|
||||
@@ -38,6 +38,13 @@
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet> <!-- add xmlMappings -->
|
||||
<directory>${current.bundle.resources.dir}/xmlMappings</directory>
|
||||
<outputDirectory>xmlMappings</outputDirectory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${current.resources.dir}</directory>
|
||||
<outputDirectory>${file.separator}</outputDirectory>
|
||||
|
||||
@@ -250,7 +250,7 @@
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<survivorship.rules.dir>${current.resources.dir}/metadata/survivorship/</survivorship.rules.dir>
|
||||
<survivorship.rules.dir>${current.int-resources.dir}/metadata/survivorship/</survivorship.rules.dir>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
||||
@@ -100,6 +100,48 @@
|
||||
<include>pom.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet><!--parent pom.xml -->
|
||||
<directory>${parentpom.dir}</directory>
|
||||
<outputDirectory>.</outputDirectory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet><!--routines code -->
|
||||
<directory>${routinescode.dir}</directory>
|
||||
<outputDirectory>code/routines/src/main</outputDirectory>
|
||||
<includes>
|
||||
<include>**/**/*.*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet><!--routines pom -->
|
||||
<directory>${routinespom.dir}</directory>
|
||||
<outputDirectory>code/routines/</outputDirectory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet><!--pigudf code -->
|
||||
<directory>${pigudfcode.dir}</directory>
|
||||
<outputDirectory>code/pigudf/src/main</outputDirectory>
|
||||
<includes>
|
||||
<include>**/**/*.*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet><!--pifudf pom -->
|
||||
<directory>${pigudfpom.dir}</directory>
|
||||
<outputDirectory>code/pigudf/</outputDirectory>
|
||||
<includes>
|
||||
<include>pom.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet><!--joblet -->
|
||||
<directory>${joblet.dir}</directory>
|
||||
<outputDirectory>jobs/</outputDirectory>
|
||||
<includes>
|
||||
<include>joblets*/**/*.*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet> <!-- add items -->
|
||||
<directory>${items.dir}</directory>
|
||||
<outputDirectory>${talend.job.name}</outputDirectory>
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<talend.routine.groupid>@RoutineGroupId@</talend.routine.groupid>
|
||||
<talend.pigudf.groupid>@PigudfGroupId@</talend.pigudf.groupid>
|
||||
<talend.project.id>@ProjectId@</talend.project.id>
|
||||
<talend.project.branch>@ProjectBranch@</talend.project.branch>
|
||||
<talend.job.name>@JobName@</talend.job.name>
|
||||
<talend.job.version>@TalendJobVersion@</talend.job.version>
|
||||
<talend.job.date>${maven.build.timestamp}</talend.job.date>
|
||||
@@ -113,6 +112,12 @@
|
||||
<templates.dir>${basedir}/src/main/templates/</templates.dir>
|
||||
<assemblies.dir>${basedir}/src/main/assemblies/</assemblies.dir>
|
||||
<poms.dir>${basedir}</poms.dir>
|
||||
<parentpom.dir>${project.parent.relativePath}</parentpom.dir>
|
||||
<routinespom.dir>${parentpom.dir}code/routines/</routinespom.dir>
|
||||
<routinescode.dir>${parentpom.dir}code/routines/src/main/</routinescode.dir>
|
||||
<pigudfpom.dir>${parentpom.dir}code/pigudf/</pigudfpom.dir>
|
||||
<pigudfcode.dir>${parentpom.dir}code/pigudf/src/main/</pigudfcode.dir>
|
||||
<joblet.dir>${parentpom.dir}jobs/</joblet.dir>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
@@ -237,7 +242,7 @@
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<survivorship.rules.dir>${current.resources.dir}/metadata/survivorship/</survivorship.rules.dir>
|
||||
<survivorship.rules.dir>${current.int-resources.dir}/metadata/survivorship/</survivorship.rules.dir>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
||||
@@ -73,6 +73,10 @@ public class FeaturesModel extends BaseModel {
|
||||
return subBundles.add(model);
|
||||
}
|
||||
|
||||
public Collection<FeatureModel> getFeatures() {
|
||||
return subFeatures;
|
||||
}
|
||||
|
||||
public Collection<BundleModel> getBundles() {
|
||||
return subBundles;
|
||||
}
|
||||
|
||||
@@ -62,11 +62,11 @@ import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.runprocess.data.PerformanceData;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.seeker.RepositorySeekerManager;
|
||||
import org.talend.core.repository.utils.Log4jUtil;
|
||||
import org.talend.core.runtime.maven.MavenUrlHelper;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
@@ -76,7 +76,6 @@ import org.talend.core.runtime.projectsetting.ProjectPreferenceManager;
|
||||
import org.talend.core.service.IESBMicroService;
|
||||
import org.talend.core.service.IESBRouteService;
|
||||
import org.talend.core.ui.ITestContainerProviderService;
|
||||
import org.talend.designer.maven.launch.MavenPomCommandLauncher;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.tools.AggregatorPomsHelper;
|
||||
import org.talend.designer.maven.tools.MavenPomSynchronizer;
|
||||
@@ -665,8 +664,8 @@ public class DefaultRunProcessService implements IRunProcessService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, Project project) {
|
||||
return TalendJavaProjectManager.getTalendCodeJavaProject(type, project);
|
||||
public ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, String projectTechName) {
|
||||
return TalendJavaProjectManager.getTalendCodeJavaProject(type, projectTechName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -695,6 +694,10 @@ public class DefaultRunProcessService implements IRunProcessService {
|
||||
return ProcessorUtilities.isExportConfig();
|
||||
}
|
||||
|
||||
public boolean isdebug() {
|
||||
return ProcessorUtilities.isdebug();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildCodesJavaProject(IProgressMonitor monitor) {
|
||||
try {
|
||||
@@ -722,62 +725,59 @@ public class DefaultRunProcessService implements IRunProcessService {
|
||||
*/
|
||||
@Override
|
||||
public void initializeRootPoms() {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
try {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
AggregatorPomsHelper helper = new AggregatorPomsHelper();
|
||||
helper.installRootPom(true);
|
||||
helper.installRootPom(false);
|
||||
AggregatorPomsHelper.updateAllCodesProjectNeededModules(monitor);
|
||||
List<ProjectReference> references = ProjectManager.getInstance().getCurrentProject().getProjectReferenceList(true);
|
||||
for (ProjectReference ref : references) {
|
||||
initRefPoms(new Project(ref.getReferencedProject()));
|
||||
}
|
||||
AggregatorPomsHelper.updateRefProjectModules(references);
|
||||
helper.updateRefProjectModules(references);
|
||||
helper.updateCodeProjects(monitor, true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initRefPoms(Project project) throws Exception {
|
||||
for (ProjectReference ref : project.getProjectReferenceList(true)) {
|
||||
private void initRefPoms(Project refProject) throws Exception {
|
||||
for (ProjectReference ref : refProject.getProjectReferenceList(true)) {
|
||||
initRefPoms(new Project(ref.getReferencedProject()));
|
||||
}
|
||||
String refProjectTechName = project.getTechnicalLabel();
|
||||
AggregatorPomsHelper refHelper = new AggregatorPomsHelper(refProjectTechName);
|
||||
AggregatorPomsHelper refHelper = new AggregatorPomsHelper(refProject.getTechnicalLabel());
|
||||
|
||||
// install ref project pom.
|
||||
refHelper.installRootPom(true);
|
||||
|
||||
// install ref codes project.
|
||||
Project refProject = ProjectManager.getInstance().getProjectFromProjectTechLabel(refProjectTechName);
|
||||
Map<String, Object> argumentsMap = new HashMap<>();
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, TalendMavenConstants.GOAL_INSTALL);
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
installRefCodeProject(ERepositoryObjectType.ROUTINES, refProject, refHelper, argumentsMap, monitor);
|
||||
installRefCodeProject(ERepositoryObjectType.ROUTINES, refHelper, monitor);
|
||||
|
||||
if (ProcessUtils.isRequiredPigUDFs(null, refProject)) {
|
||||
installRefCodeProject(ERepositoryObjectType.PIG_UDF, refProject, refHelper, argumentsMap, monitor);
|
||||
installRefCodeProject(ERepositoryObjectType.PIG_UDF, refHelper, monitor);
|
||||
}
|
||||
|
||||
if (ProcessUtils.isRequiredBeans(null, refProject)) {
|
||||
installRefCodeProject(ERepositoryObjectType.valueOf("BEANS"), refProject, refHelper, argumentsMap, monitor); //$NON-NLS-1$
|
||||
installRefCodeProject(ERepositoryObjectType.valueOf("BEANS"), refHelper, monitor); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private void installRefCodeProject(ERepositoryObjectType codeType, Project refProject, AggregatorPomsHelper refHelper,
|
||||
Map<String, Object> argumentsMap, IProgressMonitor monitor) throws Exception, CoreException {
|
||||
if (!refHelper.getProjectPomsFolder().getFile(TalendMavenConstants.POM_FILE_NAME).exists()) {
|
||||
private void installRefCodeProject(ERepositoryObjectType codeType, AggregatorPomsHelper refHelper, IProgressMonitor monitor)
|
||||
throws Exception, CoreException {
|
||||
if (!refHelper.getProjectRootPom().exists()) {
|
||||
return;
|
||||
}
|
||||
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getExistingTalendCodeProject(codeType, refProject);
|
||||
String projectTechName = refHelper.getProjectTechName();
|
||||
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getExistingTalendCodeProject(codeType, projectTechName);
|
||||
if (codeProject != null) {
|
||||
codeProject.buildWholeCodeProject();
|
||||
Map<String, Object> argumentsMap = new HashMap<>();
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, TalendMavenConstants.GOAL_INSTALL);
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_PROGRAM_ARGUMENTS, TalendMavenConstants.ARG_MAIN_SKIP);
|
||||
codeProject.buildModules(monitor, null, argumentsMap);
|
||||
codeProject.getProject().delete(false, true, monitor);
|
||||
TalendJavaProjectManager.removeFromCodeJavaProjects(codeType, refProject);
|
||||
} else {
|
||||
IFile pomFile = refHelper.getCodeFolder(codeType).getFile(TalendMavenConstants.POM_FILE_NAME);
|
||||
MavenPomCommandLauncher launcher = new MavenPomCommandLauncher(pomFile, TalendMavenConstants.GOAL_INSTALL);
|
||||
launcher.execute(monitor);
|
||||
TalendJavaProjectManager.removeFromCodeJavaProjects(codeType, projectTechName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -826,6 +826,18 @@ public class DefaultRunProcessService implements IRunProcessService {
|
||||
}
|
||||
|
||||
PomUtil.updateMainJobDependencies(mainJobInfo.getPomFile(), childPoms, childJobDependencies, progressMonitor);
|
||||
|
||||
// since all the dependencies of subJob already added to mainJob
|
||||
// need to clean job dependencies of joblet
|
||||
IRepositoryViewObject mainJobObject = factory.getSpecificVersion(mainJobInfo.getJobId(), mainJobInfo.getJobVersion(),
|
||||
true);
|
||||
if (mainJobObject != null && mainJobObject.getProperty() != null) {
|
||||
Set<Property> itemChecked = new HashSet<>();
|
||||
// clear bak cache
|
||||
PomUtil.clearBakJobletCache();
|
||||
PomUtil.checkJobRelatedJobletDependencies(mainJobObject.getProperty(), RelationshipItemBuilder.JOB_RELATION,
|
||||
childJobDependencies, itemChecked, progressMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ import org.talend.designer.runprocess.java.JavaProcessor;
|
||||
*/
|
||||
public interface IESBRunContainerService extends IService {
|
||||
|
||||
void enableRuntime(boolean valueOf);
|
||||
|
||||
boolean isRuntimeEnable();
|
||||
|
||||
JavaProcessor createJavaProcessor(IProcess process, Property property, boolean filenameFromLabel);
|
||||
|
||||
@@ -191,8 +191,6 @@ public class RunProcessContext {
|
||||
|
||||
private List<PerformanceMonitor> perMonitorList = new ArrayList<PerformanceMonitor>();
|
||||
|
||||
protected IProcessor processor;
|
||||
|
||||
/** trace mananger */
|
||||
private TraceConnectionsManager traceConnectionsManager;
|
||||
|
||||
@@ -735,11 +733,8 @@ public class RunProcessContext {
|
||||
* @return
|
||||
*/
|
||||
protected IProcessor getProcessor(IProcess process, Property property) {
|
||||
if (processor == null) {
|
||||
processor = ProcessorUtilities.getProcessor(process, property);
|
||||
return ProcessorUtilities.getProcessor(process, property);
|
||||
}
|
||||
return processor;
|
||||
}
|
||||
|
||||
public synchronized int kill() {
|
||||
return kill(null);
|
||||
@@ -859,7 +854,7 @@ public class RunProcessContext {
|
||||
}
|
||||
|
||||
private boolean isESBRuntimeProcessor() {
|
||||
return "runtimeProcessor".equals(processor.getProcessorType()); //$NON-NLS-1$
|
||||
return "runtimeProcessor".equals(getProcessor(process, process.getProperty()).getProcessorType()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
// private int getWatchPort() {
|
||||
|
||||
@@ -418,8 +418,8 @@ public class RunProcessService implements IRunProcessService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, Project project) {
|
||||
return delegateService.getTalendCodeJavaProject(type, project);
|
||||
public ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, String projectTechName) {
|
||||
return delegateService.getTalendCodeJavaProject(type, projectTechName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -473,4 +473,10 @@ public class RunProcessService implements IRunProcessService {
|
||||
delegateService.handleJobDependencyLoop(mainJobInfo, listJobs, progressMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isdebug() {
|
||||
|
||||
return delegateService.isdebug();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ 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.runtime.repository.build.IMavenPomCreator;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.maven.tools.creator.CreateMavenJobPom;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IBigDataProcessor;
|
||||
@@ -223,7 +224,7 @@ public abstract class BigDataJavaProcessor extends MavenJavaProcessor implements
|
||||
// StringBuffer.
|
||||
boolean needAllLibJars = true;
|
||||
if (needsShade()) {
|
||||
BigDataJobUtil bdUtil = new BigDataJobUtil((ProcessItem) this.getProperty().getItem());
|
||||
BigDataJobUtil bdUtil = new BigDataJobUtil(process);
|
||||
if (bdUtil.isMRWithHDInsight()) {
|
||||
needAllLibJars = false;
|
||||
}
|
||||
@@ -409,7 +410,7 @@ public abstract class BigDataJavaProcessor extends MavenJavaProcessor implements
|
||||
@Override
|
||||
public boolean needsShade() {
|
||||
if (needsShade == null && property != null) {
|
||||
needsShade = new BigDataJobUtil((ProcessItem) property.getItem()).needsShade();
|
||||
needsShade = new BigDataJobUtil(process).needsShade();
|
||||
}
|
||||
return needsShade;
|
||||
}
|
||||
@@ -429,7 +430,7 @@ public abstract class BigDataJavaProcessor extends MavenJavaProcessor implements
|
||||
modulesNeeded);
|
||||
}
|
||||
|
||||
return new BigDataJobUtil((ProcessItem) property.getItem()).getShadedModulesExclude(modulesNeeded);
|
||||
return new BigDataJobUtil(getProcess()).getShadedModulesExclude(modulesNeeded);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
@@ -133,7 +136,9 @@ import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
|
||||
import org.talend.designer.core.ui.editor.CodeEditorFactory;
|
||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.maven.utils.ClasspathsJarGenerator;
|
||||
import org.talend.designer.maven.utils.MavenVersionHelper;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.designer.runprocess.ProcessorConstants;
|
||||
@@ -141,7 +146,6 @@ import org.talend.designer.runprocess.ProcessorException;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
import org.talend.designer.runprocess.RunProcessContext;
|
||||
import org.talend.designer.runprocess.RunProcessPlugin;
|
||||
import org.talend.designer.runprocess.bigdata.BigDataJobUtil;
|
||||
import org.talend.designer.runprocess.i18n.Messages;
|
||||
import org.talend.designer.runprocess.prefs.RunProcessPrefsConstants;
|
||||
import org.talend.designer.runprocess.utils.JobVMArgumentsUtil;
|
||||
@@ -349,7 +353,13 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
outputFolder = tProcessJavaProject.getTestOutputFolder();
|
||||
} else {
|
||||
srcFolder = tProcessJavaProject.getSrcFolder();
|
||||
if (ProcessorUtilities.isExportConfig() && property != null && !new BigDataJobUtil((ProcessItem)property.getItem()).needsToHaveContextInsideJar()) {
|
||||
boolean needsToHaveContextInsideJar = true;
|
||||
|
||||
if (property != null && property.getItem() instanceof ProcessItem) {
|
||||
needsToHaveContextInsideJar = !new BigDataJobUtil(process).needsToHaveContextInsideJar();
|
||||
}
|
||||
|
||||
if (ProcessorUtilities.isExportConfig() && property != null && needsToHaveContextInsideJar) {
|
||||
resourcesFolder = tProcessJavaProject.getExternalResourcesFolder();
|
||||
} else {
|
||||
resourcesFolder = tProcessJavaProject.getResourcesFolder();
|
||||
@@ -1135,6 +1145,10 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
tmpParams.add(JavaUtils.JAVA_CP);
|
||||
tmpParams.add(getLibsClasspath()); // libs
|
||||
|
||||
// in case of loop dependency caused mainClass not settled yet
|
||||
if (getMainClass() == null) {
|
||||
getSrcCodePath();
|
||||
}
|
||||
tmpParams.add(getMainClass()); // main class
|
||||
|
||||
//
|
||||
@@ -1305,6 +1319,10 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
IFolder subjobClassesFolder = subjobPrject.getOutputFolder();
|
||||
String subjobOutputPath = subjobClassesFolder.getLocation().toPortableString();
|
||||
subjobOutputPath += classPathSeparator;
|
||||
// if equals to main classPath, no need to add again
|
||||
if (subjobOutputPath.equals(outputPath)) {
|
||||
continue;
|
||||
}
|
||||
basePath.append(subjobOutputPath);
|
||||
|
||||
// add sub job src/main/resource folder as ext-resources
|
||||
@@ -1313,6 +1331,25 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
basePath.append(subjobExternalResourcePath);
|
||||
}
|
||||
|
||||
// for loop dependency, add main classPath
|
||||
if (ProcessorUtilities.hasLoopDependency() && ProcessorUtilities.getMainJobInfo() != null) {
|
||||
// add main job classes folder
|
||||
ITalendProcessJavaProject mainjobPrject = TalendJavaProjectManager
|
||||
.getTalendJobJavaProject(ProcessorUtilities.getMainJobInfo().getProcessor().getProperty());
|
||||
IFolder mainjobClassesFolder = mainjobPrject.getOutputFolder();
|
||||
String mainjobOutputPath = mainjobClassesFolder.getLocation().toPortableString();
|
||||
mainjobOutputPath += classPathSeparator;
|
||||
if (!mainjobOutputPath.equals(outputPath)) {
|
||||
basePath.append(mainjobOutputPath);
|
||||
|
||||
// add main job src/main/resource folder as ext-resources
|
||||
String mainjobExternalResourcePath = mainjobPrject.getExternalResourcesFolder().getLocation()
|
||||
.toPortableString();
|
||||
mainjobExternalResourcePath += classPathSeparator;
|
||||
basePath.append(mainjobExternalResourcePath);
|
||||
}
|
||||
}
|
||||
|
||||
ITalendProcessJavaProject routineProject = TalendJavaProjectManager
|
||||
.getTalendCodeJavaProject(ERepositoryObjectType.ROUTINES);
|
||||
String routineOutputPath = routineProject.getOutputFolder().getLocation().toPortableString();
|
||||
@@ -1345,7 +1382,12 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
final String classPathSeparator = extractClassPathSeparator();
|
||||
final String libPrefixPath = getRootWorkingDir(true);
|
||||
|
||||
Set<ModuleNeeded> neededModules = getNeededModules(TalendProcessOptionConstants.MODULES_WITH_CHILDREN);
|
||||
int option = TalendProcessOptionConstants.MODULES_WITH_CHILDREN;
|
||||
|
||||
if (isExportConfig() || isSkipClasspathJar()) {
|
||||
option = option | TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED;
|
||||
}
|
||||
Set<ModuleNeeded> neededModules = getNeededModules(option);
|
||||
JavaProcessorUtilities.checkJavaProjectLib(neededModules);
|
||||
|
||||
// Ignore hadoop confs jars in lib path.
|
||||
@@ -1375,7 +1417,19 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
} else {
|
||||
for (ModuleNeeded neededModule : neededModules) {
|
||||
MavenArtifact artifact = MavenUrlHelper.parseMvnUrl(neededModule.getMavenUri());
|
||||
libPath.append(PomUtil.getAbsArtifactPathAsCP(artifact)).append(classPathSeparator);
|
||||
boolean isSapidoc3 = "sapidoc3".equals(artifact.getArtifactId());
|
||||
if ("sapjco3".equals(artifact.getArtifactId()) || isSapidoc3) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String jarPath = JavaProcessorUtilities.getJavaProjectLibFolder2().getFile(artifact.getArtifactId() + ".jar") //$NON-NLS-1$
|
||||
.getLocation()
|
||||
.toPortableString();
|
||||
if (compareSapjco3Version(jarPath) > 0 || isSapidoc3) {
|
||||
libPath.append(jarPath).append(classPathSeparator);
|
||||
} else {
|
||||
libPath.append(PomUtil.getAbsArtifactPathAsCP(artifact)).append(classPathSeparator);
|
||||
}
|
||||
} else {
|
||||
libPath.append(PomUtil.getAbsArtifactPathAsCP(artifact)).append(classPathSeparator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1386,6 +1440,31 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
|
||||
return libPath.toString();
|
||||
}
|
||||
|
||||
private int compareSapjco3Version(String jarPath) {
|
||||
JarFile jar = null;
|
||||
String version = null;
|
||||
try {
|
||||
jar = new JarFile(jarPath);
|
||||
Manifest manifest = jar.getManifest();
|
||||
version = manifest.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_VERSION);
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
} finally {
|
||||
if (jar != null) {
|
||||
try {
|
||||
jar.close();
|
||||
} catch (IOException e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version != null) {
|
||||
return MavenVersionHelper.compareTo(version, "3.0.10"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected String getBaseLibPath() {
|
||||
return "../" + JavaUtils.JAVA_LIB_DIRECTORY; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@@ -13,14 +13,11 @@
|
||||
package org.talend.designer.runprocess.java;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
@@ -71,6 +68,7 @@ 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.core.ui.editor.process.Process;
|
||||
import org.talend.designer.core.utils.BigDataJobUtil;
|
||||
import org.talend.designer.core.utils.JavaProcessUtil;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
@@ -102,7 +100,8 @@ public class JavaProcessorUtilities {
|
||||
* @return
|
||||
*/
|
||||
public static Set<ModuleNeeded> extractLibsOnlyForMapperAndReducer(IProcess process) {
|
||||
int options = TalendProcessOptionConstants.MODULES_WITH_CHILDREN | TalendProcessOptionConstants.MODULES_FOR_MR;
|
||||
int options = TalendProcessOptionConstants.MODULES_WITH_CHILDREN | TalendProcessOptionConstants.MODULES_FOR_MR
|
||||
| TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED;
|
||||
Set<ModuleNeeded> allModules = JavaProcessUtil.getNeededModules(process, options);
|
||||
return allModules;
|
||||
}
|
||||
@@ -239,8 +238,14 @@ public class JavaProcessorUtilities {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (BitwiseOptionUtils.containOption(options, TalendProcessOptionConstants.MODULES_EXCLUDE_SHADED)) {
|
||||
new BigDataJobUtil(process).removeExcludedModules(neededLibraries);
|
||||
}
|
||||
|
||||
// move high priority modules to front.
|
||||
Set<ModuleNeeded> highPriorityModuleNeeded = LastGenerationInfo.getInstance().getHighPriorityModuleNeeded();
|
||||
Set<ModuleNeeded> highPriorityModuleNeeded = LastGenerationInfo.getInstance()
|
||||
.getHighPriorityModuleNeeded(property.getId(), property.getVersion());
|
||||
if (!highPriorityModuleNeeded.isEmpty()) {
|
||||
Iterator<ModuleNeeded> iterator = highPriorityModuleNeeded.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
@@ -250,10 +255,8 @@ public class JavaProcessorUtilities {
|
||||
}
|
||||
}
|
||||
// order should be main -> sub1 -> sub_sub1 -> normal modules
|
||||
List<ModuleNeeded> tempList = new ArrayList<>(highPriorityModuleNeeded);
|
||||
Collections.reverse(tempList);
|
||||
Set<ModuleNeeded> orderedNeededLibraries = new LinkedHashSet<>();
|
||||
orderedNeededLibraries.addAll(tempList);
|
||||
orderedNeededLibraries.addAll(highPriorityModuleNeeded);
|
||||
orderedNeededLibraries.addAll(neededLibraries);
|
||||
return orderedNeededLibraries;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class TalendJavaProjectManager {
|
||||
if (PluginChecker.isRouteletLoaded()) {
|
||||
createFolderIfNotExist(jobs.getFolder(DIR_ROUTELETS), monitor);
|
||||
}
|
||||
helper.createRootPom(poms, monitor);
|
||||
helper.createRootPom(monitor);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -169,20 +169,20 @@ public class TalendJavaProjectManager {
|
||||
}
|
||||
|
||||
public static ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type) {
|
||||
return getTalendCodeJavaProject(type, ProjectManager.getInstance().getCurrentProject());
|
||||
return getTalendCodeJavaProject(type, ProjectManager.getInstance().getCurrentProject().getTechnicalLabel());
|
||||
}
|
||||
|
||||
public static ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, Project project) {
|
||||
String codeProjectId = AggregatorPomsHelper.getCodeProjectId(type, project.getTechnicalLabel());
|
||||
public static ITalendProcessJavaProject getTalendCodeJavaProject(ERepositoryObjectType type, String projectTechName) {
|
||||
String codeProjectId = AggregatorPomsHelper.getCodeProjectId(type, projectTechName);
|
||||
ITalendProcessJavaProject talendCodeJavaProject = talendCodeJavaProjects.get(codeProjectId);
|
||||
if (talendCodeJavaProject == null || talendCodeJavaProject.getProject() == null
|
||||
|| !talendCodeJavaProject.getProject().exists()) {
|
||||
try {
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||
AggregatorPomsHelper helper = new AggregatorPomsHelper(project.getTechnicalLabel());
|
||||
AggregatorPomsHelper helper = new AggregatorPomsHelper(projectTechName);
|
||||
IFolder codeProjectFolder = helper.getProjectPomsFolder().getFolder(type.getFolder());
|
||||
IProject codeProject = root.getProject((project.getTechnicalLabel() + "_" + type.name()).toUpperCase()); //$NON-NLS-1$
|
||||
IProject codeProject = root.getProject((projectTechName + "_" + type.name()).toUpperCase()); //$NON-NLS-1$
|
||||
if (!codeProject.exists() || TalendCodeProjectUtil.needRecreate(monitor, codeProject)) {
|
||||
// always enable maven nature for code projects.
|
||||
createMavenJavaProject(monitor, codeProject, null, codeProjectFolder, true);
|
||||
@@ -309,12 +309,12 @@ public class TalendJavaProjectManager {
|
||||
return talendJobJavaProjects.get(AggregatorPomsHelper.getJobProjectId(property));
|
||||
}
|
||||
|
||||
public static ITalendProcessJavaProject getExistingTalendCodeProject(ERepositoryObjectType codeType, Project project) {
|
||||
return talendCodeJavaProjects.get(AggregatorPomsHelper.getCodeProjectId(codeType, project.getTechnicalLabel()));
|
||||
public static ITalendProcessJavaProject getExistingTalendCodeProject(ERepositoryObjectType codeType, String projectTechName) {
|
||||
return talendCodeJavaProjects.get(AggregatorPomsHelper.getCodeProjectId(codeType, projectTechName));
|
||||
}
|
||||
|
||||
public static void removeFromCodeJavaProjects(ERepositoryObjectType codeType, Project project) {
|
||||
talendCodeJavaProjects.remove(AggregatorPomsHelper.getCodeProjectId(codeType, project.getTechnicalLabel()));
|
||||
public static void removeFromCodeJavaProjects(ERepositoryObjectType codeType, String projectTechName) {
|
||||
talendCodeJavaProjects.remove(AggregatorPomsHelper.getCodeProjectId(codeType, projectTechName));
|
||||
}
|
||||
|
||||
public static void deleteTalendJobProjectsUnderFolder(ERepositoryObjectType processType, IPath folderPath,
|
||||
@@ -476,6 +476,11 @@ public class TalendJavaProjectManager {
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
|
||||
for (IProject project : projects) {
|
||||
if (project.hasNature("com.oaklandsw.transform.runtime.nature")) { //$NON-NLS-1$
|
||||
// never delete TDM Builtin, Examples and Examples EDI project ref
|
||||
// com.oaklandsw.data.transform.builtin
|
||||
continue;
|
||||
}
|
||||
if (project.getLocation() == null || !project.getLocation().toFile().exists()
|
||||
|| !project.getFile(IProjectDescription.DESCRIPTION_FILE_NAME).getLocation().toFile().exists()) {
|
||||
project.delete(false, true, monitor);
|
||||
@@ -496,6 +501,9 @@ public class TalendJavaProjectManager {
|
||||
project.delete(false, true, monitor);
|
||||
}
|
||||
}
|
||||
talendCodeJavaProjects.clear();
|
||||
talendJobJavaProjects.clear();
|
||||
tempJavaProject = null;
|
||||
};
|
||||
|
||||
};
|
||||
@@ -535,6 +543,7 @@ public class TalendJavaProjectManager {
|
||||
IProcessor processor = ProcessorUtilities.getProcessor(process, item.getProperty(), context);
|
||||
if (processor instanceof MavenJavaProcessor) {
|
||||
LastGenerationInfo.getInstance().clearModulesNeededWithSubjobPerJob();
|
||||
LastGenerationInfo.getInstance().clearHighPriorityModuleNeeded();
|
||||
((MavenJavaProcessor) processor).generatePom(option);
|
||||
}
|
||||
AggregatorPomsHelper.addToParentModules(
|
||||
|
||||
@@ -354,6 +354,8 @@ public class TalendProcessJavaProject implements ITalendProcessJavaProject {
|
||||
} finally {
|
||||
if (TalendMavenConstants.GOAL_PACKAGE.equals(goals)) { // only for package, not for compile or others.
|
||||
PomUtil.restorePomFile(this);
|
||||
// in case of there has modified joblet's pom for loop dependencies
|
||||
PomUtil.restoreJobletPoms();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.utils.ItemResourceUtil;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
@@ -45,6 +46,8 @@ import org.talend.core.runtime.repository.build.IBuildParametes;
|
||||
import org.talend.core.runtime.repository.build.IBuildPomCreatorParameters;
|
||||
import org.talend.core.runtime.repository.build.IMavenPomCreator;
|
||||
import org.talend.core.utils.BitwiseOptionUtils;
|
||||
import org.talend.designer.core.model.process.IGeneratingProcess;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.tools.AggregatorPomsHelper;
|
||||
import org.talend.designer.maven.tools.BuildCacheManager;
|
||||
@@ -55,8 +58,6 @@ import org.talend.designer.runprocess.ProcessorException;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
import org.talend.designer.runprocess.java.JavaProcessor;
|
||||
import org.talend.repository.i18n.Messages;
|
||||
import org.talend.designer.core.model.process.IGeneratingProcess;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
|
||||
/**
|
||||
* created by ggu on 2 Feb 2015 Detailled comment
|
||||
@@ -210,9 +211,17 @@ public class MavenJavaProcessor extends JavaProcessor {
|
||||
continue;
|
||||
}
|
||||
String childJarName = JavaResourcesHelper.getJobJarName(jobInfo.getJobName(), jobInfo.getJobVersion());
|
||||
exportJar += classPathSeparator + libPrefixPath + childJarName + FileExtensions.JAR_FILE_SUFFIX;
|
||||
if (!childJarName.equals(jarName)) {
|
||||
exportJar += classPathSeparator + libPrefixPath + childJarName + FileExtensions.JAR_FILE_SUFFIX;
|
||||
}
|
||||
}
|
||||
}
|
||||
// for loop dependency, add main classPath
|
||||
JobInfo mainJobInfo = ProcessorUtilities.getMainJobInfo();
|
||||
if (!isMainJob && ProcessorUtilities.hasLoopDependency() && mainJobInfo != null) {
|
||||
String mainJobName = JavaResourcesHelper.getJobJarName(mainJobInfo.getJobName(), mainJobInfo.getJobVersion());
|
||||
exportJar += classPathSeparator + libPrefixPath + mainJobName + FileExtensions.JAR_FILE_SUFFIX;
|
||||
}
|
||||
return exportJar;
|
||||
}
|
||||
|
||||
@@ -340,14 +349,16 @@ public class MavenJavaProcessor extends JavaProcessor {
|
||||
if (!isMainJob && isGoalInstall) {
|
||||
if (!buildCacheManager.isJobBuild(getProperty())) {
|
||||
deleteExistedJobJarFile(talendJavaProject);
|
||||
|
||||
final Map<String, Object> argumentsMap = new HashMap<>();
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, TalendMavenConstants.GOAL_COMPILE);
|
||||
if (!MavenProjectUtils.hasMavenNature(project)) {
|
||||
MavenProjectUtils.enableMavenNature(monitor, project);
|
||||
}
|
||||
talendJavaProject.buildModules(monitor, null, argumentsMap);
|
||||
|
||||
if ("ROUTE".equalsIgnoreCase(getBuildType(getProperty())) && project != null &&
|
||||
ERepositoryObjectType.PROCESS.equals(ERepositoryObjectType.getType(getProperty()))) {
|
||||
// TESB-23870
|
||||
// child routes job project must be compiled explicitly for
|
||||
// correct child job manifest generation during OSGi packaging
|
||||
if (!MavenProjectUtils.hasMavenNature(project)) {
|
||||
MavenProjectUtils.enableMavenNature(monitor, project);
|
||||
}
|
||||
talendJavaProject.buildWholeCodeProject();
|
||||
}
|
||||
buildCacheManager.putJobCache(getProperty());
|
||||
} else {
|
||||
// for already installed sub jobs, can restore pom here directly
|
||||
@@ -436,4 +447,11 @@ public class MavenJavaProcessor extends JavaProcessor {
|
||||
// Else, a simple compilation is needed.
|
||||
return TalendMavenConstants.GOAL_COMPILE;
|
||||
}
|
||||
|
||||
private String getBuildType(Property property) {
|
||||
if (property != null && property.getAdditionalProperties() != null) {
|
||||
return (String) property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.talend.libraries</groupId>
|
||||
<artifactId>talend_DB_mssqlUtil-1.2-20171017</artifactId>
|
||||
<artifactId>talend_DB_mssqlUtil-1.3-20190523</artifactId>
|
||||
<version>6.0.0</version>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
|
||||
@@ -15,7 +15,10 @@ package org.talend.repository.generic.service;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -49,7 +52,6 @@ import org.talend.designer.core.model.components.ElementParameter;
|
||||
import org.talend.repository.generic.action.GenericAction;
|
||||
import org.talend.repository.generic.internal.IGenericWizardInternalService;
|
||||
import org.talend.repository.generic.internal.service.GenericWizardInternalService;
|
||||
import org.talend.repository.generic.model.genericMetadata.GenericMetadataPackage;
|
||||
import org.talend.repository.generic.model.genericMetadata.SubContainer;
|
||||
import org.talend.repository.generic.ui.DynamicComposite;
|
||||
import org.talend.repository.generic.util.GenericConnectionUtil;
|
||||
@@ -229,33 +231,65 @@ public class GenericWizardService implements IGenericWizardService {
|
||||
public void updateComponentSchema(INode node, IMetadataTable metadataTable) {
|
||||
SchemaUtils.updateComponentSchema(node, metadataTable, Boolean.FALSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComponentProperties> getAllComponentProperties(Connection connection, String tableLabel, boolean withEvaluator) {
|
||||
return getAllComponentProperties(connection, tableLabel, withEvaluator, false, new HashMap<Object, Object>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComponentProperties> getAllComponentProperties(Connection connection, String tableLabel) {
|
||||
public List<ComponentProperties> getAllComponentProperties(Connection connection, String tableLabel, boolean withEvaluator,
|
||||
boolean forComponentValue, Map<Object, Object> contextMap) {
|
||||
List<ComponentProperties> componentProperties = new ArrayList<>();
|
||||
Set<ComponentProperties> componentPropertiesSet = new HashSet<>();
|
||||
if(contextMap == null){
|
||||
contextMap = new HashMap<Object, Object>();
|
||||
}
|
||||
if (isGenericConnection(connection)) {
|
||||
String compProperties = connection.getCompProperties();
|
||||
ComponentProperties cp = ComponentsUtils.getComponentPropertiesFromSerialized(compProperties, connection, false);
|
||||
ComponentProperties cp = null;
|
||||
if(contextMap.get(connection.getId()) != null){
|
||||
cp = (ComponentProperties) contextMap.get(connection.getId());
|
||||
}else{
|
||||
cp = ComponentsUtils.getComponentPropertiesFromSerialized(compProperties, connection,
|
||||
withEvaluator);
|
||||
if(cp != null){
|
||||
contextMap.put(connection.getId(), cp);
|
||||
}
|
||||
}
|
||||
if (cp != null) {
|
||||
componentProperties.add(cp);
|
||||
}
|
||||
List<MetadataTable> metadataTables;
|
||||
if (tableLabel == null) {
|
||||
//"forComponentValue" is avoid to load all the metadataTables,
|
||||
//if just get the component value, totally no need to get hundreds of tables,
|
||||
if (tableLabel == null && !forComponentValue) {
|
||||
metadataTables = SchemaUtils.getMetadataTables(connection, SubContainer.class);
|
||||
} else {
|
||||
metadataTables = Arrays.asList(SchemaUtils.getMetadataTable(connection, tableLabel, SubContainer.class));
|
||||
}
|
||||
if(metadataTables == null){
|
||||
return componentProperties;
|
||||
}
|
||||
for (MetadataTable metadataTable : metadataTables) {
|
||||
if (metadataTable == null) {
|
||||
continue;
|
||||
}
|
||||
for (TaggedValue taggedValue : metadataTable.getTaggedValue()) {
|
||||
if (IComponentConstants.COMPONENT_PROPERTIES_TAG.equals(taggedValue.getTag())) {
|
||||
ComponentProperties compPros = ComponentsUtils
|
||||
.getComponentPropertiesFromSerialized(taggedValue.getValue(), connection, false);
|
||||
if (compPros != null && !componentProperties.contains(compPros)) {
|
||||
ComponentProperties compPros = null;
|
||||
if(contextMap.get(metadataTable.getId()) != null){
|
||||
compPros = (ComponentProperties) contextMap.get(metadataTable.getId());
|
||||
}else{
|
||||
compPros = ComponentsUtils.getComponentPropertiesFromSerialized(taggedValue.getValue(), connection, withEvaluator);
|
||||
if(compPros != null){
|
||||
contextMap.put(metadataTable.getId(), compPros);
|
||||
}
|
||||
}
|
||||
if (compPros != null && !componentPropertiesSet.contains(compPros)) {
|
||||
compPros.updateNestedProperties(cp);
|
||||
componentProperties.add(compPros);
|
||||
componentPropertiesSet.add(compPros);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -264,6 +298,18 @@ public class GenericWizardService implements IGenericWizardService {
|
||||
return componentProperties;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.talend.core.runtime.services.IGenericWizardService#getAllComponentProperties(org.talend.core.model.metadata.
|
||||
* builder.connection.Connection, java.lang.String, boolean)
|
||||
*/
|
||||
@Override
|
||||
public List<ComponentProperties> getAllComponentProperties(Connection connection, String tableLabel) {
|
||||
return getAllComponentProperties(connection, tableLabel, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getNewRepType(String oldRepTypeName) {
|
||||
return RepTypeMappingManager.getInstance().getNewRepType(oldRepTypeName);
|
||||
|
||||
@@ -91,10 +91,9 @@ public class GenericConnWizardPage extends GenericWizardPage implements Property
|
||||
baseElement = new FakeElement(form.getName());
|
||||
baseElement.setReadOnly(!isRepositoryObjectEditable);
|
||||
dynamicComposite = new DynamicComposite(container, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS, EComponentCategory.BASIC,
|
||||
baseElement, true, container.getBackground(), form, false);
|
||||
baseElement, connectionItem, true, container.getBackground(), form, false);
|
||||
dynamicComposite.setLayoutData(createMainFormData(addContextFields));
|
||||
dynamicComposite.setWizardPropertyChangeListener(this);
|
||||
dynamicComposite.setConnectionItem(connectionItem);
|
||||
addCheckListener(dynamicComposite.getChecker());
|
||||
|
||||
if (addContextFields) {
|
||||
|
||||
@@ -87,15 +87,16 @@ public class GenericDragAndDropHandler extends AbstractDragAndDropServiceHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getComponentValue(Connection connection, String value, IMetadataTable table, String targetComponent) {
|
||||
public Object getComponentValue(Connection connection, String value, IMetadataTable table, String targetComponent,
|
||||
Map<Object, Object> contextMap) {
|
||||
if (value != null && canHandle(connection)) {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGenericWizardService.class)) {
|
||||
IGenericWizardService wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault().getService(
|
||||
IGenericWizardService.class);
|
||||
IGenericWizardService wizardService = (IGenericWizardService) GlobalServiceRegister.getDefault()
|
||||
.getService(IGenericWizardService.class);
|
||||
if (wizardService != null && wizardService.isGenericConnection(connection)) {
|
||||
return getGenericRepositoryValue(connection,
|
||||
wizardService.getAllComponentProperties(connection, getSeletetedMetadataTableName(table)), value,
|
||||
table);
|
||||
List<ComponentProperties> componentPropertiesList = wizardService.getAllComponentProperties(connection,
|
||||
getSeletetedMetadataTableName(table), true, true, contextMap);
|
||||
return getGenericRepositoryValue(connection, componentPropertiesList, value, table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class GenericContextUtil {
|
||||
GenericConnParamName genericParam = (GenericConnParamName) param;
|
||||
String paramVarName = genericParam.getContextVar();
|
||||
genericVariableName = originalVariableName + paramVarName;
|
||||
matchContextForAttribues(componentProperties, genericParam, genericVariableName, prefixName);
|
||||
matchContextForAttribues(componentProperties, genericParam, genericVariableName, prefixName,false);
|
||||
}
|
||||
}
|
||||
updateComponentProperties(connection, componentProperties);
|
||||
@@ -183,7 +183,7 @@ public class GenericContextUtil {
|
||||
}
|
||||
if (genericVariableName != null) {
|
||||
genericVariableName = getCorrectVariableName(currentContext, genericVariableName, genericParam);
|
||||
matchContextForAttribues(componentProperties, genericParam, genericVariableName, currentContext.getProperty().getLabel());
|
||||
matchContextForAttribues(componentProperties, genericParam, genericVariableName, currentContext.getProperty().getLabel(),true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public class GenericContextUtil {
|
||||
}
|
||||
|
||||
private static void matchContextForAttribues(ComponentProperties componentProperties, IConnParamName param,
|
||||
String genericVariableName, String prefixName) {
|
||||
String genericVariableName, String prefixName,boolean isReuse) {
|
||||
GenericConnParamName genericParam = (GenericConnParamName) param;
|
||||
String paramName = genericParam.getName();
|
||||
Properties properties = componentProperties.getProperties(paramName);
|
||||
@@ -214,19 +214,27 @@ public class GenericContextUtil {
|
||||
String paramValue = ContextParameterUtils.getNewScriptCode(genericVariableName, ECodeLanguage.JAVA);
|
||||
setPropertyValue(componentProperties, paramName, paramValue, true);
|
||||
}else{
|
||||
matchContextForPrperties(properties, param, genericVariableName, prefixName);
|
||||
matchContextForPrperties(properties, param, genericVariableName, prefixName,isReuse);
|
||||
}
|
||||
}
|
||||
|
||||
private static void matchContextForPrperties(Properties properties,IConnParamName param,
|
||||
String genericVariableName, String prefixName){
|
||||
String genericVariableName, String prefixName,boolean isReuse){
|
||||
for(NamedThing nameThing : properties.getProperties()){
|
||||
if(nameThing != null && nameThing instanceof Property){
|
||||
Property property = (Property) nameThing;
|
||||
Object paramValue = property.getStoredValue();
|
||||
if(GenericTypeUtils.isListStringType(property) && paramValue != null){
|
||||
String propertyValue = ContextParameterUtils.getNewScriptCode(prefixName + ConnectionContextHelper.LINE
|
||||
+ ContextParameterUtils.getValidParameterName(property.getName()), LanguageManager.getCurrentLanguage());
|
||||
|
||||
// String propertyValue = ContextParameterUtils.getNewScriptCode(prefixName + ConnectionContextHelper.LINE
|
||||
// + ContextParameterUtils.getValidParameterName(property.getName()), LanguageManager.getCurrentLanguage());
|
||||
String propertyValue = "";//for driver's param: fixdb_old_ ==> context.fixdb_old_
|
||||
if(isReuse) {
|
||||
propertyValue = ContextParameterUtils.getNewScriptCode(genericVariableName, ECodeLanguage.JAVA);
|
||||
}else {
|
||||
propertyValue = ContextParameterUtils.getNewScriptCode(prefixName + ConnectionContextHelper.LINE
|
||||
+ ContextParameterUtils.getValidParameterName(property.getName()), LanguageManager.getCurrentLanguage());
|
||||
}
|
||||
property.setTaggedValue(IGenericConstants.IS_CONTEXT_MODE, true);
|
||||
List<String> driverList = new ArrayList<String>();
|
||||
driverList.add(propertyValue);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class JSONDragAndDropHandler extends AbstractDragAndDropServiceHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getComponentValue(Connection connection, String value, IMetadataTable table, String targetComponent) {
|
||||
public Object getComponentValue(Connection connection, String value, IMetadataTable table, String targetComponent, Map<Object, Object> contextMap) {
|
||||
if (value != null && canHandle(connection)) {
|
||||
return getJSONRepositoryValue((JSONFileConnection) connection, value, table);
|
||||
}
|
||||
@@ -163,6 +163,11 @@ public class JSONDragAndDropHandler extends AbstractDragAndDropServiceHandler {
|
||||
if (value.equals("JSON_MAPPING")) {
|
||||
return getTableJSONMappingValue(connection);
|
||||
}
|
||||
|
||||
// Need to be changed when this parameter is configurable in wizard.
|
||||
if (value.equals("USE_LOOP_AS_ROOT")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ public class FileInputJsonNode4Input extends FileInputNode {
|
||||
String[] paramNames = null;
|
||||
if (EJsonReadbyMode.JSONPATH.getValue().equals(readbyMode)) {
|
||||
paramNames = new String[] {
|
||||
"FILENAME", "JSON_LOOP_QUERY", "MAPPING_JSONPATH", "LIMIT", "ENCODING", "GENERATION_MODE", "READ_BY" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
"FILENAME", "JSON_LOOP_QUERY", "MAPPING_JSONPATH", "LIMIT", "ENCODING", "GENERATION_MODE", "READ_BY" ,"USE_LOOP_AS_ROOT" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
} else {
|
||||
paramNames = new String[] { "FILENAME", "LOOP_QUERY", "MAPPING", "LIMIT", "ENCODING", "GENERATION_MODE", "READ_BY" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
}
|
||||
// see bug 9785.
|
||||
Object[] paramValues = new Object[] { filename, loopQuery, mapping, limitLoop, encoding, "Dom4j", readbyMode }; //$NON-NLS-1$
|
||||
Object[] paramValues = new Object[] { filename, loopQuery, mapping, limitLoop, encoding, "Dom4j", readbyMode ,false }; //$NON-NLS-1$
|
||||
// Object[] paramValues = new Object[] { filename, loopQuery, mapping, limitLoop, encoding, "Xerces" }; //$NON-NLS-1$
|
||||
|
||||
IComponent component = ComponentsFactoryProvider.getInstance().get(INPUT_COMPONENT_NAME,
|
||||
|
||||
@@ -563,6 +563,7 @@ LoginProjectPage.remote=Remote
|
||||
LoginProjectPage.remote.talend=Remote TAC
|
||||
LoginProjectPage.cloud.us=Cloud US
|
||||
LoginProjectPage.cloud.eu=Cloud EU
|
||||
LoginProjectPage.cloud.apac=Cloud APAC
|
||||
LoginProjectPage.cloud.custom=Cloud Custom
|
||||
LoginProjectPage.local=Local
|
||||
LoginProjectPage.restart=Restart
|
||||
|
||||
@@ -362,7 +362,14 @@ public class ExportItemUtil {
|
||||
XmiResourceManager localRepositoryManager = ProxyRepositoryFactory.getInstance()
|
||||
.getRepositoryFactoryFromProvider().getResourceManager();
|
||||
IPath propertyPath = null;
|
||||
for (Resource curResource : localRepositoryManager.getAffectedResources(item.getProperty())) {
|
||||
Property property = item.getProperty();
|
||||
List<Resource> resources = localRepositoryManager.getAffectedResources(property);
|
||||
if (resources.isEmpty()) {
|
||||
IRepositoryViewObject obj = ProxyRepositoryFactory.getInstance().getSpecificVersion(property.getId(),
|
||||
property.getVersion(), true);
|
||||
resources = localRepositoryManager.getAffectedResources(obj.getProperty());
|
||||
}
|
||||
for (Resource curResource : resources) {
|
||||
URI uri = curResource.getURI();
|
||||
IPath relativeItemPath = URIHelper.convert(uri).makeRelative();
|
||||
Project project = ProjectManager.getInstance().getProject(item);
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.List;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.model.migration.AbstractItemMigrationTask;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
|
||||
@@ -37,7 +36,7 @@ public class GenerateJobPomMigrationTask extends AbstractItemMigrationTask {
|
||||
@Override
|
||||
public ExecutionResult execute(Item item) {
|
||||
// only execute the migration task during logon, disable it for the import item (check of log finished)
|
||||
if (item instanceof ProcessItem && !ProxyRepositoryFactory.getInstance().isFullLogonFinished()) {
|
||||
if (!ProxyRepositoryFactory.getInstance().isFullLogonFinished()) {
|
||||
CorePlugin.getDefault().getRunProcessService().generatePom(item);
|
||||
return ExecutionResult.SUCCESS_NO_ALERT;
|
||||
}
|
||||
|
||||
@@ -12,9 +12,13 @@
|
||||
// ============================================================================
|
||||
package org.talend.repository.model.migration;
|
||||
|
||||
import static org.talend.core.PluginChecker.*;
|
||||
import static org.talend.core.PluginChecker.EXPORT_JOB_PLUGIN_ID;
|
||||
import static org.talend.core.PluginChecker.EXPORT_ROUTE_PLUGIN_ID;
|
||||
import static org.talend.core.PluginChecker.MAVEN_JOB_PLUGIN_ID;
|
||||
import static org.talend.core.PluginChecker.isPluginLoaded;
|
||||
import static org.talend.core.runtime.projectsetting.IProjectSettingPreferenceConstants.*;
|
||||
import static org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.ArrayList;
|
||||
@@ -29,7 +33,7 @@ import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
|
||||
import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.migration.AbstractProjectMigrationTask;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
@@ -75,9 +79,12 @@ public class ResetMavenTemplateMigrationTask extends AbstractProjectMigrationTas
|
||||
IProject fsProject = ResourceUtils.getProject(project);
|
||||
|
||||
resetJobCustomTemplateFile(fsProject, ERepositoryObjectType.PROCESS);
|
||||
resetJobCustomTemplateFile(fsProject, ERepositoryObjectType.PROCESS_MR);
|
||||
resetJobCustomTemplateFile(fsProject, ERepositoryObjectType.PROCESS_STORM);
|
||||
|
||||
if (PluginChecker.isMapReducePluginLoader()) {
|
||||
resetJobCustomTemplateFile(fsProject, ERepositoryObjectType.PROCESS_MR);
|
||||
}
|
||||
if (PluginChecker.isStormPluginLoader()) {
|
||||
resetJobCustomTemplateFile(fsProject, ERepositoryObjectType.PROCESS_STORM);
|
||||
}
|
||||
if (isPluginLoaded(EXPORT_ROUTE_PLUGIN_ID)) {
|
||||
resetServiceCustomTemplateFile(fsProject);
|
||||
}
|
||||
|
||||
@@ -242,16 +242,16 @@ public class LoginHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* if the connection is Cloud US/EU/Custom
|
||||
* if the connection is Cloud US/EU/APAC/Custom
|
||||
*
|
||||
* @param connectionBean
|
||||
* @return true if connection is Cloud US or Cloud EU or Cloud Custom
|
||||
* @return true if connection is Cloud US or Cloud EU or Cloud APAC or Cloud Custom
|
||||
*/
|
||||
public static boolean isCloudConnection(ConnectionBean connectionBean) {
|
||||
if (connectionBean == null) {
|
||||
return false;
|
||||
}
|
||||
return isCloudUSConnection(connectionBean) || isCloudEUConnection(connectionBean)
|
||||
return isCloudUSConnection(connectionBean) || isCloudEUConnection(connectionBean) || isCloudAPACConnection(connectionBean)
|
||||
|| isCloudCustomConnection(connectionBean);
|
||||
}
|
||||
|
||||
@@ -269,6 +269,13 @@ public class LoginHelper {
|
||||
return RepositoryConstants.REPOSITORY_CLOUD_EU_ID.equals(connectionBean.getRepositoryId());
|
||||
}
|
||||
|
||||
public static boolean isCloudAPACConnection(ConnectionBean connectionBean) {
|
||||
if (connectionBean == null) {
|
||||
return false;
|
||||
}
|
||||
return RepositoryConstants.REPOSITORY_CLOUD_APAC_ID.equals(connectionBean.getRepositoryId());
|
||||
}
|
||||
|
||||
public static boolean isCloudCustomConnection(ConnectionBean connectionBean) {
|
||||
if (connectionBean == null) {
|
||||
return false;
|
||||
@@ -277,7 +284,8 @@ public class LoginHelper {
|
||||
}
|
||||
|
||||
public static boolean isCloudRepository(String repositoryId) {
|
||||
return isCloudUSRepository(repositoryId) || isCloudEURepository(repositoryId) || isCloudCustomRepository(repositoryId);
|
||||
return isCloudUSRepository(repositoryId) || isCloudEURepository(repositoryId) || isCloudAPACRepository(repositoryId)
|
||||
|| isCloudCustomRepository(repositoryId);
|
||||
}
|
||||
|
||||
public static boolean isCloudUSRepository(String repositoryId) {
|
||||
@@ -288,6 +296,10 @@ public class LoginHelper {
|
||||
return RepositoryConstants.REPOSITORY_CLOUD_EU_ID.equals(repositoryId);
|
||||
}
|
||||
|
||||
public static boolean isCloudAPACRepository(String repositoryId) {
|
||||
return RepositoryConstants.REPOSITORY_CLOUD_APAC_ID.equals(repositoryId);
|
||||
}
|
||||
|
||||
public static boolean isCloudCustomRepository(String repositoryId) {
|
||||
return RepositoryConstants.REPOSITORY_CLOUD_CUSTOM_ID.equals(repositoryId);
|
||||
}
|
||||
|
||||
@@ -2188,6 +2188,8 @@ public class LoginProjectPage extends AbstractLoginActionPage {
|
||||
connectionName = connectionName + " (" + Messages.getString("LoginProjectPage.cloud.us"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
} else if (LoginHelper.isCloudEUConnection(prj)) {
|
||||
connectionName = connectionName + " (" + Messages.getString("LoginProjectPage.cloud.eu"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
} else if (LoginHelper.isCloudAPACConnection(prj)) {
|
||||
connectionName = connectionName + " (" + Messages.getString("LoginProjectPage.cloud.apac"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
} else if (LoginHelper.isCloudCustomConnection(prj)) {
|
||||
connectionName = connectionName + " (" + Messages.getString("LoginProjectPage.cloud.custom"); //$NON-NLS-1$//$NON-NLS-2$
|
||||
} else {
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
@@ -490,6 +491,16 @@ public class ConnectionFormComposite extends Composite {
|
||||
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
IRepositoryFactory repository = getRepository();
|
||||
if (repository != null && LoginHelper.isCloudRepository(repository.getId())) {
|
||||
String text = userText.getText();
|
||||
String lowerCaseText = text.toLowerCase();
|
||||
if (!text.equals(lowerCaseText)) {
|
||||
Point selection = userText.getSelection();
|
||||
userText.setText(lowerCaseText);
|
||||
userText.setSelection(selection);
|
||||
}
|
||||
}
|
||||
fillBean(false);
|
||||
validateFields();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ILibraryManagerUIService;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.designer.core.model.utils.emf.component.ComponentFactory;
|
||||
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
|
||||
import org.talend.repository.i18n.Messages;
|
||||
@@ -72,6 +73,12 @@ public class ConfigExternalJarPage extends ConfigExternalLibPage {
|
||||
message = Messages.getString("ImportExternalJarPage.pageMessage");//$NON-NLS-1$
|
||||
}
|
||||
this.setMessage(message);
|
||||
|
||||
/**
|
||||
* Call this to make sure librariesListener is registed.<br>
|
||||
* Please refer to MavenPomSynchronizer#addChangeLibrariesListener
|
||||
*/
|
||||
CorePlugin.getDefault().getRunProcessService().getTalendCodeJavaProject(ERepositoryObjectType.ROUTINES);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,8 +21,11 @@ import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
|
||||
@@ -36,6 +39,8 @@ import org.talend.repository.i18n.Messages;
|
||||
*/
|
||||
public class LibraryField extends TableField {
|
||||
|
||||
private boolean readOnly;
|
||||
|
||||
/**
|
||||
* DOC tguiu StatusEditor constructor comment.
|
||||
*
|
||||
@@ -49,6 +54,7 @@ public class LibraryField extends TableField {
|
||||
|
||||
public LibraryField(String name, Composite parent, boolean isReadOnly) {
|
||||
super(name, parent, isReadOnly);
|
||||
this.readOnly = isReadOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,6 +75,23 @@ public class LibraryField extends TableField {
|
||||
descriptionColumn.setText(Messages.getString("LibraryField.descriptionColumn")); //$NON-NLS-1$
|
||||
descriptionColumn.setWidth(200);
|
||||
|
||||
contextTable.addListener(SWT.MouseUp, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
if (!readOnly) {
|
||||
final Table contextTable = (Table) event.widget;
|
||||
final TableItem item = contextTable.getSelection()[0];
|
||||
if (item.getBounds(1).contains(event.x, event.y)) {
|
||||
IMPORTType it = (IMPORTType) getList().get(contextTable.getSelectionIndex());
|
||||
if ("BeanItem".equals(it.eContainer().eClass().getName())) {
|
||||
it.setREQUIRED(!it.isREQUIRED());
|
||||
setInput(getList());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return contextTable;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ public class BuildJobHandler extends AbstractBuildJobHandler {
|
||||
public IProcessor generateJobFiles(IProgressMonitor monitor) throws Exception {
|
||||
LastGenerationInfo.getInstance().getUseDynamicMap().clear();
|
||||
LastGenerationInfo.getInstance().getUseRulesMap().clear();
|
||||
BuildCacheManager.getInstance().clearAllCaches();
|
||||
|
||||
final Map<String, Object> argumentsMap = new HashMap<String, Object>(getArguments());
|
||||
|
||||
@@ -384,9 +385,12 @@ public class BuildJobHandler extends AbstractBuildJobHandler {
|
||||
final Map<String, Object> argumentsMap = new HashMap<String, Object>();
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, TalendMavenConstants.GOAL_PACKAGE);
|
||||
argumentsMap.put(TalendProcessArgumentConstant.ARG_PROGRAM_ARGUMENTS, getProgramArgs());
|
||||
try {
|
||||
talendProcessJavaProject.buildModules(monitor, null, argumentsMap);
|
||||
BuildCacheManager.getInstance().performBuildSuccess();
|
||||
} finally {
|
||||
BuildCacheManager.getInstance().clearAllCaches();
|
||||
}
|
||||
|
||||
talendProcessJavaProject.buildModules(monitor, null, argumentsMap);
|
||||
|
||||
BuildCacheManager.getInstance().performBuildSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,8 @@ public class BuildOSGiBundleHandler extends BuildJobHandler {
|
||||
folder = talendProcessJavaProject.getSrcSubFolder(monitor, sub);
|
||||
} else if (path.startsWith("META-INF")) {
|
||||
folder = talendProcessJavaProject.createSubFolder(monitor, talendProcessJavaProject.getBundleResourcesFolder(), path);
|
||||
} else if (path.startsWith("xmlMappings")) {
|
||||
folder = talendProcessJavaProject.createSubFolder(monitor, talendProcessJavaProject.getBundleResourcesFolder(), path);
|
||||
}
|
||||
return folder == null ? null : folder.getFile(fileName);
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Profile;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
@@ -35,26 +35,31 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.m2e.core.MavenPlugin;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
import org.talend.commons.utils.time.TimeMeasure;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.process.ProcessUtils;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.relationship.RelationshipItemBuilder;
|
||||
import org.talend.core.model.repository.IRepositoryPrefConstants;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.runtime.process.IBuildJobHandler;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.repository.build.IBuildResourceParametes;
|
||||
import org.talend.core.ui.CoreUIPlugin;
|
||||
import org.talend.core.ui.services.IDesignerCoreUIService;
|
||||
import org.talend.designer.maven.model.TalendMavenConstants;
|
||||
import org.talend.designer.maven.utils.PomUtil;
|
||||
import org.talend.designer.runprocess.IRunProcessService;
|
||||
import org.talend.designer.runprocess.ItemCacheManager;
|
||||
import org.talend.designer.runprocess.ProcessorUtilities;
|
||||
@@ -62,6 +67,7 @@ import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.i18n.Messages;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.ENodeType;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.repository.ui.utils.ZipToFile;
|
||||
import org.talend.repository.ui.wizards.exportjob.JavaJobExportReArchieveCreator;
|
||||
import org.talend.repository.ui.wizards.exportjob.JavaJobScriptsExportWSWizardPage.JobExportType;
|
||||
@@ -136,6 +142,8 @@ public class BuildJobManager {
|
||||
}
|
||||
File tempProFolder = new File(tempFolder, topName);
|
||||
tempProFolder.mkdirs();
|
||||
File rootPom = null;
|
||||
boolean buildMavenSource = !Boolean.parseBoolean(exportChoiceMap.get(ExportChoice.binaries).toString());
|
||||
for (int i = 0; i < processes.size(); i++) {
|
||||
ProcessItem processItem = processes.get(i);
|
||||
pMonitor.setTaskName(Messages.getString("BuildJobManager.building", processItem.getProperty().getLabel()));//$NON-NLS-1$
|
||||
@@ -151,10 +159,29 @@ public class BuildJobManager {
|
||||
buildJobHandler.build(new SubProgressMonitor(pMonitor, scale));
|
||||
IFile jobTargetFile = buildJobHandler.getJobTargetFile();
|
||||
if (jobTargetFile != null && jobTargetFile.exists()) {
|
||||
// unzip to temp folder
|
||||
FilesUtils.unzip(jobTargetFile.getLocation().toPortableString(), tempProFolder.getAbsolutePath());
|
||||
// arrange zip structure
|
||||
// build subjob and package them to zip
|
||||
if (buildMavenSource) {
|
||||
rootPom = new File(tempProFolder.getAbsolutePath() + File.separator + TalendMavenConstants.POM_FILE_NAME);
|
||||
Model pomModel = MavenPlugin.getMavenModelManager().readMavenModel(rootPom);
|
||||
File itemFile = new File(
|
||||
tempProFolder.getAbsolutePath() + File.separator + processItem.getProperty().getLabel());
|
||||
File newItemFile = new File(tempProFolder.getAbsolutePath() + File.separator + getArrangedJobPath(
|
||||
pomModel, processItem.getProperty().getLabel(), processItem.getProperty().getVersion()));
|
||||
if (itemFile.exists()) {
|
||||
File[] jarFiles = itemFile.listFiles(FilesUtils.getAcceptJARFilesFilter());
|
||||
for (File jarfile : jarFiles) {
|
||||
FilesUtils.deleteFile(jarfile, true);
|
||||
}
|
||||
FileCopyUtils.syncFolder(itemFile, newItemFile, false);
|
||||
FilesUtils.deleteFolder(itemFile, true);
|
||||
}
|
||||
packageSubJob(tempProFolder.getAbsolutePath(), pomModel, rootPom, processItem, processes);
|
||||
}
|
||||
|
||||
String zipPath = jobTargetFile.getLocation().toPortableString();
|
||||
if (needClasspathJar(exportChoiceMap)) {
|
||||
FilesUtils.unzip(jobTargetFile.getLocation().toPortableString(), tempProFolder.getAbsolutePath());
|
||||
String zipPath = jobTargetFile.getLocation().toPortableString();
|
||||
JavaJobExportReArchieveCreator creator = new JavaJobExportReArchieveCreator(zipPath, processItem
|
||||
.getProperty().getLabel());
|
||||
creator.setTempFolder(tempFolder.getAbsolutePath());
|
||||
@@ -163,6 +190,10 @@ public class BuildJobManager {
|
||||
}
|
||||
pMonitor.worked(scale);
|
||||
}
|
||||
if (buildMavenSource) {
|
||||
// tup-19705 refresh export root pom to support use mvn package directly
|
||||
refreshExportRootPom(tempProFolder.getAbsolutePath(), rootPom);
|
||||
}
|
||||
|
||||
FilesUtils.zip(tempFolder.getAbsolutePath(), destinationPath);
|
||||
FilesUtils.deleteFile(tempFolder, true);
|
||||
@@ -267,6 +298,34 @@ public class BuildJobManager {
|
||||
TimeMeasure.step(timeMeasureId, "Recreate job jar for classpath");
|
||||
}
|
||||
|
||||
if (!Boolean.parseBoolean(exportChoiceMap.get(ExportChoice.binaries).toString())) {
|
||||
// tup-19705 refresh export root pom to support use mvn package directly
|
||||
List<String> itemLabels = new ArrayList<String>();
|
||||
itemLabels.add(label);
|
||||
ExportJobUtil.deleteTempFiles();
|
||||
String temUnzipPath = ExportJobUtil.getTmpFolder() + File.separator + label + "_" + version;
|
||||
FilesUtils.unzip(jobZip, temUnzipPath);
|
||||
// arrange zip structure
|
||||
File rootPom = new File(temUnzipPath + File.separator + TalendMavenConstants.POM_FILE_NAME);
|
||||
Model pomModel = MavenPlugin.getMavenModelManager().readMavenModel(rootPom);
|
||||
File itemFile = new File(temUnzipPath + File.separator + label);
|
||||
File newItemFile = new File(
|
||||
temUnzipPath + File.separator + getArrangedJobPath(pomModel, label, version));
|
||||
if (itemFile.exists()) {
|
||||
File[] jarFiles = itemFile.listFiles(FilesUtils.getAcceptJARFilesFilter());
|
||||
for (File jarfile : jarFiles) {
|
||||
FilesUtils.deleteFile(jarfile, true);
|
||||
}
|
||||
FileCopyUtils.syncFolder(itemFile, newItemFile, false);
|
||||
FilesUtils.deleteFolder(itemFile, true);
|
||||
}
|
||||
packageSubJob(temUnzipPath, pomModel, rootPom, processItem, null);
|
||||
refreshExportRootPom(temUnzipPath, rootPom);
|
||||
|
||||
ZipToFile.zipFile(ExportJobUtil.getTmpFolder(), jobZip);
|
||||
ExportJobUtil.deleteTempFiles();
|
||||
}
|
||||
|
||||
File jobFileTarget = new File(destinationPath);
|
||||
if (jobFileTarget.isDirectory()) {
|
||||
jobFileTarget = new File(destinationPath, jobZipFile.getName());
|
||||
@@ -303,6 +362,120 @@ public class BuildJobManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void packageSubJob(String zipLocation, Model pomModel, File rootPom, ProcessItem item,
|
||||
final List<ProcessItem> checkedProcesses)
|
||||
throws Exception {
|
||||
List<ProcessItem> dependenciesItems = new ArrayList<ProcessItem>();
|
||||
JobInfo mainJobInfo = LastGenerationInfo.getInstance().getLastMainJob();
|
||||
for (JobInfo jobInfo : mainJobInfo.getProcessor().getBuildChildrenJobs()) {
|
||||
if (checkedProcesses != null && checkedProcesses.contains(jobInfo.getProcessItem())) {
|
||||
continue;
|
||||
}
|
||||
dependenciesItems.add(jobInfo.getProcessItem());
|
||||
}
|
||||
|
||||
ITalendProcessJavaProject mainProject = getRunProcessService().getTalendJobJavaProject(item.getProperty());
|
||||
String mainTechLabel = ProjectManager.getInstance().getProject(mainProject.getPropery()).getTechnicalLabel();
|
||||
File file = new File(zipLocation);
|
||||
|
||||
for (ProcessItem processItem : dependenciesItems) {
|
||||
ITalendProcessJavaProject project = getRunProcessService().getTalendJobJavaProject(processItem.getProperty());
|
||||
String techLabel = ProjectManager.getInstance().getProject(project.getPropery()).getTechnicalLabel();
|
||||
File srcfile = project.getProject().getFolder(new Path("src")).getLocation().toFile();
|
||||
File pomfile = project.getProjectPom().getLocation().toFile();
|
||||
String destpath = null;
|
||||
File refRootPom = null;
|
||||
if (!mainTechLabel.equals(techLabel)) {
|
||||
String techpath = file.getParent() + File.separator + techLabel;
|
||||
refRootPom = new File(techpath + File.separator + TalendMavenConstants.POM_FILE_NAME);
|
||||
File parentPomFolder = pomfile.getParentFile();
|
||||
int nb = 10;
|
||||
while (parentPomFolder != null && !parentPomFolder.getName().equals(RepositoryConstants.POMS_DIRECTORY)) {
|
||||
parentPomFolder = parentPomFolder.getParentFile();
|
||||
nb--;
|
||||
if (nb < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parentPomFolder != null && parentPomFolder.exists()) {
|
||||
File refPomFile = new File(
|
||||
parentPomFolder.getAbsolutePath() + File.separator + TalendMavenConstants.POM_FILE_NAME);
|
||||
if (refPomFile.exists()) {
|
||||
// copy reference project pom to export zip
|
||||
FilesUtils.copyFile(refPomFile, refRootPom);
|
||||
Model refPomModel = MavenPlugin.getMavenModelManager().readMavenModel(refPomFile);
|
||||
destpath = techpath + File.separator + getArrangedJobPath(refPomModel,
|
||||
processItem.getProperty().getLabel(), processItem.getProperty().getVersion());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
destpath = zipLocation + File.separator + getArrangedJobPath(pomModel, processItem.getProperty().getLabel(),
|
||||
processItem.getProperty().getVersion());
|
||||
}
|
||||
|
||||
File destFile = new File(destpath);
|
||||
if (!destFile.exists()) {
|
||||
destFile.mkdirs();
|
||||
}
|
||||
|
||||
FileCopyUtils.syncFolder(srcfile, new File(destpath + File.separator + "src"), false);
|
||||
FilesUtils.copyFile(pomfile, new File(destpath + File.separator + TalendMavenConstants.POM_FILE_NAME));
|
||||
if (!mainTechLabel.equals(techLabel) && refRootPom != null && refRootPom.exists()) {
|
||||
refreshExportRootPom(refRootPom.getParent(), refRootPom);
|
||||
}
|
||||
}
|
||||
// add reference project pom to main exported pom
|
||||
for (String fileLabel : rootPom.getParentFile().getParentFile().list()) {
|
||||
if (!file.getName().equals(fileLabel)) {
|
||||
pomModel.addModule("../" + fileLabel);
|
||||
PomUtil.savePom(null, pomModel, rootPom);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void refreshExportRootPom(String pomLocation, File rootPom) throws Exception {
|
||||
if (rootPom.exists()) {
|
||||
Model pomModel = MavenPlugin.getMavenModelManager().readMavenModel(rootPom);
|
||||
List<Profile> profiles = pomModel.getProfiles();
|
||||
Iterator<Profile> profileIte = profiles.iterator();
|
||||
while (profileIte.hasNext()) {
|
||||
Profile profile = profileIte.next();
|
||||
if (TalendMavenConstants.PROFILE_CI_BUILDER.equals(profile.getId())) {
|
||||
profileIte.remove();
|
||||
}
|
||||
}
|
||||
List<String> modules = pomModel.getModules();
|
||||
Iterator<String> modulesIte = modules.iterator();
|
||||
while (modulesIte.hasNext()) {
|
||||
File sourcefile = null;
|
||||
String module = modulesIte.next();
|
||||
if (module.contains("../")) {
|
||||
sourcefile = new File(pomLocation).getParentFile();
|
||||
sourcefile = new File(sourcefile.getAbsolutePath() + File.separator + module.replaceAll("../", ""));
|
||||
} else {
|
||||
sourcefile = new File(pomLocation + File.separator + module);
|
||||
}
|
||||
if (sourcefile != null && !sourcefile.exists() && !sourcefile.isDirectory()) {
|
||||
modulesIte.remove();
|
||||
}
|
||||
}
|
||||
PomUtil.savePom(null, pomModel, rootPom);
|
||||
}
|
||||
}
|
||||
|
||||
private String getArrangedJobPath(Model pomModel, String label, String version) throws Exception {
|
||||
if (pomModel != null) {
|
||||
List<String> modules = pomModel.getModules();
|
||||
for (String module : modules) {
|
||||
if (module.contains(label + "_" + version)) {
|
||||
return module;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getLogErrorMsg(String filepath) throws IOException{
|
||||
BufferedReader reader = null;
|
||||
StringBuffer errorbuffer = new StringBuffer();
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
// ============================================================================
|
||||
package org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
@@ -27,11 +30,17 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
@@ -46,6 +55,7 @@ import org.talend.core.PluginChecker;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.process.JobInfo;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
@@ -55,6 +65,7 @@ import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.JavaResourcesHelper;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.process.ITalendProcessJavaProject;
|
||||
import org.talend.core.runtime.process.LastGenerationInfo;
|
||||
import org.talend.core.runtime.repository.build.BuildExportManager;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
@@ -73,11 +84,17 @@ import org.talend.repository.documentation.ExportFileResource;
|
||||
import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JarBuilder;
|
||||
import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobJavaScriptsManager;
|
||||
import org.talend.repository.utils.EmfModelUtils;
|
||||
import org.talend.repository.utils.EsbConfigUtils;
|
||||
import org.talend.repository.utils.TemplateProcessor;
|
||||
|
||||
import aQute.bnd.header.Attrs;
|
||||
import aQute.bnd.osgi.Analyzer;
|
||||
import aQute.bnd.osgi.Descriptors;
|
||||
import aQute.bnd.osgi.FileResource;
|
||||
import aQute.bnd.osgi.Jar;
|
||||
import aQute.bnd.service.AnalyzerPlugin;
|
||||
import aQute.bnd.service.Plugin;
|
||||
import aQute.service.reporter.Reporter;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
@@ -86,15 +103,35 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
|
||||
protected static final char MANIFEST_ITEM_SEPARATOR = ',';
|
||||
|
||||
protected static final String OSGI_EXCLUDE_PROP_FILENAME = "osgi-exclude.properties"; ////$NON-NLS-1$
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
private static final Collection<String> EXCLUDED_MODULES = new ArrayList<String>() {
|
||||
{
|
||||
try (InputStream is = RepositoryPlugin.getDefault().getBundle()
|
||||
.getEntry("/resources/osgi-exclude.properties").openStream()) { //$NON-NLS-1$
|
||||
final Properties p = new Properties();
|
||||
p.load(is);
|
||||
for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
|
||||
add((String) e.nextElement());
|
||||
File propFile = null;
|
||||
File esbConfigurationLocation = EsbConfigUtils.getEclipseEsbFolder();
|
||||
|
||||
if (esbConfigurationLocation != null && esbConfigurationLocation.exists()
|
||||
&& esbConfigurationLocation.isDirectory()) {
|
||||
propFile = new File(esbConfigurationLocation.getAbsolutePath(), OSGI_EXCLUDE_PROP_FILENAME);
|
||||
}
|
||||
|
||||
InputStream is = null;
|
||||
try {
|
||||
if (propFile != null && propFile.exists() && propFile.isFile()) {
|
||||
is = new FileInputStream(propFile);
|
||||
} else {
|
||||
is = RepositoryPlugin.getDefault().getBundle()
|
||||
.getEntry("/resources/" + OSGI_EXCLUDE_PROP_FILENAME)
|
||||
.openStream();
|
||||
}
|
||||
|
||||
if (is != null) {
|
||||
final Properties p = new Properties();
|
||||
p.load(is);
|
||||
for (Enumeration<?> e = p.propertyNames(); e.hasMoreElements();) {
|
||||
add((String) e.nextElement());
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
RepositoryPlugin.getDefault().getLog()
|
||||
@@ -179,7 +216,18 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
getJobScriptsUncompressed(jobScriptResource, processItem);
|
||||
|
||||
// dynamic DB XML mapping
|
||||
addXmlMapping(process, isOptionChoosed(ExportChoice.needSourceCode));
|
||||
addXmlMapping(process, true);// isOptionChoosed(ExportChoice.needSourceCode)
|
||||
|
||||
if (CollectionUtils.isNotEmpty(process.getAllResources())) {
|
||||
ExportFileResource xm = new ExportFileResource(null, JavaUtils.JAVA_XML_MAPPING);
|
||||
Set<URL> urls = process
|
||||
.getResourcesByRelativePath(JOB_SOURCE_FOLDER_NAME + PATH_SEPARATOR + JavaUtils.JAVA_XML_MAPPING);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(urls)) {
|
||||
xm.addResources(new ArrayList<URL>(urls));
|
||||
list.add(xm);
|
||||
}
|
||||
}
|
||||
|
||||
generateConfig(osgiResource, processItem, iProcess);
|
||||
|
||||
@@ -670,10 +718,37 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
|
||||
private Manifest getManifest(ExportFileResource libResource, ProcessItem processItem) throws IOException {
|
||||
Analyzer analyzer = createAnalyzer(libResource, processItem);
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault()
|
||||
.getService(IRunProcessService.class);
|
||||
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendJobJavaProject(processItem.getProperty());
|
||||
if (talendProcessJavaProject != null) {
|
||||
String optional = ";resolution:=optional";
|
||||
Set<String> imports = importCompiler(service, processItem);
|
||||
String[] defaultPackages = analyzer.getProperty(Analyzer.IMPORT_PACKAGE).split(",");
|
||||
for (String dp : defaultPackages) {
|
||||
if (!imports.contains(dp) && !imports.contains(dp + optional)) {
|
||||
imports.add(dp);
|
||||
}
|
||||
}
|
||||
imports.remove("*;resolution:=optional");
|
||||
imports.remove("routines.system");
|
||||
imports.remove("routines.system" + optional);
|
||||
StringBuilder importPackage = new StringBuilder();
|
||||
for (String packageName : imports) {
|
||||
importPackage.append(packageName).append(',');
|
||||
}
|
||||
importPackage.append("*;resolution:=optional");
|
||||
analyzer.setProperty(Analyzer.IMPORT_PACKAGE, importPackage.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the manifest
|
||||
Manifest manifest = null;
|
||||
try {
|
||||
manifest = analyzer.calcManifest();
|
||||
filterImportPackages(manifest);
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
@@ -684,6 +759,38 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
return manifest;
|
||||
}
|
||||
|
||||
private void filterImportPackages(Manifest manifest) {
|
||||
|
||||
// remove import packages which are present in private packages
|
||||
|
||||
List<String> privatePackages = new ArrayList<String>();
|
||||
String privatePackagesString = manifest.getMainAttributes().getValue(Analyzer.PRIVATE_PACKAGE);
|
||||
if (privatePackagesString != null) {
|
||||
String [] packages = privatePackagesString.split(",");
|
||||
for (String p : packages) {
|
||||
privatePackages.add(p);
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder fileterdImportPackage = new StringBuilder();
|
||||
String importPackagesString = manifest.getMainAttributes().getValue(Analyzer.IMPORT_PACKAGE);
|
||||
if (importPackagesString != null) {
|
||||
String [] packages = importPackagesString.split(",");
|
||||
for (String p : packages) {
|
||||
String importPackage = p.split(";")[0];
|
||||
if (!privatePackages.contains(importPackage) || importPackage.startsWith("routines")) {
|
||||
fileterdImportPackage.append(p).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String str = fileterdImportPackage.toString();
|
||||
if (str != null && str.length() > 0 && str.endsWith(",")) {
|
||||
str = str.substring(0, str.length() - 1);
|
||||
}
|
||||
manifest.getMainAttributes().putValue(Analyzer.IMPORT_PACKAGE, str);
|
||||
}
|
||||
|
||||
protected Analyzer createAnalyzer(ExportFileResource libResource, ProcessItem processItem) throws IOException {
|
||||
Analyzer analyzer = new Analyzer();
|
||||
Jar bin = new Jar(classesLocation);
|
||||
@@ -715,6 +822,12 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
for (String path : relativePathList) {
|
||||
Set<URL> resources = libResource.getResourcesByRelativePath(path);
|
||||
for (URL url : resources) {
|
||||
// TESB-21804:Fail to deploy cMessagingEndpoint with quartz component in runtime for ClassCastException
|
||||
if (url.getPath().matches("(.*)camel-(.*)-alldep-(.*)$")
|
||||
|| url.getPath().matches("(.*)activemq-all-[\\d\\.]*.jar$")
|
||||
|| url.getPath().matches("(.*)jms[\\d\\.-]*.jar$")) {
|
||||
continue;
|
||||
}
|
||||
File dependencyFile = new File(FilesUtils.getFileRealPath(url.getPath()));
|
||||
String relativePath = libResource.getDirectoryName() + PATH_SEPARATOR + dependencyFile.getName();
|
||||
bundleClasspath.append(MANIFEST_ITEM_SEPARATOR).append(relativePath);
|
||||
@@ -735,6 +848,11 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
analyzer.setProperty(Analyzer.BUNDLE_NATIVECODE, bundleNativeCode.toString());
|
||||
}
|
||||
|
||||
// TESB-24730 set specific version for "javax.annotation"
|
||||
ImportedPackageRangeReplacer r = new ImportedPackageRangeReplacer();
|
||||
r.addRange("javax.annotation", "[1.3,2)");
|
||||
analyzer.addBasicPlugin(r);
|
||||
|
||||
return analyzer;
|
||||
}
|
||||
|
||||
@@ -895,5 +1013,170 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
||||
IProcessor processor = ProcessorUtilities.getProcessor(currentProcess, process.getProperty());
|
||||
return processor.getProcess();
|
||||
}
|
||||
|
||||
|
||||
private class ImportedPackageRangeReplacer implements AnalyzerPlugin, Plugin {
|
||||
|
||||
private Set<Range> ranges = new TreeSet<>();
|
||||
|
||||
public void addRange(String packageName, String packageVersion) {
|
||||
ranges.add(new Range(packageName, packageVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyzes the jar and update the version range.
|
||||
*
|
||||
* @param analyzer the analyzer
|
||||
* @return {@code false}
|
||||
* @throws Exception if the analaysis fails.
|
||||
*/
|
||||
@Override
|
||||
public boolean analyzeJar(Analyzer analyzer) throws Exception {
|
||||
|
||||
if (analyzer.getReferred() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Map.Entry<Descriptors.PackageRef, Attrs> entry : analyzer.getReferred().entrySet()) {
|
||||
for (Range range : ranges) {
|
||||
if (range.matches(entry.getKey().getFQN())) {
|
||||
String value = range.getRange(analyzer);
|
||||
if (value != null) {
|
||||
entry.getValue().put("version", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private class Range implements Comparable<Range> {
|
||||
final String name;
|
||||
final String value;
|
||||
final Pattern regex;
|
||||
|
||||
private String foundRange;
|
||||
|
||||
private Range(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.regex = Pattern.compile(name.trim().replace(".", "\\.").replace("*", ".*"));
|
||||
}
|
||||
|
||||
private boolean matches(String pck) {
|
||||
return regex.matcher(pck).matches();
|
||||
}
|
||||
|
||||
private String getRange(Analyzer analyzer) throws Exception {
|
||||
if (foundRange != null) {
|
||||
return foundRange;
|
||||
}
|
||||
if (null == value || value.isEmpty()) {
|
||||
for (Jar jar : analyzer.getClasspath()) {
|
||||
if (isProvidedByJar(jar) && jar.getVersion() != null) {
|
||||
foundRange = jar.getVersion();
|
||||
return jar.getVersion();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isProvidedByJar(Jar jar) {
|
||||
for (String s : jar.getPackages()) {
|
||||
if (matches(s)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Range o) {
|
||||
return Integer.compare(this.regex.pattern().length(), o.regex.pattern().length());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
Range range = (Range) o;
|
||||
return Objects.equals(name, range.name) &&
|
||||
Objects.equals(value, range.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(name + value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReporter(Reporter processor) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Map<String, String> map) throws Exception {
|
||||
}
|
||||
}
|
||||
|
||||
private Set<String> importCompiler(IRunProcessService service, ProcessItem processItem) {
|
||||
Set<String> imports = new HashSet<String>();
|
||||
if (processItem != null && service != null && processItem.getProperty() != null) {
|
||||
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendJobJavaProject(processItem.getProperty());
|
||||
if (talendProcessJavaProject != null) {
|
||||
String src = JavaResourcesHelper.getJobClassFilePath(processItem, true);
|
||||
IFile srcFile = talendProcessJavaProject.getSrcFolder().getFile(src);
|
||||
imports.addAll(importCompiler(srcFile.getLocation().toString()));
|
||||
|
||||
// include imports from child jobs
|
||||
if (ERepositoryObjectType.getType(processItem.getProperty()).equals(ERepositoryObjectType.PROCESS)) {
|
||||
for (JobInfo subjobInfo : ProcessorUtilities.getChildrenJobInfo(processItem)) {
|
||||
imports.addAll(importCompiler(service, subjobInfo.getProcessItem()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return imports;
|
||||
}
|
||||
|
||||
private Set<String> importCompiler(String src) {
|
||||
Set<String> imports = new HashSet<String>();
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ByteArrayOutputStream err = new ByteArrayOutputStream();
|
||||
try {
|
||||
org.eclipse.jdt.core.compiler.batch.BatchCompiler.compile(src + " -1.7 -nowarn -maxProblems 100000 ", new PrintWriter(out),
|
||||
new PrintWriter(err), null);
|
||||
String errString = new String(err.toByteArray());
|
||||
String[] errBlocks = errString.split("----------");
|
||||
String reg = "(^[a-z_0-9\\.]+)\\.";
|
||||
Pattern pattern = Pattern.compile(reg);
|
||||
for (String errBlock : errBlocks) {
|
||||
String[] lines = errBlock.trim().replaceAll("\r", "").split("\n");
|
||||
if (lines.length == 4) {
|
||||
if (lines[3].endsWith("cannot be resolved to a type") || lines[3].endsWith("cannot be resolved")) {
|
||||
int markerPos = lines[2].indexOf('^');
|
||||
Matcher m = pattern.matcher(lines[1].substring(markerPos));
|
||||
if (m.find()) {
|
||||
if (m.groupCount() == 1 && m.group(1).indexOf('.') > 0) {
|
||||
imports.add(m.group(1) + ";resolution:=optional");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
out.close();
|
||||
err.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return imports;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ package org.talend.sdk.component.studio.metadata.handler;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
@@ -79,7 +80,7 @@ public class TaCoKitDragAndDropHandler extends AbstractDragAndDropServiceHandler
|
||||
*/
|
||||
@Override
|
||||
public Object getComponentValue(final Connection connection, final String repositoryKey, final IMetadataTable table,
|
||||
final String targetComponent) {
|
||||
final String targetComponent, Map<Object, Object> contextMap) {
|
||||
try {
|
||||
if (connection == null) {
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2018 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.core.generic.service;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.components.api.properties.ComponentProperties;
|
||||
import org.talend.components.api.properties.ComponentReferenceProperties;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.properties.PropertiesFactory;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.ui.component.ComponentsFactoryProvider;
|
||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
|
||||
/**
|
||||
* DOC hwang class global comment. Detailled comment
|
||||
*/
|
||||
public class GenericServiceTest {
|
||||
|
||||
@Test
|
||||
public void testResetReferenceValue() {
|
||||
GenericService service = new GenericService();
|
||||
//---first
|
||||
String oldConnectionName = "joblet3_1";
|
||||
String newConnectionName = "joblet1_1_joblet2_1_joblet3_1";
|
||||
|
||||
IComponent component = ComponentsFactoryProvider.getInstance().get("tJDBCInput",
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
Property property = PropertiesFactory.eINSTANCE.createProperty();
|
||||
property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
|
||||
property.setVersion(VersionUtils.DEFAULT_VERSION);
|
||||
Process process = new Process(property);
|
||||
Node node = new Node(component, process);
|
||||
|
||||
ComponentProperties pros = node.getComponentProperties();
|
||||
ComponentReferenceProperties comPro = (ComponentReferenceProperties) pros.getProperties("referencedComponent"); //$NON-NLS-1$
|
||||
comPro.componentInstanceId.setValue("joblet3_1_joblet4_1_joblet5_1_tJDBCConnection_1");
|
||||
|
||||
service.resetReferenceValue(node, oldConnectionName, newConnectionName);
|
||||
assertTrue(comPro.componentInstanceId.getStoredValue().equals("joblet1_1_joblet2_1_joblet3_1_joblet4_1_joblet5_1_tJDBCConnection_1"));
|
||||
//---second
|
||||
oldConnectionName = "tJDBCConnection_1";
|
||||
newConnectionName = "joblet1_1_joblet2_1_tJDBCConnection_1";
|
||||
comPro.componentInstanceId.setValue("tJDBCConnection_1_joblet4_1_joblet5_1_tJDBCConnection_1");
|
||||
service.resetReferenceValue(node, oldConnectionName, newConnectionName);
|
||||
assertTrue(comPro.componentInstanceId.getStoredValue().equals("joblet1_1_joblet2_1_tJDBCConnection_1_joblet4_1_joblet5_1_tJDBCConnection_1"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,15 +17,28 @@ import static org.junit.Assert.*;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.talend.core.context.Context;
|
||||
import org.talend.core.model.components.ComponentCategory;
|
||||
import org.talend.core.model.components.IComponent;
|
||||
import org.talend.core.model.context.JobContextManager;
|
||||
import org.talend.core.model.context.JobContextParameter;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.IContext;
|
||||
import org.talend.core.model.process.IContextManager;
|
||||
import org.talend.core.model.process.IContextParameter;
|
||||
import org.talend.core.model.process.IElement;
|
||||
import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.process.IGenericElementParameter;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.ui.component.ComponentsFactoryProvider;
|
||||
import org.talend.daikon.properties.property.PropertyValueEvaluator;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.core.model.components.ElementParameter;
|
||||
import org.talend.designer.core.model.components.EmfComponent;
|
||||
import org.talend.designer.core.test.util.NodeTestCreator;
|
||||
import org.talend.designer.core.test.util.SimpleInputComponent;
|
||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||
import org.talend.designer.core.ui.editor.process.Process;
|
||||
import org.talend.designer.core.utils.TestUtils;
|
||||
@@ -38,18 +51,46 @@ public class DataProcessTest {
|
||||
|
||||
private static final String TEST_COMPONENT_NAME = "tSalesforceInput"; //$NON-NLS-1$
|
||||
|
||||
private static final String TEST_SALESFORCE_CONNECTION_NAME = "tSalesforceConnection"; //$NON-NLS-1$
|
||||
|
||||
private static IComponent testComponent;
|
||||
|
||||
private static IComponent testComponent_1;
|
||||
|
||||
private Process process;
|
||||
|
||||
private Process process_1;
|
||||
|
||||
private Process process_2;
|
||||
|
||||
private DataProcess dataProcess;
|
||||
|
||||
private TestDataProcess testDataProcess;
|
||||
|
||||
private INode testNode;
|
||||
|
||||
private Node sourceNode;
|
||||
|
||||
private Node targetNode;
|
||||
|
||||
private static class TestDataProcess extends DataProcess {
|
||||
|
||||
public TestDataProcess(IProcess process) {
|
||||
super(process);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void copyElementParametersValue(IElement sourceElement, IElement targetElement) {
|
||||
super.copyElementParametersValue(sourceElement, targetElement);
|
||||
}
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
testComponent = ComponentsFactoryProvider.getInstance().get(TEST_COMPONENT_NAME,
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
testComponent_1 = ComponentsFactoryProvider.getInstance().get(TEST_SALESFORCE_CONNECTION_NAME,
|
||||
ComponentCategory.CATEGORY_4_DI.getName());
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -57,6 +98,51 @@ public class DataProcessTest {
|
||||
process = new Process(TestUtils.createDefaultProperty());
|
||||
dataProcess = new DataProcess(process);
|
||||
testNode = new Node(testComponent, process);
|
||||
|
||||
testDataProcess = new TestDataProcess(process_1);
|
||||
process_1 = new Process(TestUtils.createDefaultProperty());
|
||||
process_2 = new Process(TestUtils.createDefaultProperty());
|
||||
process_1.addUniqueNodeName("testProcess1"); //$NON-NLS-1$
|
||||
process_2.addUniqueNodeName("testProcess2"); //$NON-NLS-1$
|
||||
|
||||
sourceNode = new Node(testComponent_1, process_1);
|
||||
targetNode = new Node(testComponent_1, process_2);
|
||||
|
||||
IContextManager cm = process_1.getContextManager();
|
||||
if (cm == null) {
|
||||
cm = new JobContextManager();
|
||||
}
|
||||
|
||||
for (IElementParameter param : sourceNode.getElementParameters()) {
|
||||
if (param.getClass().getName().equals("org.talend.designer.core.generic.model.GenericElementParameter")) //$NON-NLS-1$
|
||||
{
|
||||
if (param.getName().equals("loginType")) { //$NON-NLS-1$
|
||||
param.setFieldType(EParameterFieldType.CLOSED_LIST);
|
||||
param.setContextMode(true);
|
||||
param.setName("context.salesForce_Connection_loginType"); //$NON-NLS-1$
|
||||
param.setValue("OAuth"); //$NON-NLS-1$
|
||||
} else if (param.getName().equals("oauth2FlowType")) { //$NON-NLS-1$
|
||||
param.setFieldType(EParameterFieldType.CLOSED_LIST);
|
||||
param.setContextMode(true);
|
||||
param.setName("context.salesForce_Connection_oauth2FlowType"); //$NON-NLS-1$
|
||||
param.setValue("JWT_Flow"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IContext context = cm.getDefaultContext();
|
||||
context.setName("test"); //$NON-NLS-1$
|
||||
JobContextParameter connTypeParam = new JobContextParameter();
|
||||
connTypeParam.setName("context.salesForce_Connection_loginType"); //$NON-NLS-1$
|
||||
connTypeParam.setValue("OAuth"); //$NON-NLS-1$
|
||||
connTypeParam.setSource(EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
|
||||
IContextParameter toAdd = connTypeParam.clone();
|
||||
context.getContextParameterList().add(toAdd);
|
||||
JobContextParameter oauth2FlowTypeParam = new JobContextParameter();
|
||||
oauth2FlowTypeParam.setName("context.salesForce_Connection_oauth2FlowType"); //$NON-NLS-1$
|
||||
oauth2FlowTypeParam.setValue("JWT_Flow"); //$NON-NLS-1$
|
||||
toAdd = oauth2FlowTypeParam.clone();
|
||||
context.getContextParameterList().add(toAdd);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,6 +176,27 @@ public class DataProcessTest {
|
||||
assertFalse(containsHadoopConfsNode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopyElementParametersValue() {
|
||||
testDataProcess.copyElementParametersValue(sourceNode, targetNode);
|
||||
for (IElementParameter sourceParameter : sourceNode.getElementParameters()) {
|
||||
IElementParameter targetParam = targetNode.getElementParameter(sourceParameter.getName());
|
||||
if (!sourceParameter.getFieldType().equals(EParameterFieldType.CLOSED_LIST)) {
|
||||
assertEquals(sourceParameter.getValue(), targetParam.getValue());
|
||||
} else {
|
||||
if (sourceParameter.getName().equals("context.salesForce_Connection_loginType")) { //$NON-NLS-1$
|
||||
assertEquals(targetParam.getName(), "context.salesForce_Connection_loginType"); //$NON-NLS-1$
|
||||
assertEquals(targetParam.getValue(), "OAuth"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (sourceParameter.getName().equals("context.salesForce_Connection_oauth2FlowType")) { //$NON-NLS-1$
|
||||
assertEquals(targetParam.getName(), "context.salesForce_Connection_oauth2FlowType"); //$NON-NLS-1$
|
||||
assertEquals(targetParam.getValue(), "JWT_Flow"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean containsHadoopConfsNode() {
|
||||
for (INode node : dataProcess.getNodeList()) {
|
||||
String compName = node.getComponent().getName();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user