Compare commits

...

88 Commits

Author SHA1 Message Date
Sebastien Gandon
ac1663018f refactor (TCOMP-294): changed the bundle name for tcom services 2016-10-17 15:38:31 +02:00
zwxue
18716c4459 Merge pull request #713 from Talend/bugfix/master/TUP-16066
TUP-16066:when delete a componet for spark job that used joblet, line is
2016-10-17 16:01:35 +08:00
wang wei
30086c5987 TDI-37519: fix the common javajet part
https://jira.talendforge.org/browse/TDI-37519
2016-10-17 14:34:35 +08:00
sgandon
7c9a074116 Merge pull request #714 from Talend/bug/6.3/TDI-37519-daikon
TDI-37519: fix the import
2016-10-16 17:12:24 +02:00
Sebastien Gandon
7afe1068c7 fix (TDI-37519): add missing import in manifest for daikon.runtime 2016-10-16 17:11:51 +02:00
wang wei
69826a054d TDI-37519: fix the import
https://jira.talendforge.org/browse/TDI-37519
2016-10-14 22:37:21 +08:00
hwang
fbd056c0b7 TUP-16066:when delete a componet for spark job that used joblet, line is
not deleted
2016-10-14 17:15:31 +08:00
zwxue
1393bf4c30 Merge pull request #710 from Talend/bugfix/master/TUP-16037
TUP-16037:Version for MSSQL is missing in Some Settings
2016-10-14 11:31:19 +08:00
Chao MENG
3d0a0f94d8 Merge pull request #711 from Talend/bugfix/6.3/TUP-16060_!!!SchemaController.schemaOf!!!_display_on_Guess_schema_dialog
TUP-16060 fix:!!!SchemaController.schemaOf!!! display on Guess schema
2016-10-13 18:04:53 +08:00
wchen-talend
bdbfa95aff Merge pull request #704 from Talend/bugfix/6.3/TUP-16049_Enable_Auto_Conversion_types_only_for_standard_job
TUP-16049:"Enable Auto-Conversion of types" not added for Bigdata job
2016-10-13 17:35:22 +08:00
guol
2d2aeb90ce TUP-16060 fix:!!!SchemaController.schemaOf!!! display on Guess schema
dialog
2016-10-13 17:10:17 +08:00
GGu
a578b60a6c Merge pull request #699 from Talend/bugfix/6.3/TUP-15958_fixRefactorJobletProblem
TUP-15958: NPE error when refactor for joblet for tFileInputDelimited on spark job
2016-10-13 16:55:25 +08:00
GGu
b60befa081 Merge pull request #695 from Talend/bugfix/6.3/TUP-15962_fixUpdateProblem
TUP-15962: FileDelimited: Imported job always need Update when open it even if run job and auto-save
2016-10-13 16:53:38 +08:00
wchen-talend
91476446dd Merge pull request #702 from Talend/bugfix/6.3/TUP-16004_MapRDB_column_family_missing
TUP-16004:Column family is not set when drag MapRDB schema to job
2016-10-13 15:31:26 +08:00
GGu
bdc7cdc344 Merge pull request #707 from msjian/master
TDQ-7446: fix TDQ-7348 pattern list in tMultiPatternCheck show more than
2016-10-13 15:30:29 +08:00
hwang
918fce7dbd TUP-16037:Version for MSSQL is missing in Some Settings 2016-10-13 15:13:44 +08:00
msjian
56e3de1c02 TDQ-7446: fix TDQ-7348 pattern list in tMultiPatternCheck show more than
once.
2016-10-13 14:56:26 +08:00
wang wei
8e0d42279e Merge pull request #696 from Talend/bugfix/6.3/TDI-37552_Azure_support_for_other_mssql_components
Bugfix/6.3/tdi 37552 azure support for other mssql components
2016-10-13 13:54:53 +08:00
dlin-talend
503b97e6cd Merge pull request #705 from Talend/bugfix/master/TUP-15833
TUP-15833: [6.2.1] General JDBC metadata connection cannot use SAPHana
2016-10-13 11:12:08 +08:00
zwxue
f3a6d29e32 TUP-15833: [6.2.1] General JDBC metadata connection cannot use SAPHana
Mapping.
2016-10-13 11:05:54 +08:00
hcyi
057fac325b TUP-16049:"Enable Auto-Conversion of types" not added for Bigdata job 2016-10-13 10:46:35 +08:00
hcyi
69f14ae212 Merge pull request #698 from Talend/bugfix/6.3.1/TUP-15996_saphana_guess_schema
TUP-15996:Guess Schema for tJDBCInput/tSAPHanaInput does not work for
2016-10-13 09:59:20 +08:00
wang wei
044e159924 Merge pull request #703 from Talend/bugfix/6.3/TDI-37525_support_document
TDI-37525: Add support document type in new framework
2016-10-13 09:56:44 +08:00
jzhao
b08772f36d TDI-37525: Fix delimited wrong migration mapping
https://jira.talendforge.org/browse/TDI-37525
2016-10-12 20:15:14 +08:00
jzhao
25fd1de78f TDI-37525: Add support document type in new framework
https://jira.talendforge.org/browse/TDI-37525
2016-10-12 18:15:09 +08:00
hcyi
3301983a59 TUP-16004:Column family is not set when drag MapRDB schema to job 2016-10-12 17:10:59 +08:00
nrousseau
a7591376b6 TUP-15998: Improve build speed for jobs (#700) 2016-10-12 10:25:37 +02:00
jzhao
6c93bea4c4 TDI-37606: Avoid NPE during filedelimited components migration 2016-10-11 18:40:50 +08:00
ycbai
8164b9ec83 TUP-15958: NPE error when refactor for joblet for tFileInputDelimited on
spark job
2016-10-11 18:22:20 +08:00
hwang-talend
aba9c3b6fc Merge pull request #693 from Talend/bugfix/master/TUP-15833
TUP-15833: Add migration task.
2016-10-11 17:25:56 +08:00
wchen-talend
dbdc5194da Merge pull request #697 from Talend/bugfix/6.3/TUP-15901_Proposal_for_Auto_Conversion
TUP-15901:Improve: Should support "Ctrl+Space" to list available functions in ProjectSetting->General->"Auto-Conversion of types"
2016-10-11 17:20:10 +08:00
wchen-talend
31800ac634 Merge pull request #691 from Talend/bugfix/6.3.0/TUP-15939-Git_offline_mode
TUP-15939 fix> GIT: Cannot Switch to Offline Mode if tag is selected in Remote Connection list
2016-10-11 17:12:48 +08:00
wchen-talend
d259f0310d TUP-15996:Guess Schema for tJDBCInput/tSAPHanaInput does not work for
SAP HANA tables
2016-10-11 16:19:17 +08:00
hcyi
90973106bc TUP-15901:Improve: Should support "Ctrl+Space" to list available
functions in ProjectSetting->General->"Auto-Conversion of types"
2016-10-11 14:09:57 +08:00
Dmytro Chmyga
af4f8fdea0 TDI-37552: added driver selection to tELTMSSqlMap component. 2016-10-10 15:32:52 +03:00
jzhao
e7ac065285 TDI-37525: Fix new delimited components table migration issue
https://jira.talendforge.org/browse/TDI-37525
2016-10-10 18:58:39 +08:00
ycbai
944146b602 TUP-15962: FileDelimited: Imported job always need Update when open it
even if run job and auto-save
2016-10-10 15:09:56 +08:00
GGu
a9a547bb26 Add missing test file. 2016-10-10 14:07:19 +08:00
Chao MENG
1bdcb41e1c Merge pull request #694 from Talend/bugfix/6.3.0/TUP-15923_git_editor_conn_status
TUP-15923:Git merge: parameter "Active" can be edited but can not be
2016-10-10 10:03:26 +08:00
GGu
4b3b81a1ab Merge pull request #690 from Talend/bugfix/6.3/TUP-15961_fixOverwriteProblemOfImportItems
TUP-15961: FileDelimited: Cannot list dup item if check "Overwrite existing item"
2016-10-10 09:50:01 +08:00
wchen-talend
4f4cf8571a TUP-15923:Git merge: parameter "Active" can be edited but can not be
saved.
2016-10-09 18:10:37 +08:00
zwxue
f600260074 TUP-15833: Add migration task. 2016-10-09 16:28:26 +08:00
wchen-talend
e1e463ef22 Merge pull request #692 from Talend/bugfix/6.3/TUP-15920_default_checked_auto_conversion_type
TUP-15920:when create tmap not enable option if checked auto-conversion of type in project setting
2016-10-09 15:36:10 +08:00
Mike Yan
b1af456353 TESB-17993: Add escapeJavaString method in CamelEndpointBuilder and
reformat
2016-10-09 15:23:44 +08:00
Mike Yan
a666f6a1f2 Merge branch 'master' of https://github.com/Talend/tdi-studio-se.git 2016-10-09 15:17:32 +08:00
hcyi
1038f0afce TUP-15920:when create tmap not enable option if checked auto-conversion
of type in project setting
2016-10-09 14:37:00 +08:00
cmeng-talend
f9acdcb0ec TUP-15939 fix> GIT: Cannot Switch to Offline Mode if tag is selected in
Remote Connection list
https://jira.talendforge.org/browse/TUP-15939
2016-10-08 18:36:17 +08:00
ycbai
0c383cf322 TUP-15961: FileDelimited: Cannot list dup item if check "Overwrite
existing item"
2016-10-08 16:37:52 +08:00
jzhao
d9036bdeec TUP-5011: tJMSInput "Enable Durable Subscription" causing
ClassCastException
https://jira.talendforge.org/browse/TUP-5011
2016-10-08 16:13:43 +08:00
Chao Meng
c88a63a754 Merge pull request #688 from Talend/bugfix/6.2/TUP-5737_can't_re_create_the_link_between_tMap_after_it's_deleted
TUP-5737 fix: can't re-create the link between tMap after it's deleted
2016-10-08 11:12:04 +08:00
wang wei
0f9501f816 TDI-37540: Unable to convert Dynamic type to String type in tMap with
'Auto Type Convert'
https://jira.talendforge.org/browse/TDI-37540
2016-10-08 10:47:58 +08:00
hcyi
2cfa9a3faf Merge pull request #682 from Talend/bugfix/6.3.0/TUP-15975_npe_in_tWebService
TUP-15975:Get NPE when click refresh on tWebService wizard with specific
2016-10-08 10:31:13 +08:00
Dmytro Chmyga
0109697cbd TDI-37552: added Azure support for tCreateTable component. 2016-10-06 10:48:20 +03:00
dlin-talend
f0703aa0db Merge pull request #668 from Talend/bugfix/6.3/TUP-5524
TUP-5524: Keep the job id always, won't set empty in backgroud.
2016-09-30 16:49:33 +08:00
guol
90fdabd479 TUP-5737 fix: can't re-create the link between tMap after it's deleted 2016-09-30 16:40:34 +08:00
GGu
7fa9786249 Merge pull request #687 from Talend/bugfix/6.3/TUP-15957_fixReadonlyProblem
TUP-15957: fix the problem that contexted fileds are not readonly after export context.
2016-09-30 16:11:46 +08:00
ycbai
abb83569f7 TUP-15957: fix the problem that contexted fileds are not readonly after
export context.
2016-09-30 15:47:38 +08:00
GGu
08731d1528 Merge pull request #686 from Talend/bugfix/6.3/TUP-15954_rowSepEmptyAfterExportContext
TUP-15954: FileDelimited: "Row Seperator" is Empty after "Export as Context"
2016-09-30 15:29:34 +08:00
GGu
c49b7de01c Merge pull request #685 from Talend/feature/TUP-15978_addReadonlySupportForConfOfWidget
TUP-15978: Make READ_ONLY configuration of widget take effect in studio
2016-09-30 15:27:00 +08:00
GGu
7ec2820c95 Merge pull request #683 from Talend/bugfix/6.3/TUP-15955_fixContextIssuse
TUP-15955: FileDelimited: Useless context variable after "Export as Context"
2016-09-30 15:25:30 +08:00
ycbai
2f4adf5454 TUP-15954: FileDelimited: "Row Seperator" is Empty after "Export as
Context"
2016-09-30 15:05:32 +08:00
jzhao
4722c8ddb5 TDI-37525: Fix new delimited encoding migration
https://jira.talendforge.org/browse/TDI-37525
2016-09-29 19:43:17 +08:00
ycbai
a7fd418387 TUP-15978: Make READ_ONLY configuration of widget take effect in studio 2016-09-29 18:00:54 +08:00
dlin-talend
a6b4263a9f Merge pull request #684 from Talend/bugfix/6.3/TUP-15971
TUP-15971: Fix the problem for condition of Map components.
2016-09-29 17:01:09 +08:00
ycbai
a85d9e607a TUP-15955: FileDelimited: Useless context variable after "Export as
Context"
2016-09-29 16:46:37 +08:00
GGu
8f405c003d TUP-15971: Fix the problem for condition of Map components. 2016-09-29 16:29:53 +08:00
GGu
60adffbed8 Merge pull request #681 from Talend/bugfix/6.3/TUP-15948_fileNameQuotesProblem
TUP-15948: FileDelimited:file name is not right when choose an existed metadata for tFileInputDelimited
2016-09-29 16:02:17 +08:00
wchen-talend
c582f6b33d TUP-15975:Get NPE when click refresh on tWebService wizard with specific
wsdl.
2016-09-29 15:34:44 +08:00
ycbai
80f76d3b07 TUP-15948: FileDelimited:file name is not right when choose an existed
metadata for tFileInputDelimited
2016-09-29 11:00:57 +08:00
GGu
20c2765b2c Merge pull request #680 from Talend/bugfix/6.3/TUP-15940_fixNPEWhenSaveJobWithFileDelimitedComponent
TUP-15940: Studio throw a NPE error log when saving a testcase or a job contain tfileInputDelimited/tfileOutputDelimited.
2016-09-28 17:36:07 +08:00
GGu
babe894758 Merge pull request #679 from Talend/bugfix/6.3/TUP-15937_fixRefreshProblem
TUP-15937: New framework components UI can't be refreshed
2016-09-28 17:35:27 +08:00
jzhao
a8d479471e TDI-37525: Fix filedelimited "rowseparator" migration issue.
https://jira.talendforge.org/browse/TDI-37525
2016-09-28 17:19:04 +08:00
ycbai
d273256dbe TUP-15940: Studio throw a NPE error log when saving a testcase or a job
contain tfileInputDelimited/tfileOutputDelimited.
2016-09-28 15:39:26 +08:00
ycbai
17f18fdc3d TUP-15937: New framework components UI can't be refreshed 2016-09-28 15:05:43 +08:00
hwang-talend
a30f500c56 Merge pull request #676 from Talend/bugfix/master/TUP-15938
TUP-15938:Cann't create joblet when use TP_BD license
2016-09-27 18:52:36 +08:00
GGu
4b7eff2772 Merge pull request #678 from Talend/bugfix/6.3/TUP-15929_fixProblemOfHDFSRetrieveSchema
TUP-15929: Cann't retrieve schema for HDFS
2016-09-27 18:05:28 +08:00
ycbai
8104fd4378 TUP-15929: Cann't retrieve schema for HDFS 2016-09-27 17:57:52 +08:00
hwang-talend
ddbbc4b683 Merge pull request #675 from Talend/bugfix/master/TUP-15880
TUP-15880: "Guess schema" throwing ClassNotFoundException when
2016-09-27 17:50:59 +08:00
hwang
daf01d0bd4 TUP-15938:Cann't create joblet when use TP_BD license 2016-09-27 17:29:08 +08:00
jzhao
eb94936002 TDI-37525: Fix Output components just passed the input records to next
component
https://jira.talendforge.org/browse/TDI-37525
2016-09-27 17:26:16 +08:00
zwxue
4aff5e0147 Merge pull request #673 from Talend/bugfix/master/TUP-15870
TUP-15870:NPE shows when drag Big Data schema to Spark/Spark Streaming
2016-09-27 17:13:59 +08:00
zwxue
9a9699cc6a TUP-15880: "Guess schema" throwing ClassNotFoundException when
t<DB>Connection in Joblet.
2016-09-27 17:01:54 +08:00
Mike Yan
9ad7832c84 Merge branch 'master' of https://github.com/Talend/tdi-studio-se.git 2016-09-27 09:55:51 +08:00
Mike Yan
23cdd58198 Merge branch 'master' of https://github.com/Talend/tdi-studio-se.git 2016-09-26 14:27:02 +08:00
hwang
38948abcc6 TUP-15870:NPE shows when drag Big Data schema to Spark/Spark Streaming
joblet
2016-09-26 13:29:57 +08:00
GGu
6089570f6d TUP-5524: Keep the job id always, won't set empty in backgroud. 2016-09-22 15:32:31 +08:00
Mike Yan
d0a92a5c16 Merge branch 'master' of https://github.com/Talend/tdi-studio-se.git 2016-09-22 09:41:33 +08:00
Mike Yan
5cf148fbee TESB-17856: ESB Microservice can be exported only with Default context 2016-09-21 19:35:15 +08:00
64 changed files with 1074 additions and 590 deletions

View File

@@ -271,7 +271,7 @@
unpack="false"/>
<plugin
id="org.talend.components.api.service"
id="org.talend.components.api.service.osgi"
download-size="0"
install-size="0"
version="0.0.0"

View File

@@ -176,7 +176,7 @@ topology_<%=cid%> = org.talend.components.api.component.ConnectorTopology.NONE;
}
%>
org.talend.components.api.component.runtime.RuntimeInfo runtime_info_<%=cid%> = def_<%=cid%>.getRuntimeInfo(props_<%=cid%>, topology_<%=cid%>);
org.talend.daikon.runtime.RuntimeInfo runtime_info_<%=cid%> = def_<%=cid%>.getRuntimeInfo(props_<%=cid%>, topology_<%=cid%>);
java.util.Set<org.talend.components.api.component.ConnectorTopology> supported_connector_topologies_<%=cid%> = def_<%=cid%>.getSupportedConnectorTopologies();
org.talend.components.api.component.runtime.SourceOrSink sourceOrSink_<%=cid%> = (org.talend.components.api.component.runtime.SourceOrSink)(Class.forName(runtime_info_<%=cid%>.getRuntimeClassName()).newInstance());

View File

@@ -142,44 +142,54 @@ if(hasInput){
<%
if (mainIrToRow != null) {
%>
java.util.Iterator<?> outgoingMainRecords_<%=cid%> = ((org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>)writer_<%=cid%>).getSuccessfulWrites().iterator();
Object outgoingMain_<%=cid%> = null;
if (outgoingMainRecords_<%=cid%>.hasNext()) {
outgoingMain_<%=cid%> = outgoingMainRecords_<%=cid%>.next();
if(outgoingMainRecords_<%=cid%>.hasNext()){
outgoingMain_<%=cid%> = data_<%=cid%>;
if(writer_<%=cid%> instanceof org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>){
java.util.Iterator<?> outgoingMainRecords_<%=cid%> = ((org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>)writer_<%=cid%>).getSuccessfulWrites().iterator();
Object outgoingMain_<%=cid%> = null;
if (outgoingMainRecords_<%=cid%>.hasNext()) {
outgoingMain_<%=cid%> = outgoingMainRecords_<%=cid%>.next();
if(outgoingMainRecords_<%=cid%>.hasNext()){
outgoingMain_<%=cid%> = data_<%=cid%>;
}
}
}
<%
if (rejectIrToRow == null) {
%>
else{
if (!((org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>)writer_<%=cid%>).getRejectedWrites().iterator().hasNext()) {
outgoingMain_<%=cid%> = data_<%=cid%>;
}
}
<%
}
%>
if(outgoingMain_<%=cid%>!=null){
<%=mainIrToRow.getConnection().getName()%> = new <%=mainIrToRow.getConnection().getName() %>Struct();
<%
mainIrToRow.generateConvertRecord("outgoingMain_" + cid, mainIrToRow.getConnection().getName());
<%
if (rejectIrToRow == null) {
%>
}
else{
if (!((org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>)writer_<%=cid%>).getRejectedWrites().iterator().hasNext()) {
outgoingMain_<%=cid%> = data_<%=cid%>;
}
}
<%
}
%>
if(outgoingMain_<%=cid%>!=null){
<%=mainIrToRow.getConnection().getName()%> = new <%=mainIrToRow.getConnection().getName() %>Struct();
<%
mainIrToRow.generateConvertRecord("outgoingMain_" + cid, mainIrToRow.getConnection().getName());
%>
}
}else{
// For no feedback writer,just pass the input record to the output
if(data_<%=cid%>!=null){
<%=mainIrToRow.getConnection().getName()%> = new <%=mainIrToRow.getConnection().getName() %>Struct();
<%
mainIrToRow.generateConvertRecord("data_" + cid, mainIrToRow.getConnection().getName());
%>
}
}
<%
}
if (rejectIrToRow != null) {
%>
java.util.Iterator<?> outgoingRejectRecords_<%=cid%> = ((org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>)writer_<%=cid%>).getRejectedWrites().iterator();
if (outgoingRejectRecords_<%=cid%>.hasNext()) {
<%=rejectIrToRow.getConnection().getName()%> = new <%=rejectIrToRow.getConnection().getName() %>Struct();
Object outgoingReject_<%=cid%> = outgoingRejectRecords_<%=cid%>.next();
<%
rejectIrToRow.generateConvertRecord("outgoingReject_" + cid, rejectIrToRow.getConnection().getName());
%>
}
<%
java.util.Iterator<?> outgoingRejectRecords_<%=cid%> = ((org.talend.components.api.component.runtime.WriterWithFeedback<?, ?, ?>)writer_<%=cid%>).getRejectedWrites().iterator();
if (outgoingRejectRecords_<%=cid%>.hasNext()) {
<%=rejectIrToRow.getConnection().getName()%> = new <%=rejectIrToRow.getConnection().getName() %>Struct();
Object outgoingReject_<%=cid%> = outgoingRejectRecords_<%=cid%>.next();
<%
rejectIrToRow.generateConvertRecord("outgoingReject_" + cid, rejectIrToRow.getConnection().getName());
%>
}
<%
}
}
}

View File

@@ -203,6 +203,10 @@ class IndexedRecordToRowStructGenerator {
%>
<%=codeVarRowStruct%>.<%=columnName%> = String.valueOf(<%=codeVarSchemaEnforcer%>.get(<%=i%>)).charAt(0);
<%
} else if("id_Document".equals(column.getTalendType())){
%>
<%=codeVarRowStruct%>.<%=columnName%> = ParserUtils.parseTo_Document(String.valueOf(<%=codeVarSchemaEnforcer%>.get(<%=i%>)));
<%
} else {
%>
<%=codeVarRowStruct%>.<%=columnName%> = (<%=typeToGenerate%>) (<%=codeVarSchemaEnforcer%>.get(<%=i%>));

View File

@@ -19,24 +19,21 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.process.INode;
/**
* Use to build camel endpoint.</br>The generated endpoint is different from
* real endpoint query,It generates java source code expression.</br>for example
* to build endpoint <code>comp,NAME(expression),PATH(expression)</code> with
* Use to build camel endpoint.</br>The generated endpoint is different from real endpoint query,It generates java
* source code expression.</br>for example to build endpoint <code>comp,NAME(expression),PATH(expression)</code> with
* query <code>{P=V,P2=V2}</code></br> It will generate :</br>
* <code>"comp:"+NAME+":"+PATH+"?"+P+"="+V+"&"+p2+"="+V2</code></br> instead of
* :</br>
* <code style="text-decoration: line-through;">comp:name:path?P=V&P2=V2</code>
* </br>
* <code>"comp:"+NAME+":"+PATH+"?"+P+"="+V+"&"+p2+"="+V2</code></br> instead of :</br>
* <code style="text-decoration: line-through;">comp:name:path?P=V&P2=V2</code> </br>
* <p>
* In javadoc of methods, <b>Direct String</b> means String value, eg: hello
* (without quotes)</br> <b>Expression String</b> means the source code
* expression to generate a String value, eg: "a"+context.b+"c" (with quotes)
* In javadoc of methods, <b>Direct String</b> means String value, eg: hello (without quotes)</br> <b>Expression
* String</b> means the source code expression to generate a String value, eg: "a"+context.b+"c" (with quotes)
* </p>
*
* @author GaoZone
@@ -45,377 +42,394 @@ import org.talend.core.model.process.INode;
*/
public class CamelEndpointBuilder {
private static final String QUOTED_EMPTY = "\"\""/* "" */;
private static final String QUOTED_EMPTY = "\"\""/* "" */;
private String component;
private String name;
private List<String> paths;
private String component;
private String name;
private List<String> paths;
private boolean useDoubleSlash = true;
/** The params map. k-v both are Expression. */
private final Map<String, String> paramsMap;
/** The params map. k-v both are Expression. */
private final Map<String, String> paramsMap;
private List<String> conditionsParam = new ArrayList<String>(1);
private List<String> conditionsParam = new ArrayList<String>(1);
CamelEndpointBuilder() {
paramsMap = new LinkedHashMap<String, String>();
paths = new ArrayList<String>();
}
CamelEndpointBuilder() {
paramsMap = new LinkedHashMap<String, String>();
paths = new ArrayList<String>();
}
/**
* Provider append wrapped expression to {@link StringBuilder}
*/
private final static class SBTool {
private static void appendDirectString(StringBuilder sb, String string) {
sb.append("+\"").append(string).append('\"');
}
/**
* Provider append wrapped expression to {@link StringBuilder}
*/
private final static class SBTool {
/**
* Append expression to {@link StringBuilder}.
*
* @param sb
* the sb
* @param expression
* expression represents source to generate a String
*/
private static void appendExpression(StringBuilder sb, String expression) {
sb.append("+").append(expression);
}
private static void appendDirectString(StringBuilder sb, String string) {
sb.append("+\"").append(string).append('\"');
}
public static void mergeConstantStrings(StringBuilder sb) {
String str = "\"+\"";
int index = sb.indexOf(str);
while (index>0) {
if(index>1 && sb.charAt(index-1)=='\\') {
// handle \"+" case.
index = index + str.length();
}else {
//we can merge "...abc"+"def..." to "...abcdef..."
sb.delete(index, index + str.length());
}
index = sb.indexOf(str, index);
}
}
}
/**
* Append expression to {@link StringBuilder}.
*
* @param sb the sb
* @param expression expression represents source to generate a String
*/
private static void appendExpression(StringBuilder sb, String expression) {
sb.append("+").append(expression);
}
/**
* Some appender may need to override {@link #finish()}.
*/
private class ParamAppender {
public CamelEndpointBuilder finish() {
return CamelEndpointBuilder.this;
}
}
public static void mergeConstantStrings(StringBuilder sb) {
String str = "\"+\"";
int index = sb.indexOf(str);
while (index > 0) {
if (index > 1 && sb.charAt(index - 1) == '\\') {
// handle \"+" case.
index = index + str.length();
} else {
// we can merge "...abc"+"def..." to "...abcdef..."
sb.delete(index, index + str.length());
}
index = sb.indexOf(str, index);
}
}
/**
* Add a param that value is build from a Appendable style.</br>
* {@link #finish()} must be called at last.
* <code>.append(xx).append(xx).finish()</code>
*/
public final class BuildingValueParamAppender extends ParamAppender {
public static String escapeJavaString(String text) {
return '"' + StringEscapeUtils.escapeJava(text) + '"';
}
}
private final String key;
private final StringBuilder valueBuilder;
/**
* Some appender may need to override {@link #finish()}.
*/
private class ParamAppender {
private BuildingValueParamAppender(String key) {
this.key = key;
valueBuilder = new StringBuilder();
}
public CamelEndpointBuilder finish() {
return CamelEndpointBuilder.this;
}
}
@Override
public CamelEndpointBuilder finish() {
if(valueBuilder.length() == 0) {
return super.finish();
}
valueBuilder.deleteCharAt(0);
// remove the first appended +, because generated exp will be +"dir"+E2+E3
return addParam(key, valueBuilder.toString());
}
/**
* Add a param that value is build from a Appendable style.</br> {@link #finish()} must be called at last.
* <code>.append(xx).append(xx).finish()</code>
*/
public final class BuildingValueParamAppender extends ParamAppender {
public BuildingValueParamAppender appendDirectString(String directString) {
SBTool.appendDirectString(valueBuilder, directString);
return this;
}
private final String key;
public BuildingValueParamAppender appendExpression(String expression) {
SBTool.appendExpression(valueBuilder, expression);
return this;
}
private final StringBuilder valueBuilder;
}
private BuildingValueParamAppender(String key) {
this.key = key;
valueBuilder = new StringBuilder();
}
public final class NodeParamNotDefaultAppender extends ParamAppender {
@Override
public CamelEndpointBuilder finish() {
if (valueBuilder.length() == 0) {
return super.finish();
}
valueBuilder.deleteCharAt(0);
// remove the first appended +, because generated exp will be +"dir"+E2+E3
return addParam(key, valueBuilder.toString());
}
private boolean visibleRequired;
private INode node;
public BuildingValueParamAppender appendDirectString(String directString) {
SBTool.appendDirectString(valueBuilder, directString);
return this;
}
private NodeParamNotDefaultAppender(INode node, boolean visibleRequired) {
this.visibleRequired = visibleRequired;
this.node = node;
}
public BuildingValueParamAppender appendExpression(String expression) {
SBTool.appendExpression(valueBuilder, expression);
return this;
}
public NodeParamNotDefaultAppender visibleRequired(boolean isRequired) {
visibleRequired = isRequired;
return this;
}
/**
* Adds the param.
*
* @param key
* the param name
* @param nodeParamKey
* the node param key, <code>__XXX__</code> style.
* @param defaultValue
* the default value, will skip add if value equals default.
* @return the node param not default appender
*/
public NodeParamNotDefaultAppender addParam(String key, String nodeParamKey, String defaultValue) {
if (node == null) {
return this;
}
IElementParameter param = node.getElementParameter(nodeParamKey);
if (param == null) {
return this;
}
if (visibleRequired && !param.isShow(node.getElementParametersWithChildrens())) {
return this;
}
String value = ElementParameterParser.getStringElementParameterValue(param);
addParamInConditions(key, value, false, defaultValue);
return this;
}
public NodeParamNotDefaultAppender addParam(String key, String nodeParamKey) {
return addParam(key, nodeParamKey, null);
}
}
@SuppressWarnings("unchecked")
public NodeParamNotDefaultAppender addListMapParams(String nodeParamKey) {
Collection<Map<String, String>> tableValues = (List<Map<String, String>>)
ElementParameterParser.getObjectValue(node, nodeParamKey);
addParams(tableValues);
return this;
}
}
public final class NodeParamNotDefaultAppender extends ParamAppender {
public final class ConditionParamAppender extends ParamAppender{
private boolean visibleRequired;
private final String condition;
private final Map<String, String> paramsMapWhenTrue;
private final Map<String, String> paramsMapWhenFalse;
public ConditionParamAppender(String conditionExp) {
condition = conditionExp;
paramsMapWhenTrue = new LinkedHashMap<String, String>();
paramsMapWhenFalse = new LinkedHashMap<String, String>();
}
private INode node;
@Override
public CamelEndpointBuilder finish() {
StringBuilder sb = new StringBuilder();
sb.append("+(");
sb.append(condition);
sb.append("?");
appendMap(sb, paramsMapWhenTrue);
sb.append(":");
appendMap(sb, paramsMapWhenFalse);
sb.append(")");
conditionsParam.add(sb.toString());
return super.finish();
}
private NodeParamNotDefaultAppender(INode node, boolean visibleRequired) {
this.visibleRequired = visibleRequired;
this.node = node;
}
private final void appendMap(StringBuilder sb, Map<String, String> map) {
if(map.isEmpty()) {
sb.append(QUOTED_EMPTY);
}else {
sb.append("(").append(QUOTED_EMPTY);
boolean first = true;
for (Entry<String, String> e : map.entrySet()) {
if(first) {
first = false;
}else {
SBTool.appendDirectString(sb, "&");
}
SBTool.appendExpression(sb, e.getKey());
SBTool.appendDirectString(sb, "=");
SBTool.appendExpression(sb, e.getValue());
}
sb.append(")");
}
}
public NodeParamNotDefaultAppender visibleRequired(boolean isRequired) {
visibleRequired = isRequired;
return this;
}
public ConditionParamAppender appendParamWhenTrue(String key, String valueExp) {
return appendParam(true, key, valueExp);
}
public ConditionParamAppender appendParamWhenFalse(String key, String valueExp) {
return appendParam(false, key, valueExp);
}
private ConditionParamAppender appendParam(boolean whenTrue, String key, String valueExp) {
Map<String, String> map = whenTrue ? paramsMapWhenTrue : paramsMapWhenFalse;
map.put("\""+key+"\"", valueExp);
return this;
}
}
/**
* Adds the param.
*
* @param key the param name
* @param nodeParamKey the node param key, <code>__XXX__</code> style.
* @param defaultValue the default value, will skip add if value equals default.
* @return the node param not default appender
*/
public NodeParamNotDefaultAppender addParam(String key, String nodeParamKey, String defaultValue) {
if (node == null) {
return this;
}
IElementParameter param = node.getElementParameter(nodeParamKey);
if (param == null) {
return this;
}
if (visibleRequired && !param.isShow(node.getElementParametersWithChildrens())) {
return this;
}
String value = ElementParameterParser.getStringElementParameterValue(param);
addParamInConditions(key, value, false, defaultValue);
return this;
}
/**
* Gets the builder.
*
* @return the builder
*/
public static CamelEndpointBuilder getBuilder() {
return new CamelEndpointBuilder();
}
public NodeParamNotDefaultAppender addParam(String key, String nodeParamKey) {
return addParam(key, nodeParamKey, null);
}
public String build() {
StringBuilder sb = new StringBuilder();
@SuppressWarnings("unchecked")
public NodeParamNotDefaultAppender addListMapParams(String nodeParamKey) {
Collection<Map<String, String>> tableValues = (List<Map<String, String>>) ElementParameterParser.getObjectValue(node,
nodeParamKey);
addParams(tableValues);
return this;
}
}
public final class ConditionParamAppender extends ParamAppender {
private final String condition;
private final Map<String, String> paramsMapWhenTrue;
private final Map<String, String> paramsMapWhenFalse;
public ConditionParamAppender(String conditionExp) {
condition = conditionExp;
paramsMapWhenTrue = new LinkedHashMap<String, String>();
paramsMapWhenFalse = new LinkedHashMap<String, String>();
}
@Override
public CamelEndpointBuilder finish() {
StringBuilder sb = new StringBuilder();
sb.append("+(");
sb.append(condition);
sb.append("?");
appendMap(sb, paramsMapWhenTrue);
sb.append(":");
appendMap(sb, paramsMapWhenFalse);
sb.append(")");
conditionsParam.add(sb.toString());
return super.finish();
}
private final void appendMap(StringBuilder sb, Map<String, String> map) {
if (map.isEmpty()) {
sb.append(QUOTED_EMPTY);
} else {
sb.append("(").append(QUOTED_EMPTY);
boolean first = true;
for (Entry<String, String> e : map.entrySet()) {
if (first) {
first = false;
} else {
SBTool.appendDirectString(sb, "&");
}
SBTool.appendExpression(sb, e.getKey());
SBTool.appendDirectString(sb, "=");
SBTool.appendExpression(sb, e.getValue());
}
sb.append(")");
}
}
public ConditionParamAppender appendParamWhenTrue(String key, String valueExp) {
return appendParam(true, key, valueExp);
}
public ConditionParamAppender appendParamWhenFalse(String key, String valueExp) {
return appendParam(false, key, valueExp);
}
private ConditionParamAppender appendParam(boolean whenTrue, String key, String valueExp) {
Map<String, String> map = whenTrue ? paramsMapWhenTrue : paramsMapWhenFalse;
map.put('"' + key + '"', valueExp);
return this;
}
}
/**
* Gets the builder.
*
* @return the builder
*/
public static CamelEndpointBuilder getBuilder() {
return new CamelEndpointBuilder();
}
public String build() {
StringBuilder sb = new StringBuilder();
sb.append('\"').append(component).append(":");
if (useDoubleSlash) {
sb.append("//");
}
sb.append('\"');
// "comp:"
if(name!=null) {
SBTool.appendExpression(sb, name);
// "comp:"+name
//SBTool.appendDirectString(sb, ":");
//no trailing : after name.
}
// "component:"+name"
SBTool.mergeConstantStrings(sb);
sb.append(buildPath()).append(buildParamQuery());
// comp+":"+name+":"+path+"?p="+v+"&p2="+v2
if(!conditionsParam.isEmpty()) {
for (String string : conditionsParam) {
sb.append(string);
}
}
return sb.toString();
}
// "comp:"
if (name != null) {
SBTool.appendExpression(sb, name);
// "comp:"+name
// SBTool.appendDirectString(sb, ":");
// no trailing : after name.
}
// "component:"+name"
SBTool.mergeConstantStrings(sb);
sb.append(buildPath()).append(buildParamQuery());
// comp+":"+name+":"+path+"?p="+v+"&p2="+v2
if (!conditionsParam.isEmpty()) {
for (String string : conditionsParam) {
sb.append(string);
}
}
return sb.toString();
}
/**
* Builds the path.
*
* @return the char sequence, eg: P1+"/"+P2+"/"+P3
*/
private CharSequence buildPath() {
if (paths.isEmpty()) {
return "";
}
return "+" + StringUtils.join(paths, "+\"/\"+"/* "/" */);
}
/**
* Builds the path.
*
* @return the char sequence, eg: P1+"/"+P2+"/"+P3
*/
private CharSequence buildPath() {
if (paths.isEmpty()) {
return "";
}
return "+" + StringUtils.join(paths, "+\"/\"+"/* "/" */);
}
/**
* Builds the param query.
*
* @return the char sequence, eg: +"?p="+v+"&p2="+v2
*/
private CharSequence buildParamQuery() {
StringBuilder sb = new StringBuilder();
for (Entry<String, String> entry : paramsMap.entrySet()) {
StringBuilder paramSB= new StringBuilder();
SBTool.appendDirectString(paramSB, "&");
SBTool.appendExpression(paramSB, entry.getKey());
SBTool.appendDirectString(paramSB, "=");
SBTool.appendExpression(paramSB, entry.getValue());
SBTool.mergeConstantStrings(paramSB);
sb.append(paramSB);
}
if (sb.length() > 0) {
// fix first & to ?.
sb.setCharAt(sb.indexOf("&"), '?');
}
return sb;
}
/**
* Builds the param query.
*
* @return the char sequence, eg: +"?p="+v+"&p2="+v2
*/
private CharSequence buildParamQuery() {
StringBuilder sb = new StringBuilder();
for (Entry<String, String> entry : paramsMap.entrySet()) {
StringBuilder paramSB = new StringBuilder();
SBTool.appendDirectString(paramSB, "&");
SBTool.appendExpression(paramSB, entry.getKey());
SBTool.appendDirectString(paramSB, "=");
SBTool.appendExpression(paramSB, entry.getValue());
SBTool.mergeConstantStrings(paramSB);
sb.append(paramSB);
}
if (sb.length() > 0) {
// fix first & to ?.
sb.setCharAt(sb.indexOf("&"), '?');
}
return sb;
}
public CamelEndpointBuilder addParamInConditions(String key, String valueExp, boolean skipWhenKeyExist,
String skipWhenValueIsThis) {
key = StringUtils.trimToNull(key);
if (key == null) {
return this;
}
String keyExp = "\"" + key + "\"";// quoted key, forming to expression.
return addExpressionParamInConditions(keyExp, valueExp, skipWhenKeyExist, skipWhenValueIsThis);
}
public CamelEndpointBuilder addParamInConditions(String key, String valueExp, boolean skipWhenKeyExist,
String skipWhenValueIsThis) {
key = StringUtils.trimToNull(key);
if (key == null) {
return this;
}
String keyExp = '"' + key + '"';// quoted key, forming to expression.
return addExpressionParamInConditions(keyExp, valueExp, skipWhenKeyExist, skipWhenValueIsThis);
}
/**
* Adds the or update param.
*
* @param key
* the key , <b>Direct String</b>
* @param value
* source expression to build value. <b>Expression String</b>
* @return the camel endpoint builder
*/
public CamelEndpointBuilder addParam(String key, String value) {
return addParamInConditions(key, value, false, null);
}
/**
* Adds the or update param.
*
* @param key the key , <b>Direct String</b>
* @param value source expression to build value. <b>Expression String</b>
* @return the camel endpoint builder
*/
public CamelEndpointBuilder addParam(String key, String value) {
return addParamInConditions(key, value, false, null);
}
public CamelEndpointBuilder addExpressionParamInConditions(String keyExp, String valueExp,
boolean skipWhenKeyExist, String skipWhenValueIsThis) {
keyExp = StringUtils.trimToNull(keyExp);
if (keyExp == null || keyExp.equals(QUOTED_EMPTY)) {
return this;
}
valueExp = StringUtils.trimToNull(valueExp);
if (valueExp == null || valueExp.equals(QUOTED_EMPTY)) {
return this;
}
if (skipWhenKeyExist && paramsMap.containsKey(keyExp)) {
return this;
}
if (valueExp.equals(skipWhenValueIsThis)) {
return this;
}
paramsMap.put(keyExp, valueExp);
return this;
}
public CamelEndpointBuilder addExpressionParamInConditions(String keyExp, String valueExp, boolean skipWhenKeyExist,
String skipWhenValueIsThis) {
keyExp = StringUtils.trimToNull(keyExp);
if (keyExp == null || keyExp.equals(QUOTED_EMPTY)) {
return this;
}
valueExp = StringUtils.trimToNull(valueExp);
if (valueExp == null || valueExp.equals(QUOTED_EMPTY)) {
return this;
}
if (skipWhenKeyExist && paramsMap.containsKey(keyExp)) {
return this;
}
if (valueExp.equals(skipWhenValueIsThis)) {
return this;
}
paramsMap.put(keyExp, valueExp);
return this;
}
public CamelEndpointBuilder addParamIfNotDefault(String key, String value, String defaultValue) {
return addParamInConditions(key, value, false, defaultValue);
}
public CamelEndpointBuilder addParamIfNotDefault(String key, String value, String defaultValue) {
return addParamInConditions(key, value, false, defaultValue);
}
public CamelEndpointBuilder addParamIfNotExist(String key, String value) {
return addParamInConditions(key, value, true, null);
}
public CamelEndpointBuilder addParamIfNotExist(String key, String value) {
return addParamInConditions(key, value, true, null);
}
public CamelEndpointBuilder addParams(Collection<Map<String, String>> tableValues) {
if (tableValues == null) {
return this;
}
for (Map<String, String> map : tableValues) {
addExpressionParamInConditions(map.get("NAME"), map.get("VALUE"), false, null);
}
return this;
}
public CamelEndpointBuilder addParams(Collection<Map<String, String>> tableValues) {
if (tableValues == null) {
return this;
}
for (Map<String, String> map : tableValues) {
addExpressionParamInConditions(map.get("NAME"), map.get("VALUE"), false, null);
}
return this;
}
/**
* Sets the component.
*
* @param component
* the component name, <b>Direct String</b>.
* @return
*/
public CamelEndpointBuilder setComponent(String component) {
this.component = component;
return this;
}
/**
* Escape flat text value to java string literal
*
* @param key
* @param value
* @return
*/
public CamelEndpointBuilder addParamsWithEscapeValue(String key, String value) {
return addParam(key, SBTool.escapeJavaString(value));
}
/**
* Sets the name.
*
* @param name
* the name, <b>Expression String</b>
* @return
*/
public CamelEndpointBuilder setName(String name) {
this.name = name;
return this;
}
/**
* Sets the component.
*
* @param component the component name, <b>Direct String</b>.
* @return
*/
public CamelEndpointBuilder setComponent(String component) {
this.component = component;
return this;
}
/**
* Sets the name.
*
* @param name the name, <b>Expression String</b>
* @return
*/
public CamelEndpointBuilder setName(String name) {
this.name = name;
return this;
}
/**
*
* @param useDoubleSlash
* if set to {@code false} (default = true) result endpoint will
* start with {@code componentName:Category[?options]} <br/>
* @param useDoubleSlash if set to {@code false} (default = true) result endpoint will start with
* {@code componentName:Category[?options]} <br/>
* @return
*/
public CamelEndpointBuilder useDoubleSlash(boolean useDoubleSlash) {
@@ -423,25 +437,26 @@ public class CamelEndpointBuilder {
return this;
}
public CamelEndpointBuilder setDirectName(String directName) {
this.name = '\"' + directName + '\"';
return this;
}
public CamelEndpointBuilder setDirectName(String directName) {
this.name = '\"' + directName + '\"';
return this;
}
public CamelEndpointBuilder appendPath(String pathExpression) {
paths.add(pathExpression);
return this;
}
public CamelEndpointBuilder appendPath(String pathExpression) {
paths.add(pathExpression);
return this;
}
public NodeParamNotDefaultAppender getNodeParamNotDefaultAppender(INode node) {
return new NodeParamNotDefaultAppender(node, false);
}
public NodeParamNotDefaultAppender getNodeParamNotDefaultAppender(INode node) {
return new NodeParamNotDefaultAppender(node, false);
}
public BuildingValueParamAppender getBuildingValueParamAppender(String paramName) {
return new BuildingValueParamAppender(paramName);
}
public BuildingValueParamAppender getBuildingValueParamAppender(String paramName) {
return new BuildingValueParamAppender(paramName);
}
public ConditionParamAppender getConditionParamAppender(String conditionExp) {
return new ConditionParamAppender(conditionExp);
}
public ConditionParamAppender getConditionParamAppender(String conditionExp) {
return new ConditionParamAppender(conditionExp);
}
}

View File

@@ -406,6 +406,18 @@
NUM_ROW="30"
SHOW_IF="(DBTYPE=='MSSQL') and (USE_EXISTING_CONNECTION == 'true')"
/>
<PARAMETER
NAME="MSSQL_DRIVER"
FIELD="CLOSED_LIST"
NUM_ROW="50"
REPOSITORY_VALUE="DRIVER"
SHOW_IF="(DBTYPE=='MSSQL') and (USE_EXISTING_CONNECTION == 'false')">
<ITEMS DEFAULT="JTDS">
<ITEM NAME="JTDS" VALUE="JTDS" />
<ITEM NAME="MSSQL_PROP" VALUE="MSSQL_PROP"/>
</ITEMS>
</PARAMETER>
<!--MSSQL configuration end-->
<!--Mysql configuration start-->
@@ -712,7 +724,8 @@
<IMPORT NAME="Driver-DB2-LICENSE-CISUZ" MODULE="db2jcc_license_cisuz.jar" MVN="mvn:org.talend.libraries/db2jcc_license_cisuz/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='DB2')" />
<IMPORT NAME="Driver-DB2-LICENSE-CU" MODULE="db2jcc_license_cu.jar" MVN="mvn:org.talend.libraries/db2jcc_license_cu/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='DB2')" />
<IMPORT NAME="Driver_MaxDB" MODULE="sapdbc.jar" MVN="mvn:org.talend.libraries/sapdbc/6.0.0" REQUIRED_IF="DBTYPE=='MAXDB'" />
<IMPORT NAME="Driver-MSSQL" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='MSSQL')" />
<IMPORT NAME="Driver-MSSQL" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='MSSQL') AND (MSSQL_DRIVER=='JTDS')" />
<IMPORT NAME="Driver-MSSQL-prop" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') AND (DBTYPE=='MSSQL') AND (MSSQL_DRIVER=='MSSQL_PROP')" />
<IMPORT NAME="Driver-MYSQL4" MODULE="mysql-connector-java-3.1.14-bin.jar" MVN="mvn:org.talend.libraries/mysql-connector-java-3.1.14-bin/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') and (DBTYPE=='MYSQL') and (DB_MYSQL_VERSION=='MYSQL_4')"/>
<IMPORT NAME="Driver-MYSQL5" MODULE="mysql-connector-java-5.1.30-bin.jar" MVN="mvn:org.talend.libraries/mysql-connector-java-5.1.30-bin/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') and (DBTYPE=='MYSQL') and (DB_MYSQL_VERSION=='MYSQL_5')"/>
<IMPORT NAME="Driver-MARIADB" MODULE="mariadb-java-client-1.1.7.jar" MVN="mvn:org.talend.libraries/mariadb-java-client-1.1.7/6.0.0" REQUIRED_IF="(USE_EXISTING_CONNECTION == 'false') and (DBTYPE=='MYSQL') and (DB_MYSQL_VERSION=='MARIADB')" />

View File

@@ -818,7 +818,8 @@ class MSSQLManager extends Manager {
private boolean useExistingConnection;
private String connection;
private String dbproperty;
public MSSQLManager(String host, String port, String dbName, String dbSchema, String tableName, String userName, boolean useExistingConnection, String connection, String cid, String dbproperty) {
private String driver;
public MSSQLManager(String host, String port, String dbName, String dbSchema, String tableName, String userName, boolean useExistingConnection, String connection, String cid, String dbproperty, String driver) {
super(dbName, tableName, userName, cid);
this.host = host;
this.port = port;
@@ -826,16 +827,34 @@ class MSSQLManager extends Manager {
this.useExistingConnection = useExistingConnection;
this.connection = connection;
this.dbproperty = dbproperty;
this.driver = driver;
}
protected String getDriver() {
return "net.sourceforge.jtds.jdbc.Driver";
if("JTDS".equals(driver)) {
return "net.sourceforge.jtds.jdbc.Driver";
} else {
return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}
}
public String getConnectionURL() {
if(dbproperty == null || dbproperty.equals("\"\"") || dbproperty.equals("")){
return "\"jdbc:jtds:sqlserver://\" + " + host + " + \":\" + " + port + " + \"//\" + " + dbName;
}
return "\"jdbc:jtds:sqlserver://\" + " + host + " + \":\" + " + port + " + \"//\" + " + dbName + "+\";\"+"+ dbproperty;
StringBuilder connectionUrl = new StringBuilder();
if("JTDS".equals(driver)) {
connectionUrl.append("\"jdbc:jtds:sqlserver://\" + ");
} else {
connectionUrl.append("\"jdbc:sqlserver://\" + ");
}
connectionUrl.append(host).append(" + \":\" + ").append(port);
if("JTDS".equals(driver)) {
connectionUrl.append(" + \"//\" + ");
} else {
connectionUrl.append(" + \";databaseName=\" + ");
}
connectionUrl.append(dbName);
if(dbproperty != null && !dbproperty.equals("\"\"") && !dbproperty.equals("")) {
connectionUrl.append("+\";\"+").append(dbproperty);
}
return connectionUrl.toString();
}
public String getConnection() {
StringBuilder javaCode = new StringBuilder();
@@ -1844,7 +1863,8 @@ class ManagerFactory {
boolean useExistingConnection = ("true").equals(ElementParameterParser.getValue(node, "__USE_EXISTING_CONNECTION__"));
String connection = stringUtil.getString(ElementParameterParser.getValue(node, "__CONNECTION_MSSQL__"));
String dbproperties = ElementParameterParser.getValue(node, "__PROPERTIES__");
manager = new MSSQLManager(host, port, dbName,dbSchema, tableName, userName, useExistingConnection, connection, cid, dbproperties);
String driver = ElementParameterParser.getValue(node, "__MSSQL_DRIVER__");
manager = new MSSQLManager(host, port, dbName,dbSchema, tableName, userName, useExistingConnection, connection, cid, dbproperties, driver);
} else if(("MYSQL").equals(dbType)) {
String host = ElementParameterParser.getValue(node, "__HOST__");
String port = ElementParameterParser.getValue(node, "__PORT__");

View File

@@ -134,4 +134,8 @@ CONNECTION_NETEZZA.NAME=
CONNECTION_ACCESS.NAME=
CONNECTION_GREENPLUM.NAME=
CONNECTION_VERTICA.NAME=
CASESENSITIVE.NAME=Case Sensitive
CASESENSITIVE.NAME=Case Sensitive
MSSQL_DRIVER.NAME=JDBC Provider
MSSQL_DRIVER.ITEM.JTDS=Open source JTDS
MSSQL_DRIVER.ITEM.MSSQL_PROP=Microsoft

View File

@@ -61,6 +61,18 @@
NUM_ROW="2"
SHOW_IF="(#LINK@CONNECTOR.OUT.TABLE_REF == '0') AND (USE_EXISTING_CONNECTION == 'true')"
DYNAMIC_SETTINGS="true"/>
<PARAMETER
NAME="DRIVER"
FIELD="CLOSED_LIST"
NUM_ROW="3"
REPOSITORY_VALUE="DRIVER"
SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
<ITEMS DEFAULT="JTDS">
<ITEM NAME="JTDS" VALUE="JTDS" />
<ITEM NAME="MSSQL_PROP" VALUE="MSSQL_PROP"/>
</ITEMS>
</PARAMETER>
<PARAMETER NAME="MAP" FIELD="EXTERNAL" NUM_ROW="10">
<DEFAULT/>
@@ -176,6 +188,10 @@
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED_IF="(DRIVER == 'JTDS') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="Driver-mssql-jdbc" MODULE="mssql-jdbc.jar" MVN="mvn:org.talend.libraries/mssql-jdbc/6.0.0" REQUIRED_IF="(DRIVER == 'MSSQL_PROP') AND (USE_EXISTING_CONNECTION == 'false')" />
</IMPORTS>
</CODEGENERATION>
<RETURNS>

View File

@@ -38,3 +38,7 @@ LINK_STYLE.ITEM.AUTO=Auto
LINK_STYLE.ITEM.BEZIER_CURVE=Bezier curve
LINK_STYLE.ITEM.LINE=Line (fastest)
CONNECTION.NAME=Component List
DRIVER.NAME=JDBC Provider
DRIVER.ITEM.JTDS=Open source JTDS
DRIVER.ITEM.MSSQL_PROP=Microsoft

View File

@@ -109,9 +109,6 @@
</ADVANCED_PARAMETERS>
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-jTDS" MODULE="jtds-1.3.1-patch.jar" MVN="mvn:org.talend.libraries/jtds-1.3.1-patch/6.1.1" UrlPath="platform:/plugin/org.talend.libraries.jdbc.jtds/lib/jtds-1.3.1-patch.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>
<RETURNS>

View File

@@ -65,6 +65,7 @@ imports="
String dbuser = null;
boolean useExistingConn = false;
String dbproperties = null;
String driver = "JTDS";
if(previousNode != null) {
dbhost = ElementParameterParser.getValue(previousNode, "__HOST__");
dbport = ElementParameterParser.getValue(previousNode, "__PORT__");
@@ -72,6 +73,7 @@ imports="
dbuser = ElementParameterParser.getValue(previousNode, "__USER__");
useExistingConn = ("true").equals(ElementParameterParser.getValue(previousNode, "__USE_EXISTING_CONNECTION__"));
dbproperties = ElementParameterParser.getValue(previousNode, "__PROPERTIES__");
driver = ElementParameterParser.getValue(previousNode, "__DRIVER__");
}
String whereClause = ElementParameterParser.getValue(node, "__WHERE_CLAUSE__");
@@ -88,17 +90,33 @@ if(useExistingConn) {
<%
log4jCodeGenerateUtil.useExistConnection(node);
} else {
if("JTDS".equals(driver)) {
%>
String driverClass_<%=cid%> = "net.sourceforge.jtds.jdbc.Driver";
<%} else {%>
String driverClass_<%=cid%> = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
<%}%>
java.lang.Class.forName(driverClass_<%=cid%>);
String port_<%=cid%> = <%=dbport%>;
String dbname_<%=cid%> = <%=dbname%> ;
String url_<%=cid %> = "jdbc:jtds:sqlserver://" + <%=dbhost%> ;
<%
if("JTDS".equals(driver)) {
%>
String url_<%=cid %> = "jdbc:jtds:sqlserver://" + <%=dbhost%> ;
<%} else {%>
String url_<%=cid %> = "jdbc:sqlserver://" + <%=dbhost%> ;
<%}%>
if (!"".equals(port_<%=cid%>)) {
url_<%=cid %> += ":" + <%=dbport%>;
}
if (!"".equals(dbname_<%=cid%>)) {
<%
if("JTDS".equals(driver)) {
%>
url_<%=cid%> += "//" + <%=dbname%>;
<%} else {%>
url_<%=cid%> += ";databaseName=" + <%=dbname%>;
<%}%>
}
url_<%=cid%> += ";appName=" + projectName + ";" + <%=dbproperties%>;
String dbUser_<%=cid %> = <%=dbuser%>;

View File

@@ -69,9 +69,9 @@ if(advProps.size() > 0){
javax.jms.Connection connection_<%=cid%> = factory_<%=cid%>.createConnection(<%if("true".equals(userIdentity)){%><%=user %>, decryptedPassword_<%=cid%><%}%>);
<%
if(enableSubscription){
if(enableSubscription && clientID != null && clientID.length() > 0){
%>
((javax.jms.TopicConnection)connection_<%=cid%>).setClientID(<%=clientID%>);
connection_<%=cid%>.setClientID(<%=clientID%>);
<%
}
%>
@@ -82,7 +82,7 @@ if(advProps.size() > 0){
<%
if(enableSubscription){
%>
javax.jms.MessageConsumer consumer_<%=cid%> = ((javax.jms.TopicSession) session_<%=cid%>).createDurableSubscriber((javax.jms.Topic)dest_<%=cid%>,<%=subscriberName%>,<%=messageSelector%>,false);
javax.jms.MessageConsumer consumer_<%=cid%> = session_<%=cid%>.createDurableSubscriber((javax.jms.Topic)dest_<%=cid%>,<%=subscriberName%>,<%=messageSelector%>,false);
<%
} else {
%>

View File

@@ -55,7 +55,7 @@
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="CLIENT_ID" FIELD="TEXT" NUM_ROW="27" REQUIRED="true"
<PARAMETER NAME="CLIENT_ID" FIELD="TEXT" NUM_ROW="27" REQUIRED="false"
SHOW_IF="(MSGTYPE == 'TOPIC') AND (ENABLE_SUB == 'true')">
<DEFAULT>""</DEFAULT>
</PARAMETER>

View File

@@ -50,7 +50,7 @@ for(JavaType sourceType : commonTypes) {
}
}
autoConverterMap.put(contact(JavaTypesManager.DYNAMIC.getId(), ":", JavaTypesManager.STRING.getId()), "String.valueOf(${0})");
autoConverterMap.put(contact("id_Dynamic", ":", JavaTypesManager.STRING.getId()), "String.valueOf(${0})");
autoConverterMap.put(contact("id_Document", ":", JavaTypesManager.STRING.getId()), "String.valueOf(${0})");
autoConverterMap.put(contact(JavaTypesManager.STRING.getId(), ":", "id_Document"), "routines.system.ParserUtils.parseTo_Document(${0})");
%>

View File

@@ -32,4 +32,6 @@ Import-Package: org.talend.components.api.component,
org.talend.components.api.properties,
org.talend.components.api.service,
org.talend.components.api.wizard,
org.talend.daikon.runtime,
org.talend.daikon.properties.property

View File

@@ -36,7 +36,6 @@ import org.talend.components.api.component.Connector;
import org.talend.components.api.component.ConnectorTopology;
import org.talend.components.api.component.PropertyPathConnector;
import org.talend.components.api.component.VirtualComponentDefinition;
import org.talend.components.api.component.runtime.RuntimeInfo;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.components.api.properties.ComponentPropertiesImpl;
import org.talend.components.api.properties.ComponentReferenceProperties;
@@ -76,6 +75,7 @@ import org.talend.daikon.properties.Properties;
import org.talend.daikon.properties.presentation.Form;
import org.talend.daikon.properties.property.Property;
import org.talend.daikon.properties.property.SchemaProperty;
import org.talend.daikon.runtime.RuntimeInfo;
import org.talend.daikon.serialize.PostDeserializeSetup;
import org.talend.designer.core.DesignerPlugin;
import org.talend.designer.core.generic.constants.IGenericConstants;
@@ -822,7 +822,7 @@ public class Component extends AbstractBasicComponent {
if (!(schemaProperty.getValue() instanceof Schema)) {
continue;
}
Schema schema = (Schema) schemaProperty.getValue();
Schema schema = schemaProperty.getValue();
if (connector instanceof PropertyPathConnector) {
String linkedSchema = ((PropertyPathConnector) connector).getPropertyPath() + ".schema"; //$NON-NLS-1$
if (paramName.equals(linkedSchema)) {
@@ -830,6 +830,7 @@ public class Component extends AbstractBasicComponent {
ElementParameter param = new ElementParameter(node);
param.setName(paramName);
param.setFieldType(EParameterFieldType.SCHEMA_REFERENCE);
param.setShow(false);
if (!isOutput) {
param.setContext(EConnectionType.FLOW_MAIN.getName());
} else {
@@ -1290,7 +1291,7 @@ public class Component extends AbstractBasicComponent {
if (GenericTypeUtils.isIntegerType(property) && ContextParameterUtils.isContainContextParam(value)) {
value = "Integer.valueOf(" + value + ")";
}
if("\"\"\"".equals(value)){
if ("\"\"\"".equals(value)) {
value = "\"\\\"\"";
}
return value;

View File

@@ -303,10 +303,10 @@ public class GenericElementParameter extends ElementParameter {
Schema schema = null;
schema = getRootProperties().getSchema(componentConnector, ((GenericNodeConnector) connector).isOutput());
IMetadataTable mainTable = node.getMetadataFromConnector(connector.getName());
if (schema != null) {
if (schema != null && mainTable != null) {
MetadataTable metadataTable = MetadataToolAvroHelper.convertFromAvro(schema);
IMetadataTable newTable = MetadataToolHelper.convert(metadataTable);
if ((!mainTable.sameMetadataAs(newTable) || !newTable.sameMetadataAs(mainTable))) {
if (!mainTable.sameMetadataAs(newTable) || !newTable.sameMetadataAs(mainTable)) {
mainTable.setListColumns(newTable.getListColumns());
if (this.askPropagate == null && node.getOutgoingConnections().size() != 0) {
Display.getDefault().syncExec(new Runnable() {

View File

@@ -48,15 +48,17 @@ public class NewFileDelimitedMigrationTask extends NewComponentFrameworkMigratio
ElementParameterType paramType = ParameterUtilTool.findParameterType(node, paramName);
if (node != null && paramType != null) {
Object value = ParameterUtilTool.convertParameterValue(paramType);
if ("ROWSEPARATOR".equals(paramName)) {
ElementParameterType csvOption = ParameterUtilTool.findParameterType(node, "CSV_OPTION");
if (csvOption != null && Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(csvOption)))) {
if ("CSV_OPTION".equals(paramName)) {
if("true".equals(String.valueOf(value))){
ElementParameterType csvRowSeparator = ParameterUtilTool.findParameterType(node, "CSVROWSEPARATOR");
paramType.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(csvRowSeparator)));
ElementParameterType rowSeparator = ParameterUtilTool.findParameterType(node, "ROWSEPARATOR");
if(csvRowSeparator != null && rowSeparator != null){
rowSeparator.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(csvRowSeparator)));
}
}
} else if ("FILENAME".equals(paramName) && "tFileOutputDelimited".equals(node.getComponentName())) {
ElementParameterType useStream = ParameterUtilTool.findParameterType(node, "USESTREAM");
if (Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(useStream)))) {
if (useStream != null && Boolean.valueOf(String.valueOf(ParameterUtilTool.convertParameterValue(useStream)))) {
ElementParameterType streamName = ParameterUtilTool.findParameterType(node, "STREAMNAME");
paramType.setValue(String.valueOf(ParameterUtilTool.convertParameterValue(streamName)));
}

View File

@@ -24,14 +24,17 @@ tFileInputDelimited.thousandsSeparator=THOUSANDS_SEPARATOR
tFileInputDelimited.decimalSeparator=DECIMAL_SEPARATOR
tFileInputDelimited.random=RANDOM
tFileInputDelimited.nbRandom=NB_RANDOM
tFileInputDelimited.trimColumns.trimall=TRIMALL
tFileInputDelimited.trimColumns.trimTable.mapping=SCHEMA_COLUMN=columnName;TRIM=trim;
tFileInputDelimited.trimColumns.trimAll=TRIMALL
tFileInputDelimited.trimColumns.trimTable=TRIMSELECT
tFileInputDelimited.trimColumns.trimTable.mapping=SCHEMA_COLUMN=columnName;TRIM=trim
tFileInputDelimited.checkFieldsNum=CHECK_FIELDS_NUM
tFileInputDelimited.checkDate=CHECK_DATE
tFileInputDelimited.encodingType=ENCODING
tFileInputDelimited.encoding.encodingType=ENCODING:ENCODING_TYPE
tFileInputDelimited.encoding.customEncoding=ENCODING
tFileInputDelimited.splitRecord=SPLITRECORD
tFileInputDelimited.enableDecode=ENABLE_DECODE
tFileInputDelimited.decodeTable.mapping=SCHEMA_COLUMN=columnName;DECODE=decode;
tFileInputDelimited.decodeTable=DECODE_COLS
tFileInputDelimited.decodeTable.mapping=SCHEMA_COLUMN=columnName;DECODE=decode
### tFileInputDelimited end ###
### tFileOutputDelimited start ###
@@ -72,7 +75,8 @@ tFileOutputDelimited.splitEvery=SPLIT_EVERY
tFileOutputDelimited.flushOnRow=FLUSHONROW
tFileOutputDelimited.flushOnRowNum=FLUSHONROW_NUM
tFileOutputDelimited.rowMode=ROW_MODE
tFileOutputDelimited.encodingType=ENCODING
tFileOutputDelimited.encoding.encodingType=ENCODING:ENCODING_TYPE
tFileOutputDelimited.encoding.customEncoding=ENCODING
tFileOutputDelimited.deleteEmptyFile=DELETE_EMPTYFILE
### tFileOutputDelimited end ###
##### component parameters for migration #####

View File

@@ -109,6 +109,9 @@ public class ComponentsUtils {
}
public static void loadComponents(ComponentService service) {
if(service == null){
return;
}
IComponentsFactory componentsFactory = null;
if (componentsFactory == null) {
componentsFactory = ComponentsFactoryProvider.getInstance();
@@ -278,8 +281,10 @@ public class ComponentsUtils {
param.setRequired(property.isRequired());
param.setValue(getParameterValue(element, property, fieldType, isInitializing));
boolean isNameProperty = IGenericConstants.NAME_PROPERTY.equals(param.getParameterName());
if (EParameterFieldType.NAME_SELECTION_AREA.equals(fieldType) || isNameProperty) {
// Disable context support for this filed type.
if (EParameterFieldType.NAME_SELECTION_AREA.equals(fieldType) || EParameterFieldType.JSON_TABLE.equals(fieldType)
|| EParameterFieldType.CLOSED_LIST.equals(fieldType) || EParameterFieldType.CHECK.equals(fieldType)
|| isNameProperty) {
// Disable context support for those filed types and name parameter.
param.setSupportContext(false);
} else {
param.setSupportContext(isSupportContext(property));
@@ -356,7 +361,7 @@ public class ComponentsUtils {
Boolean.valueOf(String.valueOf(widget.getConfigurationValue(Widget.HIDE_TOOLBAR_WIDGET_CONF))));
}
if (!param.isReadOnly()) {
param.setReadOnly(element.isReadOnly());
param.setReadOnly(widget.isReadonly() || element.isReadOnly());
}
param.setSerialized(true);
param.setDynamicSettings(true);

View File

@@ -391,6 +391,7 @@ GEFPasteAction.textWarning=Warning\!
GEFPasteAction.warningMessages=Can't paste the Joblet specific components(Input/Output).
GuessSchemaController.0=Connect to DB error ,or some errors in SQL query string, or 'Guess Schema' not compatible with current SQL query string.{0}
GuessSchemaController.connectionError=Connection error
GuessSchemaController.schemaOf=Schema of
GuessSchemaController.connectionFailed=Database connection is failed.
GuessSchemaController.connError=Connection error
GuessSchemaController.setParameter=Please set connection parameters
@@ -484,6 +485,7 @@ Node.noRowMainLink=This component should have at least a Row Main link.
Node.noSchemaDefined=No schema has been defined yet.
Node.notEnoughTypeInput=This component has not enough "{0}" type inputs.
Node.notEnoughTypeOutput=This component has not enough "{0}" type outputs.
Node.notFormedLoop=The connected components in a Job must not form a closed loop. Please check.
Node.onlyOneDynamicPerSchema=There should be only one Dynamic type in one schema
Node.output=outputs\:(
Node.outputNeedInputLink=If this component has output, there must be an input link to propagate the data.

View File

@@ -34,6 +34,7 @@ import org.talend.core.PluginChecker;
import org.talend.core.model.components.ComponentCategory;
import org.talend.core.model.components.EComponentType;
import org.talend.core.model.components.IComponent;
import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.components.IMultipleComponentConnection;
import org.talend.core.model.components.IMultipleComponentItem;
import org.talend.core.model.components.IMultipleComponentManager;
@@ -87,7 +88,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.AbstractExternalData;
import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType;
import org.talend.designer.core.ui.AbstractMultiPageTalendEditor;
import org.talend.designer.core.ui.editor.connections.Connection;
import org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer;
import org.talend.designer.core.ui.editor.nodecontainer.NodeContainer;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.Process;
@@ -814,8 +814,12 @@ public class DataProcess implements IGeneratingProcess {
for (IMultipleComponentItem curItem : itemList) {
String uniqueName = graphicalNode.getUniqueName() + "_" + curItem.getName(); //$NON-NLS-1$
IComponent component = ComponentsFactoryProvider.getInstance().get(curItem.getComponent(),
ComponentCategory.CATEGORY_4_DI.getName());
IComponentsFactory componentsFactory = ComponentsFactoryProvider.getInstance();
String currentComponent = curItem.getComponent();
IComponent component = componentsFactory.get(currentComponent, process.getComponentsType());
if (component == null) { // If cannot find the component then find it by default DI category by default.
component = componentsFactory.get(currentComponent, ComponentCategory.CATEGORY_4_DI.getName());
}
if (component == null) {
continue;
}
@@ -2330,10 +2334,10 @@ public class DataProcess implements IGeneratingProcess {
DataConnection dataConnection = null;
if (isOutput) {
validRuleConnections = (List<IConnection>) nodeUseValidationRule.getIncomingConnections();
mainConnections = nodeUseValidationRule.getIncomingConnections(EConnectionType.FLOW_MAIN);//$NON-NLS-1$
mainConnections = nodeUseValidationRule.getIncomingConnections(EConnectionType.FLOW_MAIN);
} else {
validRuleConnections = (List<IConnection>) nodeUseValidationRule.getOutgoingConnections();
mainConnections = nodeUseValidationRule.getOutgoingConnections(EConnectionType.FLOW_MAIN);//$NON-NLS-1$
mainConnections = nodeUseValidationRule.getOutgoingConnections(EConnectionType.FLOW_MAIN);
}
if (validRuleConnections == null || validRuleConnections.size() == 0) {

View File

@@ -480,7 +480,7 @@ public class JobSettingsManager {
param.setRepositoryValue("DB_VERSION"); //$NON-NLS-1$
param.setRequired(true);
param.setShowIf(dbCondition
+ " and (" + dbTypeName + " == 'OCLE' or " + dbTypeName + " == 'OCLE_OCI' or " + dbTypeName + " =='ACCESS' or " + dbTypeName + " =='MYSQL') "); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$
+ " and (" + dbTypeName + " == 'OCLE' or " + dbTypeName + " == 'OCLE_OCI' or " + dbTypeName + " =='ACCESS' or " +dbTypeName + " =='MSSQL' or " + dbTypeName + " =='MYSQL') "); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);
}

View File

@@ -1001,7 +1001,7 @@ public class StatsAndLogsManager {
param.setNumRow(52);
param.setRepositoryValue("DB_VERSION"); //$NON-NLS-1$
param.setRequired(true);
param.setShowIf("(ON_DATABASE_FLAG == 'true') and (DB_TYPE == 'POSTGRESQL' or DB_TYPE == 'OCLE' or DB_TYPE == 'ACCESS' or DB_TYPE == 'OCLE_OCI' or DB_TYPE == 'MYSQL') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')"); //$NON-NLS-1$
param.setShowIf("(ON_DATABASE_FLAG == 'true') and (DB_TYPE == 'POSTGRESQL' or DB_TYPE == 'OCLE' or DB_TYPE == 'ACCESS' or DB_TYPE == 'OCLE_OCI' or DB_TYPE == 'MSSQL' or DB_TYPE == 'MYSQL') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')"); //$NON-NLS-1$
paramList.add(param);
}

View File

@@ -695,9 +695,9 @@ public abstract class AbstractMultiPageTalendEditor extends MultiPageEditorPart
}
oldPageIndex = getActivePage();
}
protected void turnToJobScriptPage(int newPageIndex){
if(jobletEditor != getEditor(newPageIndex)){
protected void turnToJobScriptPage(int newPageIndex) {
if (jobletEditor != getEditor(newPageIndex)) {
return;
}
@@ -762,11 +762,11 @@ public abstract class AbstractMultiPageTalendEditor extends MultiPageEditorPart
ExceptionHandler.process(e);
}
changeContextsViewStatus(false);
}
protected void turnToCodePage(int newPageIndex){
// TDI-25866:In case select a component and switch to the code page,need clean its componentSetting view
protected void turnToCodePage(int newPageIndex) {
// TDI-25866:In case select a component and switch to the code page,need clean its componentSetting view
IComponentSettingsView viewer = (IComponentSettingsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().findView(IComponentSettingsView.ID);
@@ -777,8 +777,7 @@ public abstract class AbstractMultiPageTalendEditor extends MultiPageEditorPart
moveCursorToSelectedComponent();
/*
* Belowing method had been called at line 331 within the generateCode method, as soon as code
* generated.
* Belowing method had been called at line 331 within the generateCode method, as soon as code generated.
*/
// ((ISyntaxCheckableEditor) codeEditor).validateSyntax();
}
@@ -1515,11 +1514,12 @@ public abstract class AbstractMultiPageTalendEditor extends MultiPageEditorPart
return (Boolean) param.getValue() && param.isRequired(node.getElementParameters());
}
if (node.getUniqueName().startsWith("tMap")) { //$NON-NLS-1$
final String componentName = node.getComponent().getName();
if (componentName.equals("tMap")) { //$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getMapperService().isVirtualComponent(node);
} else if (node.getUniqueName().startsWith("tXMLMap")) { //$NON-NLS-1$
} else if (componentName.equals("tXMLMap")) { //$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getXMLMapperService().isVirtualComponent(node);
} else if (node.getUniqueName().startsWith("tAvroMap")) { //$NON-NLS-1$
} else if (componentName.equals("tAvroMap")) { //$NON-NLS-1$
isVirtualNode = CorePlugin.getDefault().getSparkMapperService().isVirtualComponent(node);
} else {
List<IMultipleComponentManager> multipleComponentManagers = node.getComponent().getMultipleComponentManagers();

View File

@@ -743,7 +743,8 @@ public class ChangeMetadataCommand extends Command {
parameter.setRepositoryValueUsed(true);
}
}
} else if (componentName != null && componentName.startsWith("tHBase") //$NON-NLS-1$
} else if (componentName != null
&& (componentName.startsWith("tHBase") || componentName.startsWith("tMapRDB"))//$NON-NLS-1$//$NON-NLS-2$
&& ("MAPPING".equals(parameter.getName()) || "FAMILIES".equals(parameter.getName()))) {//$NON-NLS-1$//$NON-NLS-2$
Object value = RepositoryToComponentProperty.getColumnMappingValue(connection, newOutputMetadata);
if (value != null) {

View File

@@ -28,7 +28,7 @@ import org.talend.core.model.process.INodeConnector;
import org.talend.core.model.process.IProcess2;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.ui.editor.connections.Connection;
import org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer;
import org.talend.designer.core.ui.editor.jobletcontainer.AbstractJobletContainer;
import org.talend.designer.core.ui.editor.nodecontainer.NodeContainer;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.Process;
@@ -83,7 +83,7 @@ public class DeleteNodeContainerCommand extends Command {
INode prevNode = connection.getSource();
if ((prevNode instanceof Node) && ((Node) prevNode).getJobletNode() != null) {
Node jobletnode = (Node) prevNode.getJobletNode();
((JobletContainer) jobletnode.getNodeContainer()).getOutputs().remove(connection);
((AbstractJobletContainer) jobletnode.getNodeContainer()).getOutputs().remove(connection);
if (!nodeList.contains(jobletnode)) {
boolean builtInJobletNode = jobletnode.getConnectorFromType(EConnectionType.FLOW_MAIN).isMultiSchema()
| node.getConnectorFromType(EConnectionType.TABLE).isMultiSchema();
@@ -108,7 +108,7 @@ public class DeleteNodeContainerCommand extends Command {
INode nextNode = connection.getTarget();
if ((nextNode instanceof Node) && ((Node) nextNode).getJobletNode() != null) {
Node jobletnode = (Node) nextNode.getJobletNode();
((JobletContainer) jobletnode.getNodeContainer()).getInputs().remove(connection);
((AbstractJobletContainer) jobletnode.getNodeContainer()).getInputs().remove(connection);
if (!nodeList.contains(jobletnode)) {
jobletnode.removeInput(connection);
boolean builtInJobletNode = jobletnode.getConnectorFromType(EConnectionType.FLOW_MAIN).isMultiSchema()
@@ -186,7 +186,7 @@ public class DeleteNodeContainerCommand extends Command {
INode prevNode = connection.getSource();
if ((prevNode instanceof Node) && ((Node) prevNode).getJobletNode() != null) {
Node jobletnode = (Node) prevNode.getJobletNode();
((JobletContainer) jobletnode.getNodeContainer()).getOutputs().add(connection);
((AbstractJobletContainer) jobletnode.getNodeContainer()).getOutputs().add(connection);
restoreMetadata(connection, jobletnode);
}
if (!nodeList.contains(prevNode)) {
@@ -216,7 +216,7 @@ public class DeleteNodeContainerCommand extends Command {
INode nextNode = connection.getTarget();
if ((nextNode instanceof Node) && ((Node) nextNode).getJobletNode() != null) {
Node jobletnode = (Node) nextNode.getJobletNode();
((JobletContainer) jobletnode.getNodeContainer()).getInputs().add(connection);
((AbstractJobletContainer) jobletnode.getNodeContainer()).getInputs().add(connection);
}
if (!nodeList.contains(nextNode)) {
if (!nextNode.getIncomingConnections().contains(connection)) {

View File

@@ -137,7 +137,9 @@ import org.talend.designer.core.utils.UpgradeElementHelper;
import org.talend.designer.joblet.model.JobletNode;
import org.talend.designer.joblet.model.JobletProcess;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.RepositoryPlugin;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.utils.AutoConvertTypesUtils;
/**
* Object that describes the node. All informations on nodes are stored in this class. <br/>
@@ -413,6 +415,7 @@ public class Node extends Element implements IGraphicalNode {
currentStatus = 0;
init(component);
initDefaultElementParameters();
IElementParameter param = getElementParameter(EParameterName.REPOSITORY_ALLOW_AUTO_SWITCH.getName());
if (param != null) {
param.setValue(Boolean.TRUE);
@@ -685,6 +688,15 @@ public class Node extends Element implements IGraphicalNode {
}
}
public void initDefaultElementParameters() {
boolean enable = RepositoryPlugin.getDefault().getPreferenceStore()
.getBoolean(AutoConvertTypesUtils.ENABLE_AUTO_CONVERSION);
IElementParameter convertElemParam = getElementParameter(AutoConvertTypesUtils.ENABLE_AUTO_CONVERT_TYPE);
if (enable && convertElemParam != null) {
convertElemParam.setValue(enable);
}
}
/**
*
* Note that if there is several connectors of the same type, it will return the first one.
@@ -3376,6 +3388,11 @@ public class Node extends Element implements IGraphicalNode {
}
}
}
// check if we have circle for current node
if (checkNodeCircle(this)) {
String errorMessage = Messages.getString("Node.notFormedLoop"); //$NON-NLS-1$
Problems.add(ProblemStatus.ERROR, this, errorMessage);
}
}
int tableOutLinkNum = 0;
int tableRefOutLinkNum = 0;
@@ -3542,6 +3559,24 @@ public class Node extends Element implements IGraphicalNode {
}
}
private static boolean checkNodeCircle(INode currentNode) {
List<INode> nodeList = new ArrayList<INode>();
Set<INode> nodeSet = new HashSet<INode>();
getAllSourceNode(currentNode, nodeList);
for (INode node : nodeList) {
nodeSet.add(node);
}
return !(nodeSet.size() == nodeList.size());
}
private static void getAllSourceNode(INode source, List<INode> list) {
List<? extends IConnection> connections = source.getIncomingConnections();
for (IConnection connection : connections) {
INode node = connection.getSource();
list.add(node);
getAllSourceNode(node, list);
}
}
public boolean isSchemaSynchronized() {
return schemaSynchronized;
}
@@ -4896,7 +4931,7 @@ public class Node extends Element implements IGraphicalNode {
// TODO Auto-generated method stub
this.needlibrary = isNeedLib;
}
public boolean isStandardJoblet() {
boolean isJoblet = false;
if (PluginChecker.isJobLetPluginLoaded()) {
@@ -4920,22 +4955,22 @@ public class Node extends Element implements IGraphicalNode {
}
return isJoblet;
}
public boolean isSparkJoblet() {
boolean isSparkJoblet = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
ISparkJobletProviderService sparkJobletService = (ISparkJobletProviderService) GlobalServiceRegister
.getDefault().getService(ISparkJobletProviderService.class);
ISparkJobletProviderService sparkJobletService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault()
.getService(ISparkJobletProviderService.class);
if (sparkJobletService != null) {
isSparkJoblet = sparkJobletService.isSparkJobletComponent(this);
}
}
return isSparkJoblet;
}
public boolean isSparkStreamingJoblet() {
boolean isSparkStreamingJoblet = false;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
ISparkStreamingJobletProviderService sparkJobletService = (ISparkStreamingJobletProviderService) GlobalServiceRegister
.getDefault().getService(ISparkStreamingJobletProviderService.class);
if (sparkJobletService != null) {
@@ -4959,11 +4994,12 @@ public class Node extends Element implements IGraphicalNode {
}
public boolean isMapReduce() {
String sourceJobFramework = (String) ((Process)this.getProcess()).getProperty().getAdditionalProperties().get(ConvertJobsUtil.FRAMEWORK);
if(sourceJobFramework == null){
String sourceJobFramework = (String) ((Process) this.getProcess()).getProperty().getAdditionalProperties()
.get(ConvertJobsUtil.FRAMEWORK);
if (sourceJobFramework == null) {
return false;
}
if(sourceJobFramework.equals(ConvertJobsUtil.MAPREDUCE_FRAMEWORK)){
if (sourceJobFramework.equals(ConvertJobsUtil.MAPREDUCE_FRAMEWORK)) {
return true;
}
return false;

View File

@@ -625,6 +625,9 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
&& !ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName().equals(process.getComponentsType())) {
return;
}
if((process instanceof IProcess2) &&(((IProcess2)process).getProperty().getItem() instanceof JobletProcessItem)){
return;
}
Item subItem = repositoryNode.getObject().getProperty().getItem();
Item hadoopClusterItem = hadoopClusterService.getHadoopClusterBySubitemId(subItem.getProperty().getId());

View File

@@ -105,6 +105,11 @@ public class CheckController extends AbstractElementPropertySectionController {
nodeList.add((Node) elem);
List<Connection> connList = new ArrayList<Connection>();
cmd = new ChangeActivateStatusElementCommand(value, nodeList, connList);
} else if (elem instanceof Connection) {
List<Node> nodeList = new ArrayList<Node>();
List<Connection> connList = new ArrayList<Connection>();
connList.add((Connection) elem);
cmd = new ChangeActivateStatusElementCommand(value, nodeList, connList);
}
} else {
cmd = new PropertyChangeCommand(elem, paramName, value);

View File

@@ -247,7 +247,7 @@ public class GuessSchemaController extends AbstractElementPropertySectionControl
MetadataDialog metaDialog = new MetadataDialog(composite.getShell(), tempMetatable, node, getCommandStack());
if (metaDialog != null) {
metaDialog.setText(Messages.getString("SchemaController.schemaOf") + node.getLabel());
metaDialog.setText(Messages.getString("GuessSchemaController.schemaOf") + node.getLabel());
if (metaDialog.open() == MetadataDialog.OK) {
outputMetaCopy = metaDialog.getOutputMetaData();
@@ -476,7 +476,7 @@ public class GuessSchemaController extends AbstractElementPropertySectionControl
tempMetatable.setDbms(dbmsId);
MetadataDialog metaDialog = new MetadataDialog(composite.getShell(), tempMetatable, inputNode, getCommandStack());
if (metaDialog != null) {
metaDialog.setText(Messages.getString("SchemaController.schemaOf") + inputNode.getLabel()); //$NON-NLS-1$
metaDialog.setText(Messages.getString("GuessSchemaController.schemaOf") + inputNode.getLabel()); //$NON-NLS-1$
}
// ok pressed

View File

@@ -42,7 +42,6 @@ import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.ui.component.ComponentsFactoryProvider;
import org.talend.core.utils.CsvArray;
import org.talend.designer.core.i18n.Messages;
import org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer;
import org.talend.designer.core.ui.editor.nodecontainer.NodeContainer;
import org.talend.designer.core.ui.editor.nodes.Node;
import org.talend.designer.core.ui.editor.process.EDatabaseComponentName;
@@ -162,8 +161,8 @@ public class GuessSchemaProcess {
IElementParameter connector = node.getElementParameter("CONNECTION");
if (connector != null) {
String connectorValue = connector.getValue().toString();
List<? extends INode> graphicalNodes = originalProcess.getGraphicalNodes();
for (INode node : graphicalNodes) {
List<? extends INode> generatingNodes = originalProcess.getGeneratingNodes();
for (INode node : generatingNodes) {
if (node.getUniqueName().equals(connectorValue)) {
connectionNode = node;
break;
@@ -236,6 +235,11 @@ public class GuessSchemaProcess {
if (ConnectionUtils.isVertica(info.getUrl())) {
createStatament = "conn.createStatement()";
}
if (EDatabaseTypeName.GENERAL_JDBC.getXmlName().equals(info.getDbType())
&& "com.sap.db.jdbc.Driver".equals(info.getDriverClassName())
|| EDatabaseTypeName.SAPHana.getXmlName().equals(info.getDbType())) {
createStatament = "conn.createStatement()";
}
codeStart = systemProperty
+ "java.lang.Class.forName(\"" + info.getDriverClassName() + "\");\r\n" + "String url = \"" + info.getUrl() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "\";\r\n" + "java.sql.Connection conn = java.sql.DriverManager.getConnection(url, \"" + info.getUsername() //$NON-NLS-1$ //$NON-NLS-2$

View File

@@ -748,11 +748,13 @@ public class ProcessController extends AbstractElementPropertySectionController
// label = path.toString() + IPath.SEPARATOR + label;
// }
} else {
final String parentName = processParam.getName() + ":"; //$NON-NLS-1$
if (elem != null) {
// can be called in multi-thread, dispose method may be already called before executing this method
elem.setPropertyValue(parentName + jobNameParam.getName(), ""); //$NON-NLS-1$
}
// FIXME TUP-5524, don't set empty, keep the id value instead.
// final String parentName = processParam.getName() + ":"; //$NON-NLS-1$
// if (elem != null) {
// // can be called in multi-thread, dispose method may be already called before executing this
// method
//elem.setPropertyValue(parentName + jobNameParam.getName(), ""); //$NON-NLS-1$
// }
}
}
}

View File

@@ -203,8 +203,8 @@ public class TableController extends AbstractElementPropertySectionController {
} else {
formData.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
}
formData.left = new FormAttachment((((nbInRow - numInRow) * MAX_PERCENT) / nbInRow),
currentLabelWidth2 + ITabbedPropertyConstants.HSPACE);
formData.left = new FormAttachment((((nbInRow - numInRow) * MAX_PERCENT) / nbInRow), currentLabelWidth2
+ ITabbedPropertyConstants.HSPACE);
formData = (FormData) labelLabel2.getLayoutData();
formData.right = new FormAttachment(mainComposite, 0);
@@ -355,18 +355,47 @@ public class TableController extends AbstractElementPropertySectionController {
String[] customizedShowIfs = param.getListItemsShowIf();
dqPatternService.overridePatternList(typeParam, param);
// Add the customized value:
param.setListItemsValue(ArrayUtils.addAll(param.getListItemsValue(), customizedValue));
param.setListItemsDisplayCodeName((String[]) ArrayUtils.addAll(param.getListItemsDisplayCodeName(),
param.setListItemsValue(mergeWithoutDuplicate(param.getListItemsValue(), customizedValue));
param.setListItemsDisplayCodeName((String[]) mergeWithoutDuplicate(param.getListItemsDisplayCodeName(),
customizedDisplayCodeName));
param.setListItemsDisplayName((String[]) ArrayUtils.addAll(param.getListItemsDisplayName(), customizedDisplayName));
param.setListItemsNotShowIf((String[]) ArrayUtils.addAll(new String[param.getListItemsShowIf().length],
param.setListItemsDisplayName((String[]) mergeWithoutDuplicate(param.getListItemsDisplayName(),
customizedDisplayName));
param.setListItemsNotShowIf(mergeWithDuplicate(new String[param.getListItemsShowIf().length],
customizedNotShowIfs));
param.setListItemsShowIf((String[]) ArrayUtils.addAll(new String[param.getListItemsShowIf().length],
customizedShowIfs));
param.setListItemsShowIf(mergeWithDuplicate(new String[param.getListItemsShowIf().length], customizedShowIfs));
}
}
}
/**
* Adds all the elements of "b" arrays into "a" array without the duplicate one in "a", and return "a".
*
* @param a
* @param b
* @return
*/
private Object[] mergeWithoutDuplicate(Object[] a, Object[] b) {
if (b == null || b.length == 0) {
return a;
}
for (Object valueB : b) {
if (!ArrayUtils.contains(a, valueB)) {
a = ArrayUtils.add(a, valueB);
}
}
return a;
}
private String[] mergeWithDuplicate(String[] a, String[] b) {
if (b == null || b.length == 0) {
return a;
}
for (String valueB : b) {
a = (String[]) ArrayUtils.add(a, valueB);
}
return a;
}
private boolean isDQPatternList(IElementParameter param) {
String paramName = param.getName();
boolean isPatternList = StringUtils.equals(paramName, "DEFAULT_PATTERN"); //$NON-NLS-1$

View File

@@ -115,15 +115,22 @@ public class StatsAndLogsConstants {
public static final String[] MYSQL_VERSION_DRIVER = new String[] {
"mysql-connector-java-5.1.30-bin.jar", "mysql-connector-java-3.1.14-bin.jar", "mariadb-java-client-1.1.7.jar" };//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
public static final String[] MSSQL_VERSION_DISPLAY = new String[] { "Open source JTDS", "Microsoft" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public static final String[] MSSQL_VERSION_CODE = new String[] { "JTDS", "MSSQL_PROP" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
public static final String[] MSSQL_VERSION_DRIVER = new String[] {
"jtds-1.3.1-patch.jar", "mssql-jdbc.jar"};//$NON-NLS-1$ //$NON-NLS-2$
public static final String[] DB_VERSION_DISPLAY = new String[] { "Oracle 12", "Oracle 11", "Oracle 10", "Oracle 9",
"Oracle 8", "MySQL 5", "MySQL 4", "MariaDB", "Access 2003", "Access 2007", "Prior to v9", "v9 +" };
"Oracle 8", "MySQL 5", "MySQL 4", "MariaDB","Open source JTDS", "Microsoft", "Access 2003", "Access 2007", "Prior to v9", "v9 +" };
public static final String[] DB_VERSION_CODE = new String[] { "ORACLE_12", "ORACLE_11", "ORACLE_10", "ORACLE_9", "ORACLE_8",
"MYSQL_5", "MYSQL_4", "MariaDB", "ACCESS_2003", "ACCESS_2007", "PRIOR_TO_V9", "V9_X" };
"MYSQL_5", "MYSQL_4", "MariaDB", "JTDS", "MSSQL_PROP","ACCESS_2003", "ACCESS_2007", "PRIOR_TO_V9", "V9_X" };
public static final String[] DB_VERSION_DRIVER = new String[] { "ORACLE_12", "ORACLE_11", "ORACLE_10", "ORACLE_9",
"ORACLE_8", "MYSQL_5", "MYSQL_4", "MARIADB", "ACCESS_2003", "ACCESS_2007", "PRIOR_TO_V9", "V9_X" };
"ORACLE_8", "MYSQL_5", "MYSQL_4", "MARIADB", "JTDS", "MSSQL_PROP","ACCESS_2003", "ACCESS_2007", "PRIOR_TO_V9", "V9_X" };
public static final String[] ACCESS_VERSION_DISPLAY = new String[] { "Access 2003", "Access 2007" }; //$NON-NLS-1$ //$NON-NLS-2$

View File

@@ -535,7 +535,7 @@ public class ProjectSettingManager extends Utils {
param.setRepositoryValue("DB_VERSION"); //$NON-NLS-1$
param.setRequired(true);
param.setShowIf(dbCondition
+ " and (" + dbTypeName + " == 'OCLE' or " + dbTypeName + " == 'OCLE_OCI' or " + dbTypeName + " =='ACCESS' or " + dbTypeName + " =='MYSQL')"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
+ " and (" + dbTypeName + " == 'OCLE' or " + dbTypeName + " == 'OCLE_OCI' or " + dbTypeName + " =='ACCESS' or " + dbTypeName + " =='MSSQL' or " + dbTypeName + " =='MYSQL')"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ //$NON-NLS-4$
param.setGroup(IMPLICIT_GROUP);
paramList.add(param);

View File

@@ -408,7 +408,7 @@ public class StatsAndLogsHelper extends Utils {
param.setNumRow(52);
param.setRepositoryValue("DB_VERSION"); //$NON-NLS-1$
param.setRequired(true);
param.setShowIf("(ON_DATABASE_FLAG == 'true') and (DB_TYPE == 'POSTGRESQL' or DB_TYPE == 'OCLE' or DB_TYPE == 'OCLE_OCI' or DB_TYPE == 'ACCESS' or DB_TYPE == 'MYSQL') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')"); //$NON-NLS-1$
param.setShowIf("(ON_DATABASE_FLAG == 'true') and (DB_TYPE == 'POSTGRESQL' or DB_TYPE == 'OCLE' or DB_TYPE == 'OCLE_OCI' or DB_TYPE == 'ACCESS' or DB_TYPE == 'MSSQL' or DB_TYPE == 'MYSQL') and (ON_STATCATCHER_FLAG == 'true' or ON_LOGCATCHER_FLAG == 'true' or ON_METERCATCHER_FLAG == 'true')"); //$NON-NLS-1$
paramList.add(param);
// jdbc url

View File

@@ -64,6 +64,14 @@ public class JobSettingVersionUtil {
}
elementParameter.setListItemsDisplayName(StatsAndLogsConstants.MYSQL_VERSION_DISPLAY);
elementParameter.setListItemsValue(StatsAndLogsConstants.MYSQL_VERSION_CODE);
} else if (dbType.toUpperCase().indexOf("MSSQL") != -1) {//$NON-NLS-1$
if (withInitialValue) {
elementParameter.setValue(StatsAndLogsConstants.MSSQL_VERSION_CODE[0]);
} else {
elementParameter.setValue(dbVersion);
}
elementParameter.setListItemsDisplayName(StatsAndLogsConstants.MSSQL_VERSION_DISPLAY);
elementParameter.setListItemsValue(StatsAndLogsConstants.MSSQL_VERSION_CODE);
} else if (dbType.toUpperCase().indexOf("POSTGRESQL") != -1) {//$NON-NLS-1$
if (withInitialValue) {
elementParameter.setValue(StatsAndLogsConstants.PSQL_VERSION_CODE[0]);

View File

@@ -456,21 +456,13 @@ public class JavaProcessor extends AbstractJavaProcessor implements IJavaBreakpo
for (IResource resource : javaCodeFolder.members()) {
if ("java".equals(resource.getFileExtension())) {//$NON-NLS-1$
if (processSourceFileName != null && processSourceFileName.equals(resource.getName())) {
((IFile) resource).setContents(new ByteArrayInputStream(new byte[0]), IResource.KEEP_HISTORY,
((IFile) resource).setContents(new ByteArrayInputStream(new byte[0]), true, false,
null);
} else {
try {
org.talend.commons.utils.io.FilesUtils.removeExistedResources(null, resource, true, true);
} catch (Exception e) {
throw new ProcessorException(e);
}
resource.delete(true, null);
}
} else {
try {
org.talend.commons.utils.io.FilesUtils.removeExistedResources(null, resource, true, true);
} catch (Exception e) {
throw new ProcessorException(e);
}
resource.delete(true, null);
}
}
}

View File

@@ -293,9 +293,9 @@ public class TalendProcessJavaProject implements ITalendProcessJavaProject {
MavenPomCommandLauncher mavenLauncher = null;
// by default is compile
if (goals == null || goals.trim().length() == 0 || goals.equals(TalendMavenConstants.GOAL_COMPILE)) {
mavenLauncher = new MavenPomCommandLauncher(childModulePomFile, TalendMavenConstants.GOAL_REFRESH);
mavenLauncher.setArgumentsMap(argumentsMap);
mavenLauncher.execute(monitor);
// mavenLauncher = new MavenPomCommandLauncher(childModulePomFile, TalendMavenConstants.GOAL_REFRESH);
// mavenLauncher.setArgumentsMap(argumentsMap);
// mavenLauncher.execute(monitor);
buildWholeCodeProject();
} else {
mavenLauncher = new MavenPomCommandLauncher(childModulePomFile, goals);

View File

@@ -319,7 +319,7 @@ public class MavenJavaProcessor extends JavaProcessor {
return TalendMavenConstants.GOAL_TEST_COMPILE;
}
if (requirePackaging()) {
if (!ProcessorUtilities.isExportConfig() && requirePackaging()) {
// We return the PACKAGE goal if the main job and/or one of its recursive job is a Big Data job.
return TalendMavenConstants.GOAL_PACKAGE;
} else {

View File

@@ -54,7 +54,7 @@ public class FileInputDelimitedNode extends FileInputNode {
public FileInputDelimitedNode(String filename, String rowSep, String fieldSep, int limitRows, int headerRows, int footerRows,
String escapeChar, String textEnclosure, boolean removeEmptyRow, boolean spitRecord, String encoding,
EShadowProcessType fileType) {
super("tFileInputDelimited"); //$NON-NLS-1$
super("tFileInputDelimitedOld"); //$NON-NLS-1$
boolean csvoption = false;
String languageName = LanguageManager.getCurrentLanguage().getName();
@@ -133,7 +133,7 @@ public class FileInputDelimitedNode extends FileInputNode {
Integer.toString(headerRows), Integer.toString(footerRows), escapeChar, textEnclosure,
Boolean.toString(removeEmptyRow), encoding, Boolean.toString(csvoption), Boolean.toString(spitRecord) };
IComponent component = ComponentsFactoryProvider.getInstance().get("tFileInputDelimited", //$NON-NLS-1$
IComponent component = ComponentsFactoryProvider.getInstance().get("tFileInputDelimitedOld", //$NON-NLS-1$
ComponentCategory.CATEGORY_4_DI.getName());
this.setElementParameters(component.createElementParameters(this));
for (int i = 0; i < paramNames.length; i++) {

View File

@@ -27,7 +27,7 @@ public class FileOutputDelimitedNode extends ShadowNode {
* Constructs a new FileOutputXmlNode.
*/
public FileOutputDelimitedNode(String filename, String encoding) {
super("tFileOutputDelimited"); //$NON-NLS-1$
super("tFileOutputDelimitedOld"); //$NON-NLS-1$
TextElementParameter param0 = new TextElementParameter("CSV_OPTION", "true"); //$NON-NLS-1$ //$NON-NLS-2$
TextElementParameter param1 = new TextElementParameter("FILENAME", filename); //$NON-NLS-1$

View File

@@ -799,7 +799,9 @@ public class ComponentBuilder {
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName(elementName);
parameterSon.setParent(parameter);
parameterSon.setNameSpace(((XmlSchemaElement) xmlSchemaObject).getQName().getNamespaceURI());
if (((XmlSchemaElement) xmlSchemaObject).getQName() != null) {
parameterSon.setNameSpace(((XmlSchemaElement) xmlSchemaObject).getQName().getNamespaceURI());
}
Long min = xmlSchemaElement.getMinOccurs();
Long max = xmlSchemaElement.getMaxOccurs();
if (max - min > 1) {

View File

@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -66,70 +66,64 @@ public abstract class NewGenericWizardMigrationTask extends AbstractItemMigratio
String propsKey = (String) element;
String propsValue = props.getProperty(propsKey);
if (propsValue != null && !"".equals(propsValue.trim())) { //$NON-NLS-1$
try {
String methodName = propsValue.substring(0, 1).toUpperCase() + propsValue.substring(1);
Object value = ReflectionUtils.invokeMethod(oldConnection, "get" + methodName, new Object[0]); //$NON-NLS-1$
if (value != null) {
NamedThing namedThing = componentProperties.getProperty(propsKey);
if (namedThing != null && namedThing instanceof org.talend.daikon.properties.property.Property) {
org.talend.daikon.properties.property.Property<?> property = (org.talend.daikon.properties.property.Property<?>) namedThing;
if (GenericTypeUtils.isEnumType(property)) {
Object obj = props.get(propsKey + "." + value);//$NON-NLS-1$
if (obj != null) {
List<?> propertyPossibleValues = property.getPossibleValues();
Object newValue = null;
if (propertyPossibleValues != null) {
for (Object possibleValue : propertyPossibleValues) {
if (possibleValue.toString().equals(obj)) {
newValue = possibleValue;
break;
}
Object value = getValueFromOldConnection(oldConnection, propsValue);
if (value != null) {
NamedThing namedThing = componentProperties.getProperty(propsKey);
if (namedThing != null && namedThing instanceof org.talend.daikon.properties.property.Property) {
org.talend.daikon.properties.property.Property<?> property = (org.talend.daikon.properties.property.Property<?>) namedThing;
if (GenericTypeUtils.isEnumType(property)) {
Object obj = props.get(propsKey + "." + value);//$NON-NLS-1$
if (obj != null) {
List<?> propertyPossibleValues = property.getPossibleValues();
Object newValue = null;
if (propertyPossibleValues != null) {
for (Object possibleValue : propertyPossibleValues) {
if (possibleValue.toString().equals(obj)) {
newValue = possibleValue;
break;
}
}
if (newValue == null) {
// set default value
newValue = propertyPossibleValues.get(0);
}
componentProperties.setValue(propsKey, newValue);
property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE, property.getName());
changed = true;
}
}
if (GenericTypeUtils.isBooleanType(property)) {
if (value != null && value instanceof String) {
try {
value = new Boolean((String) value);
} catch (Exception e) {
value = Boolean.FALSE;
}
if (newValue == null) {
// set default value
newValue = propertyPossibleValues.get(0);
}
}
if (GenericTypeUtils.isIntegerType(property) && !oldConnection.isContextMode()) {
if (value != null && value instanceof String) {
try {
value = new Integer((String) value);
} catch (Exception e) {
value = 0;
}
}
}
if (property.isFlag(org.talend.daikon.properties.property.Property.Flags.ENCRYPT)
&& !oldConnection.isContextMode()) {
componentProperties.setValue(propsKey,
CryptoHelper.getDefault().decrypt(String.valueOf(value)));
componentProperties.setValue(propsKey, newValue);
property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE, property.getName());
modified = true;
changed = true;
}
if (!changed) {
property.setStoredValue(value);
property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE, property.getName());
modified = true;
}
if (GenericTypeUtils.isBooleanType(property)) {
if (value != null && value instanceof String) {
try {
value = new Boolean((String) value);
} catch (Exception e) {
value = Boolean.FALSE;
}
}
}
if (GenericTypeUtils.isIntegerType(property) && !oldConnection.isContextMode()) {
if (value != null && value instanceof String) {
try {
value = new Integer((String) value);
} catch (Exception e) {
value = 0;
}
}
}
if (property.isFlag(org.talend.daikon.properties.property.Property.Flags.ENCRYPT)
&& !oldConnection.isContextMode()) {
componentProperties.setValue(propsKey, CryptoHelper.getDefault().decrypt(String.valueOf(value)));
property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE, property.getName());
modified = true;
changed = true;
}
if (!changed) {
property.setStoredValue(value);
property.setTaggedValue(IGenericConstants.REPOSITORY_VALUE, property.getName());
modified = true;
}
}
} catch (Exception e) {
// Do nothing
}
}
}
@@ -137,6 +131,21 @@ public abstract class NewGenericWizardMigrationTask extends AbstractItemMigratio
return modified;
}
protected Object getValueFromOldConnection(Connection oldConnection, String parameterName) {
String methodName = parameterName.substring(0, 1).toUpperCase() + parameterName.substring(1);
Object value = null;
try {
value = ReflectionUtils.invokeMethod(oldConnection, "get" + methodName, new Object[0]); //$NON-NLS-1$
} catch (Exception e) {
try {
value = ReflectionUtils.invokeMethod(oldConnection, "is" + methodName, new Object[0]); //$NON-NLS-1$
} catch (Exception ex) {
// do nothing.
}
}
return value;
}
protected boolean updateMetadataTable(Connection oldConnection, Connection genericConnection,
ComponentProperties componentProperties) {
return false;

View File

@@ -46,8 +46,10 @@ import org.talend.repository.generic.model.genericMetadata.GenericConnection;
import org.talend.repository.generic.model.genericMetadata.GenericMetadataPackage;
import org.talend.repository.generic.model.genericMetadata.SubContainer;
import org.talend.repository.generic.ui.DynamicComposite;
import org.talend.repository.generic.util.RepTypeMappingManager;
import org.talend.repository.model.IRepositoryNode.ENodeType;
import org.talend.repository.model.RepositoryNode;
import orgomg.cwm.objectmodel.core.TaggedValue;
/**
@@ -217,4 +219,8 @@ public class GenericWizardService implements IGenericWizardService {
return componentProperties;
}
public ERepositoryObjectType getNewRepType(String oldRepTypeName) {
return RepTypeMappingManager.getInstance().getNewRepType(oldRepTypeName);
}
}

View File

@@ -390,13 +390,17 @@ public class DynamicComposite extends MultipleThreadDynamicComposite implements
@Override
public void refresh() {
DisplayUtils.getDisplay().syncExec(new Runnable() {
if (element instanceof FakeElement) {
DisplayUtils.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
operationInThread();
}
});
@Override
public void run() {
operationInThread();
}
});
} else {
super.refresh();
}
}
@Override

View File

@@ -23,7 +23,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.core.model.context.JobContextManager;
import org.talend.core.model.process.EParameterFieldType;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.properties.ContextItem;
@@ -105,10 +104,6 @@ public class GenericContextHandler implements IContextHandler {
for (IElementParameter param : parameters) {
if (param instanceof GenericElementParameter) {
GenericElementParameter genericElementParameter = (GenericElementParameter) param;
if (genericElementParameter.getFieldType() == EParameterFieldType.CLOSED_LIST
|| genericElementParameter.getFieldType() == EParameterFieldType.CHECK) {
continue;
}
if (genericElementParameter.isSupportContext()) {
GenericConnParamName connParamName = new GenericConnParamName();
String paramName = genericElementParameter.getName();

View File

@@ -90,7 +90,7 @@ public class GenericDragAndDropHandler extends AbstractDragAndDropServiceHandler
Property<?> property = compPro.getValuedProperty(value);
if (property != null) {
Object paramValue = property.getStoredValue();
if (GenericTypeUtils.isStringType(property)) {
if (GenericTypeUtils.isStringType(property) || GenericTypeUtils.isObjectType(property)) {
if (paramValue != null) {
return getRepositoryValueOfStringType(connection, paramValue.toString());
} else {

View File

@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringEscapeUtils;
import org.talend.components.api.properties.ComponentProperties;
import org.talend.core.language.ECodeLanguage;
import org.talend.core.model.context.ContextUtils;
@@ -33,7 +34,6 @@ import org.talend.core.utils.TalendQuoteUtils;
import org.talend.daikon.NamedThing;
import org.talend.daikon.properties.Properties;
import org.talend.daikon.properties.property.Property;
import org.talend.daikon.serialize.SerializerDeserializer;
import org.talend.designer.core.generic.constants.IGenericConstants;
import org.talend.designer.core.generic.utils.ComponentsUtils;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
@@ -73,7 +73,8 @@ public class GenericContextUtil {
if (GenericTypeUtils.isIntegerType(property)) {
type = JavaTypesManager.INTEGER;
}
String value = property == null || property.getValue() == null ? null : String.valueOf(property.getValue());
String value = property == null || property.getValue() == null ? null
: StringEscapeUtils.escapeJava(String.valueOf(property.getValue()));
ConnectionContextHelper.createParameters(varList, paramName, value, type);
}
}

View File

@@ -0,0 +1,75 @@
// ============================================================================
//
// Copyright (C) 2006-2016 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.generic.util;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.model.repository.ERepositoryObjectType;
/**
* created by ycbai on 2016年10月8日 Detailled comment
*
*/
public class RepTypeMappingManager {
private static RepTypeMappingManager instance = null;
private static final String TYPE_MAPPING_FILE = "rep_type_mapping.properties"; //$NON-NLS-1$
private Properties properties;
private RepTypeMappingManager() {
}
public synchronized static RepTypeMappingManager getInstance() {
if (instance == null) {
instance = new RepTypeMappingManager();
}
return instance;
}
private void loadTypeMapping() {
properties = new Properties();
InputStream input = null;
try {
input = getClass().getClassLoader().getResourceAsStream(TYPE_MAPPING_FILE);
properties.load(input);
} catch (IOException e) {
ExceptionHandler.process(e);
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace(); // Only for debug.
}
}
}
}
public ERepositoryObjectType getNewRepType(String oldType) {
if (properties == null || properties.isEmpty()) {
loadTypeMapping();
}
ERepositoryObjectType newType = null;
String property = properties.getProperty(oldType);
if (property != null) {
newType = ERepositoryObjectType.valueOf(property);
}
return newType;
}
}

View File

@@ -0,0 +1,4 @@
# The properties file define the mapping from the old repository type to the new repository type.
METADATA_SALESFORCE_SCHEMA=salesforce
METADATA_FILE_DELIMITED=fileDelimited

View File

@@ -2808,6 +2808,15 @@
name="UpdateELTComponentMigrationTask"
version="6.1.2">
</projecttask>
<projecttask
beforeLogon="true"
breaks="6.2.1"
class="org.talend.repository.model.migration.ChangeMappingFileMigrationTask"
description="Change mapping file"
id="org.talend.repository.model.migration.ChangeMappingFileMigrationTask"
name="ChangeMappingFileMigrationTask"
version="6.2.2">
</projecttask>
</extension>
<extension

View File

@@ -900,7 +900,7 @@ WorkbenchMessages.ExportWizard_title=Export
AutoConversionTypesEditor.title=Auto-Conversion of types
AutoConversionTypesEditor.Button.enable=Enable Auto-Conversion of types
AutoConversionTypesEditor.Label.note=Note that Auto-Conversion is only available from tMap.\nif enabled,all the tMap created willenable the auto-convert,Existing tMap will have the option disabled.\n\nTable below will override the default conversion system for the types defined.\n
AutoConversionTypesEditor.Label.messages=Note that Auto-Conversion is only available from tMap in standard Jobs.\nIf enabled, any newly added tMap component will have the Auto Type Conversion feature activated.\n\nTable below will override the default conversion system for the types defined.\n
AutoConversionTypesEditor.table.column.sourceDataType=Source Data Type
AutoConversionTypesEditor.table.column.targetDataType=Target Data Type
AutoConversionTypesEditor.table.column.conversionFunction=Conversion Function

View File

@@ -0,0 +1,79 @@
package org.talend.repository.model.migration;
import java.io.File;
import java.io.FileWriter;
import java.net.URL;
import java.util.Date;
import java.util.GregorianCalendar;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ICoreService;
import org.talend.core.model.general.Project;
import org.talend.core.model.metadata.MetadataTalendType;
import org.talend.core.model.migration.AbstractProjectMigrationTask;
public class ChangeMappingFileMigrationTask extends AbstractProjectMigrationTask {
@Override
public ExecutionResult execute(Project project) {
try {
URL p = MetadataTalendType.getProjectForderURLOfMappingsFile();
changeSAPHanaMappingFile(p);
URL s = MetadataTalendType.getSystemForderURLOfMappingsFile();
changeSAPHanaMappingFile(s);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
service.synchronizeMapptingXML();
return ExecutionResult.SUCCESS_NO_ALERT;
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return ExecutionResult.FAILURE;
}
private void changeSAPHanaMappingFile(URL url) {
File dir = new File(url.getFile());
File target = null;
if (dir.isDirectory()) {
File[] files = dir.listFiles();
for (File file : files) {
if (file.getName().equals("mapping_SAPHana.xml")) { //$NON-NLS-1$
target = file;
break;
}
}
}
if (target != null) {
try {
SAXReader reader = new SAXReader();
Document document = reader.read(target);
Element root = document.getRootElement();
Element node = root.element("dbms"); //$NON-NLS-1$
Attribute attr = node.attribute("label"); //$NON-NLS-1$
if (attr != null && attr.getValue().equals("Mapping SAP Hana")) { //$NON-NLS-1$
attr.setValue("Mapping SAPHana"); //$NON-NLS-1$
target.delete();
XMLWriter writer = new XMLWriter(new FileWriter(target));
writer.write(document);
writer.close();
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
@Override
public Date getOrder() {
GregorianCalendar gc = new GregorianCalendar(2016, 10, 9, 12, 0, 0);
return gc.getTime();
}
}

View File

@@ -82,7 +82,7 @@ public class AutoConversionTypesEditor extends FieldEditor {
enableBtn.setText(Messages.getString("AutoConversionTypesEditor.Button.enable"));//$NON-NLS-1$
Label noteLabel = new Label(parentComposite, SWT.NONE);
noteLabel.setText(Messages.getString("AutoConversionTypesEditor.Label.note"));//$NON-NLS-1$
noteLabel.setText(Messages.getString("AutoConversionTypesEditor.Label.messages"));//$NON-NLS-1$
typeModel = new AutoConversionTypeModel();
tableEditorView = new AutoConversionTypesEditorView(parentComposite, typeModel);

View File

@@ -17,7 +17,6 @@ import java.util.List;
import org.eclipse.gef.commands.Command;
import org.eclipse.jface.viewers.ComboBoxCellEditor;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.widgets.Composite;
@@ -31,6 +30,7 @@ import org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButton;
import org.talend.commons.ui.swt.advanced.dataeditor.button.PastePushButtonForExtendedTable;
import org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTablePasteCommand;
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
import org.talend.commons.ui.swt.proposal.TextCellEditorWithProposal;
import org.talend.commons.ui.swt.tableviewer.TableViewerCreator;
import org.talend.commons.ui.swt.tableviewer.TableViewerCreatorColumn;
import org.talend.commons.utils.data.bean.IBeanPropertyAccessors;
@@ -39,6 +39,7 @@ import org.talend.core.model.metadata.MetadataTalendType;
import org.talend.core.model.metadata.types.AutoConversionType;
import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.ui.metadata.celleditor.JavaTypeComboValueAdapter;
import org.talend.core.ui.proposal.AutoConversionProposalProvider;
import org.talend.repository.i18n.Messages;
import org.talend.repository.model.AutoConversionTypeModel;
@@ -175,12 +176,16 @@ public class AutoConversionTypesEditorView extends AbstractDataTableEditorView<A
}
});
column.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
column.setModifiable(true);
column.setWeight(60);
column.setMinimumWidth(50);
column.setDefaultInternalValue(""); //$NON-NLS-1$
AutoConversionProposalProvider functionProposalProvider = new AutoConversionProposalProvider();
TextCellEditorWithProposal textCellEditor = new TextCellEditorWithProposal(tableViewerCreator.getTable(), column);
textCellEditor.setContentProposalProvider(functionProposalProvider);
column.setCellEditor(textCellEditor);
return column;
}

View File

@@ -803,7 +803,10 @@ public class LoginProjectPage extends AbstractLoginActionPage {
finishButton.setEnabled(false);
Project project = getProject();
if (project != null) {
loginHelper.getPrefManipulator().setLastProject(project.getLabel());
// last used project will be saved when click finish
// loginHelper.getPrefManipulator().setLastProject(project.getLabel());
try {
fillUIBranches(project, false);
} catch (JSONException e) {
@@ -820,19 +823,21 @@ public class LoginProjectPage extends AbstractLoginActionPage {
@Override
public void selectionChanged(SelectionChangedEvent event) {
String branch = getBranch();
if (branch == null) {
branch = SVNConstant.EMPTY;
}
Project project = getProject();
try {
loginHelper.getPrefManipulator().setLastSVNBranch(
new JSONObject(project.getEmfProject().getUrl()).getString("location"), project.getTechnicalLabel(),
branch);
} catch (JSONException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
}
// last used branch of project will be saved when click finish
// String branch = getBranch();
// if (branch == null) {
// branch = SVNConstant.EMPTY;
// }
// Project project = getProject();
// try {
// loginHelper.getPrefManipulator().setLastSVNBranch(
// new JSONObject(project.getEmfProject().getUrl()).getString("location"), project.getTechnicalLabel(),
// branch);
// } catch (JSONException e) {
// // TODO Auto-generated catch block
// ExceptionHandler.process(e);
// }
}
});
@@ -994,6 +999,8 @@ public class LoginProjectPage extends AbstractLoginActionPage {
if (LoginHelper.isRestart) {
loginDialog.okPressed();
} else {
// should save before login, since svn related codes will read them
saveLastUsedProjectAndBranch();
boolean isLogInOk = loginHelper.logIn(getConnection(), getProject());
if (isLogInOk) {
LoginHelper.setAlwaysAskAtStartup(alwaysAsk.getSelection());
@@ -1011,6 +1018,28 @@ public class LoginProjectPage extends AbstractLoginActionPage {
repositoryContext.setNoUpdateWhenLogon(false);
}
private void saveLastUsedProjectAndBranch() {
Project project = getProject();
loginHelper.getPrefManipulator().setLastProject(project.getLabel());
if (loginHelper.isRemoteConnection(getConnection())) {
String branch = getBranch();
if (branch == null) {
branch = SVNConstant.EMPTY;
}
try {
loginHelper.getPrefManipulator().setLastSVNBranch(
new JSONObject(project.getEmfProject().getUrl()).getString("location"), project.getTechnicalLabel(),
branch);
} catch (JSONException e) {
// TODO Auto-generated catch block
ExceptionHandler.process(e);
}
}
}
@Override
public Object getCheckedErrors() {
// TODO Auto-generated method stub

View File

@@ -21,6 +21,8 @@ import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.utils.workbench.resources.ResourceUtils;
import org.talend.core.CorePlugin;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ICoreService;
@@ -53,7 +55,7 @@ public abstract class AbstractBuildJobHandler implements IBuildJobHandler {
protected static final String NEGATION = "!"; //$NON-NLS-1$
protected static final String JOB_EXTENSION = ".zip"; //$NON-NLS-1$
protected static final String JOB_EXTENSION = "zip"; //$NON-NLS-1$
protected static final String JOB_NAME_SEP = "-"; //$NON-NLS-1$
@@ -81,6 +83,12 @@ public abstract class AbstractBuildJobHandler implements IBuildJobHandler {
}
IRunProcessService runProcessService = CorePlugin.getDefault().getRunProcessService();
this.talendProcessJavaProject = runProcessService.getTalendProcessJavaProject();
IFolder targetFolder = talendProcessJavaProject.getTargetFolder();
try {
ResourceUtils.emptyFolder(targetFolder);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
protected boolean isOptionChoosed(Object key) {
@@ -249,15 +257,23 @@ public abstract class AbstractBuildJobHandler implements IBuildJobHandler {
if (talendProcessJavaProject == null) {
return null;
}
Property jobProperty = processItem.getProperty();
String jobZipName = JavaResourcesHelper.getJobJarName(jobProperty.getLabel(), jobProperty.getVersion()) + JOB_EXTENSION;
IFolder targetFolder = talendProcessJavaProject.getTargetFolder();
IFile jobFile = null;
try {
targetFolder.refreshLocal(IResource.DEPTH_ONE, null);
// we only build one zip at a time, so just get the zip file to be able to manage some pom customizations.
for (IResource resource : targetFolder.members()) {
if (resource instanceof IFile) {
IFile file = (IFile) resource;
if (JOB_EXTENSION.equals(file.getFileExtension())) {
jobFile = file;
break;
}
}
}
} catch (CoreException e) {
ExceptionHandler.process(e);
}
IFile jobFile = targetFolder.getFile(jobZipName);
return jobFile;
}

View File

@@ -58,6 +58,8 @@ public class AutoConvertTypesUtils {
public static final String ENABLE_AUTO_CONVERSION = "ENABLE_AUTO_CONVERSION";//$NON-NLS-1$
public static final String ENABLE_AUTO_CONVERT_TYPE = "ENABLE_AUTO_CONVERT_TYPE"; //$NON-NLS-1$
private static List<AutoConversionType> beanList = null;
public static List<AutoConversionType> getAllAutoConversionTypes() {

View File

@@ -0,0 +1,38 @@
// ============================================================================
//
// Copyright (C) 2006-2016 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.repository.generic.util;
import static org.junit.Assert.*;
import org.junit.Test;
import org.talend.core.model.repository.ERepositoryObjectType;
/**
* created by ycbai on 2016年10月8日 Detailled comment
*
*/
public class RepTypeMappingManagerTest {
@Test
public void testGetNewRepType() {
ERepositoryObjectType newSFRepType = RepTypeMappingManager.getInstance().getNewRepType("METADATA_SALESFORCE_SCHEMA"); //$NON-NLS-1$
if (newSFRepType != null) {
assertEquals("salesforce", newSFRepType.getType()); //$NON-NLS-1$
}
ERepositoryObjectType newFDRepType = RepTypeMappingManager.getInstance().getNewRepType("METADATA_FILE_DELIMITED"); //$NON-NLS-1$
if (newFDRepType != null) {
assertEquals("fileDelimited", newFDRepType.getType()); //$NON-NLS-1$
}
}
}

View File

@@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
resources/
resources/,\
AutoConversionTypesTest.xml