Compare commits

...

50 Commits

Author SHA1 Message Date
wwang-talend
ad2181551e add readme for patch 2020-05-28 15:13:28 +08:00
wang wei
25b4724de6 fix(TDI-43410): Enable AWS ECS role for tAmazonEMR component (#4247) 2020-05-28 15:04:20 +08:00
wang wei
f6d7c55c06 fix(TDI-43409): Enable AWS ECS role for tSQS component (#4248) 2020-05-28 15:04:12 +08:00
Dmytro Sylaiev
4fa889ddfd Dsylaiev/tdi 43810 add ignore service attr checkbox for xml (#4539)
* fix(TDI-43810): Fix for xml component

* fix(TDI-43810): Do not ignore service attr when checkbox is hidden

* fix(TDI-43810): Use hashset instead of arraylist

* fix(TDI-43810): Minor refactoring
2020-03-24 14:47:55 +02:00
Jane Ding
1b0b5b9c4b Jding/patch711/tps 3786 (#4497)
* fix(TUP-22620)java.lang.StackOverflowError exception when opening the (#3391) (#3399)

* fix(TUP-22620)java.lang.StackOverflowError exception when opening the
job in studio
https://jira.talendforge.org/browse/TUP-22620

* fix(TUP-22620)java.lang.StackOverflowError exception when opening the
job in studio
https://jira.talendforge.org/browse/TUP-22620

* fix(TUP-22620)java.lang.StackOverflowError exception when opening the (#3402) (#3406)

job in studio
https://jira.talendforge.org/browse/TUP-22620
Since my new added test testCheckCircle is the first one to execute, it
used common variable node broke other test balance. Modify to use it own
private variable.
2020-03-02 18:29:38 +08:00
hwang-talend
4fa291afa5 Hwang/tup 26059 (#4436)
* bugfix(TUP-26059):tELTPostgresqlMap lost its "DB Type" column for which
the value should be "BPCHAR"
2020-03-02 17:01:26 +08:00
Mike Yan
2410d7c81b fix(TESB-28166): [CI] Missig fieature.xml in esb consumer and service (#4494) 2020-03-02 14:21:45 +08:00
apoltavtsev
a6dac58827 fix(TESB-27583): Maven nature is added to child Job for OSGI build 2020-01-20 10:46:58 +01:00
Denis Sergent
d1ce25465c fix(TESB-27030): Exclude jms library when it is used from tRunJob (#4340)
Backport for patch 7.1.1 (#4045)
* fix(TESB-27030): Avoid to add activemq-all lib in OSGi bundle
* fix(TESB-27030): Exclude jms library when it is used from tRunJob

Conflicts:
	main/plugins/org.talend.repository/src/main/java/org/talend/repository/ui/wizards/exportjob/scriptsmanager/esb/JobJavaScriptOSGIForESBManager.java

Co-authored-by: Mike Yan <yyan@talend.com>
2020-01-17 10:44:32 +01:00
bhe-talendbj
1f31ea1c4f backport(TUP-25237) backport (#4218)
Conflicts:
	main/plugins/org.talend.designer.runprocess/src/main/java/org/talend/designer/runprocess/java/TalendJavaProjectManager.java
2020-01-03 17:41:35 +08:00
hwang-talend
4a28c50b04 bugfix(TUP-23228):The order of schema changed when ticked "used column" (#3525) (#4234)
bugfix(TUP-23228):The order of schema changed when ticked "used column" again
2020-01-03 17:38:09 +08:00
Chao MENG
6beef70589 fix(TUP-24749): [7.2.1] issue to download component jar via https proxy (#4167) (#4184) (#4279)
fix(TUP-24749): [7.2.1] issue to download component jar via https proxy
https://jira.talendforge.org/browse/TUP-24749
2020-01-03 17:35:14 +08:00
hzhao-talendbj
06be524b5c bugfix(TUP-25035)Implicit tContextLoad feature (with selection from (#4268) (#4276)
file) uses a hardcoded encoding of ISO-8859-15
2020-01-03 17:31:18 +08:00
bhe-talendbj
139acb8b90 backport(TUP-25257) 2019-12-12 10:48:47 +08:00
hwang-talend
e1a8dfc24b bugfix(TUP-24355):Default Context environment appended after migrating (#4037) (#4041)
bugfix(TUP-24355):Default Context environment appended after migrating
2019-12-09 10:54:44 +08:00
hwang-talend
6782042783 bugfix(TUP-24355):Default Context environment appended after migrating (#3927)
* bugfix(TUP-24355):Default Context environment appended after migrating
to 7.2.1
2019-12-09 10:54:41 +08:00
hzhao-talendbj
c54af4b1e2 Hengzhao/bugfix/tup 25035 (#4157)
* feat(TUP-25035)Implicit tContextLoad feature (with selection from file)
uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15

* bugfix(TUP-25035)Implicit tContextLoad feature (with selection from
file) uses a hardcoded encoding of ISO-8859-15
2019-12-09 10:46:24 +08:00
Hanna Liashchuk
71e572da23 patch(TPS-3584): Header field is ignored in Service account mode tBigQueryBulkExec (TBD-8951) (#4210) 2019-12-06 16:43:13 +02:00
hwang
d46c202e6b bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job
#1102
2019-11-11 13:06:27 +08:00
nrousseau
f536ed47ae Nrousseau/tup 24884 backport (#4110)
* bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job (#4042)

bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job

* bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job (#4101)

bugfix(TUP-24884):Spark Joblets cannot be built within Parent DI job
2019-11-11 11:41:58 +08:00
hwang-talend
de82c16af4 bugfix(TUP-23322):context value doesn't update after publishing the job (#3555) (#3580)
bugfix(TUP-23322):context value doesn't update after publishing the job to release repository
2019-11-11 10:42:53 +08:00
apoltavtsev
c5eac4ef90 TESB-27081 SOAP Action missing while calling a SOAP WebService through tESBConsumer 2019-11-08 10:03:22 +01:00
hwang
1fa26e95ed Revert "bugfix(TUP-23322):context value doesn't update after publishing the job (#3555) (#3580)"
This reverts commit 4d4040de42.
2019-11-08 14:45:52 +08:00
hwang-talend
4d4040de42 bugfix(TUP-23322):context value doesn't update after publishing the job (#3555) (#3580)
bugfix(TUP-23322):context value doesn't update after publishing the job to release repository
2019-11-08 14:27:32 +08:00
Chao MENG
2fa1c9c6c0 Patch/monthly/7.1.1/201911/tps 3485 subquery issue (#4093)
* Revert "Revert "fix(TBD-9366): tELTHiveMap doesn't pass context variable properly (#4066)""

This reverts commit d69f83c3bd.

* fix(TBD-9366): tELTHiveMap doesn't pass context variable properly
https://jira.talendforge.org/browse/TBD-9366
2019-11-04 18:13:53 +08:00
Chao MENG
d69f83c3bd Revert "fix(TBD-9366): tELTHiveMap doesn't pass context variable properly (#4066)"
This reverts commit 2ad55908cd.
2019-11-01 16:41:59 +08:00
Chao MENG
2ad55908cd fix(TBD-9366): tELTHiveMap doesn't pass context variable properly
(#4066)

fix(TBD-9366): tELTHiveMap doesn't pass context variable properly
https://jira.talendforge.org/browse/TBD-9366

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
	test/plugins/org.talend.designer.dbmap.test/src/org/talend/designer/dbmap/language/generation/DbGenerationManagerTest.java
2019-11-01 16:40:20 +08:00
hwang
f6209cee95 Revert "bugfix(TUP-24273):Created a new test case and run it, can not show up the test result on the right panel"
This reverts commit fe032a359c.
2019-10-30 15:36:04 +08:00
hwang
fe032a359c bugfix(TUP-24273):Created a new test case and run it, can not show up
the test result on the right panel
2019-10-28 17:59:08 +08:00
apoltavtsev
dec8461335 TESB-26789 Bean called in routelet not found by main route (#3987) 2019-10-07 14:47:49 +02:00
Zhiwei Xue
46eae3db6a fix(TUP-24310):routines is duplicated in the reactor (#3909) 2019-09-24 16:46:46 +08:00
AlixMetivier
0b2496cca6 migration task from TBD-9121 (#3905) 2019-09-06 11:29:47 +02:00
Chao MENG
24c2e1bbb3 Cmeng/bugfix/tup 23914 json wizard encoding (#3771) (#3778)
* fix(TUP-23914): JSON with accented characters is not being recognized
when creating a new JSON file in Metadata.
https://jira.talendforge.org/browse/TUP-23914
2019-09-06 17:26:27 +08:00
Andrii Medvedenko
dd18017695 patch(TPS-3276): Could not insert a value which the column type is DATETIME via tBigQueryBulkExec(TBD-8925) (#3856)
* fix(TBD-8242): Compilation error for tFileInputDelimited/tFixedFlowInput with int type not nullable (#3193)

* fix(TBD-8301) : Use Regional Location for BigQuery datasets (#3228) (#3229)

* fix(TBD-7153): Fixed missing mappings for BigQuery (#3291) (#3337)

* Hliashchuk/fix/tbd 8356 bigquery empty strings (#3322) (#3339)

* fix(TBD-8356): empty strings handling in bigquery

* fix(TBD-8356): service account empty strings support

* fix(TBD-8925): table won't be created unless createTable option is checked OAuth (#3686)
2019-08-23 15:30:56 +03:00
SunChaoqun
af1d09968b TESB-24354:SFTP proxy bean not recognized in runtime only (#3131) 2019-08-23 11:56:08 +08:00
yanbasic
4a0e546f9a Revert "fix(TESB-26174):tRunJob calling another Child job with tESBConsumer"
This reverts commit 48571e54bc.
2019-08-21 17:41:12 +08:00
jiezhang-tlnd
9142b137de fix(TUP-24159)XML metadata wizard showing inconsistent view on V711 (#3838)
comparing with V6 Studio
https://jira.talendforge.org/browse/TUP-24159
2019-08-20 10:58:44 +08:00
jiezhang-tlnd
96d9b2c8a2 fix(TUP-24159)XML metadata wizard showing inconsistent view on (#3810)
V711comparing with V6 Studio
https://jira.talendforge.org/browse/TUP-24159
2019-08-16 17:54:33 +08:00
Jane Ding
96a52cea5a Jding/71/tup 23789 pom files are not generated (#3753)
* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
(#3738)

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789
Add a junit.

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789

Conflicts:
	test/plugins/org.talend.designer.runprocess.test/src/org/talend/designer/runprocess/maven/listener/ProcessChangeListenerTest.java
2019-08-12 11:03:40 +08:00
Stéphane Bouchet
af6792732a TESB-26300: disable message dialog when checking build errors (#3654)
* TESB-23600 : do not open dialog anymore when checking errors

* TESB-23600 : refactor/cleanup

Conflicts:
	main/plugins/org.talend.designer.runprocess/src/main/java/org/talend/designer/runprocess/JobErrorsChecker.java
2019-08-09 15:07:03 +02:00
yanbasic
48571e54bc fix(TESB-26174):tRunJob calling another Child job with tESBConsumer 2019-08-06 15:40:30 +08:00
Jane Ding
dc64a893c6 Jding/patch711/tup 21075 t map issue on mac (#3792)
* fix(TUP-21075)Problem of display in the tMap with Mojave (#2900) (#2906)

* fix(TUP-21075)Problem of display in the tMap with Mojave
https://jira.talendforge.org/browse/TUP-21075

* fix(TUP-21075)use duplicate name for jdbc connection, no error show
https://jira.talendforge.org/browse/TUP-21075

* fix(TUP-21075)Problem of display in the tMap with Mojave
https://jira.talendforge.org/browse/TUP-21075

* fix(TUP-21075)Problem of display in the tMap with Mojave (#2943) (#2954)

https://jira.talendforge.org/browse/TUP-21075
2019-08-05 11:15:45 +08:00
hcyi
78d8d901b6 fix(TUP-23743):ERROR when Job in MDM project calling Job in Reference DI (#3710)
project routines cannot be resolved.
2019-08-05 11:04:54 +08:00
apoltavtsev
6947ccdf9d TESB-24730 Services no longer accessible ( NPE) after route deployment (#3758) 2019-07-29 11:08:37 +08:00
wwang-talend
91bd64ec32 fix(TPS-3238): [7.1.1]Migration issues in the Studio after migrating the
jobs from 6.5 to 7.1(TDI-42380).
2019-07-26 10:11:48 +08:00
apoltavtsev
d96a383857 TESB-24900 Compillation error is removed 2019-07-24 11:47:19 +03:00
apoltavtsev
85581b5d25 TESB-24900 Undeploying a Data Service causes "Exception in opening zip file" error 2019-07-22 17:17:14 +03:00
hwang
32e02c0bbd bugfix(TUP-22649):tELTOracleMap : wrong Generated SQL Select query after
patch
2019-07-18 17:14:48 +08:00
hwang-talend
f0251625b4 Hwang/tup 22649 (#3413) (#3440)
bugfix(TUP-22649):tELTOracleMap : wrong Generated SQL Select query after
patch TPS-2944

Conflicts:
	main/plugins/org.talend.designer.dbmap/src/main/java/org/talend/designer/dbmap/language/generation/DbGenerationManager.java
2019-07-18 16:13:07 +08:00
sponomarova
cb3b7a5b37 patch(TPS-3225): removed too small total timeout for service account (#3726) 2019-07-17 10:50:07 +03:00
58 changed files with 1924 additions and 625 deletions

57
PATCH_RELEASE_NOTE.md Normal file
View File

@@ -0,0 +1,57 @@
---
version: 7.1.1
module: https://talend.poolparty.biz/coretaxonomy/42
product:
- https://talend.poolparty.biz/coretaxonomy/23
---
# TPS-4052
| Info | Value |
| ---------------- | ---------------- |
| Patch Name | Patch\_20200528\_TPS-4052\_v1-7.1.1 |
| Release Date | 2020-05-28 |
| Target Version | 20181026_1147-V7.1.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-4052 [7.1.1] S3/SQS Components Inherit Role Issue in AWS Fargate (TDI-43410, TDI-43409, TDI-42687)
## Prerequisites
Consider the following requirements for your system:
- Talend Studio 7.1.1 must be installed.
## Installation
### Installing the patch using Software update
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}

View File

@@ -69,145 +69,140 @@ if(hasInput){
}
}
}
boolean hasValidInput = inputConn!=null;
IMetadataTable metadata = null;
List<IMetadataTable> metadatas = node.getMetadataList();
boolean haveValidNodeMetadata = ((metadatas != null) && (metadatas.size() > 0) && (metadata = metadatas.get(0)) != null);
if (hasValidInput && haveValidNodeMetadata) {
if (hasValidInput) {
List<IMetadataColumn> input_columnList = inputConn.getMetadataTable().getListColumns();
if(input_columnList == null) {
input_columnList = new ArrayList<IMetadataColumn>();
}
// add incoming (not present) columns to enforcer for this comps
if (cid.contains("tDataStewardship") || cid.contains("tMarkLogic")){
%>
boolean shouldCreateRuntimeSchemaForIncomingNode = false;
<%
for (int i = 0; i < input_columnList.size(); i++) {
if(!input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
%>
if (incomingEnforcer_<%=cid%>.getDesignSchema().getField("<%=input_columnList.get(i)%>") == null){
incomingEnforcer_<%=cid%>.addIncomingNodeField("<%=input_columnList.get(i)%>", ((Object) <%=inputConn.getName()%>.<%=input_columnList.get(i)%>).getClass().getCanonicalName());
shouldCreateRuntimeSchemaForIncomingNode = true;
}
<%
}
}
%>
if (shouldCreateRuntimeSchemaForIncomingNode){
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
// If there are dynamic columns in the schema, they need to be
// initialized into the runtime schema of the actual IndexedRecord
// provided to the component.
int dynamicPos = -1;
for (int i = 0; i < input_columnList.size(); i++) {
if (input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
dynamicPos = i;
break;
}
}
if (dynamicPos != -1) {
%>
if (!incomingEnforcer_<%=cid%>.areDynamicFieldsInitialized()) {
// Initialize the dynamic columns when they are first encountered.
for (routines.system.DynamicMetadata dm_<%=cid%> : <%=inputConn.getName()%>.<%=input_columnList.get(dynamicPos).getLabel()%>.metadatas) {
incomingEnforcer_<%=cid%>.addDynamicField(
dm_<%=cid%>.getName(),
dm_<%=cid%>.getType(),
dm_<%=cid%>.getLogicalType(),
dm_<%=cid%>.getFormat(),
dm_<%=cid%>.getDescription(),
dm_<%=cid%>.isNullable());
}
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
%>
incomingEnforcer_<%=cid%>.createNewRecord();
<%
for (int i = 0; i < input_columnList.size(); i++) { // column
IMetadataColumn column = input_columnList.get(i);
if (dynamicPos != i) {
%>
//skip the put action if the input column doesn't appear in component runtime schema
if (incomingEnforcer_<%=cid%>.getRuntimeSchema().getField("<%=input_columnList.get(i)%>") != null){
incomingEnforcer_<%=cid%>.put("<%=column.getLabel()%>", <%=inputConn.getName()%>.<%=column.getLabel()%>);
}
<%
} else {
%>
for (int i = 0; i < <%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnCount(); i++) {
incomingEnforcer_<%=cid%>.put(<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnMetadata(i).getName(),
<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnValue(i));
}
<%
}
} // column
// If necesary, generate the code to handle outgoing connections.
// TODO: For now, this can only handle one outgoing record for
// each incoming record. To handle multiple outgoing records, code
// generation needs to occur in component_begin in order to open
// a for() loop.
// There will be a ClassCastException if the output component does
// not implement WriterWithFeedback, but permits outgoing
// connections.
if (input_columnList!=null && !input_columnList.isEmpty()) {
// add incoming (not present) columns to enforcer for this comps
if (cid.contains("tDataStewardship") || cid.contains("tMarkLogic")){
%>
boolean shouldCreateRuntimeSchemaForIncomingNode = false;
<%
for (int i = 0; i < input_columnList.size(); i++) {
if(!input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
%>
if (incomingEnforcer_<%=cid%>.getDesignSchema().getField("<%=input_columnList.get(i)%>") == null){
incomingEnforcer_<%=cid%>.addIncomingNodeField("<%=input_columnList.get(i)%>", ((Object) <%=inputConn.getName()%>.<%=input_columnList.get(i)%>).getClass().getCanonicalName());
shouldCreateRuntimeSchemaForIncomingNode = true;
}
<%
}
}
%>
if (shouldCreateRuntimeSchemaForIncomingNode){
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
// If there are dynamic columns in the schema, they need to be
// initialized into the runtime schema of the actual IndexedRecord
// provided to the component.
int dynamicPos = -1;
for (int i = 0; i < input_columnList.size(); i++) {
if (input_columnList.get(i).getTalendType().equals("id_Dynamic")) {
dynamicPos = i;
break;
}
}
if (dynamicPos != -1) {
%>
if (!incomingEnforcer_<%=cid%>.areDynamicFieldsInitialized()) {
// Initialize the dynamic columns when they are first encountered.
for (routines.system.DynamicMetadata dm_<%=cid%> : <%=inputConn.getName()%>.<%=input_columnList.get(dynamicPos).getLabel()%>.metadatas) {
incomingEnforcer_<%=cid%>.addDynamicField(
dm_<%=cid%>.getName(),
dm_<%=cid%>.getType(),
dm_<%=cid%>.getLogicalType(),
dm_<%=cid%>.getFormat(),
dm_<%=cid%>.getDescription(),
dm_<%=cid%>.isNullable());
}
incomingEnforcer_<%=cid%>.createRuntimeSchema();
}
<%
}
%>
incomingEnforcer_<%=cid%>.createNewRecord();
<%
for (int i = 0; i < input_columnList.size(); i++) { // column
IMetadataColumn column = input_columnList.get(i);
if (dynamicPos != i) {
%>
//skip the put action if the input column doesn't appear in component runtime schema
if (incomingEnforcer_<%=cid%>.getRuntimeSchema().getField("<%=input_columnList.get(i)%>") != null){
incomingEnforcer_<%=cid%>.put("<%=column.getLabel()%>", <%=inputConn.getName()%>.<%=column.getLabel()%>);
}
<%
} else {
%>
for (int i = 0; i < <%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnCount(); i++) {
incomingEnforcer_<%=cid%>.put(<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnMetadata(i).getName(),
<%=inputConn.getName()%>.<%=column.getLabel()%>.getColumnValue(i));
}
<%
}
} // column
// If necesary, generate the code to handle outgoing connections.
// TODO: For now, this can only handle one outgoing record for
// each incoming record. To handle multiple outgoing records, code
// generation needs to occur in component_begin in order to open
// a for() loop.
// There will be a ClassCastException if the output component does
// not implement WriterWithFeedback, but permits outgoing
// connections.
ComponentProperties componentProps = node.getComponentProperties();
ProcessPropertiesGenerator generator = new ProcessPropertiesGenerator(cid, component);
List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(componentProps);
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
List<NamedThing> properties = propInfo.props.getProperties();
for (NamedThing prop : properties) { // property
if (prop instanceof Property) { // if, only deal with valued Properties
Property property = (Property)prop;
if (property.getFlags() != null && (property.getFlags().contains(Property.Flags.DESIGN_TIME_ONLY) || property.getFlags().contains(Property.Flags.HIDDEN)))
continue;
if(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)!=null && Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)))) {
generator.setPropertyValues(property, propInfo, null, false, false);
}
ComponentProperties componentProps = node.getComponentProperties();
ProcessPropertiesGenerator generator = new ProcessPropertiesGenerator(cid, component);
List<Component.CodegenPropInfo> propsToProcess = component.getCodegenPropInfos(componentProps);
for (Component.CodegenPropInfo propInfo : propsToProcess) { // propInfo
List<NamedThing> properties = propInfo.props.getProperties();
for (NamedThing prop : properties) { // property
if (prop instanceof Property) { // if, only deal with valued Properties
Property property = (Property)prop;
if (property.getFlags() != null && (property.getFlags().contains(Property.Flags.DESIGN_TIME_ONLY) || property.getFlags().contains(Property.Flags.HIDDEN)))
continue;
if(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)!=null && Boolean.valueOf(String.valueOf(property.getTaggedValue(IGenericConstants.DYNAMIC_PROPERTY_VALUE)))) {
generator.setPropertyValues(property, propInfo, null, false, false);
}
} // property
} // propInfo
%>
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
}
} // property
} // propInfo
%>
org.apache.avro.generic.IndexedRecord data_<%=cid%> = incomingEnforcer_<%=cid%>.getCurrentRecord();
<%
boolean isParallelize ="true".equalsIgnoreCase(ElementParameterParser.getValue(node, "__PARALLELIZE__"));
if (isParallelize) {
String sourceComponentId = inputConn.getSource().getUniqueName();
if(sourceComponentId!=null && sourceComponentId.contains("tAsyncIn")) {
%>
globalMap.put(buffersSizeKey_<%=cid%>, buffersSize_<%=sourceComponentId%>);
<%
}
}
%>
writer_<%=cid%>.write(data_<%=cid%>);
nb_line_<%=cid %>++;
<%if(hasMainOutput){
%>
if(!(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback)) {
// For no feedback writer,just pass the input record to the output
if (data_<%=cid%>!=null) {
outgoingMainRecordsList_<%=cid%> = java.util.Arrays.asList(data_<%=cid%>);
}
}
<%
}
writer_<%=cid%>.write(data_<%=cid%>);
nb_line_<%=cid %>++;
<%if(hasMainOutput){
%>
if(!(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback)) {
// For no feedback writer,just pass the input record to the output
if (data_<%=cid%>!=null) {
outgoingMainRecordsList_<%=cid%> = java.util.Arrays.asList(data_<%=cid%>);
}
}
<%
}
}
} // canStart

View File

@@ -258,76 +258,80 @@
com.google.api.services.bigquery.model.JobConfiguration config_<%=cid%> = new com.google.api.services.bigquery.model.JobConfiguration();
com.google.api.services.bigquery.model.JobConfigurationLoad queryLoad_<%=cid%> = new com.google.api.services.bigquery.model.JobConfigurationLoad();
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Table field schema:");
<%
}
%>
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "string";
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "float";
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
typeToGenerate = "integer";
} else if("id_Character".equals(column.getTalendType())) {
typeToGenerate = "string";
} else if("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "numeric";
} else if("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "boolean";
} else if("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "date";
}else if(pattern.length() > 12){
typeToGenerate = "timestamp";
}else{
typeToGenerate = "string";
}
}
%>
<%
String modeType = null;
if (!column.isNullable()) {
modeType = "REQUIRED";
} else {
modeType = "NULLABLE";
if (<%=ElementParameterParser.getBooleanValue(node, "__CREATE_TABLE_IF_NOT_EXIST__")%>) {
com.google.api.services.bigquery.model.TableSchema schema_<%=cid%> = new com.google.api.services.bigquery.model.TableSchema();
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Table field schema:");
<%
}
%>
java.util.List<com.google.api.services.bigquery.model.TableFieldSchema> fields_<%=cid%> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableFieldSchema>();
<%
List<IMetadataTable> metadatas = node.getMetadataList();
if ((metadatas!=null) && (metadatas.size() > 0)) {
IMetadataTable metadata = metadatas.get(0);
if (metadata != null) {
List<IMetadataColumn> columns = metadata.getListColumns();
int nbColumns = columns.size();
for (int i = 0; i < nbColumns; i++ ) {
IMetadataColumn column = columns.get(i);
String columnName = column.getLabel();
String typeToGenerate = "string";
if("id_Float".equals(column.getTalendType()) || "id_Double".equals(column.getTalendType())) {
typeToGenerate = "float";
}else if("id_Integer".equals(column.getTalendType()) || "id_Long".equals(column.getTalendType()) || "id_Short".equals(column.getTalendType())) {
typeToGenerate = "integer";
} else if("id_Character".equals(column.getTalendType())) {
typeToGenerate = "string";
} else if("id_BigDecimal".equals(column.getTalendType())) {
typeToGenerate = "numeric";
} else if("id_Boolean".equals(column.getTalendType())) {
typeToGenerate = "boolean";
} else if("id_Date".equals(column.getTalendType())) {
String pattern = column.getPattern();
if(pattern.length() == 12 || pattern.isEmpty() || "\"\"".equals(pattern)) {
typeToGenerate = "date";
}else if(pattern.length() > 12){
typeToGenerate = "timestamp";
}else{
typeToGenerate = "string";
}
}
%>
<%
String modeType = null;
if (!column.isNullable()) {
modeType = "REQUIRED";
} else {
modeType = "NULLABLE";
}
%>
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
<%
}
%>
com.google.api.services.bigquery.model.TableFieldSchema <%=columnName%>_<%=cid%> = new com.google.api.services.bigquery.model.TableFieldSchema();
<%=columnName%>_<%=cid%>.setName("<%=columnName%>");
<%=columnName%>_<%=cid%>.setType("<%=typeToGenerate%>");
<%=columnName%>_<%=cid%>.setMode("<%=modeType%>");
fields_<%=cid%>.add(<%=columnName%>_<%=cid%>);
<%
if(isLog4jEnabled){
%>
log.debug("<%=cid%> - Field index[<%=i%>] {\"name\":\"<%=columnName%>\",\"type\":\"<%=typeToGenerate%>\",\"mode\":\"<%=modeType%>\"}");
<%
}
}
}
}
%>
%>
schema_<%=cid%>.setFields(fields_<%=cid%>);
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
schema_<%=cid%>.setFields(fields_<%=cid%>);
queryLoad_<%=cid%>.setSchema(schema_<%=cid%>);
}
<%
if("true".equals(ElementParameterParser.getValue(node, "__CREATE_TABLE_IF_NOT_EXIST__"))) {
%>
@@ -534,6 +538,7 @@
com.google.cloud.bigquery.TableInfo tableInfo_<%=cid%> = com.google.cloud.bigquery.TableInfo.newBuilder(tableId_<%=cid%>, com.google.cloud.bigquery.StandardTableDefinition.of(schema_<%=cid%>)).build();
table_<%=cid%> = bigquery_<%=cid%>.create(tableInfo_<%=cid%>);
loadJobBuilder_<%=cid%>.setSchema(schema_<%=cid%>);
}
<%
@@ -569,17 +574,18 @@
loadJobBuilder_<%=cid%>.setDestinationTable(tableId_<%=cid%>);
com.google.cloud.bigquery.CsvOptions.Builder csvOptions_<%=cid%> = com.google.cloud.bigquery.CsvOptions.newBuilder();
csvOptions_<%=cid%>.setAllowQuotedNewLines(true);
csvOptions_<%=cid%>.setSkipLeadingRows(<%=ElementParameterParser.getValue(node, "__GS_FILE_HEADER__")%>);
<%if("true".equals(ElementParameterParser.getValue(node, "__SET_FIELD_DELIMITER__"))) {
%>
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>).build());
csvOptions_<%=cid%>.setFieldDelimiter(<%=fieldDelimiter%>);
<%
}
%>
loadJobBuilder_<%=cid%>.setNullMarker("\\N");
loadJobBuilder_<%=cid%>.setNullMarker("\\N");
loadJobBuilder_<%=cid%>.setFormatOptions(csvOptions_<%=cid%>.build());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.of(loadJobBuilder_<%=cid%>.build()));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)), com.google.cloud.RetryOption.totalTimeout(org.threeten.bp.Duration.ofSeconds(30)));
job_<%=cid%> = job_<%=cid%>.waitFor(com.google.cloud.RetryOption.initialRetryDelay(org.threeten.bp.Duration.ofSeconds(1)));
if (job_<%=cid%> != null && job_<%=cid%>.getStatus().getError() == null) {
<%
if(isLog4jEnabled){
@@ -598,4 +604,4 @@
} else {
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);
}
%>
%>

View File

@@ -62,11 +62,12 @@ class BigQueryUtil_<%=cid%> {
com.google.api.services.bigquery.model.JobConfigurationQuery queryConfig = new com.google.api.services.bigquery.model.JobConfigurationQuery();
queryConfig.setQuery(query);
queryConfig.setUseLegacySql(useLegacySql);
String location = getLocation(queryConfig);
if(useLargeResult){
this.useLargeResult = true;
tempDataset = genTempName("dataset");
tempTable = genTempName("table");
createDataset(getLocation(queryConfig));
createDataset(location);
queryConfig.setAllowLargeResults(true);
queryConfig.setDestinationTable(new com.google.api.services.bigquery.model.TableReference()
.setProjectId(projectId)
@@ -131,7 +132,7 @@ class BigQueryUtil_<%=cid%> {
%>
// wait for query execution
while (true) {
com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).execute();
com.google.api.services.bigquery.model.Job pollJob = bigqueryclient.jobs().get(projectId, jobId.getJobId()).setLocation(location).execute();
com.google.api.services.bigquery.model.JobStatus status = pollJob.getStatus();
if (status.getState().equals("DONE")) {
com.google.api.services.bigquery.model.ErrorProto errorProto = status.getErrorResult();

View File

@@ -43,10 +43,8 @@
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String pattern = column.getPattern() == null || column.getPattern().trim().length() == 0 ? null : column.getPattern();
if(JavaTypesManager.isJavaPrimitiveType( column.getTalendType(), column.isNullable())){
%>
if(<%=conn.getName() %>.<%=column.getLabel() %> != null) {
<%
if(javaType == JavaTypesManager.BOOLEAN ){
if(javaType == JavaTypesManager.BOOLEAN ){
%>
row_<%=cid%>[<%=i%>] = String.valueOf(
true == <%=conn.getName() %>.<%=column.getLabel() %> ?"1":"0"
@@ -56,12 +54,8 @@
%>
row_<%=cid%>[<%=i%>] = String.valueOf(<%=conn.getName() %>.<%=column.getLabel() %>);
<%
}
%>
} else {
row_<%=cid%>[<%=i%>] = null;
}
<%
}
}else {
%>
if(<%=conn.getName() %>.<%=column.getLabel() %> != null){
@@ -70,10 +64,24 @@
%>
row_<%=cid%>[<%=i%>] = <%=conn.getName() %>.<%=column.getLabel() %>;
<%
}else if(javaType == JavaTypesManager.DATE && pattern != null){
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd HH:mm:ss");
}else if(javaType == JavaTypesManager.DATE && pattern == null){
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd");
<%
}else if(javaType == JavaTypesManager.DATE && pattern != null){
if(pattern.length() > 12){
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd HH:mm:ss");
<%
}else if(pattern.length() == 12 || "\"\"".equals(pattern)) {
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, "yyyy-MM-dd");
<%
}else {
%>
row_<%=cid%>[<%=i%>] = FormatterUtils.format_Date(<%=conn.getName() %>.<%=column.getLabel() %>, <%=pattern%>);
<%
}
}else if(javaType == JavaTypesManager.BYTE_ARRAY){
%>
row_<%=cid%>[<%=i%>] = java.nio.charset.Charset.forName(<%=encoding %>).decode(java.nio.ByteBuffer.wrap(<%=conn.getName() %>.<%=column.getLabel() %>)).toString();
@@ -92,7 +100,7 @@
}
%>
} else {
row_<%=cid%>[<%=i%>] = null;
row_<%=cid%>[<%=i%>] = "\\N";
}
<%
}

View File

@@ -54,7 +54,7 @@
<%
} else {
%>
com.amazonaws.auth.AWSCredentialsProvider credentialsProvider_<%=cid%> = new com.amazonaws.auth.InstanceProfileCredentialsProvider();
com.amazonaws.auth.AWSCredentialsProvider credentialsProvider_<%=cid%> = new com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper();
<%
}
%>

View File

@@ -106,7 +106,12 @@
REQUIRED="false" NUM_ROW="11">
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
<DEFAULT>false</DEFAULT>
@@ -173,6 +178,8 @@
TARGET="Out.CREATE" />
<TEMPLATE_PARAM SOURCE="self.CREATE_EMPTY_ELEMENT"
TARGET="Out.CREATE_EMPTY_ELEMENT" />
<TEMPLATE_PARAM SOURCE="self.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY"
TARGET="Out.IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" />
<TEMPLATE_PARAM SOURCE="self.EXPAND_EMPTY_ELM"
TARGET="Out.EXPAND_EMPTY_ELM" />
<TEMPLATE_PARAM SOURCE="self.OUTPUT_AS_XSD"

View File

@@ -43,4 +43,5 @@ SCHEMA.NAME=Schema
THOUSANDS_SEPARATOR.NAME=Thousands separator
XMLFIELD.NAME=Output Column
XSD_FILE.NAME=XSD file path
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)

View File

@@ -45,6 +45,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
String removeHeader = ElementParameterParser.getValue(node, "__REMOVE_HEADER__"); // add for feature7788
String encoding = ElementParameterParser.getValue(node, "__ENCODING__");
boolean isAllowEmpty = ("true").equals(ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__"));
boolean ignoreServiceAttributes = ("true").equals(ElementParameterParser.getValue(node, "__IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY__"));
boolean expandEmptyElm = ("true").equals(ElementParameterParser.getValue(node, "__EXPAND_EMPTY_ELM__"));
String mode = ElementParameterParser.getValue(node, "__GENERATION_MODE__");
List<Map<String, String>> rootTable =
@@ -200,6 +201,18 @@ java.util.Map<String,String> arraysValueMap_<%=cid%> = new java.util.HashMap<Str
%>
class NestXMLTool_<%=cid%>{
<%
if (!isAllowEmpty && ignoreServiceAttributes) {
%>
private java.util.Set<String> serviceAttributeNames = new java.util.HashSet<>();
{
serviceAttributeNames.add("type");
serviceAttributeNames.add("class");
serviceAttributeNames.add("array");
}
<%
}
%>
public void parseAndAdd(org.dom4j.Element nestRoot, String value){
try {
org.dom4j.Document doc4Str = org.dom4j.DocumentHelper.parseText("<root>"+ value + "</root>");
@@ -235,16 +248,25 @@ class NestXMLTool_<%=cid%>{
for (org.dom4j.Element tmp: (java.util.List<org.dom4j.Element>) root.elements()) {
removeEmptyElement(tmp);
}
if (root.content().size() == 0
&& root.attributes().size() == 0
&& root.declaredNamespaces().size() == 0) {
if(root.getParent()!=null){
root.getParent().remove(root);
boolean noSignificantDataAnnotationsExist = root.attributes().isEmpty() <%if (!isAllowEmpty && ignoreServiceAttributes) {%>|| isOnlyServiceAttributesDeclared(root.attributes()) <% } %>;
if (root.content().isEmpty()
&& noSignificantDataAnnotationsExist && root.declaredNamespaces().isEmpty()) {
if(root.getParent()!=null){
root.getParent().remove(root);
}
}
}
}
}
}
<%
if (!isAllowEmpty && ignoreServiceAttributes) {
%>
private boolean isOnlyServiceAttributesDeclared(List<org.dom4j.Attribute> attributes) {
return attributes.stream().allMatch(a -> serviceAttributeNames.contains(a.getName().toLowerCase()));
}
<%
}
%>
public String objectToString(Object value){
if(value.getClass().isArray()){
StringBuilder sb = new StringBuilder();

View File

@@ -99,6 +99,11 @@
<DEFAULT>true</DEFAULT>
</PARAMETER>
<PARAMETER NAME="IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='false'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="EXPAND_EMPTY_ELM" FIELD="CHECK" NUM_ROW="11"
SHOW_IF="CREATE_EMPTY_ELEMENT=='true'">
<DEFAULT>false</DEFAULT>

View File

@@ -44,5 +44,6 @@ THOUSANDS_SEPARATOR.NAME=Thousands separator
XMLFIELD.NAME=Output Column
XML_FIELD.NAME=XML Field
XSD_FILE.NAME=XSD file path
IGNORE_SERVICE_ATTRIBUTES_FOR_EMPTY.NAME = Ignore service attributes for empty elements
EXPAND_EMPTY_ELM.NAME = Expand Empty Element if needed(for dom4j)
COMPACT_FORMAT.NAME = Compact Format

View File

@@ -30,7 +30,7 @@
<%
if(inheritCredentials) {
%>
credentialsProvider_<%=cid%> = new com.amazonaws.auth.InstanceProfileCredentialsProvider();
credentialsProvider_<%=cid%> = new com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper();
<%} else {%>
com.amazonaws.auth.AWSCredentials credentials_<%=cid%> = new com.amazonaws.auth.BasicAWSCredentials(<%=accesskey%>,decryptedPassword_<%=cid%>);

View File

@@ -35,6 +35,7 @@ imports="
%>
String driverClass_<%=cid%> = "<%=this.getDirverClassName(node)%>";
java.lang.Class.forName(driverClass_<%=cid%>);
globalMap.put("driverClass_<%=cid%>", driverClass_<%=cid%>);
<%
}

View File

@@ -165,6 +165,12 @@ imports="
close_begin();
%>
conn_<%=cid%>.close();
<% /* TESB-24900 - graceful shutdown for MYSQL connection */ %>
if("com.mysql.cj.jdbc.Driver".equals((String)globalMap.get("driverClass_<%=(connection!=null)?connection.replaceAll("'","").trim():""%>"))
&& routines.system.BundleUtils.inOSGi()) {
Class.forName("com.mysql.cj.jdbc.AbandonedConnectionCleanupThread").
getMethod("checkedShutdown").invoke(null, (Object[]) null);
}
<%
close_end();
}

View File

@@ -759,6 +759,15 @@
name="ChangeOracleVersionForProjectSetting"
version="5.2.1">
</projecttask>
<projecttask
beforeLogon="false"
breaks="7.1.0"
class="org.talend.designer.core.utils.FillTRunJobReferenceParametersMigrationTask"
description="Fix empty process id parameters for tRunjob node."
id="org.talend.designer.core.utils.FillTRunJobReferenceParametersMigrationTask"
name="Fix empty process id parameters for tRunjob node"
version="7.1.1">
</projecttask>
</extension>
<extension
point="org.talend.repository.projectsetting_page">

View File

@@ -272,6 +272,7 @@ EParameterName.FunName=Function name
EParameterName.IDocName=IDoc name
EParameterName.fromDatabaseFlag=From Database
EParameterName.fromFileFlag=From File
EParameterName.OverrideEncodingFlag=Override Encoding
EParameterName.generateCode=Generate Code
EParameterName.help=Help
EParameterName.host=Host
@@ -733,6 +734,7 @@ PerformancePreferencePage.generateCode=Generate code when opening the job
PerformancePreferencePage.checkVersion=Check only the last version when updating jobs or joblets
PerformancePreferencePage.addOrDeleteVariable=Propagate add/delete variable changes in repository contexts
PerformancePreferencePage.ActivedTimeoutSetting=Activate the timeout for database connection.
PerformancePreferencePage.propagateContext=Propagate contexts added in repository context groups
PerformancePreferencePage.ConnectionTimeout=Connection timeout (seconds)
PerformancePreferencePage.HBaseOrMaprDBScanLimit=HBase/MapR-DB scan limit (for retrieving schema)
PerformancePreferencePage.HBaseOrMaprDBScanLimitTip=If set it by zero, will be same as deactiving the limit.

View File

@@ -226,6 +226,9 @@ public enum EParameterName {
FIELDSEPARATOR(Messages.getString("EParameterName.FieldSeparator")), //$NON-NLS-1$
ROWSEPARATOR(Messages.getString("EParameterName.RowSeparator")), //$NON-NLS-1$
FROM_FILE_FLAG(Messages.getString("EParameterName.fromFileFlag")), //$NON-NLS-1$
OVERRIDE_ENCODING_FLAG(Messages.getString("EParameterName.OverrideEncodingFlag")), //$NON-NLS-1$
// for override encoding (name should be diff from the encoding of Stats&Logs)
OVERRIDE_ENCODING_IN_EXTRA("OVERRIDE_ENCODING_IN_EXTRA"), //$NON-NLS-1$
FROM_DATABASE_FLAG(Messages.getString("EParameterName.fromDatabaseFlag")), //$NON-NLS-1$
// implict tConextLoad parameters.
LOAD_NEW_VARIABLE(Messages.getString("EParameterName.LoadNewVariableLabel")), //$NON-NLS-1$

View File

@@ -2248,6 +2248,9 @@ public class EmfComponent extends AbstractBasicComponent {
readOnlyColumnPosition = EReadOnlyComlumnPosition.BOTTOM.toString();
}
defaultTable.setReadOnlyColumnPosition(readOnlyColumnPosition);
List<String> originalColumns = new ArrayList<>();
int nbCustom = 0;
for (int i = 0; i < xmlColumnList.size(); i++) {
xmlColumn = (COLUMNType) xmlColumnList.get(i);
@@ -2283,9 +2286,11 @@ public class EmfComponent extends AbstractBasicComponent {
talendColumn.setCustomId(-1);
}
talendColumnList.add(talendColumn);
originalColumns.add(talendColumn.getLabel());
}
defaultTable.setListColumns(talendColumnList);
defaultTable.setOriginalColumns(originalColumns);
// store the default table in default value
IElementParameterDefaultValue defaultValue = new ElementParameterDefaultValue();

View File

@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
@@ -31,6 +32,7 @@ import org.talend.core.model.process.IReplaceNodeInProcess;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.JobletProcessItem;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryEditorInput;
import org.talend.core.model.update.UpdateResult;
import org.talend.designer.core.ui.editor.process.Process;
@@ -143,7 +145,7 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
}
}
}
/**
* DOC qzhang Comment method "canDeleteNode".
*
@@ -257,5 +259,10 @@ public abstract class AbstractProcessProvider implements IReplaceNodeInProcess {
public boolean canHandleNode(INode node) {
return false;
}
public IRepositoryEditorInput createJobletEditorInput(JobletProcessItem processItem, boolean load, Boolean lastVersion, Boolean readonly,
Boolean openedInJob) throws PersistenceException{
return null;
}
}

View File

@@ -808,6 +808,9 @@ public class ConnectionManager {
if (list.contains(newTarget)) {
return true;
}
if (source.equals(newTarget)) {
return true;
}
return false;
}

View File

@@ -256,6 +256,9 @@ public class JobContextLoadComponent implements IComponent {
source = self + "IGNORE_ERROR_MESSAGE"; //$NON-NLS-1$
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".IGNORE_ERROR_MESSAGE"); //$NON-NLS-1$
source = self + "ENCODING";
multipleComponentManager.addParam(source, FILE_INPUT_REGEX + ".ENCODING"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
String source = self + JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());
multipleComponentManager.addParam(source, DB_INPUT + ".URL");

View File

@@ -96,6 +96,12 @@ public class JobSettingsManager {
private static final String CONNECTOR = TalendTextUtils.getStringConnect();
private static final String ENCODING_TYPE_UTF_8 = "UTF-8"; //$NON-NLS-1$
private static final String ENCODING_TYPE_ISO_8859_15 = "ISO-8859-15"; //$NON-NLS-1$
private static final String ENCODING_TYPE_CUSTOM = "CUSTOM"; //$NON-NLS-1$
private static List<IElementParameter> getHeaderFooterParameters(IProcess process) {
// for headerFooter Code
ElementParameter param;
@@ -384,6 +390,51 @@ public class JobSettingsManager {
param.setShowIf(condition);
paramList.add(param);
// begin Override encoding checkbox
param = new ElementParameter(process);
param.setName(EParameterName.OVERRIDE_ENCODING_FLAG.getName());
param.setDisplayName(EParameterName.OVERRIDE_ENCODING_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(33);
param.setValue(false);
param.setShowIf(condition);
paramList.add(param);
// end Override encoding checkbox
// begin encoding select
ElementParameter encodingParam = new ElementParameter(process);
encodingParam.setName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName());
encodingParam.setDisplayName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getDisplayName());
encodingParam.setCategory(EComponentCategory.EXTRA);
encodingParam.setGroup(IMPLICIT_GROUP);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
StringBuilder sb = new StringBuilder();
sb.append(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName())).append(" == 'true' and ")
.append(EParameterName.OVERRIDE_ENCODING_FLAG.getName()).append(" == 'true' and ").append(CONTEXTLOAD_CONDITION);
condition = JobSettingsConstants.addBrackets(sb.toString());
encodingParam.setShowIf(condition); // $NON-NLS-1$
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
encodingParam.setNumRow(34);
paramList.add(encodingParam);
ElementParameter childParam = new ElementParameter(process);
childParam.setName(EParameterName.ENCODING_TYPE.getName());
childParam.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
childParam.setFieldType(EParameterFieldType.TECHNICAL);
childParam.setCategory(EComponentCategory.EXTRA);
childParam.setGroup(IMPLICIT_GROUP);
childParam.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsDisplayCodeName(
new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setValue(ENCODING_TYPE_ISO_8859_15);
childParam.setNumRow(34);
childParam.setShow(true);
childParam.setShowIf(condition); // $NON-NLS-1$
childParam.setParentParameter(encodingParam);
// end encoding select
return paramList;
}
@@ -952,6 +1003,25 @@ public class JobSettingsManager {
tContextLoadNode.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue(inputFile);
String regex = FileSeparator.getSeparatorsRegexp(fileSparator);
tContextLoadNode.getElementParameter(JobSettingsConstants.IMPLICIT_TCONTEXTLOAD_REGEX).setValue(regex);
String encoding = (String) process.getElementParameter(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName())
.getValue();
if (StringUtils.isNotEmpty(encoding) && !encoding.startsWith(TalendTextUtils.getQuoteChar())) {
encoding = TalendTextUtils.addQuotes(encoding);
}
// override encoding
paramName = EParameterName.OVERRIDE_ENCODING_FLAG.getName();
boolean overrideFlag = ((Boolean) process.getElementParameter(paramName).getValue())
&& process.getElementParameter(paramName).isShow(process.getElementParameters());
if (overrideFlag) {
IElementParameter encodingParam = new ElementParameter(tContextLoadNode);
encodingParam.setName(EParameterName.ENCODING.getName());
encodingParam.setDisplayName(EParameterName.ENCODING.getDisplayName());
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
encodingParam.setValue(encoding);
tContextLoadNode.addElementParameter(encodingParam);
}
} else {
// is db
paramName = JobSettingsConstants.getExtraParameterName(EParameterName.URL.getName());

View File

@@ -634,6 +634,7 @@ public class Node extends Element implements IGraphicalNode {
if (param.getValue() instanceof IMetadataTable) {
IMetadataTable paramTable = (IMetadataTable) param.getValue();
table.getListColumns().addAll(paramTable.getListColumns());
table.setOriginalColumns(paramTable.getOriginalColumns());
table.setReadOnly(paramTable.isReadOnly());
} else if (param.getFieldType().equals(EParameterFieldType.SCHEMA_REFERENCE)) {
Schema schema = (Schema) componentProperties.getValuedProperty(param.getName()).getValue();

View File

@@ -122,6 +122,7 @@ import org.talend.core.model.update.IUpdateManager;
import org.talend.core.model.utils.TalendTextUtils;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ConvertJobsUtil;
import org.talend.core.repository.utils.ProjectHelper;
import org.talend.core.repository.utils.XmiResourceManager;
import org.talend.core.runtime.repository.item.ItemProductKeys;
import org.talend.core.runtime.util.ItemDateParser;
@@ -1914,12 +1915,25 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
}
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
//
boolean isLimited = false;
org.talend.core.model.properties.Project currProject = getProject().getEmfProject();
org.talend.core.model.properties.Project project = ProjectManager.getInstance().getProject(this.property);
if (currProject != null && project != null && !currProject.equals(project)) {
int currOrdinal = ProjectHelper.getProjectTypeOrdinal(currProject);
int ordinal = ProjectHelper.getProjectTypeOrdinal(project);
if (currOrdinal > ordinal) {
isLimited = true;
}
}
if (!isLimited) {
for (IRepositoryViewObject object : routines) {
if (routinesToAdd.contains(object.getLabel()) && !routinesAlreadySetup.contains(object.getLabel())) {
RoutinesParameterType routinesParameterType = TalendFileFactory.eINSTANCE.createRoutinesParameterType();
routinesParameterType.setId(object.getId());
routinesParameterType.setName(object.getLabel());
routinesDependencies.add(routinesParameterType);
}
}
}
} catch (PersistenceException e) {
@@ -2777,9 +2791,14 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
continue;
}
}
EConnectionType type = EConnectionType.getTypeFromId(lineStyleId);
connec = new Connection(source, target, type, source.getConnectorFromType(type).getName(), metaname,
cType.getLabel(), cType.getMetaname(), monitorConnection);
if (!ConnectionManager.checkCircle(source, target)) {
EConnectionType type = EConnectionType.getTypeFromId(lineStyleId);
connec = new Connection(source, target, type, source.getConnectorFromType(type).getName(), metaname,
cType.getLabel(), cType.getMetaname(), monitorConnection);
} else {
ExceptionHandler.process(new Exception(Messages.getString("Process.errorCircleConnectionDetected", //$NON-NLS-1$
cType.getLabel(), source.getLabel(), target.getLabel())));
}
}
if (connec == null) {
continue;
@@ -4533,6 +4552,9 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
}
private void saveJobletNode(AbstractJobletContainer jobletContainer) {
if (CommonsPlugin.isHeadless()) {
return;
}
INode jobletNode = jobletContainer.getNode();
IProcess jobletProcess = jobletNode.getComponent().getProcess();
if (jobletProcess == null) {

View File

@@ -115,6 +115,7 @@ import org.talend.core.ui.ICDCProviderService;
import org.talend.core.ui.IJobletProviderService;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.cwm.helper.SAPBWTableHelper;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.model.components.EParameterName;
import org.talend.designer.core.model.components.ElementParameter;
@@ -125,6 +126,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.update.UpdateCheckResult;
import org.talend.designer.core.ui.editor.update.UpdateManagerUtils;
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
import org.talend.designer.core.utils.ConnectionUtil;
import org.talend.designer.core.utils.SAPParametersUtils;
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
@@ -307,6 +309,10 @@ public class ProcessUpdateManager extends AbstractUpdateManager {
}
}
} else {
Boolean propagate = DesignerPlugin.getDefault().getPreferenceStore().getBoolean(TalendDesignerPrefConstants.PROPAGATE_CONTEXT);
if(!propagate) {
return contextResults;
}
// only handle added groups
Set<String> contextSourceChecked = new HashSet<String>();
Set<String> processContextGroups = new HashSet<String>();

View File

@@ -1113,9 +1113,13 @@ public abstract class AbstractSchemaController extends AbstractRepositoryControl
for (IMetadataColumn column : metadataTable.getListColumns()) {
columnNames.add(column.getLabel());
}
metadataTable.setOriginalColumns(columnNames);
if(metadataTable.getOriginalColumns() == null || metadataTable.getOriginalColumns().isEmpty()){
metadataTable.setOriginalColumns(columnNames);
}
}
if(tableCopy.getOriginalColumns() == null || tableCopy.getOriginalColumns().isEmpty()){
tableCopy.setOriginalColumns(metadataTable.getOriginalColumns());
}
tableCopy.setOriginalColumns(metadataTable.getOriginalColumns());
}
}

View File

@@ -133,7 +133,7 @@ public class DesignerPreferencePage extends FieldEditorPreferencePage implements
Messages.getString("DesignerPreferencePage.duplicateTestCases"), getFieldEditorParent()); //$NON-NLS-1$
addField(duplicateTestCases);
}
DirectoryFieldEditor compDefaultFileDir = new DirectoryFieldEditor(TalendDesignerPrefConstants.COMP_DEFAULT_FILE_DIR,
Messages.getString("DesignerPreferencePage.defaultFilePathDirectory"), getFieldEditorParent()) {

View File

@@ -64,6 +64,9 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
Messages.getString("PerformancePreferencePage.checkVersion"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT,
Messages.getString("PerformancePreferencePage.propagateContext"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE,
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), //$NON-NLS-1$
getFieldEditorParent()));
@@ -100,6 +103,9 @@ public class PerformancePreferencePage extends FieldEditorPreferencePage impleme
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.CHECK_ONLY_LAST_VERSION,
Messages.getString("PerformancePreferencePage.checkVersion"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT,
Messages.getString("PerformancePreferencePage.propagateContext"), //$NON-NLS-1$
getFieldEditorParent()));
addField(new BooleanFieldEditor(TalendDesignerPrefConstants.PROPAGATE_CONTEXT_VARIABLE,
Messages.getString("PerformancePreferencePage.addOrDeleteVariable"), //$NON-NLS-1$
getFieldEditorParent()));

View File

@@ -67,6 +67,8 @@ public class TalendDesignerPrefConstants {
public static final String EDITOR_LINESTYLE = "editorLineStyle "; //$NON-NLS-1$
public static final String DUPLICATE_TESTCASE = "duplicateTestCases "; //$NON-NLS-1$
public static final String PROPAGATE_CONTEXT = "propagateContext"; //$NON-NLS-1$
public static final String SCHEMA_OPTIONS = "schemaOptions"; //$NON-NLS-1$

View File

@@ -85,6 +85,12 @@ public class ProjectSettingManager extends Utils {
private static String languagePrefix = LanguageManager.getCurrentLanguage().toString() + "_"; //$NON-NLS-1$
private static final String ENCODING_TYPE_UTF_8 = "UTF-8"; //$NON-NLS-1$
private static final String ENCODING_TYPE_ISO_8859_15 = "ISO-8859-15"; //$NON-NLS-1$
private static final String ENCODING_TYPE_CUSTOM = "CUSTOM"; //$NON-NLS-1$
public static void saveProject() {
RepositoryContext repositoryContext = (RepositoryContext) CorePlugin.getContext().getProperty(
Context.REPOSITORY_CONTEXT_KEY);
@@ -448,6 +454,51 @@ public class ProjectSettingManager extends Utils {
param.setShowIf(condition);
paramList.add(param);
// begin Override encoding checkbox
param = new ElementParameter(elem);
param.setName(EParameterName.OVERRIDE_ENCODING_FLAG.getName());
param.setDisplayName(EParameterName.OVERRIDE_ENCODING_FLAG.getDisplayName());
param.setFieldType(EParameterFieldType.CHECK);
param.setCategory(EComponentCategory.EXTRA);
param.setGroup(IMPLICIT_GROUP);
param.setNumRow(33);
param.setValue(false);
param.setShowIf(condition);
paramList.add(param);
// end Override encoding checkbox
// begin encoding select
ElementParameter encodingParam = new ElementParameter(elem);
encodingParam.setName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getName());
encodingParam.setDisplayName(EParameterName.OVERRIDE_ENCODING_IN_EXTRA.getDisplayName());
encodingParam.setCategory(EComponentCategory.EXTRA);
encodingParam.setGroup(IMPLICIT_GROUP);
encodingParam.setFieldType(EParameterFieldType.ENCODING_TYPE);
StringBuilder sb = new StringBuilder();
sb.append(JobSettingsConstants.getExtraParameterName(EParameterName.FROM_FILE_FLAG.getName())).append(" == 'true' and ")
.append(EParameterName.OVERRIDE_ENCODING_FLAG.getName()).append(" == 'true' and ").append(CONTEXTLOAD_CONDITION);
condition = JobSettingsConstants.addBrackets(sb.toString());
encodingParam.setShowIf(condition); // $NON-NLS-1$
encodingParam.setValue(ENCODING_TYPE_ISO_8859_15);
encodingParam.setNumRow(34);
paramList.add(encodingParam);
ElementParameter childParam = new ElementParameter(elem);
childParam.setName(EParameterName.ENCODING_TYPE.getName());
childParam.setDisplayName(EParameterName.ENCODING_TYPE.getDisplayName());
childParam.setFieldType(EParameterFieldType.TECHNICAL);
childParam.setCategory(EComponentCategory.EXTRA);
childParam.setGroup(IMPLICIT_GROUP);
childParam.setListItemsDisplayName(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsDisplayCodeName(
new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setListItemsValue(new String[] { ENCODING_TYPE_ISO_8859_15, ENCODING_TYPE_UTF_8, ENCODING_TYPE_CUSTOM });
childParam.setValue(ENCODING_TYPE_ISO_8859_15);
childParam.setNumRow(34);
childParam.setShow(true);
childParam.setShowIf(condition); // $NON-NLS-1$
childParam.setParentParameter(encodingParam);
// end encoding select
}
private static void createExtraOnDBParameters(Element elem) {

View File

@@ -587,6 +587,7 @@ public class MainComposite extends AbstractTabComposite {
|| property == null) {
return;
}
String oldVersion = repositoryObject.getVersion();
String originalName = nameText.getText();
String originalJobType = jobTypeCCombo.getText();
String originalFramework = ConvertJobsUtil.convertFrameworkByJobType(originalJobType,
@@ -779,6 +780,9 @@ public class MainComposite extends AbstractTabComposite {
public void run(final IProgressMonitor monitor) throws CoreException {
try {
if (repositoryObject.getProperty() != null) {
if (!originalversion.equals(StringUtils.trimToEmpty(oldVersion))) {
RelationshipItemBuilder.getInstance().addOrUpdateItem(repositoryObject.getProperty().getItem());
}
proxyRepositoryFactory.save(ProjectManager.getInstance().getCurrentProject(),
repositoryObject.getProperty().getItem(), false);
if (needjobletRelateUpdate && GlobalServiceRegister.getDefault()

View File

@@ -0,0 +1,120 @@
// ============================================================================
//
// Copyright (C) 2006-2019 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.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.ModifyComponentsAction;
import org.talend.core.model.components.conversions.IComponentConversion;
import org.talend.core.model.components.filters.IComponentFilter;
import org.talend.core.model.components.filters.NameComponentFilter;
import org.talend.core.model.migration.AbstractItemMigrationTask;
import org.talend.core.model.properties.Item;
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.IRepositoryViewObject;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.model.components.EParameterName;
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.repository.model.IProxyRepositoryFactory;
/**
* Created by bhe on Nov 22, 2019
*/
public class FillTRunJobReferenceParametersMigrationTask extends AbstractItemMigrationTask {
@Override
public List<ERepositoryObjectType> getTypes() {
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess());
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess2());
return toReturn;
}
@Override
public final ExecutionResult execute(Item item) {
ProcessType pt = null;
if (item instanceof ProcessItem) {
ProcessItem processItem = (ProcessItem) item;
pt = processItem.getProcess();
} else if (item instanceof JobletProcessItem) {
JobletProcessItem jobletItem = (JobletProcessItem) item;
pt = jobletItem.getJobletProcess();
}
if (pt == null) {
return ExecutionResult.NOTHING_TO_DO;
}
IComponentFilter filter = new NameComponentFilter("tRunJob"); //$NON-NLS-1$
try {
ModifyComponentsAction.searchAndModify(item, pt, filter,
Arrays.<IComponentConversion> asList(new IComponentConversion() {
@Override
public void transform(NodeType node) {
ElementParameterType jobId = ComponentUtilities.getNodeProperty(node,
EParameterName.PROCESS.getName() + ":" + EParameterName.PROCESS_TYPE_PROCESS.getName()); //$NON-NLS-1$
if (jobId.getValue() == null || jobId.getValue().isEmpty()) {
ElementParameterType jobLabel = ComponentUtilities.getNodeProperty(node,
EParameterName.PROCESS.getName()); // $NON-NLS-1$
String id = getIdFormLabel(jobLabel.getValue());
if (id != null && !id.isEmpty()) {
jobId.setValue(id);
}
}
}
}));
} catch (PersistenceException e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
private static String getIdFormLabel(final String label) {
if (label == null || label.isEmpty()) {
return null;
}
final IProxyRepositoryFactory proxyRepositoryFactory = DesignerPlugin.getDefault().getProxyRepositoryFactory();
try {
List<IRepositoryViewObject> allRepositoryObject = proxyRepositoryFactory.getAll(ERepositoryObjectType.PROCESS, true);
for (IRepositoryViewObject repObject : allRepositoryObject) {
Item item = repObject.getProperty().getItem();
if (item != null && label.equals(item.getProperty().getLabel())) {
return item.getProperty().getId();
}
}
} catch (PersistenceException e) {
//
}
return null;
}
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2019, 11, 22, 12, 0, 0);
return gc.getTime();
}
}

View File

@@ -677,7 +677,11 @@ public abstract class DbGenerationManager {
query = query + " \""; //$NON-NLS-1$
} else {
if (query.trim().endsWith("+ \"")) { //$NON-NLS-1$
query = query.substring(0, query.lastIndexOf("+ \"")); //$NON-NLS-1$
if (DEFAULT_TAB_SPACE_STRING.equals(this.tabSpaceString)) {
query = query.substring(0, query.lastIndexOf("+ \"")); //$NON-NLS-1$
} else {
query = query + "\"";
}
}
}
}
@@ -1173,7 +1177,11 @@ public abstract class DbGenerationManager {
}
}
if(i % 2 == 0 && i != indexs.size() - 1){
result.append(expression.substring(indexs.get(i), indexs.get(i+1)+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());

View File

@@ -45,6 +45,7 @@ import org.talend.commons.ui.runtime.ws.WindowSystem;
import org.talend.commons.ui.swt.drawing.background.BackgroundRefresher;
import org.talend.commons.ui.swt.linking.BgDrawableComposite;
import org.talend.commons.utils.threading.ExecutionLimiter;
import org.talend.core.model.process.IConnection;
import org.talend.designer.abstractmap.model.table.IDataMapTable;
import org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup;
import org.talend.designer.abstractmap.ui.listener.DropTargetOperationListener;
@@ -230,6 +231,20 @@ public class MapperUI {
dbmsId = input.getMetadataTable().getDbms();
}
}
if(dbmsId == null && mapperModel.getOutputDataMapTables() != null && !mapperModel.getOutputDataMapTables().isEmpty()) {
OutputTable output = mapperModel.getOutputDataMapTables().get(0);
if (output.getMetadataTable() != null) {
dbmsId = output.getMetadataTable().getDbms();
}
}
if(dbmsId == null && mapperManager.getAbstractMapComponent() != null
&& !mapperManager.getAbstractMapComponent().getIncomingConnections().isEmpty()){
IConnection conn = mapperManager.getAbstractMapComponent().getIncomingConnections().get(0);
if(conn.getMetadataTable() != null) {
dbmsId = conn.getMetadataTable().getDbms();
}
}
tabFolderEditors = new TabFolderEditors(mainSashForm, SWT.BORDER, mapperManager, dbmsId);
createInputZoneWithTables(mapperModel, uiManager, display);

View File

@@ -507,6 +507,8 @@ public class CompleteDropTargetTableListener extends DefaultDropTargetListener {
uiManager.selectLinks(dataMapTableViewTarget, selectedEntries, true, false);
dataMapTableViewTarget.checkChangementsAfterEntryModifiedOrAdded(false);
// refresh for cell data disappear on MAC
tableViewerCreatorTarget.getTableViewer().refresh();
tableViewerCreatorTarget.getTable().setFocus();
uiManager.setDragging(false);

View File

@@ -48,6 +48,9 @@ import org.talend.core.ui.metadata.editor.MetadataToolbarEditorView;
import org.talend.designer.mapper.MapperMain;
import org.talend.designer.mapper.i18n.Messages;
import org.talend.designer.mapper.managers.MapperManager;
import org.talend.designer.mapper.model.table.InputTable;
import org.talend.designer.mapper.model.table.OutputTable;
import org.talend.designer.mapper.ui.visualmap.table.DataMapTableView;
/**
* DOC amaumont class global comment. Detailled comment <br/>
@@ -158,8 +161,20 @@ public class TabFolderEditors extends CTabFolder {
};
IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
List<InputTable> inputTablesList = mapperManager.getInputTables();
for (InputTable inputTable : inputTablesList) {
DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(inputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
};
for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
extendedPushButton.addListener(beforeCommandListenerForInputButtons, true);
extendedPushButton.addListener(afterCommandListener, false);
}
this.addDisposeListener(new DisposeListener() {
@@ -197,8 +212,20 @@ public class TabFolderEditors extends CTabFolder {
};
IExtendedButtonListener afterCommandListener = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
List<OutputTable> outputTablesList = mapperManager.getOutputTables();
for (OutputTable outputTable : outputTablesList) {
DataMapTableView view = mapperManager.retrieveAbstractDataMapTableView(outputTable);
view.getTableViewerCreatorForColumns().getTableViewer().refresh();
}
}
};
for (ExtendedPushButton extendedPushButton : outputToolBarButtons) {
extendedPushButton.addListener(beforeCommandListenerForOutputButtons, true);
extendedPushButton.addListener(afterCommandListener, false);
if (extendedPushButton instanceof RemovePushButton && !mapperManager.componentIsReadOnly()) {
removeButton = (RemovePushButtonForExtendedTable) extendedPushButton;
}

View File

@@ -14,6 +14,7 @@
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**/*.class</include>
<include>${talend.job.path}/**/*.wsdl</include>
<include>__tdm/**</include>
</includes>
</fileSet>

View File

@@ -16,6 +16,7 @@
<outputDirectory>${file.separator}</outputDirectory>
<includes>
<include>${talend.job.path}/**/*.class</include>
<include>${talend.job.path}/**/*.wsdl</include>
<include>__tdm/**</include>
</includes>
</fileSet>

View File

@@ -798,7 +798,7 @@ public class DefaultRunProcessService implements IRunProcessService {
for (ProjectReference ref : references) {
initRefPoms(new Project(ref.getReferencedProject()));
}
helper.updateRefProjectModules(references);
helper.updateRefProjectModules(references, monitor);
helper.updateCodeProjects(monitor, true);
} catch (Exception e) {
ExceptionHandler.process(e);
@@ -825,13 +825,17 @@ public class DefaultRunProcessService implements IRunProcessService {
if (ProcessUtils.isRequiredBeans(null, refProject)) {
installRefCodeProject(ERepositoryObjectType.valueOf("BEANS"), refHelper, monitor); //$NON-NLS-1$
}
}
deleteRefProjects(refProject, refHelper);
}
private void installRefCodeProject(ERepositoryObjectType codeType, AggregatorPomsHelper refHelper, IProgressMonitor monitor)
throws Exception, CoreException {
if (!refHelper.getProjectRootPom().exists()) {
return;
}
String projectTechName = refHelper.getProjectTechName();
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getExistingTalendCodeProject(codeType, projectTechName);
if (codeProject != null) {
@@ -840,6 +844,35 @@ public class DefaultRunProcessService implements IRunProcessService {
argumentsMap.put(TalendProcessArgumentConstant.ARG_GOAL, TalendMavenConstants.GOAL_INSTALL);
argumentsMap.put(TalendProcessArgumentConstant.ARG_PROGRAM_ARGUMENTS, TalendMavenConstants.ARG_MAIN_SKIP);
codeProject.buildModules(monitor, null, argumentsMap);
}
}
private void deleteRefProjects(Project refProject, AggregatorPomsHelper refHelper) throws Exception {
IProgressMonitor monitor = new NullProgressMonitor();
deleteRefProject(ERepositoryObjectType.ROUTINES, refHelper, monitor);
if (ProcessUtils.isRequiredPigUDFs(null, refProject)) {
deleteRefProject(ERepositoryObjectType.PIG_UDF, refHelper, monitor);
}
if (ProcessUtils.isRequiredBeans(null, refProject)) {
deleteRefProject(ERepositoryObjectType.valueOf("BEANS"), refHelper, monitor); //$NON-NLS-1$
}
}
private void deleteRefProject(ERepositoryObjectType codeType, AggregatorPomsHelper refHelper, IProgressMonitor monitor)
throws Exception, CoreException {
if (!refHelper.getProjectRootPom().exists()) {
return;
}
String projectTechName = refHelper.getProjectTechName();
ITalendProcessJavaProject codeProject = TalendJavaProjectManager.getExistingTalendCodeProject(codeType, projectTechName);
if (codeProject != null) {
codeProject.getProject().delete(false, true, monitor);
TalendJavaProjectManager.removeFromCodeJavaProjects(codeType, projectTechName);
}

View File

@@ -15,6 +15,7 @@ package org.talend.designer.runprocess;
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;
@@ -31,7 +32,6 @@ import org.talend.commons.exception.CommonExceptionHandler;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.exception.SystemException;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.core.CorePlugin;
import org.talend.core.model.process.IContainerEntry;
import org.talend.core.model.process.IProcess;
@@ -61,15 +61,17 @@ public class JobErrorsChecker {
public static List<IContainerEntry> getErrors() {
List<IContainerEntry> input = new ArrayList<IContainerEntry>();
if(LastGenerationInfo.getInstance() == null ||
LastGenerationInfo.getInstance().getLastMainJob() == null) {
return input;
}
try {
Item item = null;
IProxyRepositoryFactory proxyRepositoryFactory = CorePlugin.getDefault().getRepositoryService()
.getProxyRepositoryFactory();
ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
IProxyRepositoryFactory proxyRepositoryFactory =
CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
ITalendSynchronizer synchronizer =
CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
Set<String> jobIds = new HashSet<String>();
HashSet<JobInfo> jobInfos = new HashSet<>();
@@ -94,14 +96,15 @@ public class JobErrorsChecker {
}
jobIds.add(item.getProperty().getId());
// Property property = process.getProperty();
Problems.addJobRoutineFile(sourceFile, ProblemType.JOB, item, true);
}
if (!CommonsPlugin.isHeadless()) {
List<IRepositoryViewObject> routinesObjects = proxyRepositoryFactory.getAll(ERepositoryObjectType.ROUTINES, false);
Set<String> dependentRoutines = LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(
LastGenerationInfo.getInstance().getLastMainJob().getJobId(),
LastGenerationInfo.getInstance().getLastMainJob().getJobVersion());
List<IRepositoryViewObject> routinesObjects =
proxyRepositoryFactory.getAll(ERepositoryObjectType.ROUTINES, false);
Set<String> dependentRoutines = LastGenerationInfo
.getInstance()
.getRoutinesNeededWithSubjobPerJob(LastGenerationInfo.getInstance().getLastMainJob().getJobId(),
LastGenerationInfo.getInstance().getLastMainJob().getJobVersion());
if (routinesObjects != null) {
for (IRepositoryViewObject obj : routinesObjects) {
Property property = obj.getProperty();
@@ -110,7 +113,7 @@ public class JobErrorsChecker {
IFile routineFile = synchronizer.getFile(routinesitem);
Problems.addJobRoutineFile(routineFile, ProblemType.ROUTINE, routinesitem, true);
} else {
Problems.clearAllComliationError(property.getLabel());
Problems.clearAllComliationError(property.getLabel());
}
}
}
@@ -153,11 +156,11 @@ public class JobErrorsChecker {
public static boolean checkExportErrors(IStructuredSelection selection, boolean isJob) {
if (!selection.isEmpty()) {
final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService()
.createRoutineSynchronizer();
final ITalendSynchronizer synchronizer =
CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
Set<String> jobIds = new HashSet<String>();
List<RepositoryNode> nodes = selection.toList();
List<RepositoryNode> nodes = extractNodes(selection);
if (nodes.size() > 1) {
// in case it's a multiple export, only check the status of the latest job to export
for (RepositoryNode node : nodes) {
@@ -189,22 +192,35 @@ public class JobErrorsChecker {
}
if (ret) {
if (isJob) {
throw new ProcessorException(Messages.getString("JobErrorsChecker_compile_errors") + '\n' + //$NON-NLS-1$
Messages.getString("JobErrorsChecker_compile_error_content", item.getProperty() //$NON-NLS-1$
.getLabel()) + '\n' + message);
throw new ProcessorException(
Messages.getString("JobErrorsChecker_compile_errors") + '\n' + //$NON-NLS-1$
Messages
.getString("JobErrorsChecker_compile_error_content", //$NON-NLS-1$
item.getProperty().getLabel())
+ '\n' + message);
} else {
throw new ProcessorException(Messages.getString("CamelJobErrorsChecker_compile_errors") + '\n' + //$NON-NLS-1$
Messages.getString("CamelJobErrorsChecker_compile_error_content", item.getProperty() //$NON-NLS-1$
.getLabel()) + '\n' + message);
throw new ProcessorException(
Messages.getString("CamelJobErrorsChecker_compile_errors") + '\n' + //$NON-NLS-1$
Messages
.getString("CamelJobErrorsChecker_compile_error_content", //$NON-NLS-1$
item.getProperty().getLabel())
+ '\n' + message);
}
}
jobIds.add(item.getProperty().getId());
Problems.addRoutineFile(sourceFile, ProblemType.JOB, item.getProperty().getLabel(), item.getProperty()
.getVersion(), true);
Problems
.addRoutineFile(sourceFile, ProblemType.JOB, item.getProperty().getLabel(),
item.getProperty().getVersion(), true);
} catch (Exception e) {
MessageBoxExceptionHandler.process(e);
CommonExceptionHandler.process(e);
if (CommonsPlugin.isHeadless()) {
// [TESB-8953] avoid SWT invoked and also throw Exception let Command Executor to have
// detailed
// trace in command status.
throw new RuntimeException(e);
}
return true;
}
@@ -214,13 +230,12 @@ public class JobErrorsChecker {
try {
checkLastGenerationHasCompilationError(true);
} catch (Exception e) {
CommonExceptionHandler.process(e);
if (CommonsPlugin.isHeadless()) {
CommonExceptionHandler.process(e);
// [TESB-8953] avoid SWT invoked and also throw Exception let Command Executor to have detailed
// trace in command status.
throw new RuntimeException(e);
}
MessageBoxExceptionHandler.process(e);
return true;
}
}
@@ -249,7 +264,12 @@ public class JobErrorsChecker {
}
}
} catch (Exception e) {
MessageBoxExceptionHandler.process(e);
CommonExceptionHandler.process(e);
if (CommonsPlugin.isHeadless()) {
// [TESB-8953] avoid SWT invoked and also throw Exception let Command Executor to have detailed
// trace in command status.
throw new RuntimeException(e);
}
return true;
}
@@ -264,9 +284,10 @@ public class JobErrorsChecker {
boolean hasError = false;
boolean isJob = true;
Item item = null;
final IProxyRepositoryFactory proxyRepositoryFactory = CorePlugin.getDefault().getRepositoryService()
.getProxyRepositoryFactory();
final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
final IProxyRepositoryFactory proxyRepositoryFactory =
CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
final ITalendSynchronizer synchronizer =
CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
Integer line = null;
String errorMessage = null;
try {
@@ -299,7 +320,7 @@ public class JobErrorsChecker {
// one job
final IResource[] members = file.getParent().members();
for (IResource member : members) {
if (member instanceof IFile && "java".equals(member.getFileExtension())) {
if (member instanceof IFile && "java".equals(member.getFileExtension())) { //$NON-NLS-1$
IMarker[] markers = ((IFile) member).findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_ONE);
for (IMarker marker : markers) {
Integer lineNr = (Integer) marker.getAttribute(IMarker.LINE_NUMBER);
@@ -322,8 +343,9 @@ public class JobErrorsChecker {
}
}
if (updateProblemsView) {
Problems.addRoutineFile(file, ProblemType.JOB, item.getProperty().getLabel(),
item.getProperty().getVersion(), true);
Problems
.addRoutineFile(file, ProblemType.JOB, item.getProperty().getLabel(),
item.getProperty().getVersion(), true);
}
if (hasError) {
break;
@@ -335,17 +357,17 @@ public class JobErrorsChecker {
}
if (hasError && item != null) {
if (isJob) {
throw new ProcessorException(Messages.getString("JobErrorsChecker_compile_errors") + " " + '\n' + //$NON-NLS-1$
Messages.getString("JobErrorsChecker_compile_error_message", item.getProperty().getLabel()) + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + errorMessage + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_jvmmessage")); //$NON-NLS-1$
throw new ProcessorException(Messages.getString("JobErrorsChecker_compile_errors") + ' ' + '\n' + //$NON-NLS-1$
Messages.getString("JobErrorsChecker_compile_error_message", item.getProperty().getLabel()) //$NON-NLS-1$
+ '\n' + Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + errorMessage //$NON-NLS-1$
+ '\n' + Messages.getString("JobErrorsChecker_compile_error_jvmmessage")); //$NON-NLS-1$
} else {
throw new ProcessorException(Messages.getString("CamelJobErrorsChecker_compile_errors") + " " + '\n' + //$NON-NLS-1$
Messages.getString("JobErrorsChecker_compile_error_message", item.getProperty().getLabel()) + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + errorMessage + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_jvmmessage")); //$NON-NLS-1$
throw new ProcessorException(Messages.getString("CamelJobErrorsChecker_compile_errors") + ' ' + '\n' + //$NON-NLS-1$
Messages.getString("JobErrorsChecker_compile_error_message", item.getProperty().getLabel()) //$NON-NLS-1$
+ '\n' + Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + errorMessage //$NON-NLS-1$
+ '\n' + Messages.getString("JobErrorsChecker_compile_error_jvmmessage")); //$NON-NLS-1$
}
}
@@ -356,6 +378,7 @@ public class JobErrorsChecker {
}
private static void checkRoutinesCompilationError() throws ProcessorException {
if(LastGenerationInfo.getInstance() == null || LastGenerationInfo.getInstance().getLastMainJob() == null) {
return;
}
@@ -368,32 +391,35 @@ public class JobErrorsChecker {
for (Problem p : errors) {
if (p instanceof TalendProblem) {
TalendProblem talendProblem = (TalendProblem) p;
if (talendProblem.getType() == ProblemType.ROUTINE && dependentRoutines.contains(talendProblem.getJavaUnitName())) {
if (talendProblem.getType() == ProblemType.ROUTINE
&& dependentRoutines.contains(talendProblem.getJavaUnitName())) {
int line = talendProblem.getLineNumber();
String errorMessage = talendProblem.getDescription();
throw new ProcessorException(Messages.getString(
"JobErrorsChecker_routines_compile_errors", talendProblem.getJavaUnitName()) + '\n'//$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + errorMessage); //$NON-NLS-1$
throw new ProcessorException(Messages
.getString("JobErrorsChecker_routines_compile_errors", talendProblem.getJavaUnitName()) //$NON-NLS-1$
+ '\n' + Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + line + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' //$NON-NLS-1$
+ errorMessage);
}
} else {
// for now not to check components errors when building jobs in studio/commandline
// throw new ProcessorException(Messages.getString("JobErrorsChecker_jobDesign_errors", p.getType().getTypeName(), //$NON-NLS-1$
// p.getJobInfo().getJobName(), p.getComponentName(), p.getDescription()));
// throw new ProcessorException(Messages.getString("JobErrorsChecker_jobDesign_errors",
// p.getType().getTypeName(), //$NON-NLS-1$
// p.getJobInfo().getJobName(), p.getComponentName(), p.getDescription()));
}
}
// if can't find the routines problem, try to check the file directly(mainly for commandline)
try {
final ITalendSynchronizer synchronizer = CorePlugin.getDefault().getCodeGeneratorService()
.createRoutineSynchronizer();
final ITalendSynchronizer synchronizer =
CorePlugin.getDefault().getCodeGeneratorService().createRoutineSynchronizer();
IProxyRepositoryFactory factory = CorePlugin.getDefault().getProxyRepositoryFactory();
List<IRepositoryViewObject> routinesObjects = factory.getAll(ERepositoryObjectType.ROUTINES, false);
if (routinesObjects != null) {
for (IRepositoryViewObject obj : routinesObjects) {
Property property = obj.getProperty();
if (!dependentRoutines.contains(property.getLabel())) {
continue;
continue;
}
Item routinesitem = property.getItem();
IFile routinesFile = synchronizer.getFile(routinesitem);
@@ -407,10 +433,12 @@ public class JobErrorsChecker {
if (lineNr != null && message != null && severity != null && start != null && end != null) {
switch (severity) {
case IMarker.SEVERITY_ERROR:
throw new ProcessorException(
Messages.getString("JobErrorsChecker_routines_compile_errors", property.getLabel()) + '\n'//$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' + lineNr + '\n' //$NON-NLS-1$
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") + ':' + ' ' + message); //$NON-NLS-1$
throw new ProcessorException(Messages
.getString("JobErrorsChecker_routines_compile_errors", property.getLabel()) //$NON-NLS-1$
+ '\n' + Messages.getString("JobErrorsChecker_compile_error_line") + ':' + ' ' //$NON-NLS-1$
+ lineNr + '\n'
+ Messages.getString("JobErrorsChecker_compile_error_detailmessage") //$NON-NLS-1$
+ ':' + ' ' + message);
default:
break;
}
@@ -427,11 +455,11 @@ public class JobErrorsChecker {
}
}
protected static void checkSubJobMultipleVersionsError() throws ProcessorException {
if(LastGenerationInfo.getInstance() == null || LastGenerationInfo.getInstance().getLastGeneratedjobs() == null) {
return;
}
if (LastGenerationInfo.getInstance() == null
|| LastGenerationInfo.getInstance().getLastGeneratedjobs() == null) {
return;
}
Set<JobInfo> jobInfos = LastGenerationInfo.getInstance().getLastGeneratedjobs();
Map<String, Set<String>> jobInfoMap = new HashMap<>();
for (JobInfo jobInfo : jobInfos) {
@@ -458,4 +486,14 @@ public class JobErrorsChecker {
}
}
private static List<RepositoryNode> extractNodes(IStructuredSelection selection) {
List<RepositoryNode> nodes = new ArrayList<>();
for (Iterator<?> iterator = selection.iterator(); iterator.hasNext();) {
Object o = iterator.next();
if (o instanceof RepositoryNode)
nodes.add((RepositoryNode) o);
}
return nodes;
}
}

View File

@@ -568,6 +568,8 @@ public class TalendJavaProjectManager {
if (processor instanceof MavenJavaProcessor) {
LastGenerationInfo.getInstance().clearModulesNeededWithSubjobPerJob();
LastGenerationInfo.getInstance().getHighPriorityModuleNeeded().clear();
// Need to clear modules per job cache
LastGenerationInfo.getInstance().clearModulesNeededPerJob();
// Gen poms only
((MavenJavaProcessor) processor).generatePom(option);
}

View File

@@ -349,7 +349,8 @@ public class MavenJavaProcessor extends JavaProcessor {
if (!isMainJob && isGoalInstall) {
if (!buildCacheManager.isJobBuild(getProperty())) {
deleteExistedJobJarFile(talendJavaProject);
if ("ROUTE".equalsIgnoreCase(getBuildType(getProperty())) && project != null &&
String buildType = getBuildType(getProperty());
if (("ROUTE".equalsIgnoreCase(buildType) || "OSGI".equalsIgnoreCase(buildType)) && project != null &&
ERepositoryObjectType.PROCESS.equals(ERepositoryObjectType.getType(getProperty()))) {
// TESB-23870
// child routes job project must be compiled explicitly for

View File

@@ -125,6 +125,8 @@ public class ProcessChangeListener implements PropertyChangeListener {
// version change, will create new item
// create new job project.
TalendJavaProjectManager.generatePom(property.getItem());
AggregatorPomsHelper helper = new AggregatorPomsHelper();
helper.syncParentJobPomsForPropertyChange(property);
}
}
}

View File

@@ -28,6 +28,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.apache.oro.text.regex.MalformedPatternException;
import org.apache.oro.text.regex.MatchResult;
import org.apache.oro.text.regex.Pattern;
@@ -54,8 +55,9 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.swt.formtools.Form;
import org.talend.commons.ui.swt.formtools.LabelledCombo;
import org.talend.commons.ui.swt.formtools.LabelledFileField;
@@ -79,6 +81,7 @@ import org.talend.repository.ProjectManager;
import org.talend.repository.json.i18n.Messages;
import org.talend.repository.json.util.JSONUtil;
import org.talend.repository.ui.wizards.metadata.connection.files.xml.TreePopulator;
import orgomg.cwm.resource.record.RecordFactory;
import orgomg.cwm.resource.record.RecordFile;
@@ -151,7 +154,7 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
}
if (JSONFileOutputStep1Form.this.tempPath == null) {
if (jsonXmlPath != null && !jsonXmlPath.equals("")) {
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(jsonXmlPath);
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(jsonXmlPath, getConnection().getEncoding());
} else {
JSONFileOutputStep1Form.this.tempPath = "";
}
@@ -315,7 +318,7 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
List<FOXTreeNode> rootFoxTreeNodes = null;
if (JSONFileOutputStep1Form.this.tempPath == null) {
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(text);
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(text, getConnection().getEncoding());
}
if (treeNode == null) {
rootFoxTreeNodes = TreeUtil.getFoxTreeNodes(JSONFileOutputStep1Form.this.tempPath);
@@ -362,12 +365,12 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
}
// getConnection().setJSONFilePath(PathUtils.getPortablePath(JSONXsdFilePath.getText()));
if (JSONFileOutputStep1Form.this.tempPath == null) {
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(text);
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(text, getConnection().getEncoding());
}
File file = new File(text);
if (file.exists()) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(JSONUtil.changeJsonToXml(text), treeNode);
valid = treePopulator.populateTree(JSONUtil.changeJsonToXml(text, getConnection().getEncoding()), treeNode);
checkFieldsValue();
if (!valid) {
return;
@@ -391,130 +394,7 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
@Override
public void modifyText(ModifyEvent event) {
String text = jsonFilePath.getText();
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(
connectionItem.getConnection(), true);
text = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, text));
}
if (getConnection().getJSONFilePath() != null && !getConnection().getJSONFilePath().equals(text)) {
getConnection().getLoop().clear();
getConnection().getRoot().clear();
getConnection().getGroup().clear();
xsdPathChanged = true;
} else {
xsdPathChanged = false;
}
if (Path.fromOSString(jsonFilePath.getText()).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonFilePath.getText()));
} else {
getConnection().setJSONFilePath(jsonFilePath.getText());
}
// updateConnection(text);
StringBuilder fileContent = new StringBuilder();
BufferedReader in = null;
File file = null;
if (tempJSONPath != null && getConnection().getFileContent() != null
&& getConnection().getFileContent().length > 0 && !isModifing) {
file = new File(tempJSONPath);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e2) {
ExceptionHandler.process(e2);
}
FileOutputStream outStream;
try {
outStream = new FileOutputStream(file);
outStream.write(getConnection().getFileContent());
outStream.close();
} catch (FileNotFoundException e1) {
ExceptionHandler.process(e1);
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
} else {
file = new File(text);
}
String str;
try {
Charset guessCharset = CharsetToolkit.guessEncoding(file, 4096);
in = new BufferedReader(new InputStreamReader(new FileInputStream(file), guessCharset.displayName()));
while ((str = in.readLine()) != null) {
fileContent.append(str + "\n");
// for encoding
if (str.contains("encoding")) {
String regex = "^<\\?JSON\\s*version=\\\"[^\\\"]*\\\"\\s*encoding=\\\"([^\\\"]*)\\\"\\?>$";
Perl5Compiler compiler = new Perl5Compiler();
Perl5Matcher matcher = new Perl5Matcher();
Pattern pattern = null;
try {
pattern = compiler.compile(regex);
if (matcher.contains(str, pattern)) {
MatchResult matchResult = matcher.getMatch();
if (matchResult != null) {
encoding = matchResult.group(1);
}
}
} catch (MalformedPatternException malE) {
ExceptionHandler.process(malE);
}
}
}
fileContentText.setText(new String(fileContent));
} catch (Exception e) {
String msgError = "File" + " \"" + jsonFilePath.getText().replace("\\\\", "\\") + "\"\n";
if (e instanceof FileNotFoundException) {
msgError = msgError + "is not found";
} else if (e instanceof EOFException) {
msgError = msgError + "have an incorrect character EOF";
} else if (e instanceof IOException) {
msgError = msgError + "is locked by another soft";
} else {
msgError = msgError + "doesn't exist";
}
fileContentText.setText(msgError);
if (!isReadOnly()) {
updateStatus(IStatus.ERROR, msgError);
}
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception exception) {
ExceptionHandler.process(exception);
}
}
if (getConnection().getEncoding() == null || "".equals(getConnection().getEncoding())) {
getConnection().setEncoding(encoding);
if (encoding != null && !"".equals(encoding)) {
encodingCombo.setText(encoding);
} else {
encodingCombo.setText("UTF-8");
}
}
// if (tempJSONXsdPath != null && getConnection().getFileContent() != null
// && getConnection().getFileContent().length > 0 && !isModifing) {
// valid = treePopulator.populateTree(tempJSONXsdPath, treeNode);
// } else {
// valid = treePopulator.populateTree(text, treeNode);
// }
if (file.exists()) {
valid = treePopulator.populateTree(JSONUtil.changeJsonToXml(text), treeNode);
updateConnection(text);
}
checkFieldsValue();
isModifing = true;
validateJsonFile();
}
});
@@ -523,6 +403,16 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
@Override
public void modifyText(ModifyEvent e) {
getConnection().setEncoding(encodingCombo.getText());
String encoding = getConnection().getEncoding();
try {
Charset charSet = Charset.forName(encoding);
if (charSet != null) {
validateJsonFile();
return;
}
} catch (Exception ex) {
// ignore
}
checkFieldsValue();
}
});
@@ -540,7 +430,8 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, str));
}
if (JSONFileOutputStep1Form.this.tempPath == null) {
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(jsonFilePath.getText());
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(jsonFilePath.getText(),
getConnection().getEncoding());
}
File file = new File(JSONFileOutputStep1Form.this.tempPath);
@@ -779,4 +670,141 @@ public class JSONFileOutputStep1Form extends AbstractJSONFileStepForm {
// valid = this.treePopulator.populateTree(tempJSONXsdPath, treeNode);
}
private void validateJsonFile() {
String text = jsonFilePath.getText();
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(
connectionItem.getConnection(), true);
text = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, text));
}
if (getConnection().getJSONFilePath() != null && !getConnection().getJSONFilePath().equals(text)) {
getConnection().getLoop().clear();
getConnection().getRoot().clear();
getConnection().getGroup().clear();
xsdPathChanged = true;
} else {
xsdPathChanged = false;
}
if (Path.fromOSString(jsonFilePath.getText()).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonFilePath.getText()));
} else {
getConnection().setJSONFilePath(jsonFilePath.getText());
}
// updateConnection(text);
StringBuilder fileContent = new StringBuilder();
BufferedReader in = null;
File file = null;
if (tempJSONPath != null && getConnection().getFileContent() != null
&& getConnection().getFileContent().length > 0 && !isModifing) {
file = new File(tempJSONPath);
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e2) {
ExceptionHandler.process(e2);
}
FileOutputStream outStream;
try {
outStream = new FileOutputStream(file);
outStream.write(getConnection().getFileContent());
outStream.close();
} catch (FileNotFoundException e1) {
ExceptionHandler.process(e1);
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
} else {
file = new File(text);
}
String str;
try {
Charset guessCharset = null;
try {
guessCharset = Charset.forName(getConnection().getEncoding());
} catch (Exception e) {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler.process(e, Priority.INFO);
}
}
if (guessCharset == null) {
guessCharset = CharsetToolkit.guessEncoding(file, 4096);
}
in = new BufferedReader(new InputStreamReader(new FileInputStream(file), guessCharset.displayName()));
while ((str = in.readLine()) != null) {
fileContent.append(str + "\n");
// for encoding
if (str.contains("encoding")) {
String regex = "^<\\?JSON\\s*version=\\\"[^\\\"]*\\\"\\s*encoding=\\\"([^\\\"]*)\\\"\\?>$";
Perl5Compiler compiler = new Perl5Compiler();
Perl5Matcher matcher = new Perl5Matcher();
Pattern pattern = null;
try {
pattern = compiler.compile(regex);
if (matcher.contains(str, pattern)) {
MatchResult matchResult = matcher.getMatch();
if (matchResult != null) {
encoding = matchResult.group(1);
}
}
} catch (MalformedPatternException malE) {
ExceptionHandler.process(malE);
}
}
}
fileContentText.setText(new String(fileContent));
} catch (Exception e) {
String msgError = "File" + " \"" + jsonFilePath.getText().replace("\\\\", "\\") + "\"\n";
if (e instanceof FileNotFoundException) {
msgError = msgError + "is not found";
} else if (e instanceof EOFException) {
msgError = msgError + "have an incorrect character EOF";
} else if (e instanceof IOException) {
msgError = msgError + "is locked by another soft";
} else {
msgError = msgError + "doesn't exist";
}
fileContentText.setText(msgError);
if (!isReadOnly()) {
updateStatus(IStatus.ERROR, msgError);
}
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception exception) {
ExceptionHandler.process(exception);
}
}
if (getConnection().getEncoding() == null || "".equals(getConnection().getEncoding())) {
getConnection().setEncoding(encoding);
if (encoding != null && !"".equals(encoding)) {
encodingCombo.setText(encoding);
} else {
encodingCombo.setText("UTF-8");
}
}
// if (tempJSONXsdPath != null && getConnection().getFileContent() != null
// && getConnection().getFileContent().length > 0 && !isModifing) {
// valid = treePopulator.populateTree(tempJSONXsdPath, treeNode);
// } else {
// valid = treePopulator.populateTree(text, treeNode);
// }
if (file.exists()) {
valid = treePopulator.populateTree(JSONUtil.changeJsonToXml(text, getConnection().getEncoding()), treeNode);
updateConnection(text);
}
checkFieldsValue();
isModifing = true;
}
}

View File

@@ -244,7 +244,7 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
if (JSONFileStep1Form.this.wizard.getTempJsonPath() == null
|| JSONFileStep1Form.this.wizard.getTempJsonPath().length() == 0) {
if (EJsonReadbyMode.XPATH.getValue().equals(JSONFileStep1Form.this.wizard.getReadbyMode())) {
tempxml = JSONUtil.changeJsonToXml(jsonFilePath);
tempxml = JSONUtil.changeJsonToXml(jsonFilePath, getConnection().getEncoding());
} else {
tempxml = jsonFilePath;
}
@@ -271,6 +271,7 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
treePopulator.setLimit(limit);
this.treePopulator.configureDefaultTreeViewer();
if (filePath != null && !filePath.isEmpty()) {
this.treePopulator.setEncoding(getConnection().getEncoding());
valid = this.treePopulator.populateTree(filePath, treeNode);
}
}
@@ -506,7 +507,7 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
if (EJsonReadbyMode.JSONPATH.getValue().equals(readbyMode)) {
tempxml = text;
} else {
tempxml = JSONUtil.changeJsonToXml(text);
tempxml = JSONUtil.changeJsonToXml(text, getConnection().getEncoding());
}
JSONFileStep1Form.this.wizard.setTempJsonPath(tempxml);
switchPopulator(readbyMode, tempxml);
@@ -518,170 +519,7 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
@Override
public void modifyText(final ModifyEvent e) {
String jsonPath = fileFieldJSON.getText();
String _jsonPath = jsonPath;
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(
connectionItem.getConnection(), connectionItem.getConnection().getContextName());
jsonPath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
jsonPath));
}
String text = validateJsonFilePath(jsonPath);
if (text == null || text.isEmpty()) {
return;
}
String tempxml = null;
String readbyMode = JSONFileStep1Form.this.wizard.getReadbyMode();
if (EJsonReadbyMode.JSONPATH.getValue().equals(readbyMode)) {
tempxml = text;
} else {
tempxml = JSONUtil.changeJsonToXml(text);
}
File file = new File(text);
if (!file.exists()) {
file = new File(JSONUtil.tempJSONXsdPath);
}
JSONFileStep1Form.this.wizard.setTempJsonPath(tempxml);
String limitString = commonNodesLimitation.getText();
try {
limit = Integer.valueOf(limitString);
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, limit));
} catch (Exception excpt) {
// nothing need to do
}
switchPopulator(readbyMode, tempxml);
// }
// add for bug TDI-20432
checkFieldsValue();
// }
// String text = fileFieldJSON.getText();
// File temp = new File(text);
// if (!temp.exists()) {
// return;
// }
if (getConnection().getJSONFilePath() != null && !getConnection().getJSONFilePath().equals(text)) {
getConnection().getLoop().clear();
xsdPathChanged = true;
} else {
xsdPathChanged = false;
}
if (isContextMode()) {
jsonPath = _jsonPath;
}
if (Path.fromOSString(jsonPath).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonPath));
} else {
getConnection().setJSONFilePath(jsonPath);
}
JSONWizard wizard = ((JSONWizard) getPage().getWizard());
wizard.setTreeRootNode(treeNode);
BufferedReader in = null;
// File file = null;
//
// if (tempJSONXsdPath != null && getConnection().getFileContent() != null
// && getConnection().getFileContent().length > 0 && !isModifing) {
// file = new File(tempJSONXsdPath);
// if (!file.exists()) {
// try {
// file.createNewFile();
// } catch (IOException e2) {
// ExceptionHandler.process(e2);
// }
// FileOutputStream outStream;
// try {
// outStream = new FileOutputStream(file);
// outStream.write(getConnection().getFileContent());
// outStream.close();
// } catch (FileNotFoundException e1) {
// ExceptionHandler.process(e1);
// } catch (IOException e3) {
// ExceptionHandler.process(e3);
// }
// }
//
// } else {
// file = new File(text);
// }
// setFileContent(file);
// }
try {
Charset guessedCharset = CharsetToolkit.guessEncoding(file, 4096);
String str;
in = new BufferedReader(new InputStreamReader(new FileInputStream(file), guessedCharset.displayName()));
while ((str = in.readLine()) != null) {
if (str.contains("encoding")) { //$NON-NLS-1$
String regex = "^<\\?JSON\\s*version=\\\"[^\\\"]*\\\"\\s*encoding=\\\"([^\\\"]*)\\\"\\?>$"; //$NON-NLS-1$
Perl5Compiler compiler = new Perl5Compiler();
Perl5Matcher matcher = new Perl5Matcher();
Pattern pattern = null;
try {
pattern = compiler.compile(regex);
if (matcher.contains(str, pattern)) {
MatchResult matchResult = matcher.getMatch();
if (matchResult != null) {
encoding = matchResult.group(1);
}
}
} catch (MalformedPatternException malE) {
ExceptionHandler.process(malE);
}
}
}
} catch (Exception ex) {
String fileStr = text;
String msgError = "JSON" + " \"" + fileStr.replace("\\\\", "\\") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "\"\n"; //$NON-NLS-1$
if (ex instanceof FileNotFoundException) {
msgError = msgError + "is not found";
} else if (ex instanceof EOFException) {
msgError = msgError + "have an incorrect character EOF";
} else if (ex instanceof IOException) {
msgError = msgError + "is locked by another soft";
} else {
msgError = msgError + "doesn't exist";
}
if (!isReadOnly()) {
updateStatus(IStatus.ERROR, msgError);
}
// ExceptionHandler.process(ex);
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception ex2) {
ExceptionHandler.process(ex2);
}
}
if (getConnection().getEncoding() == null || "".equals(getConnection().getEncoding())) { //$NON-NLS-1$
getConnection().setEncoding(encoding);
if (encoding != null && !("").equals(encoding)) { //$NON-NLS-1$
encodingCombo.setText(encoding);
} else {
encodingCombo.setText("UTF-8"); //$NON-NLS-1$
}
}
// if (tempJSONXsdPath != null && getConnection().getFileContent() != null
// && getConnection().getFileContent().length > 0 && !isModifing) {
// valid = treePopulator.populateTree(tempJSONXsdPath, treeNode);
// } else {
// valid = treePopulator.populateTree(text, treeNode);
// }
checkFieldsValue();
isModifing = true;
validateJsonFile();
}
});
@@ -691,6 +529,19 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
@Override
public void modifyText(final ModifyEvent e) {
getConnection().setEncoding(encodingCombo.getText());
String encoding = getConnection().getEncoding();
if (treePopulator != null) {
treePopulator.setEncoding(encoding);
}
try {
Charset charSet = Charset.forName(encoding);
if (charSet != null) {
validateJsonFile();
return;
}
} catch (Exception ex) {
// ignore
}
checkFieldsValue();
}
});
@@ -883,4 +734,171 @@ public class JSONFileStep1Form extends AbstractJSONFileStepForm {
// valid = this.treePopulator.populateTree(tempJSONXsdPath, treeNode);
// temfile.delete();
}
private void validateJsonFile() {
String jsonPath = fileFieldJSON.getText();
String _jsonPath = jsonPath;
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(
connectionItem.getConnection(), connectionItem.getConnection().getContextName());
jsonPath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType,
jsonPath));
}
String text = validateJsonFilePath(jsonPath);
if (text == null || text.isEmpty()) {
return;
}
String tempxml = null;
String readbyMode = JSONFileStep1Form.this.wizard.getReadbyMode();
if (EJsonReadbyMode.JSONPATH.getValue().equals(readbyMode)) {
tempxml = text;
} else {
tempxml = JSONUtil.changeJsonToXml(text, getConnection().getEncoding());
}
File file = new File(text);
if (!file.exists()) {
file = new File(JSONUtil.tempJSONXsdPath);
}
JSONFileStep1Form.this.wizard.setTempJsonPath(tempxml);
String limitString = commonNodesLimitation.getText();
try {
limit = Integer.valueOf(limitString);
labelLimitation.setToolTipText(MessageFormat.format(Messages.JSONLimitToolTip, limit));
} catch (Exception excpt) {
// nothing need to do
}
switchPopulator(readbyMode, tempxml);
// }
// add for bug TDI-20432
checkFieldsValue();
// }
// String text = fileFieldJSON.getText();
// File temp = new File(text);
// if (!temp.exists()) {
// return;
// }
if (getConnection().getJSONFilePath() != null && !getConnection().getJSONFilePath().equals(text)) {
getConnection().getLoop().clear();
xsdPathChanged = true;
} else {
xsdPathChanged = false;
}
if (isContextMode()) {
jsonPath = _jsonPath;
}
if (Path.fromOSString(jsonPath).toFile().isFile()) {
getConnection().setJSONFilePath(PathUtils.getPortablePath(jsonPath));
} else {
getConnection().setJSONFilePath(jsonPath);
}
JSONWizard wizard = ((JSONWizard) getPage().getWizard());
wizard.setTreeRootNode(treeNode);
BufferedReader in = null;
// File file = null;
//
// if (tempJSONXsdPath != null && getConnection().getFileContent() != null
// && getConnection().getFileContent().length > 0 && !isModifing) {
// file = new File(tempJSONXsdPath);
// if (!file.exists()) {
// try {
// file.createNewFile();
// } catch (IOException e2) {
// ExceptionHandler.process(e2);
// }
// FileOutputStream outStream;
// try {
// outStream = new FileOutputStream(file);
// outStream.write(getConnection().getFileContent());
// outStream.close();
// } catch (FileNotFoundException e1) {
// ExceptionHandler.process(e1);
// } catch (IOException e3) {
// ExceptionHandler.process(e3);
// }
// }
//
// } else {
// file = new File(text);
// }
// setFileContent(file);
// }
try {
Charset guessedCharset = CharsetToolkit.guessEncoding(file, 4096);
String str;
in = new BufferedReader(new InputStreamReader(new FileInputStream(file), guessedCharset.displayName()));
while ((str = in.readLine()) != null) {
if (str.contains("encoding")) { //$NON-NLS-1$
String regex = "^<\\?JSON\\s*version=\\\"[^\\\"]*\\\"\\s*encoding=\\\"([^\\\"]*)\\\"\\?>$"; //$NON-NLS-1$
Perl5Compiler compiler = new Perl5Compiler();
Perl5Matcher matcher = new Perl5Matcher();
Pattern pattern = null;
try {
pattern = compiler.compile(regex);
if (matcher.contains(str, pattern)) {
MatchResult matchResult = matcher.getMatch();
if (matchResult != null) {
encoding = matchResult.group(1);
}
}
} catch (MalformedPatternException malE) {
ExceptionHandler.process(malE);
}
}
}
} catch (Exception ex) {
String fileStr = text;
String msgError = "JSON" + " \"" + fileStr.replace("\\\\", "\\") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "\"\n"; //$NON-NLS-1$
if (ex instanceof FileNotFoundException) {
msgError = msgError + "is not found";
} else if (ex instanceof EOFException) {
msgError = msgError + "have an incorrect character EOF";
} else if (ex instanceof IOException) {
msgError = msgError + "is locked by another soft";
} else {
msgError = msgError + "doesn't exist";
}
if (!isReadOnly()) {
updateStatus(IStatus.ERROR, msgError);
}
// ExceptionHandler.process(ex);
} finally {
try {
if (in != null) {
in.close();
}
} catch (Exception ex2) {
ExceptionHandler.process(ex2);
}
}
if (getConnection().getEncoding() == null || "".equals(getConnection().getEncoding())) { //$NON-NLS-1$
getConnection().setEncoding(encoding);
if (encoding != null && !("").equals(encoding)) { //$NON-NLS-1$
encodingCombo.setText(encoding);
} else {
encodingCombo.setText("UTF-8"); //$NON-NLS-1$
}
}
// if (tempJSONXsdPath != null && getConnection().getFileContent() != null
// && getConnection().getFileContent().length > 0 && !isModifing) {
// valid = treePopulator.populateTree(tempJSONXsdPath, treeNode);
// } else {
// valid = treePopulator.populateTree(text, treeNode);
// }
checkFieldsValue();
isModifing = true;
}
}

View File

@@ -27,6 +27,7 @@ import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.apache.log4j.Priority;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.viewers.TreeViewer;
@@ -52,6 +53,7 @@ import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.talend.commons.CommonsPlugin;
import org.talend.commons.ui.command.CommandStackForComposite;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.runtime.ws.WindowSystem;
@@ -222,6 +224,7 @@ public class JSONFileStep2Form extends AbstractJSONFileStepForm implements IRefr
jsonXPathLoopDescriptor.setLimitBoucle(XmlArray.getRowLimit());
}
treePopulator.setEncoding(getConnection().getEncoding());
treePopulator.populateTree(wizard.getTempJsonPath(), treeNode);
fieldsModel.setJSONXPathLoopDescriptor(jsonXPathLoopDescriptor.getSchemaTargets());
fieldsTableEditorView.getTableViewerCreator().layout();
@@ -608,7 +611,22 @@ public class JSONFileStep2Form extends AbstractJSONFileStepForm implements IRefr
}
};
previewLoader.load(getProcessDescription(false));
ProcessDescription processDescription = getProcessDescription(false);
EJsonReadbyMode mode = null;
String readbyMode = getConnection().getReadbyMode();
if (StringUtils.isNotBlank(readbyMode)) {
mode = EJsonReadbyMode.getEJsonReadbyModeByValue(readbyMode);
}
if (EJsonReadbyMode.XPATH.equals(mode)) {
/**
* JSON XPATH mode uses the temp generated xml file to execute the preview, the generated xml file is
* encoded using UTF-8. <br/>
* (The generated xml file can't be encoded using other charset, otherwise the converted xml file will be
* empty)
*/
processDescription.setEncoding(TalendQuoteUtils.addQuotes("UTF-8"));
}
previewLoader.load(processDescription);
}
@@ -871,10 +889,20 @@ public class JSONFileStep2Form extends AbstractJSONFileStepForm implements IRefr
}
}
Charset guessedCharset = CharsetToolkit.guessEncoding(file, 4096);
Charset guessedCharset = null;
try {
guessedCharset = Charset.forName(getConnection().getEncoding());
} catch (Exception e) {
if (CommonsPlugin.isDebugMode()) {
ExceptionHandler.process(e, Priority.WARN);
}
}
if (guessedCharset == null) {
guessedCharset = CharsetToolkit.guessEncoding(file, 4096);
}
String str;
in = new BufferedReader(new InputStreamReader(new FileInputStream(pathStr), guessedCharset.displayName()));
in = new BufferedReader(new InputStreamReader(new FileInputStream(pathStr), guessedCharset));
while ((str = in.readLine()) != null) {
previewRows.append(str + "\n"); //$NON-NLS-1$
@@ -947,6 +975,7 @@ public class JSONFileStep2Form extends AbstractJSONFileStepForm implements IRefr
// fix bug: when the JSON file is changed, the linker doesn't work.
resetStatusIfNecessary();
String tempJson = this.wizard.getTempJsonPath();
this.treePopulator.setEncoding(getConnection().getEncoding());
this.treePopulator.populateTree(tempJson, treeNode);
ScrollBar verticalBar = availableJSONTree.getVerticalBar();

View File

@@ -328,7 +328,7 @@ public class JSONFileStep3Form extends AbstractJSONFileStepForm {
processDescription = JSONShadowProcessHelper.getProcessDescription(connection2, connection2.getJSONFilePath());
} else {
processDescription = JSONShadowProcessHelper.getProcessDescription(connection2,
JSONUtil.changeJsonToXml(connection2.getJSONFilePath()));
JSONUtil.changeJsonToXml(connection2.getJSONFilePath(), getConnection().getEncoding()));
}
}
return processDescription;
@@ -357,10 +357,18 @@ public class JSONFileStep3Form extends AbstractJSONFileStepForm {
informationLabel.setText(" " + "Guess in progress...");
CsvArray csvArray = null;
ProcessDescription processDescription = getProcessDescription(false);
if (EJsonReadbyMode.JSONPATH.getValue().equals(connection2.getReadbyMode())) {
csvArray = JSONShadowProcessHelper.getCsvArray(getProcessDescription(false), "FILE_JSON"); //$NON-NLS-1$
csvArray = JSONShadowProcessHelper.getCsvArray(processDescription, "FILE_JSON"); //$NON-NLS-1$
} else {
csvArray = JSONShadowProcessHelper.getCsvArray(getProcessDescription(false), "FILE_XML"); //$NON-NLS-1$
/**
* JSON XPATH mode uses the temp generated xml file to execute the preview, the generated xml file is
* encoded using UTF-8. <br/>
* (The generated xml file can't be encoded using other charset, otherwise the converted xml file will
* be empty)
*/
processDescription.setEncoding(TalendQuoteUtils.addQuotes("UTF-8"));
csvArray = JSONShadowProcessHelper.getCsvArray(processDescription, "FILE_XML"); //$NON-NLS-1$
}
if (csvArray == null) {
informationLabel.setText(" " + "Guess failure");

View File

@@ -20,10 +20,13 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.actions.SelectionProviderAction;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.model.metadata.builder.connection.Connection;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode;
import org.talend.metadata.managment.ui.wizard.metadata.xml.utils.TreeUtil;
import org.talend.repository.json.ui.wizards.AbstractJSONStepForm;
import org.talend.repository.json.util.JSONUtil;
import org.talend.repository.model.json.JSONFileConnection;
/**
* hwang class global comment. Detailled comment
@@ -56,7 +59,17 @@ public class ImportTreeFromJSONAction extends SelectionProviderAction {
boolean changed = true;
try {
newInput = TreeUtil.getFoxTreeNodes(JSONUtil.changeJsonToXml(filePath));
String encoding = "UTF-8";
if (this.form != null) {
ConnectionItem connectionItem = this.form.getConnectionItem();
if (connectionItem != null) {
Connection connection = connectionItem.getConnection();
if (connection instanceof JSONFileConnection) {
encoding = ((JSONFileConnection) connection).getEncoding();
}
}
}
newInput = TreeUtil.getFoxTreeNodes(JSONUtil.changeJsonToXml(filePath, encoding));
changed = true;
} catch (Exception e) {
ExceptionHandler.process(e);

View File

@@ -272,6 +272,7 @@ public class JSONToXPathLinker extends TreeToTablesLinker<Object, Object> {
}
if (originalValue != null) {
loadItemDataForLazyLoad(loopTableEditorView);
createLoopLinks(originalValue, tableItem, monitorWrap);
}
@@ -311,6 +312,7 @@ public class JSONToXPathLinker extends TreeToTablesLinker<Object, Object> {
List<SchemaTarget> schemaTargetList, int startTableItem, int tableItemLength) {
monitorWrap.beginTask("Fields links creation ...", totalWork);
loadItemDataForLazyLoad(fieldsTableEditorView);
TableItem[] fieldsTableItems = fieldsTableEditorView.getTable().getItems();
for (int i = startTableItem, indexShemaTarget = 0; i < startTableItem + tableItemLength; i++, indexShemaTarget++) {
@@ -330,6 +332,7 @@ public class JSONToXPathLinker extends TreeToTablesLinker<Object, Object> {
createFieldLinks(relativeXpathQuery, tableItem, monitorWrap, schemaTarget);
monitorWrap.worked(1);
}
fieldsTableEditorView.getTableViewerCreator().getTableViewer().refresh();
getLinksManager().sortLinks(getDrawingLinksComparator());
getBackgroundRefresher().refreshBackground();
}

View File

@@ -111,7 +111,7 @@ public class JSONUtil {
return true;
}
public static String changeJsonToXml(String jsonPath) {
public static String changeJsonToXml(String jsonPath, String encoding) {
Project project = ProjectManager.getInstance().getCurrentProject();
IProject fsProject = null;
try {
@@ -166,10 +166,9 @@ public class JSONUtil {
}
try {
String jsonStr = IOUtils.toString(input);
String jsonStr = IOUtils.toString(input, encoding);
convertJSON.setJsonString(jsonStr);
convertJSON.generate();
jsonStr = convertJSON.getJsonString4XML();
inStream = new ByteArrayInputStream(jsonStr.getBytes());

View File

@@ -3129,6 +3129,15 @@
name="UseOracle11VersionInsteadOfRemoved"
version="7.1.0">
</projecttask>
<projecttask
beforeLogon="false"
breaks="7.0.0"
class="org.talend.repository.model.migration.changeDBVersionForMapROJAIOutputMigrationTask"
description="Changed DB version in MapROJAI output component"
id="org.talend.repository.model.migration.changeDBVersionForMapROJAIOutputMigrationTask"
name="changeDBVersionForMapROJAIOutputMigrationTask"
version="7.0.1">
</projecttask>
</extension>
<extension

View File

@@ -0,0 +1,84 @@
// Copyright (C) 2006-2019 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.model.migration;
import java.util.Arrays;
import java.util.Date;
import java.util.GregorianCalendar;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.model.components.ComponentUtilities;
import org.talend.core.model.components.ModifyComponentsAction;
import org.talend.core.model.components.conversions.IComponentConversion;
import org.talend.core.model.components.filters.IComponentFilter;
import org.talend.core.model.components.filters.NameComponentFilter;
import org.talend.core.model.migration.AbstractJobMigrationTask;
import org.talend.core.model.properties.Item;
import org.talend.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.migration.IMigrationTask.ExecutionResult;
public class changeDBVersionForMapROJAIOutputMigrationTask extends AbstractJobMigrationTask {
@Override
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2019, 8, 12, 12, 0, 0);
return gc.getTime();
}
@Override
public ExecutionResult execute(Item item) {
final ProcessType processType = getProcessType(item);
String[] compNames = {"tMapROjaiOutput"};
IComponentConversion changeDBNVersion = new IComponentConversion() {
public void transform(NodeType node) {
if(node == null) {
return;
}
ElementParameterType database = ComponentUtilities.getNodeProperty(node, "DB_VERSION"); //$NON-NLS-1$
if (database == null) {
return;
}
String dbname = database.getValue();
if("MAPROJAI_5_1".equals(dbname)) {
database.setValue("MAPR510");
} else if ("MAPROJAI_5_2".equals(dbname)) {
database.setValue("MAPR520");
}
}
};
for (String name : compNames) {
IComponentFilter filter = new NameComponentFilter(name);
try {
ModifyComponentsAction.searchAndModify(item, processType, filter, Arrays
.<IComponentConversion> asList(changeDBNVersion));
} catch (PersistenceException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
return ExecutionResult.SUCCESS_NO_ALERT;
}
}

View File

@@ -81,6 +81,7 @@ import org.talend.commons.ui.runtime.exception.ExceptionMessageDialog;
import org.talend.commons.ui.runtime.exception.MessageBoxExceptionHandler;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
import org.talend.commons.utils.network.TalendProxySelector;
import org.talend.commons.utils.system.EclipseCommandLine;
import org.talend.commons.utils.system.EnvironmentUtils;
import org.talend.core.CorePlugin;
@@ -694,6 +695,8 @@ public class LoginProjectPage extends AbstractLoginActionPage {
CommonExceptionHandler.process(e);
} catch (JSONException e) {
CommonExceptionHandler.process(e);
} finally {
TalendProxySelector.getInstance();
}
}

View File

@@ -32,6 +32,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.repository.ui.wizards.exportjob.JavaJobScriptsExportWSWizardPage.JobExportType;
import org.talend.repository.ui.wizards.exportjob.handler.BuildJobHandler;
import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice;
import org.talend.repository.utils.EmfModelUtils;
/**
* created by ycbai on 2015年5月15日 Detailled comment
@@ -40,6 +41,7 @@ import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManag
public class BuildJobFactory {
public static final Map<JobExportType, String> oldBuildTypeMap = new HashMap<JobExportType, String>();
private static final String T_REST_REQUEST = "tRESTRequest";
private static final List<String> esbComponents;
static {
// from the extension point
@@ -101,15 +103,22 @@ public class BuildJobFactory {
if (StringUtils.isEmpty(buildType)) {
final Object type = processItem.getProperty().getAdditionalProperties()
.get(TalendProcessArgumentConstant.ARG_BUILD_TYPE);
boolean esb = false;
boolean esb = false; //for esb consumer job and service
if (processItem instanceof ProcessItem) {
for (Object o : ((ProcessItem) processItem).getProcess().getNode()) {
if (o instanceof NodeType) {
NodeType currentNode = (NodeType) o;
if(esbComponents.contains(currentNode.getComponentName())) {
esb = true;
break;
if (null != EmfModelUtils.getComponentByName((ProcessItem) processItem, T_REST_REQUEST)) {
if (type == null) {
processItem.getProperty().getAdditionalProperties().put(TalendProcessArgumentConstant.ARG_BUILD_TYPE,
oldBuildTypeMap.get(JobExportType.OSGI));
}
esb = true;
} else {
for (Object o : ((ProcessItem) processItem).getProcess().getNode()) {
if (o instanceof NodeType) {
NodeType node = (NodeType) o;
if (esbComponents.contains(node.getComponentName())) {
esb = true;
break;
}
}
}
}

View File

@@ -30,8 +30,10 @@ 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;
@@ -65,6 +67,7 @@ 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;
import org.talend.designer.core.ICamelDesignerCoreService;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
@@ -82,9 +85,14 @@ import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobJavaScriptsM
import org.talend.repository.utils.EmfModelUtils;
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
@@ -201,9 +209,40 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
ExportFileResource libResource = getCompiledLibExportFileResource(processes);
list.add(libResource);
ExportFileResource libResourceSelected = new ExportFileResource(null, LIBRARY_FOLDER_NAME);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
ICamelDesignerCoreService camelService = (ICamelDesignerCoreService) GlobalServiceRegister.getDefault().getService(
ICamelDesignerCoreService.class);
Collection<String> unselectList = camelService.getUnselectDependenciesBundle(processItem);
List<URL> unselectListURLs = new ArrayList<>();
for(Set<URL> set:libResource.getAllResources()) {
for (URL url : set) {
boolean exist = false;
for(String name: unselectList) {
if (name.equals(new File(url.toURI()).getName())) {
exist = true;
}
}
if (!exist) {
unselectListURLs.add(url);
}
}
}
libResourceSelected.addResources(unselectListURLs);
}
// generate the META-INFO folder
ExportFileResource metaInfoFolder = genMetaInfoFolder(libResource, processItem);
ExportFileResource metaInfoFolder = genMetaInfoFolder(libResourceSelected, processItem);
list.add(0, metaInfoFolder);
ExportFileResource providedLibResources = getProvidedLibExportFileResource(processes);
@@ -784,7 +823,9 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
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-(.*)$")) {
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()));
@@ -806,6 +847,11 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
bundleNativeCode.setLength(bundleNativeCode.length() - 1);
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;
}
@@ -1000,4 +1046,116 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
}
return imports;
}
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 {
}
}
}

View File

@@ -12,7 +12,11 @@
// ============================================================================
package org.talend.designer.core.model.process;
import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.draw2d.geometry.Point;
import org.junit.After;
@@ -362,4 +366,61 @@ public class ConnectionManagerTest {
}
@Test
public void testCheckCircle() {
Process process = new Process(createProperty());
IComponent component = ComponentsFactoryProvider.getInstance().get("tJava", ComponentCategory.CATEGORY_4_DI.getName());
Node sourceNode = new Node(componentSource, process);
Node targetNode = new Node(componentTarget, process);
Node middleNode_1 = new Node(component, process);
Node middleNode_2 = new Node(component, process);
Node middleNode_3 = new Node(component, process);
// sourceNode -> middleNode_1 -> targetNode
resetNodeConnection(sourceNode);
resetNodeConnection(middleNode_1);
resetNodeConnection(targetNode);
((List<Connection>) middleNode_1.getIncomingConnections()).add(new Connection(sourceNode, middleNode_1,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
((List<Connection>) targetNode.getIncomingConnections()).add(new Connection(middleNode_1, targetNode,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
Assert.assertFalse(ConnectionManager.checkCircle(middleNode_1, targetNode));
// TUP-22620 source==target, no incomming connections
Assert.assertTrue(ConnectionManager.checkCircle(sourceNode, sourceNode));
// for circle connection, test checkCircle by canConnectToTrget
// sourceNode -> targetNode -> sourceNode
resetNodeConnection(sourceNode);
resetNodeConnection(middleNode_1);
resetNodeConnection(targetNode);
((List<Connection>) targetNode.getIncomingConnections()).add(new Connection(sourceNode, targetNode,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
Assert.assertFalse(ConnectionManager.canConnectToTarget(targetNode, null, sourceNode, EConnectionType.FLOW_MAIN,
EConnectionType.FLOW_MAIN.getName(), "testRow"));
// sourceNode -> middleNode_1 -> middleNode_2 -> middleNode_3 -> middleNode_1 -> targetNode
resetNodeConnection(sourceNode);
resetNodeConnection(targetNode);
((List<Connection>) middleNode_1.getIncomingConnections()).add(new Connection(sourceNode, middleNode_1,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
((List<Connection>) middleNode_2.getIncomingConnections()).add(new Connection(middleNode_1, middleNode_2,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
((List<Connection>) middleNode_1.getIncomingConnections()).add(new Connection(middleNode_3, middleNode_1,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
((List<Connection>) targetNode.getIncomingConnections()).add(new Connection(middleNode_1, targetNode,
EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "testRow", "testRow", "testRow", false));
Assert.assertFalse(ConnectionManager.canConnectToTarget(middleNode_2, null, middleNode_3, EConnectionType.FLOW_MAIN,
EConnectionType.FLOW_MAIN.getName(), "testRow"));
}
private static void resetNodeConnection(Node node) {
List<Connection> inconnections = new ArrayList<Connection>();
node.setIncomingConnections(inconnections);
List<Connection> outconnections = new ArrayList<Connection>();
node.setOutgoingConnections(outconnections);
}
}

View File

@@ -5,6 +5,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -610,5 +611,163 @@ public class DbGenerationManagerTest extends DbGenerationManagerTestHelper {
+" \n"
+" ) table2\"";
assertEquals(exceptQuery.replaceAll("\n", "").trim(), query.trim());
}
@Test
public void testBuildSqlSelect_endWithContext() {
String schema = "";
String table1 = "table1";
String table2 = "table2";
String table3 = "table3";
List<IConnection> incomingConnections = new ArrayList<IConnection>();
String[] mainTableEntities = new String[] { "id", "column1", "column2" };
incomingConnections.add(mockConnection(schema, table1, mainTableEntities));
dbMapComponent.setIncomingConnections(incomingConnections);
ExternalDbMapData externalData = new ExternalDbMapData();
List<ExternalDbMapTable> inputs = new ArrayList<ExternalDbMapTable>();
List<ExternalDbMapTable> outputs = new ArrayList<ExternalDbMapTable>();
// main table
ExternalDbMapTable inputTable = new ExternalDbMapTable();
String mainTableName = "".equals(schema) ? table1 : schema + "." + table1;
// quote will be removed in the ui for connections ,so we do the same for test
String mainTableNameNoQuote = TalendTextUtils.removeQuotes(mainTableName);
inputTable.setTableName(mainTableNameNoQuote);
inputTable.setName(mainTableName);
List<ExternalDbMapEntry> entities = getMetadataEntities(mainTableEntities, new String[3]);
inputTable.setMetadataTableEntries(entities);
inputs.add(inputTable);
// output
ExternalDbMapTable outputTable = new ExternalDbMapTable();
mainTableName = "".equals(schema) ? table2 : schema + "." + table2;
// quote will be removed in the ui for connections ,so we do the same for test
mainTableNameNoQuote = TalendTextUtils.removeQuotes(mainTableName);
outputTable.setTableName(mainTableNameNoQuote);
outputTable.setName("table2");
String[] names = new String[] { "id", "column1", "column2" };
String mainTable = mainTableName;
String[] expressions = new String[] { "table1.id",
"CASE WHEN table1.column1 IS NULL THEN context.param1 ELSE table1.column1 END", "table1.column2" };
outputTable.setMetadataTableEntries(getMetadataEntities(names, expressions));
String[] whereNames = new String[] { "whereFilter" };
String[] whereExps = new String[] { "t.column2 = context.param2" };
outputTable.setCustomWhereConditionsEntries(getMetadataEntities(whereNames, whereExps));
outputs.add(outputTable);
externalData.setInputTables(inputs);
externalData.setOutputTables(outputs);
dbMapComponent.setExternalData(externalData);
List<IMetadataTable> metadataList = new ArrayList<IMetadataTable>();
MetadataTable metadataTable = getMetadataTable(names);
metadataTable.setLabel("table2");
metadataList.add(metadataTable);
dbMapComponent.setMetadataList(metadataList);
JobContext newContext = new JobContext("Default");
List<IContextParameter> newParamList = new ArrayList<IContextParameter>();
newContext.setContextParameterList(newParamList);
JobContextParameter param = new JobContextParameter();
param.setName("schema");
newParamList.add(param);
process = mock(Process.class);
JobContextManager contextManger = new JobContextManager();
contextManger.setDefaultContext(newContext);
when(process.getContextManager()).thenReturn(contextManger);
dbMapComponent.setProcess(process);
ExternalDbMapData externalData2 = new ExternalDbMapData();
DbMapComponent dbMapComponent2 = new DbMapComponent();
dbMapComponent2.setExternalData(externalData2);
mainTableEntities = new String[] { "id", "column1", "column2" };
List<IConnection> outgoingConnections = new ArrayList<IConnection>();
Node map1 = mockNode(dbMapComponent);
outgoingConnections.add(mockConnection(map1, schema, table2, mainTableEntities));
dbMapComponent.setOutgoingConnections(outgoingConnections);
dbMapComponent2.setIncomingConnections(outgoingConnections);
inputs = new ArrayList<ExternalDbMapTable>();
outputs = new ArrayList<ExternalDbMapTable>();
// main table
inputTable = new ExternalDbMapTable();
mainTableName = "".equals(schema) ? table2 : schema + "." + table2;
// quote will be removed in the ui for connections ,so we do the same for test
mainTableNameNoQuote = TalendTextUtils.removeQuotes(mainTableName);
inputTable.setTableName(mainTableNameNoQuote);
inputTable.setName("table2");
entities = getMetadataEntities(mainTableEntities, new String[3]);
inputTable.setMetadataTableEntries(entities);
inputs.add(inputTable);
// output
outputTable = new ExternalDbMapTable();
mainTableName = "".equals(schema) ? table3 : schema + "." + table3;
// quote will be removed in the ui for connections ,so we do the same for test
mainTableNameNoQuote = TalendTextUtils.removeQuotes(mainTableName);
outputTable.setTableName(mainTableNameNoQuote);
outputTable.setName("table3");
names = new String[] { "id", "column1", "column2" };
mainTable = mainTableName;
expressions = new String[] { "table2.id", "table2.column1", "table2.column2" };
outputTable.setMetadataTableEntries(getMetadataEntities(names, expressions));
whereNames = new String[] { "whereFilter" };
whereExps = new String[] { "t.column2A = context.param2A" };
outputTable.setCustomWhereConditionsEntries(getMetadataEntities(whereNames, whereExps));
outputs.add(outputTable);
externalData2.setInputTables(inputs);
externalData2.setOutputTables(outputs);
dbMapComponent2.setExternalData(externalData2);
metadataList = new ArrayList<IMetadataTable>();
metadataTable = getMetadataTable(names);
metadataTable.setLabel("table3");
metadataList.add(metadataTable);
dbMapComponent2.setMetadataList(metadataList);
if (dbMapComponent2.getElementParameters() == null) {
dbMapComponent2.setElementParameters(Collections.EMPTY_LIST);
}
JobContextParameter param1 = new JobContextParameter();
param1.setName("param1");
newParamList.add(param1);
JobContextParameter param2 = new JobContextParameter();
param2.setName("param2");
newParamList.add(param2);
dbMapComponent2.setProcess(process);
outgoingConnections = new ArrayList<IConnection>();
outgoingConnections.add(mockConnection(schema, table3, mainTableEntities));
dbMapComponent2.setOutgoingConnections(outgoingConnections);
ElementParameter comName = new ElementParameter(dbMapComponent);
comName.setName("COMPONENT_NAME");
comName.setValue("tELTMap");
List<ElementParameter> list = new ArrayList<>();
list.add(comName);
dbMapComponent.setElementParameters(list);
dbManager = new GenericDbGenerationManager() {
@Override
protected java.util.List<String> getContextList(DbMapComponent component) {
return Arrays.asList("context.param1", "context.param2", "context.param2A");
};
};
String query = dbManager.buildSqlSelect(dbMapComponent2, "table3");
String exceptQuery = "\"SELECT\n" +
"table2.id, table2.column1, table2.column2\n" +
"FROM\n" +
" (\n" +
" SELECT\n" +
" table1.id AS id, CASE WHEN table1.column1 IS NULL THEN \" +context.param1+ \" ELSE table1.column1 END AS column1, table1.column2 AS column2\n" +
" FROM\n" +
" table1\n" +
" WHERE t.column2 = \" +context.param2+ \"\n" +
" ) table2\n" +
"WHERE t.column2A = \" +context.param2A";
assertEquals(exceptQuery.trim(), query.trim());
}
}

View File

@@ -31,26 +31,47 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.model.context.JobContextManager;
import org.talend.core.model.process.IContext;
import org.talend.core.model.process.IContextManager;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.process.IProcess2;
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.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.Relation;
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.repository.RepositoryObject;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.TalendProcessOptionConstants;
import org.talend.designer.core.IDesignerCoreService;
import org.talend.designer.core.model.utils.emf.talendfile.ParametersType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
import org.talend.designer.core.ui.editor.process.Process;
import org.talend.designer.maven.model.TalendJavaProjectConstants;
import org.talend.designer.maven.model.TalendMavenConstants;
import org.talend.designer.maven.tools.AggregatorPomsHelper;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IProcessor;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.designer.runprocess.java.TalendJavaProjectManager;
import org.talend.designer.runprocess.maven.MavenJavaProcessor;
import org.talend.repository.ProjectManager;
import org.talend.repository.documentation.ERepositoryActionName;
import org.talend.repository.model.IProxyRepositoryFactory;
@@ -348,6 +369,145 @@ public class ProcessChangeListenerTest {
checkRootPomModules(toRemove, toAdd);
}
@Test
public void testSyncParentJobPomsForPropertyChange() throws Exception {
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
Property maintestProp = createJobPropertyWithContext("maintest", "0.1");
Property childtestProp = createJobPropertyWithContext("childtest", "0.1");
ProcessItem mainItem = (ProcessItem) maintestProp.getItem();
mainItem.getProcess().setDefaultContext("Default");
JobInfo mainJobInfo = new JobInfo(mainItem, mainItem.getProcess().getDefaultContext());
ProcessItem childItem = (ProcessItem) childtestProp.getItem();
JobInfo childJobInfo = new JobInfo(childItem, childItem.getProcess().getDefaultContext());
childJobInfo.setJobId(childtestProp.getId());
childJobInfo.setFatherJobInfo(mainJobInfo);
IProcessor mainProcessor = getProcessor(maintestProp.getItem());
assertTrue(mainProcessor != null);
mainProcessor.getBuildFirstChildrenJobs().add(childJobInfo);
int option = 0;
option |= TalendProcessOptionConstants.GENERATE_POM_ONLY;
option |= TalendProcessOptionConstants.GENERATE_IS_MAINJOB;
// ((MavenJavaProcessor) processor).generatePom(option);
MavenJavaProcessor mavenProcessor = (MavenJavaProcessor) mainProcessor;
mavenProcessor.generatePom(option);
// prepare relationship
RelationshipItemBuilder relationBuilder = RelationshipItemBuilder
.getInstance(ProjectManager.getInstance().getCurrentProject(), true);
relationBuilder.load();
Map<Relation, Set<Relation>> currentProjectItemsRelations = relationBuilder.getCurrentProjectItemsRelations();
Relation baseItem = new Relation();
baseItem.setId(maintestProp.getId());
baseItem.setType(RelationshipItemBuilder.JOB_RELATION);
baseItem.setVersion("0.1");
Relation relatedItem = new Relation();
relatedItem.setId(childtestProp.getId());
relatedItem.setVersion(RelationshipItemBuilder.LATEST_VERSION);
relatedItem.setType(RelationshipItemBuilder.JOB_RELATION);
currentProjectItemsRelations.put(baseItem, new HashSet<Relation>());
currentProjectItemsRelations.get(baseItem).add(relatedItem);
relationBuilder.saveRelations();
IFile maintestPom = getJobPomFile(maintestProp);
assertTrue(maintestPom.exists());
// expect: parentJob pom exist childJob dependency
assertTrue(PomUtil.checkIfJobDependencyExist(maintestPom, childtestProp));
// to upgrade child job version
IRepositoryViewObject childObject = factory.getSpecificVersion(childtestProp.getId(), childtestProp.getVersion(), true);
RepositoryObject upperChildObject = new RepositoryObject(childObject.getProperty());
Property upperProperty = upperChildObject.getProperty();
upperProperty.setVersion("0.2");
factory.save(upperProperty, childtestProp.getLabel(), childtestProp.getVersion());
RelationshipItemBuilder.getInstance().addOrUpdateItem(upperChildObject.getProperty().getItem());
// to moke the process of syncParentJobPomsForPropertyChange
List<Relation> itemsHaveRelationWith = RelationshipItemBuilder.getInstance()
.getItemsHaveRelationWith(upperProperty.getId(), upperProperty.getVersion());
assertTrue(itemsHaveRelationWith.size() == 1);
Relation relation = itemsHaveRelationWith.get(0);
assertTrue(relation.getId().equals(maintestProp.getId()));
assertTrue(relation.getVersion().equals(maintestProp.getVersion()));
// will get latest version childJobInfo in ProcessorUtilities.getSubjobInfo
mainProcessor.getBuildFirstChildrenJobs().clear();
ProcessItem upperItem = (ProcessItem) upperChildObject.getProperty().getItem();
JobInfo newChildJobInfo = new JobInfo(upperItem, upperItem.getProcess().getDefaultContext());
newChildJobInfo.setJobId(upperProperty.getId());
newChildJobInfo.setFatherJobInfo(mainJobInfo);
mainProcessor.getBuildFirstChildrenJobs().add(newChildJobInfo);
mavenProcessor.generatePom(option);
// expect: after childJob upgrade version, parentJob pom exist childJob dependency
// dependency version should be new version
assertTrue(PomUtil.checkIfJobDependencyExist(maintestPom, upperProperty));
}
private Property createJobPropertyWithContext(String label, String version) throws Exception {
Property property = PropertiesFactory.eINSTANCE.createProperty();
String id = ProxyRepositoryFactory.getInstance().getNextId();
property.setId(id);
property.setLabel(label);
property.setVersion(version);
ProcessItem item = PropertiesFactory.eINSTANCE.createProcessItem();
item.setProperty(property);
Process process = new Process(property);
ProcessType processType = TalendFileFactory.eINSTANCE.createProcessType();
ParametersType parameterType = TalendFileFactory.eINSTANCE.createParametersType();
processType.setParameters(parameterType);
item.setProcess(processType);
IContextManager contextManager = process.getContextManager();
if (contextManager == null) {
contextManager = new JobContextManager();
}
ProxyRepositoryFactory.getInstance().create(item, new Path(""));
testJobs.add(property);
return property;
}
private IProcessor getProcessor(Item item) {
GlobalServiceRegister register = GlobalServiceRegister.getDefault();
IProcessor processor = null;
IProcess process = null;
IContext context = null;
Property curProperty = item.getProperty();
if (register.isServiceRegistered(IDesignerCoreService.class)) {
IDesignerCoreService designerService = (IDesignerCoreService) register.getService(IDesignerCoreService.class);
process = designerService.getProcessFromItem(item);
if (item.getProperty() == null && process instanceof IProcess2) {
curProperty = ((IProcess2) process).getProperty();
}
context = process.getContextManager().getDefaultContext();
}
if (process != null && GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService runProcessservice = (IRunProcessService) GlobalServiceRegister.getDefault()
.getService(IRunProcessService.class);
processor = runProcessservice.createCodeProcessor(process, curProperty, ECodeLanguage.getCodeLanguage("java"), true);
}
processor.setContext(context);
return processor;
}
private IFile getJobPomFile(Property property) {
String projectTechName = ProjectManager.getInstance().getCurrentProject().getTechnicalLabel();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IProject project = root.getProject(projectTechName);
IFolder pomsFolder = project.getFolder(TalendJavaProjectConstants.DIR_POMS);
IFolder jobFolder = pomsFolder.getFolder("jobs").getFolder("process")
.getFolder(property.getLabel() + "_" + property.getVersion());
IFile jobPom = jobFolder.getFile("pom.xml");
return jobPom;
}
private Property createJobProperty(String label, String version, boolean create) throws Exception {
String id = ProxyRepositoryFactory.getInstance().getNextId();
return createJobProperty(id, label, version, new Path(""), create);