Compare commits
24 Commits
codegen_ba
...
patch/5.5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5b6610abb | ||
|
|
9d4155314f | ||
|
|
d03f803d06 | ||
|
|
c92187aac1 | ||
|
|
b54878022c | ||
|
|
e15fae7537 | ||
|
|
3f0be852c5 | ||
|
|
c6aa41b4b1 | ||
|
|
00f7756d2a | ||
|
|
15942688cf | ||
|
|
1960c9fcec | ||
|
|
82e2af536b | ||
|
|
ec60f556f5 | ||
|
|
96aafbd48f | ||
|
|
85a1808676 | ||
|
|
985409e0d1 | ||
|
|
30b5fe0da7 | ||
|
|
e022cf20f6 | ||
|
|
a014635905 | ||
|
|
c3bd080912 | ||
|
|
3fa50a4f21 | ||
|
|
8bfdf93db1 | ||
|
|
fa2d16e5f9 | ||
|
|
97d5f1a66b |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*/target
|
||||
/*/bin
|
||||
/*/class
|
||||
/*/classes
|
||||
/*/.settings
|
||||
/**/dev_con
|
||||
@@ -49,26 +49,16 @@
|
||||
boolean hasParallelIterate = false;
|
||||
for (IConnection iterateConn : iterateConnSet) {
|
||||
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
||||
String iterateNodeName = iterateConn.getTarget().getUniqueName();
|
||||
if (parallelIterate) {
|
||||
%>
|
||||
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
|
||||
|
||||
<%
|
||||
if(!hasParallelIterate){
|
||||
hasParallelIterate = true;
|
||||
%>
|
||||
|
||||
final Object[] lockWrite = new Object[0];
|
||||
int threadIdCounter =0;
|
||||
globalMap.put("lockWrite_<%=iterateNodeName%>", new Object[0]);
|
||||
int threadIdCounter_<%=iterateNodeName%> =0;
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
<%
|
||||
}
|
||||
|
||||
String iterateNodeName = iterateConn.getTarget().getUniqueName();
|
||||
%>
|
||||
int NB_ITERATE_<%=iterateNodeName %> = 0; //for statistics
|
||||
<%
|
||||
continue;
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter++);
|
||||
<%=node.getUniqueName() %>Thread bt_<%=node.getUniqueName() %> = new <%=node.getUniqueName() %>Thread(globalMap<%=schemaInstanceDeclaration %>,threadIdCounter_<%=node.getUniqueName()%>++);
|
||||
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
|
||||
|
||||
<%
|
||||
|
||||
@@ -67,7 +67,6 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
||||
rowList = rowList.substring(0, rowList.length()-1);
|
||||
%>
|
||||
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
|
||||
|
||||
class ThreadedMap extends java.util.HashMap<String, Object> {
|
||||
|
||||
private static final long serialVersionUID = 0L;
|
||||
|
||||
@@ -868,7 +868,6 @@ public class CodeGenerator implements ICodeGenerator {
|
||||
CodeGeneratorArgument argument = new CodeGeneratorArgument();
|
||||
argument.setNode(node);
|
||||
argument.setAllMainSubTreeConnections(subProcess.getAllMainSubTreeConnections());
|
||||
argument.setSubTreeContainsParallelIterate(subProcess.subTreeContainsParallelIterate());
|
||||
argument.setCodePart(part);
|
||||
argument.setStatistics(statistics);
|
||||
argument.setTrace(trace);
|
||||
|
||||
@@ -60,6 +60,7 @@ public class CodeGeneratorArgument {
|
||||
|
||||
private int pauseTime;
|
||||
|
||||
@Deprecated
|
||||
private boolean subTreeContainsParallelIterate;
|
||||
|
||||
/**
|
||||
@@ -277,10 +278,15 @@ public class CodeGeneratorArgument {
|
||||
this.subTree = subTree;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/*
|
||||
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
|
||||
*/
|
||||
public boolean subTreeContainsParallelIterate() {
|
||||
return subTreeContainsParallelIterate;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
|
||||
this.subTreeContainsParallelIterate = subTreeContainsParallelIterate;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.Map;
|
||||
|
||||
import org.talend.core.model.process.AbstractNode;
|
||||
import org.talend.core.model.process.EConnectionType;
|
||||
import org.talend.core.model.process.ElementParameterParser;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IConnectionCategory;
|
||||
import org.talend.core.model.process.INode;
|
||||
@@ -61,6 +60,7 @@ public class NodesSubTree {
|
||||
|
||||
List<IConnection> allMainSubTreeConnections = null;
|
||||
|
||||
@Deprecated
|
||||
boolean subTreeContainsParallelIterate = false;
|
||||
|
||||
List<INode> mergeBranchStarts;
|
||||
@@ -251,10 +251,6 @@ public class NodesSubTree {
|
||||
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
||||
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
|
||||
allMainSubTreeConnections.add(connection);
|
||||
} else {
|
||||
if (Boolean.TRUE.toString().equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) { //$NON-NLS-1$
|
||||
subTreeContainsParallelIterate = true;
|
||||
}
|
||||
}
|
||||
if (DEBUG) {
|
||||
System.out.print(" -> "); //$NON-NLS-1$
|
||||
@@ -505,6 +501,10 @@ public class NodesSubTree {
|
||||
this.allMainSubTreeConnections = allMainSubTreeConnections;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/*
|
||||
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
|
||||
*/
|
||||
public boolean subTreeContainsParallelIterate() {
|
||||
return subTreeContainsParallelIterate;
|
||||
}
|
||||
|
||||
@@ -10306,7 +10306,23 @@ public class SforceServiceStub extends org.apache.axis2.client.Stub implements
|
||||
"urn:partner.soap.sforce.com:Soap:describeGlobalRequest");
|
||||
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
||||
true);
|
||||
|
||||
{
|
||||
/*- ADD - START - BY cmeng - 20140901*/
|
||||
/**
|
||||
* https://jira.talendforge.org/browse/TDI-30366<br>
|
||||
* 1. Because this API seems not support this case: server use HTTP Protocol 1.0(not support CHUNKED) while client use HTTP Protocol 1.1<br>
|
||||
* , then client will throw exception(org.apache.axis2.AxisFault: Transport error: 411 Error: Length Required)<br>
|
||||
* 2. If the new API can support this case, then this additional codes can be cancelled.
|
||||
*
|
||||
* Some information I searched on the net:<br>
|
||||
* https://www.mail-archive.com/basedb-devel@lists.sourceforge.net/msg00309.html
|
||||
* http://axis.apache.org/axis2/java/core/docs/http-transport.html
|
||||
* http://en.wikipedia.org/wiki/Chunked_transfer_encoding
|
||||
*/
|
||||
_operationClient.getOptions().setProperty(
|
||||
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, "false");
|
||||
/*- ADD - END - BY cmeng* - 20140901*/
|
||||
}
|
||||
addPropertyToOperationClient(
|
||||
_operationClient,
|
||||
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
||||
@@ -12816,7 +12832,23 @@ public class SforceServiceStub extends org.apache.axis2.client.Stub implements
|
||||
"urn:partner.soap.sforce.com:Soap:describeSObjectRequest");
|
||||
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
||||
true);
|
||||
|
||||
{
|
||||
/*- ADD - START - BY cmeng - 20140901*/
|
||||
/**
|
||||
* https://jira.talendforge.org/browse/TDI-30366<br>
|
||||
* 1. Because this API seems not support this case: server use HTTP Protocol 1.0(not support CHUNKED) while client use HTTP Protocol 1.1<br>
|
||||
* , then client will throw exception(org.apache.axis2.AxisFault: Transport error: 411 Error: Length Required)<br>
|
||||
* 2. If the new API can support this case, then this additional codes can be cancelled.
|
||||
*
|
||||
* Some information I searched on the net:<br>
|
||||
* https://www.mail-archive.com/basedb-devel@lists.sourceforge.net/msg00309.html
|
||||
* http://axis.apache.org/axis2/java/core/docs/http-transport.html
|
||||
* http://en.wikipedia.org/wiki/Chunked_transfer_encoding
|
||||
*/
|
||||
_operationClient.getOptions().setProperty(
|
||||
org.apache.axis2.transport.http.HTTPConstants.CHUNKED, "false");
|
||||
/*- ADD - END - BY cmeng - 20140901*/
|
||||
}
|
||||
addPropertyToOperationClient(
|
||||
_operationClient,
|
||||
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
||||
|
||||
@@ -12,6 +12,8 @@ imports="
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
java.util.List
|
||||
org.talend.core.model.process.IProcess
|
||||
org.talend.core.model.process.IElementParameter
|
||||
org.talend.core.model.process.AbstractNode
|
||||
"
|
||||
%>
|
||||
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
||||
@@ -457,9 +459,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -508,7 +510,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
@@ -892,9 +894,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -943,7 +945,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
java.util.List
|
||||
org.talend.core.model.process.IProcess
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
org.talend.core.model.process.AbstractNode
|
||||
"
|
||||
%>
|
||||
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
||||
@@ -43,9 +45,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -138,7 +140,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
java.util.List
|
||||
org.talend.core.model.process.IProcess
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
org.talend.core.model.process.AbstractNode
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -43,9 +45,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -140,7 +142,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -10,6 +10,8 @@ imports="
|
||||
java.util.List
|
||||
org.talend.core.model.metadata.types.JavaTypesManager
|
||||
org.talend.core.model.metadata.types.JavaType
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
org.talend.core.model.process.AbstractNode
|
||||
"
|
||||
%>
|
||||
|
||||
@@ -80,9 +82,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -135,7 +137,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
@@ -226,9 +228,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -349,7 +351,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
@@ -404,6 +406,8 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
|
||||
boolean compress = ("true").equals(ElementParameterParser.getValue(node,"__COMPRESS__"));
|
||||
|
||||
boolean useOSLineSeparator = ("true").equals(ElementParameterParser.getValue(node,"__OS_LINE_SEPARATOR_AS_ROW_SEPARATOR__"));
|
||||
|
||||
boolean hasDynamic = metadata.isDynamicSchema();
|
||||
IMetadataColumn dynamicCol = metadata.getDynamicColumn();
|
||||
if(hasDynamic){
|
||||
@@ -424,9 +428,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -495,7 +499,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
@@ -583,9 +587,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -624,8 +628,25 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
new java.io.FileOutputStream(fullName_<%=cid%> + splitedFileNo_<%=cid%> + extension_<%=cid%>, <%=isAppend%>),<%=encoding%>)));
|
||||
CsvWriter<%=cid%>.setSeparator(csvSettings_<%=cid %>.getFieldDelim());
|
||||
<%}%>
|
||||
if(csvSettings_<%=cid %>.getRowDelim()!='\r' && csvSettings_<%=cid %>.getRowDelim()!='\n')
|
||||
|
||||
<%
|
||||
if(!useOSLineSeparator) {
|
||||
%>
|
||||
if(csvSettings_<%=cid%>.isUseCRLFRecordDelimiter()) {
|
||||
CsvWriter<%=cid%>.setLineEnd("\r\n");
|
||||
} else {
|
||||
CsvWriter<%=cid%>.setLineEnd(""+csvSettings_<%=cid%>.getRowDelim());
|
||||
}
|
||||
<%
|
||||
} else {
|
||||
%>
|
||||
if(!csvSettings_<%=cid%>.isUseCRLFRecordDelimiter() && csvSettings_<%=cid%>.getRowDelim()!='\r' && csvSettings_<%=cid%>.getRowDelim()!='\n') {
|
||||
CsvWriter<%=cid%>.setLineEnd(""+csvSettings_<%=cid%>.getRowDelim());
|
||||
}
|
||||
<%
|
||||
}
|
||||
%>
|
||||
|
||||
//set header.
|
||||
<%
|
||||
if(isIncludeHeader && !isAppend){
|
||||
@@ -735,7 +756,7 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
java.util.List
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
org.talend.core.model.process.AbstractNode
|
||||
"
|
||||
%>
|
||||
<%
|
||||
@@ -30,9 +32,9 @@
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -57,7 +59,7 @@
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
org.talend.core.model.process.IConnectionCategory
|
||||
org.talend.core.model.process.ElementParameterParser
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||
org.talend.core.model.utils.NodeUtil
|
||||
java.util.List
|
||||
java.util.Map
|
||||
org.talend.core.model.process.AbstractNode
|
||||
"
|
||||
%>
|
||||
<%
|
||||
@@ -70,9 +72,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
synchronized (multiThreadLockWrite) {
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
synchronized (lockWrite) {
|
||||
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||
<%
|
||||
}
|
||||
if (isParallelize) {
|
||||
@@ -96,7 +98,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
||||
}
|
||||
<%
|
||||
}
|
||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
||||
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||
%>
|
||||
}
|
||||
<%
|
||||
|
||||
Binary file not shown.
@@ -22,6 +22,7 @@ imports="
|
||||
|
||||
boolean validate = ("true").equals(ElementParameterParser.getValue(node,"__VALIDATE__"));
|
||||
boolean isGenerateId = ("true").equals(ElementParameterParser.getValue(node,"__GENERATE_ID__"));
|
||||
boolean insertOnly = ("true").equals(ElementParameterParser.getValue(node,"__INSERT_ONLY__"));
|
||||
|
||||
boolean useTransaction = ("true").equals(ElementParameterParser.getValue(node,"__USE_TRANSACTION__"));
|
||||
String transactionProvider = ElementParameterParser.getValue(node,"__TRANSACTION_PROVIDER__");
|
||||
@@ -41,6 +42,6 @@ if(mdmTransaction_<%=cid%>!=null) {
|
||||
}
|
||||
<%}%>
|
||||
bulkloadClient_<%=cid %>.startThreadCount();
|
||||
bulkloadClient_<%=cid %>.setOptions(new org.talend.mdm.bulkload.client.BulkloadOptions(<%=isGenerateId %>, <%=validate %>, <%=arraySize%>));
|
||||
bulkloadClient_<%=cid %>.setOptions(new org.talend.mdm.bulkload.client.BulkloadOptions(<%=isGenerateId %>, <%=validate %>, <%=arraySize%>, <%=insertOnly%>));
|
||||
int count_<%=cid%> = 0;
|
||||
org.talend.mdm.bulkload.client.InputStreamMerger inputStreamMerger_<%=cid%> = null;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<%@ jet
|
||||
imports="
|
||||
org.talend.core.model.process.INode
|
||||
org.talend.designer.codegen.config.CodeGeneratorArgument"
|
||||
%>
|
||||
<%
|
||||
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
|
||||
INode node = (INode)codeGenArgument.getArgument();
|
||||
String cid = node.getUniqueName();
|
||||
%>
|
||||
Object o<%=cid %> = resourceMap.get("mdmBulkStream<%=cid %>");
|
||||
if(o<%=cid %> != null){
|
||||
org.talend.mdm.bulkload.client.InputStreamMerger stream = (org.talend.mdm.bulkload.client.InputStreamMerger)o<%=cid %>;
|
||||
stream.clean();
|
||||
}
|
||||
@@ -86,6 +86,10 @@
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="INSERT_ONLY" FIELD="CHECK" NUM_ROW="50">
|
||||
<DEFAULT>false</DEFAULT>
|
||||
</PARAMETER>
|
||||
|
||||
<PARAMETER NAME="MASS_LEVEL" FIELD="TEXT" NUM_ROW="60"
|
||||
REQUIRED="true">
|
||||
<DEFAULT>500</DEFAULT>
|
||||
|
||||
@@ -29,6 +29,7 @@ if (count_<%=cid%> % <%=arraySize%> == 0) {
|
||||
if(inputStreamMerger_<%=cid%> != null)
|
||||
inputStreamMerger_<%=cid%>.close();
|
||||
inputStreamMerger_<%=cid%> = bulkloadClient_<%=cid %>.load();
|
||||
resourceMap.put("mdmBulkStream<%=cid %>", inputStreamMerger_<%=cid%>);
|
||||
}
|
||||
|
||||
if(<%=conn.getName()%>.<%=xmlField %>!=null){
|
||||
|
||||
@@ -8,6 +8,7 @@ DATACONCEPT.NAME=Entity
|
||||
XMLFIELD.NAME=XML Field
|
||||
VALIDATE.NAME=Validate
|
||||
GENERATE_ID.NAME=Generate ID
|
||||
INSERT_ONLY.NAME=Insert only
|
||||
MASS_LEVEL.NAME=Commit size
|
||||
HELP=org.talend.help.tMDMOutput
|
||||
LONG_NAME=Output an xml structure to the talend MDM web service
|
||||
|
||||
@@ -8,6 +8,7 @@ DATACONCEPT.NAME=Entity
|
||||
XMLFIELD.NAME=XML Field
|
||||
VALIDATE.NAME=Validate
|
||||
GENERATE_ID.NAME=Generate ID
|
||||
INSERT_ONLY.NAME=Insert only
|
||||
MASS_LEVEL.NAME=Commit size
|
||||
HELP=org.talend.help.tMDMOutput
|
||||
LONG_NAME=Output an xml structure to the talend MDM web service
|
||||
|
||||
@@ -177,8 +177,10 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
|
||||
|
||||
boolean continueFlag_<%=cid%> = true;
|
||||
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
|
||||
int totalPage_<%=cid %> = -1;
|
||||
int pageNumber_<%=cid %> = 0;
|
||||
while (continueFlag_<%=cid%>) {
|
||||
|
||||
pageNumber_<%=cid %>++;
|
||||
getitems_<%=cid%>=new org.talend.mdm.webservice.WSGetItems(dataCluster_<%=cid%>, <%=concept%>, wsItem_<%=cid%>,
|
||||
<%=spellThrehold%>, //spell Threshold
|
||||
skip_<%=cid%> + retrievedCount_<%=cid%>,
|
||||
@@ -188,6 +190,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
|
||||
items_<%=cid%> = xtentisWS_<%=cid%>.getItems(getitems_<%=cid%>);
|
||||
if(totalCount_<%=cid%> < 0){
|
||||
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
|
||||
totalPage_<%=cid %> = totalCount_<%=cid%>/recordsPerPage_<%=cid%> +1;
|
||||
}
|
||||
} catch(java.lang.Exception e) {
|
||||
<%if(dieOnError) {%>
|
||||
@@ -197,7 +200,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
|
||||
<% } %>
|
||||
}
|
||||
retrievedCount_<%=cid%> += (items_<%=cid%>.length - 1);
|
||||
if (totalCount_<%=cid%> == retrievedCount_<%=cid%> || recordsPerPage_<%=cid%> == -1 || (items_<%=cid%>.length - 1) < readRecordsSize_<%=cid%> || limit_<%=cid%> == retrievedCount_<%=cid%>) {
|
||||
if (totalCount_<%=cid%> == retrievedCount_<%=cid%> || recordsPerPage_<%=cid%> == -1 || (items_<%=cid%>.length - 1) < 1 || pageNumber_<%=cid %> == totalPage_<%=cid %> || limit_<%=cid%> == retrievedCount_<%=cid%>) {
|
||||
continueFlag_<%=cid%> = false;
|
||||
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
|
||||
readRecordsSize_<%=cid%> = limit_<%=cid%> - retrievedCount_<%=cid%>;
|
||||
|
||||
@@ -843,3 +843,5 @@ PasswordController.NewPassword=Enter a new password
|
||||
PasswordController.NoteConvention=Note: Follow the usual Java convention which requires text to be surrounded by double quotes.
|
||||
NodeSelectedDialog.title=Select node
|
||||
NodeSelectedDialog.msg=Please select a node.
|
||||
SaveRoutineContentError.ErrorTitile=Error
|
||||
SaveRoutineContentError.ErrorContent=Save Routine Failed!
|
||||
@@ -158,6 +158,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setName(final String s) {
|
||||
name = s;
|
||||
}
|
||||
@@ -167,10 +168,12 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getVariableName()
|
||||
*/
|
||||
@Override
|
||||
public String getVariableName() {
|
||||
return "__" + name + "__"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCategory(final EComponentCategory cat) {
|
||||
category = cat;
|
||||
}
|
||||
@@ -180,6 +183,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getCategory()
|
||||
*/
|
||||
@Override
|
||||
public EComponentCategory getCategory() {
|
||||
return this.category;
|
||||
}
|
||||
@@ -189,6 +193,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setDisplayName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setDisplayName(final String s) {
|
||||
displayName = s;
|
||||
}
|
||||
@@ -199,6 +204,7 @@ public class ElementParameter implements IElementParameter {
|
||||
* @seeorg.talend.designer.core.model.components.IDesignerElementParameter#setField(org.talend.core.model.designer.
|
||||
* EParameterFieldType)
|
||||
*/
|
||||
@Override
|
||||
public void setFieldType(final EParameterFieldType type) {
|
||||
field = type;
|
||||
}
|
||||
@@ -208,10 +214,12 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setValue(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void setValue(final Object o) {
|
||||
value = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -221,6 +229,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getDisplayName()
|
||||
*/
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
@@ -230,6 +239,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getField()
|
||||
*/
|
||||
@Override
|
||||
public EParameterFieldType getFieldType() {
|
||||
return field;
|
||||
}
|
||||
@@ -239,26 +249,32 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getValue()
|
||||
*/
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListItemsDisplayName(final String[] list) {
|
||||
itemsDisplayName = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getListItemsDisplayName() {
|
||||
return itemsDisplayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListItemsDisplayCodeName(final String[] list) {
|
||||
itemsDisplayCodeName = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getListItemsDisplayCodeName() {
|
||||
return itemsDisplayCodeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListItemsValue(final Object[] list) {
|
||||
if (this.getFieldType() == EParameterFieldType.TABLE) {
|
||||
EParameterFieldType.AS400_CHECK.getClass();
|
||||
@@ -266,42 +282,52 @@ public class ElementParameter implements IElementParameter {
|
||||
itemsValue = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getListItemsValue() {
|
||||
return itemsValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultClosedListValue(Object o) {
|
||||
defaultClosedListValue = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDefaultClosedListValue() {
|
||||
return defaultClosedListValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListRepositoryItems(final String[] list) {
|
||||
itemsRepository = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getListRepositoryItems() {
|
||||
return itemsRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListItemsShowIf(String[] list) {
|
||||
itemsShowIf = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getListItemsShowIf() {
|
||||
return itemsShowIf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setListItemsNotShowIf(String[] list) {
|
||||
itemsNotShowIf = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getListItemsNotShowIf() {
|
||||
return itemsNotShowIf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexOfItemFromList(String item) {
|
||||
int index = -1;
|
||||
boolean found = false;
|
||||
@@ -324,22 +350,27 @@ public class ElementParameter implements IElementParameter {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNbLines() {
|
||||
return this.nbLines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNbLines(final int nbLines) {
|
||||
this.nbLines = nbLines;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumRow() {
|
||||
return this.numRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNumRow(final int numRow) {
|
||||
this.numRow = numRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadOnly() {
|
||||
if (element != null) {
|
||||
return (this.readOnly || element.isReadOnly());
|
||||
@@ -351,54 +382,67 @@ public class ElementParameter implements IElementParameter {
|
||||
return this.readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadOnly(final boolean readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRequired() {
|
||||
return this.required;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRequired(final boolean required) {
|
||||
this.required = required;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShow(final boolean show) {
|
||||
this.show = show;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepositoryValue() {
|
||||
return this.repositoryValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryValue(String repositoryValue) {
|
||||
this.repositoryValue = repositoryValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepositoryValueUsed() {
|
||||
return this.repositoryValueUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryValueUsed(boolean repositoryUsed) {
|
||||
this.repositoryValueUsed = repositoryUsed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShowIf() {
|
||||
return showIf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShowIf(String showIf) {
|
||||
this.showIf = showIf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNotShowIf() {
|
||||
return notShowIf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNotShowIf(String notShowIf) {
|
||||
this.notShowIf = notShowIf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShow(List<? extends IElementParameter> listParam) {
|
||||
boolean showParameter = false;
|
||||
|
||||
@@ -415,6 +459,7 @@ public class ElementParameter implements IElementParameter {
|
||||
}
|
||||
|
||||
// added by dlin for feature TDI-22421
|
||||
@Override
|
||||
public boolean isRequired(List<? extends IElementParameter> listParam) {
|
||||
boolean requiredParameter = false;
|
||||
if (this.requiredIF != null && !required) {
|
||||
@@ -425,6 +470,7 @@ public class ElementParameter implements IElementParameter {
|
||||
return requiredParameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShow(String conditionShowIf, String conditionNotShowIf, List<? extends IElementParameter> listParam) {
|
||||
boolean showParameter = false;
|
||||
|
||||
@@ -454,19 +500,29 @@ public class ElementParameter implements IElementParameter {
|
||||
return showParameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IElementParameterDefaultValue> getDefaultValues() {
|
||||
return this.defaultValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDefaultValues(List<IElementParameterDefaultValue> defaultValues) {
|
||||
this.defaultValues = defaultValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValueToDefault(List<? extends IElementParameter> listParam) {
|
||||
for (IElementParameterDefaultValue defaultValue : defaultValues) {
|
||||
if (defaultValues == null) {
|
||||
return;
|
||||
}
|
||||
int size = defaultValues.size();
|
||||
// a performance improvement, and keep the result like before.
|
||||
// for (IElementParameterDefaultValue defaultValue : defaultValues) {
|
||||
for (int i = size - 1; 0 <= i; i--) {
|
||||
IElementParameterDefaultValue iDefaultValue = defaultValues.get(i);
|
||||
boolean setDefaultValue = false;
|
||||
String conditionIf = defaultValue.getIfCondition();
|
||||
String conditionNotIf = defaultValue.getNotIfCondition();
|
||||
String conditionIf = iDefaultValue.getIfCondition();
|
||||
String conditionNotIf = iDefaultValue.getNotIfCondition();
|
||||
|
||||
if ((conditionIf != null) || (conditionNotIf != null)) {
|
||||
if (conditionIf != null) {
|
||||
@@ -477,26 +533,31 @@ public class ElementParameter implements IElementParameter {
|
||||
}
|
||||
if (setDefaultValue) {
|
||||
if (this.field.equals(EParameterFieldType.CHECK) || this.field.equals(EParameterFieldType.RADIO)) {
|
||||
setValue(new Boolean(defaultValue.getDefaultValue().toString()));
|
||||
setValue(new Boolean(iDefaultValue.getDefaultValue().toString()));
|
||||
} else {
|
||||
setValue(defaultValue.getDefaultValue());
|
||||
setValue(iDefaultValue.getDefaultValue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IElement getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setElement(IElement element) {
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBasedOnSchema() {
|
||||
return basedOnSchema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBasedOnSchema(boolean basedOnSchema) {
|
||||
this.basedOnSchema = basedOnSchema;
|
||||
}
|
||||
@@ -509,10 +570,12 @@ public class ElementParameter implements IElementParameter {
|
||||
return name + ": " + value.toString(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFilter(String filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
@@ -522,6 +585,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @return the noCheck
|
||||
*/
|
||||
@Override
|
||||
public boolean isNoCheck() {
|
||||
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
@@ -542,6 +606,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @param noCheck the noCheck to set
|
||||
*/
|
||||
@Override
|
||||
public void setNoCheck(boolean noCheck) {
|
||||
this.noCheck = noCheck;
|
||||
}
|
||||
@@ -551,6 +616,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @return the context
|
||||
*/
|
||||
@Override
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
@@ -560,6 +626,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @param context the context to set
|
||||
*/
|
||||
@Override
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
@@ -569,6 +636,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @return the childParameters
|
||||
*/
|
||||
@Override
|
||||
public Map<String, IElementParameter> getChildParameters() {
|
||||
if (childParameters == null) {
|
||||
childParameters = new HashMap<String, IElementParameter>();
|
||||
@@ -576,10 +644,12 @@ public class ElementParameter implements IElementParameter {
|
||||
return childParameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IElementParameter getParentParameter() {
|
||||
return parentParameter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentParameter(IElementParameter parentParameter) {
|
||||
this.parentParameter = parentParameter;
|
||||
// keep the same category with parent.
|
||||
@@ -614,6 +684,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getGroup()
|
||||
*/
|
||||
@Override
|
||||
public String getGroup() {
|
||||
return this.groupName;
|
||||
}
|
||||
@@ -623,6 +694,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setGroup(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setGroup(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
@@ -632,6 +704,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getGroupDisplayName()
|
||||
*/
|
||||
@Override
|
||||
public String getGroupDisplayName() {
|
||||
return this.groupDisplayName;
|
||||
}
|
||||
@@ -641,6 +714,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setGroupDisplayName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setGroupDisplayName(String groupDisplayName) {
|
||||
this.groupDisplayName = groupDisplayName;
|
||||
}
|
||||
@@ -650,6 +724,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getContextMode()
|
||||
*/
|
||||
@Override
|
||||
public boolean isContextMode() {
|
||||
return this.contextMode;
|
||||
}
|
||||
@@ -659,6 +734,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setContextMode(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setContextMode(boolean mode) {
|
||||
this.contextMode = mode;
|
||||
}
|
||||
@@ -668,6 +744,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getLabelFromRepository()
|
||||
*/
|
||||
@Override
|
||||
public String getLabelFromRepository() {
|
||||
return this.labelFromRepository;
|
||||
}
|
||||
@@ -677,6 +754,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setLabelFromRepository(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setLabelFromRepository(String label) {
|
||||
this.labelFromRepository = label;
|
||||
|
||||
@@ -687,6 +765,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @return the color
|
||||
*/
|
||||
@Override
|
||||
public RGB getColor() {
|
||||
return this.color;
|
||||
}
|
||||
@@ -696,6 +775,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @param color the color to set
|
||||
*/
|
||||
@Override
|
||||
public void setColor(RGB color) {
|
||||
this.color = color;
|
||||
}
|
||||
@@ -705,6 +785,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @return the backgroundColor
|
||||
*/
|
||||
@Override
|
||||
public RGB getBackgroundColor() {
|
||||
return this.backgroundColor;
|
||||
}
|
||||
@@ -714,6 +795,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @param backgroundColor the backgroundColor to set
|
||||
*/
|
||||
@Override
|
||||
public void setBackgroundColor(RGB backgroundColor) {
|
||||
this.backgroundColor = backgroundColor;
|
||||
}
|
||||
@@ -723,6 +805,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#isBasedOnSubjobStarts()
|
||||
*/
|
||||
@Override
|
||||
public boolean isBasedOnSubjobStarts() {
|
||||
return basedOnSubjobStarts;
|
||||
}
|
||||
@@ -732,6 +815,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setBasedOnSubjobStarts(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setBasedOnSubjobStarts(boolean basedOnSubjobStarts) {
|
||||
this.basedOnSubjobStarts = basedOnSubjobStarts;
|
||||
}
|
||||
@@ -741,6 +825,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#isDynamicSettings()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDynamicSettings() {
|
||||
return this.dynamicSettings;
|
||||
}
|
||||
@@ -750,6 +835,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setDynamicSettings(java.lang.Boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setDynamicSettings(boolean dynamicSettings) {
|
||||
this.dynamicSettings = dynamicSettings;
|
||||
}
|
||||
@@ -759,6 +845,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getListItemsNotReadOnlyIf()
|
||||
*/
|
||||
@Override
|
||||
public String[] getListItemsNotReadOnlyIf() {
|
||||
return this.itemsNotReadOnlyIf;
|
||||
}
|
||||
@@ -768,6 +855,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getListItemsReadOnlyIf()
|
||||
*/
|
||||
@Override
|
||||
public String[] getListItemsReadOnlyIf() {
|
||||
return this.itemsReadOnlyIf;
|
||||
}
|
||||
@@ -777,6 +865,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getNotReadOnlyIf()
|
||||
*/
|
||||
@Override
|
||||
public String getNotReadOnlyIf() {
|
||||
// TODO Auto-generated method stub
|
||||
return this.notReadonlyIf;
|
||||
@@ -787,6 +876,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#getReadOnlyIf()
|
||||
*/
|
||||
@Override
|
||||
public String getReadOnlyIf() {
|
||||
// TODO Auto-generated method stub
|
||||
return this.readonlyIf;
|
||||
@@ -797,6 +887,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#isReadOnly(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public boolean isReadOnly(List<? extends IElementParameter> listParam) {
|
||||
boolean readonlyParameter = false;
|
||||
|
||||
@@ -818,6 +909,7 @@ public class ElementParameter implements IElementParameter {
|
||||
* @see org.talend.core.model.process.IElementParameter#isReadOnly(java.lang.String, java.lang.String,
|
||||
* java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public boolean isReadOnly(String conditionReadOnlyIf, String conditionNotReadOnlyIf,
|
||||
List<? extends IElementParameter> listParam) {
|
||||
boolean readonlyParameter = false;
|
||||
@@ -839,6 +931,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setListItemsNotReadOnlyIf(java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public void setListItemsNotReadOnlyIf(String[] list) {
|
||||
itemsNotReadOnlyIf = list;
|
||||
|
||||
@@ -849,6 +942,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setListItemsReadOnlyIf(java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public void setListItemsReadOnlyIf(String[] list) {
|
||||
itemsReadOnlyIf = list;
|
||||
|
||||
@@ -859,6 +953,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setNotReadOnlyIf(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setNotReadOnlyIf(String notReadOnly) {
|
||||
this.notReadonlyIf = notReadOnly;
|
||||
}
|
||||
@@ -868,26 +963,32 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @see org.talend.core.model.process.IElementParameter#setReadOnlyIf(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setReadOnlyIf(String readOnly) {
|
||||
this.readonlyIf = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isColumnsBasedOnSchema() {
|
||||
return this.columnsBasedOnSchema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColumnsBasedOnSchema(boolean columnsBasedOnSchema) {
|
||||
this.columnsBasedOnSchema = columnsBasedOnSchema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNoContextAssist() {
|
||||
return this.noContextAssist;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoContextAssist(boolean enable) {
|
||||
this.noContextAssist = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IElementParameter getClone() {
|
||||
IElementParameter clone = new ElementParameter(this.element);
|
||||
|
||||
@@ -1038,6 +1139,7 @@ public class ElementParameter implements IElementParameter {
|
||||
*
|
||||
* @return the maxlength
|
||||
*/
|
||||
@Override
|
||||
public int getMaxlength() {
|
||||
return this.maxlength;
|
||||
}
|
||||
|
||||
@@ -311,20 +311,34 @@ public final class Expression {
|
||||
// #LINK@NODE, #PREVIOUS@NODE, #NEXT@NODE ----->implement them later
|
||||
if ((variableName != null) && (variableValue != null)) {
|
||||
if (varNames[0].equals("#LINK@NODE")) { //$NON-NLS-1$
|
||||
INode node = null;
|
||||
if (currentParam != null && currentParam.getElement() instanceof INode) {
|
||||
INode node = (INode) currentParam.getElement();
|
||||
node = (INode) currentParam.getElement();
|
||||
} else if (currentParam == null) {
|
||||
if (listParam != null && listParam.size() > 0) {
|
||||
IElement element = listParam.get(0).getElement();
|
||||
if (element instanceof INode) {
|
||||
node = (INode) element;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node != null) {
|
||||
String relatedNodeName = ElementParameterParser.getValue(node, "__" + varNames[1] + "__"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// if relatedNodeName is empty, maybe means this property have not been setted
|
||||
if (relatedNodeName != null && !relatedNodeName.trim().isEmpty()) {
|
||||
List<? extends INode> generatingNodes = node.getProcess().getGeneratingNodes();
|
||||
for (INode aNode : generatingNodes) {
|
||||
if (aNode.getUniqueName().equals(relatedNodeName)) {
|
||||
simpleExpression = simpleExpression.replace(varNames[0] + "." + varNames[1] + ".", ""); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
|
||||
List<? extends IElementParameter> elementParameters = aNode.getElementParameters();
|
||||
// let's supose the currentParam = null, there won't want deal with the TABLE field, only
|
||||
// let's supose the currentParam = null, there won't want deal with the TABLE field,
|
||||
// only
|
||||
// deal with LIST/CHECKBOX
|
||||
return evaluate(simpleExpression, elementParameters);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -662,6 +676,19 @@ public final class Expression {
|
||||
// debug: System.out.println(leftString + " => " +
|
||||
// leftExpression.isValid());
|
||||
}
|
||||
|
||||
boolean needValidRightExpression = true;
|
||||
if (expression.getCondition().equals(AND) && !expression.getLeftExpression().isValid()) {
|
||||
// if left expression is already false, then needn't continue to validate right expression
|
||||
expression.setValid(false);
|
||||
needValidRightExpression = false;
|
||||
} else if (expression.getCondition().equals(OR) && expression.getLeftExpression().isValid()) {
|
||||
// if left expression is already true, then need't continue to validate right expression
|
||||
expression.setValid(true);
|
||||
needValidRightExpression = false;
|
||||
}
|
||||
|
||||
if (needValidRightExpression) {
|
||||
String rightString = string.substring(i + 3, string.length()).trim();
|
||||
Expression rightExpression = new Expression(rightString);
|
||||
expression.setRightExpression(rightExpression);
|
||||
@@ -688,6 +715,7 @@ public final class Expression {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if after an expression between bracket there's no other expression,
|
||||
// then the validation of the expression
|
||||
// will depends on the "left" expression.
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.talend.core.model.process.AbstractNode;
|
||||
import org.talend.core.model.process.EComponentCategory;
|
||||
import org.talend.core.model.process.EConnectionType;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
import org.talend.core.model.process.ElementParameterParser;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IConnectionCategory;
|
||||
import org.talend.core.model.process.IElement;
|
||||
@@ -1770,6 +1771,20 @@ public class DataProcess implements IGeneratingProcess {
|
||||
dataNodeList.remove(preStaLogConNode);
|
||||
dataNodeList.add(0, preStaLogConNode);
|
||||
}
|
||||
|
||||
// tag all the components after Iterator(Parallel)
|
||||
// !iterator with parallel shouldn't work on merge!
|
||||
for (INode node : dataNodeList) {
|
||||
if (node.isSubProcessStart() && node.isActivate()) {
|
||||
tagComponentAfterParallelIterator(node);
|
||||
}
|
||||
}
|
||||
for (INode node : dataNodeList) {
|
||||
if (node.isSubProcessStart() && node.isActivate()) {
|
||||
tagSubProcessAfterParallelIterator(node);
|
||||
}
|
||||
}
|
||||
|
||||
checkRefList = null;
|
||||
checkMultipleMap = null;
|
||||
checktUniteMap = null;
|
||||
@@ -1781,6 +1796,50 @@ public class DataProcess implements IGeneratingProcess {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC bchen Comment method "tagSubProcessAfterParallelIterator".
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
private void tagSubProcessAfterParallelIterator(INode node) {
|
||||
if (node.getIncomingConnections() != null && node.getIncomingConnections().size() != 0) {
|
||||
IConnection connection = node.getIncomingConnections().get(0);
|
||||
if (connection.getLineStyle().equals(EConnectionType.ON_COMPONENT_OK)
|
||||
|| connection.getLineStyle().equals(EConnectionType.ON_COMPONENT_ERROR)
|
||||
|| connection.getLineStyle().equals(EConnectionType.ON_SUBJOB_OK)
|
||||
|| connection.getLineStyle().equals(EConnectionType.ON_SUBJOB_ERROR)
|
||||
|| connection.getLineStyle().equals(EConnectionType.RUN_IF)) {// add if you think it should be count
|
||||
// for parallel Iterator
|
||||
if (((AbstractNode) connection.getSource()).getParallelIterator() != null) {
|
||||
((AbstractNode) node).setParallelIterator(((AbstractNode) connection.getSource()).getParallelIterator());
|
||||
tagComponentAfterParallelIterator(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC bchen Comment method "tagComponentAfterParallelIterator".
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
private void tagComponentAfterParallelIterator(INode node) {
|
||||
for (IConnection connection : node.getOutgoingSortedConnections()) {
|
||||
if (connection.getTarget().isActivate()) {
|
||||
|
||||
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN | IConnectionCategory.USE_ITERATE)) {
|
||||
if (((AbstractNode) node).getParallelIterator() != null) {
|
||||
((AbstractNode) connection.getTarget()).setParallelIterator(((AbstractNode) node).getParallelIterator());
|
||||
} else if (connection.getLineStyle().equals(EConnectionType.ITERATE)
|
||||
&& Boolean.TRUE.toString().equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) {
|
||||
((AbstractNode) connection.getTarget()).setParallelIterator(connection.getTarget().getUniqueName());
|
||||
}
|
||||
tagComponentAfterParallelIterator(connection.getTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPigLoadComponent() {
|
||||
// if (PluginChecker.isPigudfPluginLoaded()) {
|
||||
// for (INode dataNode : dataNodeList) {
|
||||
|
||||
@@ -16,9 +16,15 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.emf.common.notify.Notification;
|
||||
import org.eclipse.emf.common.notify.impl.AdapterImpl;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
@@ -55,16 +61,19 @@ import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.properties.ByteArray;
|
||||
import org.talend.core.model.properties.FileItem;
|
||||
import org.talend.core.model.properties.Information;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.Folder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.utils.RepositoryManagerHelper;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.ui.ILastVersionChecker;
|
||||
import org.talend.core.ui.IUIRefresher;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
@@ -74,6 +83,7 @@ import org.talend.designer.core.ui.action.SaveAsRoutineAction;
|
||||
import org.talend.designer.core.ui.action.SaveAsSQLPatternAction;
|
||||
import org.talend.designer.core.ui.views.problems.Problems;
|
||||
import org.talend.designer.core.utils.DesignerColorUtils;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
import org.talend.repository.editor.RepositoryEditorInput;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
@@ -299,6 +309,27 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
|
||||
|
||||
}
|
||||
|
||||
public void resetItem() throws PersistenceException {
|
||||
if (item.getProperty().eResource() == null || item.eResource() == null) {
|
||||
IRepositoryService service = CoreRuntimePlugin.getInstance().getRepositoryService();
|
||||
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
|
||||
//
|
||||
// Property updated = factory.getUptodateProperty(getItem().getProperty());
|
||||
Property updatedProperty = null;
|
||||
try {
|
||||
factory.initialize();
|
||||
IRepositoryViewObject repositoryViewObject = factory.getLastVersion(new Project(ProjectManager.getInstance()
|
||||
.getProject(item.getProperty().getItem())), item.getProperty().getId());
|
||||
if (repositoryViewObject != null) {
|
||||
updatedProperty = repositoryViewObject.getProperty();
|
||||
item = (FileItem) updatedProperty.getItem();
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doSave(final IProgressMonitor monitor) {
|
||||
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
|
||||
@@ -325,6 +356,7 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
|
||||
super.doSave(monitor);
|
||||
|
||||
try {
|
||||
resetItem();
|
||||
ByteArray byteArray = item.getContent();
|
||||
byteArray.setInnerContentFromFile(((FileEditorInput) getEditorInput()).getFile());
|
||||
try {
|
||||
@@ -343,8 +375,10 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
|
||||
refreshJobAndSave(repFactory);
|
||||
}
|
||||
};
|
||||
repositoryWorkUnit.setAvoidSvnUpdate(true);
|
||||
repositoryWorkUnit.setAvoidUnloadResources(true);
|
||||
repFactory.executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||
|
||||
repositoryWorkUnit.throwPersistenceExceptionIfAny();
|
||||
// for bug 11930: Unable to save Routines.* in db project
|
||||
|
||||
// repFactory.save(item);
|
||||
@@ -357,13 +391,47 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
|
||||
|
||||
}
|
||||
|
||||
private void refreshJobAndSave(final IProxyRepositoryFactory repFactory) {
|
||||
private void refreshJobAndSave(final IProxyRepositoryFactory repFactory) throws PersistenceException {
|
||||
|
||||
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
try {
|
||||
// cause it to update MaxInformationLevel
|
||||
repFactory.save(item);
|
||||
} catch (Exception e) {
|
||||
} catch (PersistenceException e) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, DesignerPlugin.ID, "Save Routine failed!", e));
|
||||
}
|
||||
// update editor image
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try {
|
||||
ISchedulingRule schedulingRule = workspace.getRoot();
|
||||
// the update the project files need to be done in the workspace runnable to avoid all
|
||||
// notification
|
||||
// of changes before the end of the modifications.
|
||||
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
|
||||
} catch (CoreException e) {
|
||||
throw new InvocationTargetException(e);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
PlatformUI.getWorkbench().getProgressService().run(false, false, iRunnableWithProgress);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new PersistenceException(e);
|
||||
} catch (InterruptedException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
|
||||
setTitleImage(getTitleImage());
|
||||
|
||||
}
|
||||
|
||||
@@ -433,6 +433,10 @@ public class NodesPasteCommand extends Command {
|
||||
copyOfMetadataList.add(newTable);
|
||||
}
|
||||
pastedNode.setMetadataList(copyOfMetadataList);
|
||||
}
|
||||
|
||||
// TDQ-10039 extract this code from above "else",aslo consider tMatchGroup.
|
||||
if (mainConnector.isMultiSchema() || copiedNode.getComponent().getName().startsWith("tMatchGroup")) { //$NON-NLS-1$
|
||||
IExternalNode externalNode = pastedNode.getExternalNode();
|
||||
if (externalNode != null) {
|
||||
if (copiedNode.getExternalData() != null) {
|
||||
|
||||
@@ -77,7 +77,7 @@ public class PropertyChangeCommand extends Command {
|
||||
|
||||
private final Map<IElementParameter, Object> oldElementValues;
|
||||
|
||||
private ChangeMetadataCommand changeMetadataCommand;
|
||||
private List<ChangeMetadataCommand> changeMetadataCommands;
|
||||
|
||||
private String propertyTypeName;
|
||||
|
||||
@@ -106,6 +106,7 @@ public class PropertyChangeCommand extends Command {
|
||||
newValue = propValue;
|
||||
toUpdate = false;
|
||||
oldElementValues = new HashMap<IElementParameter, Object>();
|
||||
changeMetadataCommands = new ArrayList<ChangeMetadataCommand>();
|
||||
setLabel(Messages.getString("PropertyChangeCommand.Label")); //$NON-NLS-1$
|
||||
// for job settings extra (feature 2710)
|
||||
// if (JobSettingsConstants.isExtraParameter(propName) ||
|
||||
@@ -128,9 +129,50 @@ public class PropertyChangeCommand extends Command {
|
||||
// }
|
||||
}
|
||||
|
||||
private List<INode> getRelativeNodes(List<? extends IElementParameter> elementParameters) {
|
||||
List<INode> retList = null;
|
||||
if (elementParameters == null || elementParameters.size() == 0) {
|
||||
return retList;
|
||||
}
|
||||
IElement element = elementParameters.get(0).getElement();
|
||||
if (element instanceof Node) {
|
||||
Node operatingNode = (Node) element;
|
||||
IProcess process = operatingNode.getProcess();
|
||||
if (process == null) {
|
||||
return retList;
|
||||
}
|
||||
List<? extends INode> graphicNodes = process.getGraphicalNodes();
|
||||
if (graphicNodes == null || graphicNodes.size() == 0) {
|
||||
return retList;
|
||||
}
|
||||
String nodeName = operatingNode.getLabel();
|
||||
retList = new ArrayList<INode>();
|
||||
for (INode node : graphicNodes) {
|
||||
List<? extends IElementParameter> nodeElementParameters = node.getElementParameters();
|
||||
if (nodeElementParameters == null || nodeElementParameters.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
for (IElementParameter elementParameter : nodeElementParameters) {
|
||||
if (elementParameter.getFieldType() == EParameterFieldType.COMPONENT_LIST) {
|
||||
Object objName = elementParameter.getValue();
|
||||
if (objName == null) {
|
||||
continue;
|
||||
}
|
||||
String relatedComponentsName = objName.toString();
|
||||
if (relatedComponentsName.equals(nodeName)) {
|
||||
retList.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
IElementParameter currentParam = elem.getElementParameter(propName);
|
||||
changeMetadataCommands.clear();
|
||||
oldElementValues.clear();
|
||||
if (currentParam == null) {
|
||||
return;
|
||||
@@ -316,11 +358,93 @@ public class PropertyChangeCommand extends Command {
|
||||
if (!toUpdate
|
||||
&& (currentParam.getFieldType().equals(EParameterFieldType.RADIO)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CHECK) || currentParam.getFieldType().equals(
|
||||
EParameterFieldType.AS400_CHECK))) {
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.CHECK)
|
||||
|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK) || currentParam.getFieldType()
|
||||
.equals(EParameterFieldType.COMPONENT_LIST))) {
|
||||
toUpdate = false;
|
||||
for (int i = 0; i < elem.getElementParameters().size(); i++) {
|
||||
IElementParameter testedParam = elem.getElementParameters().get(i);
|
||||
setDefaultValues(currentParam, elem);
|
||||
}
|
||||
|
||||
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
|
||||
toUpdate = true;
|
||||
}
|
||||
|
||||
if (toUpdate) {
|
||||
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||
}
|
||||
// see bug 9151:100% CPU when typing text.
|
||||
if (getNewValue() instanceof String && elem instanceof INode) {
|
||||
INode curNode = (INode) elem;
|
||||
String uniqueName = curNode.getUniqueName();
|
||||
IProcess process = curNode.getProcess();
|
||||
if (process != null && process instanceof IProcess2) {
|
||||
IProcess2 process2 = (IProcess2) process;
|
||||
List<? extends INode> generatingNodes = null;
|
||||
if (process2.isProcessModified()) {
|
||||
process2.setProcessModified(false);
|
||||
generatingNodes = process2.getGeneratingNodes();
|
||||
if (generatingNodes != null) {
|
||||
for (INode genNode : new ArrayList<INode>(generatingNodes)) {
|
||||
if (genNode.getUniqueName().equals(uniqueName)) {
|
||||
IElementParameter genParam = genNode.getElementParameter(propName);
|
||||
if (genParam != null) {
|
||||
genParam.setValue(newValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process2.setProcessModified(true);
|
||||
codeViewUpdater.startIfExecutable(elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
updateRelativeNodesIfNeeded(currentParam);
|
||||
//
|
||||
if (elem instanceof IGraphicalNode) {
|
||||
((IGraphicalNode) elem).checkAndRefreshNode();
|
||||
}
|
||||
|
||||
// See feature 3902
|
||||
if (needUpdateMonitorConnection()) {
|
||||
((Connection) elem).setMonitorConnection((Boolean) currentParam.getValue());
|
||||
}
|
||||
refreshMR(propName);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC cmeng Comment method "updateRelativeNodesIfNeeded".
|
||||
*
|
||||
* @param currentParam
|
||||
*/
|
||||
private void updateRelativeNodesIfNeeded(IElementParameter currentParam) {
|
||||
boolean originalUpdateValue = toUpdate;
|
||||
List<INode> relativeNodes = getRelativeNodes(elem.getElementParameters());
|
||||
if (relativeNodes != null && 0 < relativeNodes.size()) {
|
||||
for (INode node : relativeNodes) {
|
||||
toUpdate = false;
|
||||
setDefaultValues(currentParam, node);
|
||||
if (toUpdate) {
|
||||
node.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
toUpdate = originalUpdateValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC cmeng Comment method "setDefaultValues".
|
||||
*
|
||||
* @param currentParam
|
||||
*/
|
||||
private void setDefaultValues(IElementParameter currentParam, IElement node) {
|
||||
List<? extends IElementParameter> elementParameters = node.getElementParameters();
|
||||
if (elementParameters == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < elementParameters.size(); i++) {
|
||||
IElementParameter testedParam = elementParameters.get(i);
|
||||
|
||||
String showIf = testedParam.getShowIf();
|
||||
String notShowIf = testedParam.getNotShowIf();
|
||||
@@ -382,57 +506,10 @@ public class PropertyChangeCommand extends Command {
|
||||
}
|
||||
}
|
||||
}
|
||||
setDefaultValues(currentParam, testedParam);
|
||||
setDefaultValues(currentParam, testedParam, node);
|
||||
}
|
||||
}
|
||||
|
||||
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
|
||||
toUpdate = true;
|
||||
}
|
||||
|
||||
if (toUpdate) {
|
||||
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||
}
|
||||
// see bug 9151:100% CPU when typing text.
|
||||
if (getNewValue() instanceof String && elem instanceof INode) {
|
||||
INode curNode = (INode) elem;
|
||||
String uniqueName = curNode.getUniqueName();
|
||||
IProcess process = curNode.getProcess();
|
||||
if (process != null && process instanceof IProcess2) {
|
||||
IProcess2 process2 = (IProcess2) process;
|
||||
List<? extends INode> generatingNodes = null;
|
||||
if (process2.isProcessModified()) {
|
||||
process2.setProcessModified(false);
|
||||
generatingNodes = process2.getGeneratingNodes();
|
||||
if (generatingNodes != null) {
|
||||
for (INode genNode : new ArrayList<INode>(generatingNodes)) {
|
||||
if (genNode.getUniqueName().equals(uniqueName)) {
|
||||
IElementParameter genParam = genNode.getElementParameter(propName);
|
||||
if (genParam != null) {
|
||||
genParam.setValue(newValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process2.setProcessModified(true);
|
||||
codeViewUpdater.startIfExecutable(elem);
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
if (elem instanceof IGraphicalNode) {
|
||||
((IGraphicalNode) elem).checkAndRefreshNode();
|
||||
}
|
||||
|
||||
// See feature 3902
|
||||
if (needUpdateMonitorConnection()) {
|
||||
((Connection) elem).setMonitorConnection((Boolean) currentParam.getValue());
|
||||
}
|
||||
refreshMR(propName);
|
||||
}
|
||||
|
||||
private boolean needUpdateMonitorConnection() {
|
||||
|
||||
if (elem instanceof Connection) {
|
||||
@@ -465,7 +542,11 @@ public class PropertyChangeCommand extends Command {
|
||||
* @param testedParam Tested parameter, to know if there is a link for the default values between this parameter and
|
||||
* the current.
|
||||
*/
|
||||
private void setDefaultValues(IElementParameter currentParam, IElementParameter testedParam) {
|
||||
private void setDefaultValues(IElementParameter currentParam, IElementParameter testedParam, IElement referenceNode) {
|
||||
List<? extends IElementParameter> elementParameters = referenceNode.getElementParameters();
|
||||
if (elementParameters == null) {
|
||||
return;
|
||||
}
|
||||
boolean contains = false;
|
||||
|
||||
// zli
|
||||
@@ -495,13 +576,13 @@ public class PropertyChangeCommand extends Command {
|
||||
if (testedParam.getListItemsShowIf() != null) {
|
||||
String conditionShowIf = testedParam.getListItemsShowIf()[index];
|
||||
if (conditionShowIf != null) {
|
||||
isCurrentComboValid = Expression.evaluate(conditionShowIf, elem.getElementParameters());
|
||||
isCurrentComboValid = Expression.evaluate(conditionShowIf, elementParameters);
|
||||
}
|
||||
}
|
||||
if (testedParam.getListItemsNotShowIf() != null) {
|
||||
String conditionNotShowIf = testedParam.getListItemsNotShowIf()[index];
|
||||
if (conditionNotShowIf != null) {
|
||||
isCurrentComboValid = !Expression.evaluate(conditionNotShowIf, elem.getElementParameters());
|
||||
isCurrentComboValid = !Expression.evaluate(conditionNotShowIf, elementParameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -509,7 +590,7 @@ public class PropertyChangeCommand extends Command {
|
||||
if (!isCurrentComboValid && testedParam.getListItemsShowIf() != null) {
|
||||
for (String condition : testedParam.getListItemsShowIf()) {
|
||||
if (condition != null && condition.contains(currentParam.getName())) {
|
||||
boolean isValid = Expression.evaluate(condition, elem.getElementParameters());
|
||||
boolean isValid = Expression.evaluate(condition, elementParameters);
|
||||
if (isValid) {
|
||||
int index = ArrayUtils.indexOf(testedParam.getListItemsShowIf(), condition);
|
||||
testedParam.setValue(testedParam.getListItemsValue()[index]);
|
||||
@@ -521,7 +602,7 @@ public class PropertyChangeCommand extends Command {
|
||||
if (!isCurrentComboValid && !contains && testedParam.getListItemsNotShowIf() != null) {
|
||||
for (String condition : testedParam.getListItemsNotShowIf()) {
|
||||
if (condition != null && condition.contains(currentParam.getName())) {
|
||||
boolean isValid = !Expression.evaluate(condition, elem.getElementParameters());
|
||||
boolean isValid = !Expression.evaluate(condition, elementParameters);
|
||||
if (isValid) {
|
||||
int index = ArrayUtils.indexOf(testedParam.getListItemsNotShowIf(), condition);
|
||||
testedParam.setValue(testedParam.getListItemsValue()[index]);
|
||||
@@ -542,11 +623,11 @@ public class PropertyChangeCommand extends Command {
|
||||
&& !testedParam.getFieldType().equals(EParameterFieldType.RADIO)) {
|
||||
oldMapping = (String) testedParam.getValue();
|
||||
}
|
||||
testedParam.setValueToDefault(elem.getElementParameters());
|
||||
testedParam.setValueToDefault(elementParameters);
|
||||
if (testedParam.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
|
||||
String newMapping = (String) testedParam.getValue();
|
||||
if (!oldMapping.equals(newMapping)) {
|
||||
Node node = (Node) elem;
|
||||
Node node = (Node) referenceNode;
|
||||
if (node.getMetadataList().size() > 0) {
|
||||
// to change with:
|
||||
// IMetadataTable metadataTable = node.getMetadataFromConnector(testedParam.getContext());
|
||||
@@ -557,7 +638,7 @@ public class PropertyChangeCommand extends Command {
|
||||
}
|
||||
} else {
|
||||
// See issue 975, update the schema.
|
||||
Node node = (Node) elem;
|
||||
Node node = (Node) referenceNode;
|
||||
if (node.getMetadataList().size() > 0) {
|
||||
IMetadataTable metadataTable = null;
|
||||
IMetadataTable newMetadataTable = null;
|
||||
@@ -629,7 +710,9 @@ public class PropertyChangeCommand extends Command {
|
||||
newMetadataTable = metadataTable;
|
||||
}
|
||||
|
||||
changeMetadataCommand = new ChangeMetadataCommand(node, null, null, newMetadataTable);
|
||||
ChangeMetadataCommand changeMetadataCommand = new ChangeMetadataCommand(node, null, null,
|
||||
newMetadataTable);
|
||||
changeMetadataCommands.add(changeMetadataCommand);
|
||||
changeMetadataCommand.execute(true);
|
||||
}
|
||||
}
|
||||
@@ -670,9 +753,13 @@ public class PropertyChangeCommand extends Command {
|
||||
if (toUpdate) {
|
||||
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||
}
|
||||
if (changeMetadataCommand != null) {
|
||||
if (changeMetadataCommands != null) {
|
||||
int size = changeMetadataCommands.size();
|
||||
for (int i = size - 1; 0 <= i; i--) {
|
||||
ChangeMetadataCommand changeMetadataCommand = changeMetadataCommands.get(i);
|
||||
changeMetadataCommand.undo();
|
||||
}
|
||||
}
|
||||
CodeView.refreshCodeView(elem);
|
||||
ComponentSettings.switchToCurComponentSettingsView();
|
||||
JobSettings.switchToCurJobSettingsView();
|
||||
@@ -726,9 +813,11 @@ public class PropertyChangeCommand extends Command {
|
||||
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||
}
|
||||
|
||||
if (changeMetadataCommand != null) {
|
||||
if (changeMetadataCommands != null) {
|
||||
for (ChangeMetadataCommand changeMetadataCommand : changeMetadataCommands) {
|
||||
changeMetadataCommand.redo();
|
||||
}
|
||||
}
|
||||
CodeView.refreshCodeView(elem);
|
||||
ComponentSettings.switchToCurComponentSettingsView();
|
||||
JobSettings.switchToCurJobSettingsView();
|
||||
|
||||
@@ -528,7 +528,7 @@ public class JobletContainer extends NodeContainer {
|
||||
if (isCollapsed()) {
|
||||
((Connection) conn).reconnect(conn.getSource(), this.node, conn.getLineStyle());
|
||||
} else {
|
||||
for (NodeContainer nodeContainer : this.nodeContainers) {
|
||||
out: for (NodeContainer nodeContainer : this.nodeContainers) {
|
||||
Node connNode = nodeContainer.getNode();
|
||||
IElementParameter elePa = this.node.getElementParameter(connNode.getJoblet_unique_name());
|
||||
|
||||
@@ -565,6 +565,11 @@ public class JobletContainer extends NodeContainer {
|
||||
break;
|
||||
} else if (getFlowInput(inputs).size() == 1 && !isTri
|
||||
&& new JobletUtil().isJobletInput(connNode, this.getProcess())) {
|
||||
for (IConnection flowConn : getFlowInput(inputs)) {
|
||||
if (!flowConn.getUniqueName().equals(conn.getUniqueName())) {
|
||||
continue out;
|
||||
}
|
||||
}
|
||||
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
|
||||
reConnectCommand.setNewTarget(connNode);
|
||||
reConnectCommand.execute();
|
||||
@@ -674,6 +679,7 @@ public class JobletContainer extends NodeContainer {
|
||||
public boolean canCollapse() {
|
||||
List<String> connList = new ArrayList<String>();
|
||||
List<String> metaList = new ArrayList<String>();
|
||||
List<String> triConnList = new ArrayList<String>();
|
||||
if (node.getIncomingConnections().size() > 1) {
|
||||
for (IConnection conn : node.getIncomingConnections()) {
|
||||
if (conn.getConnectorName().startsWith("TRIGGER")) {
|
||||
@@ -693,6 +699,15 @@ public class JobletContainer extends NodeContainer {
|
||||
if (isTri) {
|
||||
IElementParameter elechild = elePa.getChildParameters().get("COMPONENT_LIST");
|
||||
if (elechild != null) {
|
||||
if (elechild.getValue() == null || ((String) elechild.getValue()).length() <= 0) {
|
||||
return false;
|
||||
} else {
|
||||
if (triConnList.contains(elechild.getValue())) {
|
||||
return false;
|
||||
} else {
|
||||
triConnList.add((String) elechild.getValue());
|
||||
}
|
||||
}
|
||||
if (elechild.getValue() != null && (elechild.getValue() instanceof String)) {
|
||||
metaList.remove(elechild.getValue());
|
||||
}
|
||||
|
||||
@@ -3391,7 +3391,7 @@ public class Node extends Element implements IGraphicalNode {
|
||||
"Node.differentFromSchemaDefined", inputConnecion.getName()); //$NON-NLS-1$
|
||||
Problems.add(ProblemStatus.ERROR, this, errorMessage);
|
||||
}
|
||||
} else if (connector.getMaxLinkInput() != 0 && connector.getMaxLinkOutput() == 0) {
|
||||
} else if (connector != null && connector.getMaxLinkInput() != 0 && connector.getMaxLinkOutput() == 0) {
|
||||
if (!outputMeta.sameMetadataAs(inputMeta, IMetadataColumn.OPTIONS_NONE)) {
|
||||
schemaSynchronized = false;
|
||||
String errorMessage = Messages.getString(
|
||||
|
||||
@@ -152,6 +152,7 @@ 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.notes.Note;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.ColumnListController;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.ComponentListController;
|
||||
import org.talend.designer.core.ui.editor.properties.controllers.ConnectionListController;
|
||||
import org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer;
|
||||
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
|
||||
@@ -1084,6 +1085,22 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
listParamType.add(pType);
|
||||
}
|
||||
|
||||
private void initJobletComponents() {
|
||||
for (INode node : nodes) {
|
||||
if ((node instanceof Node) && ((Node) node).isJoblet()) {
|
||||
List<? extends IElementParameter> parametersWithChildrens = node.getElementParametersWithChildrens();
|
||||
for (IElementParameter param : parametersWithChildrens) {
|
||||
if (param.getFieldType() == EParameterFieldType.COMPONENT_LIST) {
|
||||
if (param.getValue() == null || ((String) param.getValue()).length() <= 0) {
|
||||
ComponentListController.updateComponentList(node, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void loadElementParameters(Element elemParam, EList listParamType) {
|
||||
boolean flag = false;
|
||||
@@ -1750,6 +1767,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
||||
loadSubjobs(processType);
|
||||
|
||||
initExternalComponents();
|
||||
initJobletComponents();
|
||||
setActivate(true);
|
||||
checkStartNodes();
|
||||
// (bug 5365)
|
||||
|
||||
@@ -1301,7 +1301,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
|
||||
|
||||
// fore HL7, by gcui
|
||||
if (selectedNode.getObjectType() == ERepositoryObjectType.METADATA_FILE_HL7 && PluginChecker.isHL7PluginLoaded()) {
|
||||
for (MetadataTable table : ConnectionHelper.getTables(originalConnection)) {
|
||||
for (MetadataTable table : ConnectionHelper.getTablesWithOrders(originalConnection)) {
|
||||
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(node, IHL7Constant.TABLE_SCHEMAS,
|
||||
table.getLabel(), ConvertionHelper.convert(table));
|
||||
list.add(hl7Cmd);
|
||||
|
||||
@@ -648,9 +648,19 @@ public class TableController extends AbstractElementPropertySectionController {
|
||||
}
|
||||
|
||||
contextParameterNames = contextParameterNamesList.toArray(new String[0]);
|
||||
} else {
|
||||
contextParameterNames = new String[0];
|
||||
}
|
||||
|
||||
if (contextParameterNames == null || contextParameterNames.length == 0) {
|
||||
contextParameterNamesList.clear();
|
||||
// in case the job is opened but childjob are missing, or if there is a problem when retrieve the child job
|
||||
// we rerebuild the list here from what was saved in the job before
|
||||
for (HashMap<String, Object> values : (List<HashMap<String, Object>>) param.getValue()) {
|
||||
String name = (String) values.get("PARAM_NAME_COLUMN"); //$NON-NLS-1$
|
||||
contextParameterNamesList.add(name);
|
||||
}
|
||||
contextParameterNames = contextParameterNamesList.toArray(new String[0]);
|
||||
}
|
||||
|
||||
// update table values
|
||||
TableViewerCreator tableViewerCreator = (TableViewerCreator) hashCurControls.get(param.getName());
|
||||
Object[] itemsValue = param.getListItemsValue();
|
||||
@@ -694,7 +704,7 @@ public class TableController extends AbstractElementPropertySectionController {
|
||||
} else {
|
||||
if (o instanceof String) {
|
||||
Integer nb = new Integer(tmpParam.getIndexOfItemFromList((String) o));
|
||||
if (nb == -1) {
|
||||
if (nb == -1 && !"".equals(tmpParam.getDefaultClosedListValue())) { //$NON-NLS-1$
|
||||
currentLine.put(items[j], tmpParam.getDefaultClosedListValue());
|
||||
}
|
||||
}
|
||||
@@ -706,18 +716,6 @@ public class TableController extends AbstractElementPropertySectionController {
|
||||
}
|
||||
// (bug 3740)
|
||||
boolean checked = contextParameterNames != null && contextParameterNames.length > 0;
|
||||
if (!checked) {
|
||||
Object value = param.getValue();
|
||||
if (value != null && value instanceof List) {
|
||||
if (!((List) value).isEmpty()) {
|
||||
((List) value).clear();
|
||||
if (part != null && part.getTalendEditor() != null) {
|
||||
part.getTalendEditor().setDirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
revertToolBarButtonState(checked);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.eclipse.ui.IEditorReference;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.PasswordEncryptUtil;
|
||||
import org.talend.commons.utils.VersionUtils;
|
||||
import org.talend.core.CorePlugin;
|
||||
import org.talend.core.context.Context;
|
||||
@@ -240,12 +242,26 @@ public class ElementParameter2ParameterType {
|
||||
}
|
||||
}
|
||||
}
|
||||
IElementParameter tmpParam = null;
|
||||
for (Object o : param.getListItemsValue()) {
|
||||
if (o instanceof IElementParameter) {
|
||||
IElementParameter tableParam = (IElementParameter) o;
|
||||
if (tableParam.getName().equals(elementValue.getElementRef())) {
|
||||
tmpParam = tableParam;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
if ((lineValues == null) || (lineValues.get(elementValue.getElementRef()) != null)) {
|
||||
lineValues = new HashMap<String, Object>();
|
||||
tableValues.add(lineValues);
|
||||
}
|
||||
lineValues.put(elementValue.getElementRef(), elementValue.getValue());
|
||||
String elemValue = elementValue.getValue();
|
||||
if (tmpParam != null && EParameterFieldType.PASSWORD.equals(tmpParam.getFieldType())) {
|
||||
elemValue = getRawValue(elemValue, tmpParam.getFieldType());
|
||||
}
|
||||
lineValues.put(elementValue.getElementRef(), elemValue);
|
||||
if (elementValue.getType() != null) {
|
||||
lineValues.put(elementValue.getElementRef() + IEbcdicConstant.REF_TYPE,
|
||||
elementValue.getType());
|
||||
@@ -253,6 +269,8 @@ public class ElementParameter2ParameterType {
|
||||
}
|
||||
}
|
||||
elemParam.setPropertyValue(pTypeName, tableValues);
|
||||
} else if (param.getFieldType().equals(EParameterFieldType.PASSWORD)) {
|
||||
param.setValue(getRawValue(pType.getValue(), param.getFieldType()));
|
||||
} else if (param.getFieldType().equals(EParameterFieldType.ENCODING_TYPE)) {
|
||||
// fix for bug 2193
|
||||
boolean setToCustom = false;
|
||||
@@ -516,4 +534,22 @@ public class ElementParameter2ParameterType {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getRawValue(String value, EParameterFieldType fileType) {
|
||||
if (value != null && value.length() > 0 && fileType.equals(EParameterFieldType.PASSWORD)) {
|
||||
|
||||
try {
|
||||
int ind = value.lastIndexOf(PasswordEncryptUtil.ENCRYPT_KEY);
|
||||
if (ind != -1) {
|
||||
String encryptedPart = new StringBuilder(value).replace(ind, ind + PasswordEncryptUtil.ENCRYPT_KEY.length(),
|
||||
"").toString(); //$NON-NLS-1$
|
||||
String decryptedValue = PasswordEncryptUtil.decryptPassword(encryptedPart);
|
||||
return decryptedValue;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#Fri Feb 05 11:38:53 CST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.5
|
||||
@@ -23,6 +23,10 @@ Bundle-Vendor: .Talend SA.
|
||||
Bundle-ClassPath: .
|
||||
Export-Package: org.talend.designer.hl7,
|
||||
org.talend.designer.hl7.action,
|
||||
org.talend.designer.hl7.dnd,
|
||||
org.talend.designer.hl7.model,
|
||||
org.talend.designer.hl7.ui.data,
|
||||
org.talend.designer.hl7.ui.edit,
|
||||
org.talend.designer.hl7.ui.form
|
||||
org.talend.designer.hl7.ui.form,
|
||||
org.talend.designer.hl7.ui.header,
|
||||
org.talend.designer.hl7.util
|
||||
|
||||
@@ -5,3 +5,5 @@ FooterComposite.AutoMap=Auto map!
|
||||
FooterComposite.AutoMapTip=Map automatically schema to xml tree (for empty column node only)
|
||||
FooterComposite.RootElementError.Title=Error
|
||||
FooterComposite.RootElementError.Message=Root elements of xml tree should be the same.
|
||||
SetRepetableAction_removeRepeatable=Remove Repeatable
|
||||
SetRepetableAction_setAsRepeatable=Set As Repeatable Element
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.hl7.action;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||
import org.talend.designer.hl7.ui.HL7UI;
|
||||
import org.talend.designer.hl7.ui.data.Attribute;
|
||||
import org.talend.designer.hl7.ui.data.Element;
|
||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||
import org.talend.repository.ui.swt.utils.AbstractForm;
|
||||
|
||||
/**
|
||||
* bqian Create a xml node. <br/>
|
||||
*
|
||||
* $Id: CreateAttributeAction.java,v 1.1 2007/06/12 07:20:38 gke Exp $
|
||||
*
|
||||
*/
|
||||
public class CreateHL7AttributeAction extends SelectionProviderAction {
|
||||
|
||||
// the xml viewer, see HL7UI.
|
||||
private TreeViewer xmlViewer;
|
||||
|
||||
private HL7UI hl7ui;
|
||||
|
||||
private AbstractForm from;
|
||||
|
||||
/**
|
||||
* CreateNode constructor comment.
|
||||
*
|
||||
* @param provider
|
||||
* @param text
|
||||
*/
|
||||
public CreateHL7AttributeAction(TreeViewer xmlViewer, String text) {
|
||||
super(xmlViewer, text);
|
||||
this.xmlViewer = xmlViewer;
|
||||
}
|
||||
|
||||
public CreateHL7AttributeAction(TreeViewer xmlViewer, String text, AbstractForm from) {
|
||||
super(xmlViewer, text);
|
||||
this.xmlViewer = xmlViewer;
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public CreateHL7AttributeAction(TreeViewer xmlViewer, HL7UI hl7ui, String text) {
|
||||
super(xmlViewer, text);
|
||||
this.xmlViewer = xmlViewer;
|
||||
this.hl7ui = hl7ui;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||
|
||||
if (node == null) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (node.getParent() == null) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (node instanceof Element) {
|
||||
if (((Element) node).getAttributeChildren().size() > 0) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
String nodeName = node.getLabel() + "-";
|
||||
List<HL7TreeNode> childs = ((Element) node).getElementChildren();
|
||||
if (childs.size() > 0) {
|
||||
for (HL7TreeNode child : childs) {
|
||||
if (!child.getLabel().startsWith(nodeName)) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (node.getClass() != Element.class) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
this.setEnabled(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||
if (node != null) {
|
||||
createChildNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the child node of the input node
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
private void createChildNode(HL7TreeNode node) {
|
||||
String label = ""; //$NON-NLS-1$
|
||||
while (!StringUtil.validateLabelForXML(label)) {
|
||||
InputDialog dialog = new InputDialog(null, "Input attribute's label", "Input the new attribute's valid label", "",
|
||||
null);
|
||||
int status = dialog.open();
|
||||
if (status == InputDialog.OK) {
|
||||
label = dialog.getValue().trim();
|
||||
}
|
||||
if (status == InputDialog.CANCEL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
HL7TreeNode child = new Attribute(label);
|
||||
child.setRow(node.getRow());
|
||||
node.addChild(child);
|
||||
this.xmlViewer.refresh();
|
||||
xmlViewer.expandAll();
|
||||
if (hl7ui != null) {
|
||||
hl7ui.redrawLinkers();
|
||||
} else if (from != null) {
|
||||
from.refreshLinks();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,11 +12,17 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.hl7.action;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.IInputValidator;
|
||||
import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||
import org.talend.core.model.metadata.IMetadataTable;
|
||||
import org.talend.core.model.metadata.MetadataTable;
|
||||
import org.talend.designer.hl7.managers.HL7OutputManager;
|
||||
import org.talend.designer.hl7.ui.HL7UI;
|
||||
import org.talend.designer.hl7.ui.data.Attribute;
|
||||
@@ -95,13 +101,7 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
||||
@Override
|
||||
public void run() {
|
||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||
if (createChildNode(node)) {
|
||||
if (hl7ui != null) {
|
||||
hl7ui.redrawLinkers();
|
||||
} else if (from != null) {
|
||||
from.refreshLinks();
|
||||
}
|
||||
}
|
||||
createChildNode(node);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,6 +126,7 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
||||
// add validator
|
||||
IInputValidator validator = new IInputValidator() {
|
||||
|
||||
@Override
|
||||
public String isValid(String newText) {
|
||||
if (newText != null) {
|
||||
String text = newText.trim();
|
||||
@@ -165,7 +166,37 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
||||
// if the root not have CurSchema
|
||||
if (node.getRow() == null || node.getRow().equals("")) {
|
||||
if (hl7ui != null && hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
||||
child.setRow(((HL7OutputManager) hl7ui.gethl7Manager()).getCurrentSchema(false));
|
||||
if (label.length() == 3) {
|
||||
child.setRow(label);
|
||||
IMetadataTable table = null;
|
||||
for (IMetadataTable curTable : hl7ui.gethl7Manager().getHl7Component().getMetadataList()) {
|
||||
if (label.equals(curTable.getLabel())) {
|
||||
table = curTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (table == null) {
|
||||
table = new MetadataTable();
|
||||
table.setLabel(label);
|
||||
table.setTableName(label);
|
||||
hl7ui.gethl7Manager().getHl7Component().getMetadataList().add(table);
|
||||
}
|
||||
List<Map<String, String>> maps = (List<Map<String, String>>) hl7ui.gethl7Manager().getHl7Component()
|
||||
.getElementParameter("SCHEMAS").getValue(); //$NON-NLS-1$
|
||||
boolean found = false;
|
||||
for (Map<String, String> map : maps) {
|
||||
if (map.get("SCHEMA").equals(table.getTableName())) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
Map<String, String> hl7Schema = new HashMap<String, String>();
|
||||
maps.add(hl7Schema);
|
||||
hl7Schema.put("SCHEMA", table.getTableName());
|
||||
}
|
||||
}
|
||||
} else if (label.length() == 3) {
|
||||
child.setRow(label);
|
||||
}
|
||||
} else {
|
||||
child.setRow(node.getRow());
|
||||
@@ -173,7 +204,6 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
||||
|
||||
node.addChild(child);
|
||||
this.xmlViewer.refresh();
|
||||
this.xmlViewer.expandAll();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ import java.util.List;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||
import org.talend.designer.hl7.ui.HL7UI;
|
||||
import org.talend.designer.hl7.ui.data.Attribute;
|
||||
import org.talend.designer.hl7.ui.data.Element;
|
||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
||||
import org.talend.repository.ui.swt.utils.AbstractForm;
|
||||
|
||||
/**
|
||||
@@ -94,19 +92,7 @@ public class DeleteHL7NodeAction extends SelectionProviderAction {
|
||||
disconnectSubTree(node);
|
||||
}
|
||||
parent.removeChild(node);
|
||||
// if (TreeUtil.refreshTree((HL7TreeNode) xmlViewer.getTree().getItem(0).getData())) {
|
||||
// xmlViewer.refresh();
|
||||
// }
|
||||
if (node.isRepetable() || node.isGroup()) {
|
||||
// hl7ui.updateStatus();
|
||||
}
|
||||
xmlViewer.refresh(parent);
|
||||
xmlViewer.expandAll();
|
||||
if (hl7ui != null) {
|
||||
hl7ui.redrawLinkers();
|
||||
} else if (form != null) {
|
||||
form.refreshLinks();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,12 +107,6 @@ public class DeleteHL7NodeAction extends SelectionProviderAction {
|
||||
if (node.hasLink()) {
|
||||
node.setColumn(null);
|
||||
}
|
||||
if (node instanceof Attribute) {
|
||||
return;
|
||||
}
|
||||
if (node instanceof NameSpaceNode) {
|
||||
return;
|
||||
}
|
||||
List<HL7TreeNode> children = node.getChildren();
|
||||
for (HL7TreeNode child : children) {
|
||||
disconnectSubTree(child);
|
||||
|
||||
@@ -35,16 +35,13 @@ import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IConnectionCategory;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.utils.NodeUtil;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
import org.talend.core.ui.metadata.command.RepositoryChangeMetadataForHL7Command;
|
||||
import org.talend.designer.hl7.managers.HL7OutputManager;
|
||||
import org.talend.designer.hl7.ui.HL7UI;
|
||||
import org.talend.designer.hl7.ui.data.Attribute;
|
||||
import org.talend.designer.hl7.ui.data.Element;
|
||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
||||
import org.talend.designer.hl7.ui.form.AbstractHL7StepForm;
|
||||
import org.talend.designer.hl7.ui.header.HL7Parse;
|
||||
import org.talend.designer.hl7.util.HL7PublicUtil;
|
||||
@@ -63,8 +60,6 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
|
||||
private AbstractHL7StepForm form;
|
||||
|
||||
private int order = 1;
|
||||
|
||||
private HL7Connection hl7Connection;
|
||||
|
||||
private HL7PublicUtil hl7Util = new HL7PublicUtil();
|
||||
@@ -115,13 +110,13 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
EList root = hl7Connection.getRoot();
|
||||
root.clear();
|
||||
if (hl7TreeNode != null) {
|
||||
hl7Util.initNodeOrder(hl7TreeNode, orderMap, order);
|
||||
hl7Util.initNodeOrder(hl7TreeNode, orderMap);
|
||||
hl7Util.tableLoader((Element) hl7TreeNode, "", root, hl7TreeNode.getDefaultValue(), orderMap);
|
||||
}
|
||||
table.addAll(root);
|
||||
} else {
|
||||
if (hl7TreeNode != null) {
|
||||
hl7Util.initNodeOrder(hl7TreeNode, orderMap, order);
|
||||
hl7Util.initNodeOrder(hl7TreeNode, orderMap);
|
||||
hl7Util.tableLoader((Element) hl7TreeNode, "", table, hl7TreeNode.getDefaultValue(), orderMap);
|
||||
}
|
||||
}
|
||||
@@ -151,39 +146,38 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
IConnectionCategory.FLOW);
|
||||
}
|
||||
}
|
||||
|
||||
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||
List<MetadataTable> iMetadataTables = new ArrayList<MetadataTable>();
|
||||
INode targetNode = null;
|
||||
HL7TreeNode rootNode = null;
|
||||
for (String rowName : schemaList) {
|
||||
Map<String, IMetadataTable> schemaNameToInputTable = new HashMap<String, IMetadataTable>();
|
||||
Map<String, MetadataTable> schemaNameToOutputTable = new HashMap<String, MetadataTable>();
|
||||
for (String schemaName : schemaList) {
|
||||
IMetadataTable metadataTable = null;
|
||||
for (IConnection connection : incomingConnections) {
|
||||
if (connection.getUniqueName().equals(rowName)) {
|
||||
if (connection.getUniqueName().equals(schemaName)) {
|
||||
metadataTable = connection.getMetadataTable();
|
||||
metadataTable.setLabel(connection.getUniqueName());
|
||||
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||
break;
|
||||
}
|
||||
targetNode = connection.getTarget();
|
||||
}
|
||||
|
||||
MetadataTable targetMetadataTable = ConnectionFactory.eINSTANCE.createMetadataTable();
|
||||
targetMetadataTable.setId(factory.getNextId());
|
||||
targetMetadataTable.setLabel(rowName);
|
||||
schemaNameToOutputTable.put(schemaName, targetMetadataTable);
|
||||
targetMetadataTable.setLabel(schemaName);
|
||||
iMetadataTables.add(targetMetadataTable);
|
||||
List<MetadataColumn> columns = new ArrayList<MetadataColumn>();
|
||||
}
|
||||
|
||||
HL7TreeNode current = null;
|
||||
HL7TreeNode temp = null;
|
||||
HL7TreeNode mainNode = null;
|
||||
String mainPath = null;
|
||||
String currentPath = null;
|
||||
String defaultValue = null;
|
||||
int nodeOrder = 0;
|
||||
boolean haveOrder = true;
|
||||
String schemaId = rowName + ":";//((MetadataTable) obj).getLabel() + ":"; //$NON-NLS-1$
|
||||
// build root tree
|
||||
for (int i = 0; i < root.size(); i++) {
|
||||
HL7FileNode node = (HL7FileNode) root.get(i);
|
||||
HL7FileNode node = root.get(i);
|
||||
String newPath = node.getFilePath();
|
||||
defaultValue = node.getDefaultValue();
|
||||
String columnName = node.getRelatedColumn();
|
||||
@@ -195,45 +189,37 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
if (haveOrder) {
|
||||
nodeOrder = node.getOrder();
|
||||
}
|
||||
String flag = columnName + ":"; //$NON-NLS-1$
|
||||
if (columnName != null && columnName.length() > 0 && !flag.startsWith(schemaId)) {
|
||||
String rowName = columnName;
|
||||
if (columnName != null && columnName.contains(":")) {
|
||||
String[] names = columnName.split(":");
|
||||
rowName = names[0];
|
||||
columnName = names[1];
|
||||
} else {
|
||||
columnName = null;
|
||||
}
|
||||
temp = this.addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||
if (temp == null) {
|
||||
// should not happen
|
||||
continue;
|
||||
}
|
||||
if (node.getAttribute().equals("attri")) {
|
||||
temp = new Attribute(newPath);
|
||||
temp.setDefaultValue(defaultValue);
|
||||
temp.setAttribute(true);
|
||||
// temp.setDataType(type);
|
||||
current.addChild(temp);
|
||||
} else if (node.getAttribute().equals("ns")) {
|
||||
temp = new NameSpaceNode(newPath);
|
||||
temp.setDefaultValue(defaultValue);
|
||||
temp.setNameSpace(true);
|
||||
// temp.setDataType(type);
|
||||
current.addChild(temp);
|
||||
} else {
|
||||
temp = this.addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||
// temp.setDataType(type);
|
||||
if (rootNode == null) {
|
||||
rootNode = temp;
|
||||
}
|
||||
if (node.getAttribute().equals("main")) {
|
||||
temp.setMain(true);
|
||||
mainNode = temp;
|
||||
mainPath = newPath;
|
||||
}
|
||||
current = temp;
|
||||
currentPath = newPath;
|
||||
}
|
||||
if (haveOrder) {
|
||||
temp.setOrder(nodeOrder);
|
||||
}
|
||||
if (columnName != null && columnName.length() > 0) {
|
||||
if (rowName != null && rowName.length() > 0) {
|
||||
temp.setRow(rowName);
|
||||
}
|
||||
|
||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
||||
columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
||||
if (columnName != null) {
|
||||
IMetadataTable metadataTable = schemaNameToInputTable.get(rowName);
|
||||
// group node can not get the metadata table
|
||||
if (metadataTable == null) {
|
||||
IMetadataTable metadataTableTemp = null;
|
||||
@@ -247,8 +233,8 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (metadataTableTemp != null) {
|
||||
temp.setColumnName(columnName);
|
||||
if (metadataTableTemp != null) {
|
||||
temp.setColumn(metadataTableTemp.getColumn(columnName));
|
||||
temp.setTable(metadataTableTemp);
|
||||
}
|
||||
@@ -264,18 +250,16 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
newColumn.setName(temp.getLabel());
|
||||
newColumn.setLength(226);
|
||||
newColumn.setTalendType("id_String");
|
||||
columns.add(newColumn);
|
||||
schemaNameToOutputTable.get(rowName).getColumns().add(newColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
targetMetadataTable.getColumns().addAll(columns);
|
||||
if (rootNode == null) {
|
||||
rootNode = new Element("rootTag");
|
||||
}
|
||||
if (haveOrder) {
|
||||
orderNode(rootNode);
|
||||
}
|
||||
}
|
||||
if (rootNode != null) {
|
||||
treeData.add(rootNode);
|
||||
}
|
||||
@@ -289,19 +273,19 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
||||
form.getContents().put(rootNode.getColumnLabel(), hl7Node);
|
||||
}
|
||||
}
|
||||
if (hl7ui != null) {
|
||||
// execute the commands,initialize the propertiesView .
|
||||
List<Command> commands = new ArrayList<Command>();
|
||||
for (MetadataTable tableTemp : iMetadataTables) {
|
||||
if (targetNode != null) {
|
||||
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(targetNode.getExternalNode(),
|
||||
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(hl7ui.gethl7Manager().getHl7Component(),
|
||||
IHL7Constant.TABLE_SCHEMAS, tableTemp.getLabel(), ConvertionHelper.convert(tableTemp));
|
||||
commands.add(hl7Cmd);
|
||||
}
|
||||
}
|
||||
for (Command command : commands) {
|
||||
command.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void orderNode(HL7TreeNode node) {
|
||||
// reset the order.
|
||||
|
||||
@@ -14,11 +14,10 @@ package org.talend.designer.hl7.action;
|
||||
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||
import org.talend.designer.hl7.i18n.Messages;
|
||||
import org.talend.designer.hl7.ui.HL7UI;
|
||||
import org.talend.designer.hl7.ui.data.Attribute;
|
||||
import org.talend.designer.hl7.ui.data.Element;
|
||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
||||
import org.talend.repository.ui.swt.utils.AbstractForm;
|
||||
|
||||
/**
|
||||
@@ -29,32 +28,24 @@ import org.talend.repository.ui.swt.utils.AbstractForm;
|
||||
*/
|
||||
public class SetRepetableAction extends SelectionProviderAction {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final String REMOVE_REPEATABLE = Messages.getString("SetRepetableAction_removeRepeatable"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final String SET_AS_REPEATABLE_ELEMENT = Messages.getString("SetRepetableAction_setAsRepeatable"); //$NON-NLS-1$
|
||||
|
||||
// the xml viewer, see HL7UI.
|
||||
private TreeViewer xmlViewer;
|
||||
|
||||
private HL7UI hl7ui;
|
||||
|
||||
private boolean value;
|
||||
|
||||
private AbstractForm form;
|
||||
|
||||
/**
|
||||
* SetForLoopAction constructor comment.
|
||||
*
|
||||
* @param provider
|
||||
* @param text
|
||||
*/
|
||||
public SetRepetableAction(TreeViewer xmlViewer, String text) {
|
||||
super(xmlViewer, text);
|
||||
public SetRepetableAction(TreeViewer xmlViewer, AbstractForm form) {
|
||||
super(xmlViewer, SET_AS_REPEATABLE_ELEMENT);
|
||||
this.xmlViewer = xmlViewer;
|
||||
}
|
||||
|
||||
public SetRepetableAction(TreeViewer xmlViewer, String text, AbstractForm form) {
|
||||
super(xmlViewer, text);
|
||||
this.xmlViewer = xmlViewer;
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* SetForLoopAction constructor comment.
|
||||
@@ -66,39 +57,21 @@ public class SetRepetableAction extends SelectionProviderAction {
|
||||
public SetRepetableAction(TreeViewer xmlViewer, HL7UI hl7ui, String text, boolean value) {
|
||||
super(xmlViewer, text);
|
||||
this.xmlViewer = xmlViewer;
|
||||
this.hl7ui = hl7ui;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
setText(SET_AS_REPEATABLE_ELEMENT);
|
||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||
if (node == null) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (node.getParent() == null) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (node.getParent().getParent() != null) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
if (node.isRepetable()) {
|
||||
this.setEnabled(false);
|
||||
this.setEnabled(true);
|
||||
this.setText(REMOVE_REPEATABLE);
|
||||
return;
|
||||
}
|
||||
if (!node.isMain()) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (node instanceof Attribute) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (node instanceof NameSpaceNode) {
|
||||
if (node.getLabel().length() != 3) {
|
||||
this.setEnabled(false);
|
||||
return;
|
||||
}
|
||||
@@ -113,45 +86,18 @@ public class SetRepetableAction extends SelectionProviderAction {
|
||||
@Override
|
||||
public void run() {
|
||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||
if (node.isRepetable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// HL7Manager hl7Manager = hl7ui.gethl7Manager();
|
||||
|
||||
// HL7TreeNode rootTreeData = hl7Manager.getRootHL7TreeNode(node);
|
||||
// TreeUtil.clearSubGroupNode(node);
|
||||
// // make sure group element is a ancestor of loop, or no group element.
|
||||
// if (TreeUtil.findUpGroupNode(node) == null) {
|
||||
// TreeUtil.clearSubGroupNode(rootTreeData);
|
||||
// }
|
||||
// TreeUtil.clearLoopNode(rootTreeData);
|
||||
// TreeUtil.clearMainNode(rootTreeData);
|
||||
|
||||
if (!node.isRepetable()) {
|
||||
if (node.isGroup()) {
|
||||
node.setGroup(false);
|
||||
}
|
||||
node.setRepetable(true);
|
||||
// if (this.value) {
|
||||
// if (hl7ui != null && node.isGroup()) {
|
||||
// // hl7ui.updateStatus();
|
||||
// }
|
||||
// // TreeUtil.upsetMainNode(node);
|
||||
// // xmlViewer.refresh();
|
||||
// } else {
|
||||
// // if (hl7ui != null) {
|
||||
// // hl7ui.updateStatus();
|
||||
// // }
|
||||
// // upsetMainNode(node);
|
||||
// // xmlViewer.refresh();
|
||||
// }
|
||||
node.setMain(true);
|
||||
upsetMainNode(node);
|
||||
xmlViewer.refresh();
|
||||
if (form != null) {
|
||||
form.refreshLinks();
|
||||
} else {
|
||||
node.setRepetable(false);
|
||||
}
|
||||
|
||||
// this.hl7ui.updateStatus();
|
||||
xmlViewer.refresh();
|
||||
}
|
||||
|
||||
public void upsetMainNode(HL7TreeNode node) {
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
package org.talend.designer.hl7.edit;
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.dnd.ByteArrayTransfer;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.DragSource;
|
||||
import org.eclipse.swt.dnd.DragSourceAdapter;
|
||||
import org.eclipse.swt.dnd.DragSourceEvent;
|
||||
import org.eclipse.swt.dnd.DropTarget;
|
||||
import org.eclipse.swt.dnd.DropTargetAdapter;
|
||||
import org.eclipse.swt.dnd.DropTargetEvent;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.dnd.TransferData;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
public class Snippet79 {
|
||||
|
||||
/*
|
||||
* The data being transferred is an <bold>array of type MyType</bold> where MyType is define as:
|
||||
*/
|
||||
static class MyType {
|
||||
|
||||
String fileName;
|
||||
|
||||
long fileLength;
|
||||
|
||||
long lastModified;
|
||||
}
|
||||
|
||||
static class MyTransfer extends ByteArrayTransfer {
|
||||
|
||||
private static final String MYTYPENAME = "name_for_my_type";
|
||||
|
||||
private static final int MYTYPEID = registerType(MYTYPENAME);
|
||||
|
||||
private static MyTransfer _instance = new MyTransfer();
|
||||
|
||||
public static MyTransfer getInstance() {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
public void javaToNative(Object object, TransferData transferData) {
|
||||
if (!checkMyType(object) || !isSupportedType(transferData)) {
|
||||
DND.error(DND.ERROR_INVALID_DATA);
|
||||
}
|
||||
MyType[] myTypes = (MyType[]) object;
|
||||
try {
|
||||
// write data to a byte array and then ask super to convert to
|
||||
// pMedium
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
DataOutputStream writeOut = new DataOutputStream(out);
|
||||
for (int i = 0, length = myTypes.length; i < length; i++) {
|
||||
byte[] buffer = myTypes[i].fileName.getBytes();
|
||||
writeOut.writeInt(buffer.length);
|
||||
writeOut.write(buffer);
|
||||
writeOut.writeLong(myTypes[i].fileLength);
|
||||
writeOut.writeLong(myTypes[i].lastModified);
|
||||
}
|
||||
byte[] buffer = out.toByteArray();
|
||||
writeOut.close();
|
||||
super.javaToNative(buffer, transferData);
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public Object nativeToJava(TransferData transferData) {
|
||||
if (isSupportedType(transferData)) {
|
||||
byte[] buffer = (byte[]) super.nativeToJava(transferData);
|
||||
if (buffer == null)
|
||||
return null;
|
||||
|
||||
MyType[] myData = new MyType[0];
|
||||
try {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(buffer);
|
||||
DataInputStream readIn = new DataInputStream(in);
|
||||
while (readIn.available() > 20) {
|
||||
MyType datum = new MyType();
|
||||
int size = readIn.readInt();
|
||||
byte[] name = new byte[size];
|
||||
readIn.read(name);
|
||||
datum.fileName = new String(name);
|
||||
datum.fileLength = readIn.readLong();
|
||||
datum.lastModified = readIn.readLong();
|
||||
MyType[] newMyData = new MyType[myData.length + 1];
|
||||
System.arraycopy(myData, 0, newMyData, 0, myData.length);
|
||||
newMyData[myData.length] = datum;
|
||||
myData = newMyData;
|
||||
}
|
||||
readIn.close();
|
||||
} catch (IOException ex) {
|
||||
return null;
|
||||
}
|
||||
return myData;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String[] getTypeNames() {
|
||||
return new String[] { MYTYPENAME };
|
||||
}
|
||||
|
||||
protected int[] getTypeIds() {
|
||||
return new int[] { MYTYPEID };
|
||||
}
|
||||
|
||||
boolean checkMyType(Object object) {
|
||||
if (object == null || !(object instanceof MyType[]) || ((MyType[]) object).length == 0) {
|
||||
return false;
|
||||
}
|
||||
MyType[] myTypes = (MyType[]) object;
|
||||
for (int i = 0; i < myTypes.length; i++) {
|
||||
if (myTypes[i] == null || myTypes[i].fileName == null || myTypes[i].fileName.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean validate(Object object) {
|
||||
return checkMyType(object);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Display display = new Display();
|
||||
Shell shell = new Shell(display);
|
||||
shell.setLayout(new FillLayout());
|
||||
final Label label1 = new Label(shell, SWT.BORDER | SWT.WRAP);
|
||||
label1.setText("Drag Source for MyData[]");
|
||||
final Label label2 = new Label(shell, SWT.BORDER | SWT.WRAP);
|
||||
label2.setText("Drop Target for MyData[]");
|
||||
|
||||
DragSource source = new DragSource(label1, DND.DROP_COPY);
|
||||
source.setTransfer(new Transfer[] { MyTransfer.getInstance() });
|
||||
source.addDragListener(new DragSourceAdapter() {
|
||||
|
||||
public void dragSetData(DragSourceEvent event) {
|
||||
MyType myType1 = new MyType();
|
||||
myType1.fileName = "C:\\abc.txt";
|
||||
myType1.fileLength = 1000;
|
||||
myType1.lastModified = 12312313;
|
||||
MyType myType2 = new MyType();
|
||||
myType2.fileName = "C:\\xyz.txt";
|
||||
myType2.fileLength = 500;
|
||||
myType2.lastModified = 12312323;
|
||||
event.data = new MyType[] { myType1, myType2 };
|
||||
}
|
||||
});
|
||||
DropTarget target = new DropTarget(label2, DND.DROP_COPY | DND.DROP_DEFAULT);
|
||||
target.setTransfer(new Transfer[] { MyTransfer.getInstance() });
|
||||
target.addDropListener(new DropTargetAdapter() {
|
||||
|
||||
public void dragEnter(DropTargetEvent event) {
|
||||
if (event.detail == DND.DROP_DEFAULT) {
|
||||
event.detail = DND.DROP_COPY;
|
||||
}
|
||||
}
|
||||
|
||||
public void dragOperationChanged(DropTargetEvent event) {
|
||||
if (event.detail == DND.DROP_DEFAULT) {
|
||||
event.detail = DND.DROP_COPY;
|
||||
}
|
||||
}
|
||||
|
||||
public void drop(DropTargetEvent event) {
|
||||
if (event.data != null) {
|
||||
MyType[] myTypes = (MyType[]) event.data;
|
||||
if (myTypes != null) {
|
||||
String string = "";
|
||||
for (int i = 0; i < myTypes.length; i++) {
|
||||
string += myTypes[i].fileName + " ";
|
||||
}
|
||||
label2.setText(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
shell.setSize(200, 200);
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.designer.hl7.edit;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.DragSource;
|
||||
import org.eclipse.swt.dnd.DragSourceEvent;
|
||||
import org.eclipse.swt.dnd.DragSourceListener;
|
||||
import org.eclipse.swt.dnd.DropTarget;
|
||||
import org.eclipse.swt.dnd.DropTargetAdapter;
|
||||
import org.eclipse.swt.dnd.DropTargetEvent;
|
||||
import org.eclipse.swt.dnd.TextTransfer;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
|
||||
public class Snippet91 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
final Display display = new Display();
|
||||
final Shell shell = new Shell(display);
|
||||
shell.setLayout(new FillLayout());
|
||||
final Tree tree = new Tree(shell, SWT.BORDER);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
TreeItem item = new TreeItem(tree, SWT.NONE);
|
||||
item.setText("item " + i);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
TreeItem subItem = new TreeItem(item, SWT.NONE);
|
||||
subItem.setText("item " + i + " " + j);
|
||||
for (int k = 0; k < 3; k++) {
|
||||
TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
|
||||
subsubItem.setText("item " + i + " " + j + " " + k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
|
||||
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
|
||||
|
||||
final DragSource source = new DragSource(tree, operations);
|
||||
source.setTransfer(types);
|
||||
final TreeItem[] dragSourceItem = new TreeItem[1];
|
||||
source.addDragListener(new DragSourceListener() {
|
||||
|
||||
public void dragStart(DragSourceEvent event) {
|
||||
TreeItem[] selection = tree.getSelection();
|
||||
if (selection.length > 0 && selection[0].getItemCount() == 0) {
|
||||
event.doit = true;
|
||||
dragSourceItem[0] = selection[0];
|
||||
} else {
|
||||
event.doit = false;
|
||||
}
|
||||
};
|
||||
|
||||
public void dragSetData(DragSourceEvent event) {
|
||||
event.data = dragSourceItem[0].getText();
|
||||
}
|
||||
|
||||
public void dragFinished(DragSourceEvent event) {
|
||||
if (event.detail == DND.DROP_MOVE)
|
||||
dragSourceItem[0].dispose();
|
||||
dragSourceItem[0] = null;
|
||||
}
|
||||
});
|
||||
|
||||
DropTarget target = new DropTarget(tree, operations);
|
||||
target.setTransfer(types);
|
||||
target.addDropListener(new DropTargetAdapter() {
|
||||
|
||||
public void dragOver(DropTargetEvent event) {
|
||||
event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
|
||||
if (event.item != null) {
|
||||
TreeItem item = (TreeItem) event.item;
|
||||
Point pt = display.map(null, tree, event.x, event.y);
|
||||
Rectangle bounds = item.getBounds();
|
||||
if (pt.y < bounds.y + bounds.height / 3) {
|
||||
event.feedback |= DND.FEEDBACK_INSERT_BEFORE;
|
||||
} else if (pt.y > bounds.y + 2 * bounds.height / 3) {
|
||||
event.feedback |= DND.FEEDBACK_INSERT_AFTER;
|
||||
} else {
|
||||
event.feedback |= DND.FEEDBACK_SELECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drop(DropTargetEvent event) {
|
||||
if (event.data == null) {
|
||||
event.detail = DND.DROP_NONE;
|
||||
return;
|
||||
}
|
||||
String text = (String) event.data;
|
||||
if (event.item == null) {
|
||||
TreeItem item = new TreeItem(tree, SWT.NONE);
|
||||
item.setText(text);
|
||||
} else {
|
||||
TreeItem item = (TreeItem) event.item;
|
||||
Point pt = display.map(null, tree, event.x, event.y);
|
||||
Rectangle bounds = item.getBounds();
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null) {
|
||||
TreeItem[] items = parent.getItems();
|
||||
int index = 0;
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] == item) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pt.y < bounds.y + bounds.height / 3) {
|
||||
TreeItem newItem = new TreeItem(parent, SWT.NONE, index);
|
||||
newItem.setText(text);
|
||||
} else if (pt.y > bounds.y + 2 * bounds.height / 3) {
|
||||
TreeItem newItem = new TreeItem(parent, SWT.NONE, index + 1);
|
||||
newItem.setText(text);
|
||||
} else {
|
||||
TreeItem newItem = new TreeItem(item, SWT.NONE);
|
||||
newItem.setText(text);
|
||||
}
|
||||
|
||||
} else {
|
||||
TreeItem[] items = tree.getItems();
|
||||
int index = 0;
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if (items[i] == item) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pt.y < bounds.y + bounds.height / 3) {
|
||||
TreeItem newItem = new TreeItem(tree, SWT.NONE, index);
|
||||
newItem.setText(text);
|
||||
} else if (pt.y > bounds.y + 2 * bounds.height / 3) {
|
||||
TreeItem newItem = new TreeItem(tree, SWT.NONE, index + 1);
|
||||
newItem.setText(text);
|
||||
} else {
|
||||
TreeItem newItem = new TreeItem(item, SWT.NONE);
|
||||
newItem.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
shell.setSize(400, 400);
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
display.dispose();
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,8 @@ import org.talend.core.model.process.IConnection;
|
||||
import org.talend.core.model.process.IConnectionCategory;
|
||||
import org.talend.core.model.utils.NodeUtil;
|
||||
import org.talend.designer.hl7.HL7InputComponent;
|
||||
import org.talend.designer.hl7.ui.data.Attribute;
|
||||
import org.talend.designer.hl7.ui.data.Element;
|
||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
||||
|
||||
/**
|
||||
* DOC hwang class global comment. Detailled comment
|
||||
@@ -57,52 +55,61 @@ public class HL7OutputManager extends HL7Manager {
|
||||
}
|
||||
|
||||
public void initModel() {
|
||||
int i = 0;
|
||||
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(hl7Component, IConnectionCategory.FLOW);
|
||||
// HL7Root root = new HL7Root("root");
|
||||
List<Map<String, String>> maps = (List<Map<String, String>>) ElementParameterParser.getObjectValue(hl7Component,
|
||||
"__SCHEMAS__"); //$NON-NLS-1$
|
||||
List<String> schemaList = new ArrayList<String>();
|
||||
List<Map<String, String>> rootTable = (List<Map<String, String>>) hl7Component.getTableList(HL7InputComponent.ROOT);
|
||||
List<String> columnList = new ArrayList<String>();
|
||||
Map<String, HL7TreeNode> mapNodes = new HashMap<String, HL7TreeNode>();
|
||||
if (rootTable != null && rootTable.size() > 0) {
|
||||
for (Map<String, String> rootMap : rootTable) {
|
||||
String columnName = rootMap.get(HL7InputComponent.COLUMN);
|
||||
if (columnName.contains(":")) {
|
||||
columnName = columnName.substring(0, columnName.indexOf(":"));
|
||||
}
|
||||
if (!columnList.contains(columnName) && !"".equals(columnName)) {
|
||||
columnList.add(columnName);
|
||||
for (IMetadataTable table : hl7Component.getMetadataList()) {
|
||||
if (table.getLabel() != null) {
|
||||
schemaList.add(table.getLabel());
|
||||
}
|
||||
}
|
||||
HL7TreeNode rootNode = null;
|
||||
for (String rowName : columnList) {
|
||||
|
||||
List<Map<String, String>> rootTable = hl7Component.getTableList(HL7InputComponent.ROOT);
|
||||
Map<String, IMetadataTable> schemaNameToInputTable = new HashMap<String, IMetadataTable>();
|
||||
|
||||
if (!maps.isEmpty()) {
|
||||
for (Map<String, String> map : maps) {
|
||||
String schemaName = map.get("SCHEMA");
|
||||
int first = schemaName.indexOf("_");
|
||||
int second = schemaName.lastIndexOf("_");
|
||||
if (first > 0 && first < second) {
|
||||
schemaName = schemaName.substring(first + 1, second);
|
||||
}
|
||||
IMetadataTable metadataTable = null;
|
||||
String metadataTableName = rowName;
|
||||
for (IConnection connection : incomingConnections) {
|
||||
if (connection.getUniqueName().equals(rowName)) {
|
||||
if (connection.getUniqueName().equals(map.get("PARENT_ROW"))) {
|
||||
metadataTable = connection.getMetadataTable();
|
||||
metadataTable.setLabel(connection.getUniqueName());
|
||||
metadataTableName = metadataTable.getLabel();
|
||||
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
for (String schemaName : schemaList) {
|
||||
IMetadataTable metadataTable = null;
|
||||
for (IConnection connection : incomingConnections) {
|
||||
if (connection.getUniqueName().equals(schemaName)) {
|
||||
metadataTable = connection.getMetadataTable();
|
||||
metadataTable.setLabel(connection.getUniqueName());
|
||||
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String, HL7TreeNode> mapNodes = new HashMap<String, HL7TreeNode>();
|
||||
treeData = new ArrayList<HL7TreeNode>();
|
||||
if (i == 0)// the first schema as current
|
||||
currentSchema = metadataTableName;// metadataTable.getLabel();
|
||||
|
||||
HL7TreeNode rootNode = null;
|
||||
HL7TreeNode current = null;
|
||||
HL7TreeNode temp = null;
|
||||
HL7TreeNode mainNode = null;
|
||||
String mainPath = null;
|
||||
String currentPath = null;
|
||||
String defaultValue = null;
|
||||
int nodeOrder = 0;
|
||||
boolean haveOrder = true;
|
||||
|
||||
String schemaId = rowName + ":";
|
||||
|
||||
// build root tree
|
||||
for (Map<String, String> rootMap : rootTable) {
|
||||
String newPath = rootMap.get(HL7InputComponent.PATH);
|
||||
String columnName = rootMap.get(HL7InputComponent.COLUMN);
|
||||
@@ -112,44 +119,36 @@ public class HL7OutputManager extends HL7Manager {
|
||||
if (orderValue == null || "".equals(orderValue)) {
|
||||
haveOrder = false;
|
||||
}
|
||||
if (haveOrder) {
|
||||
nodeOrder = Integer.valueOf(rootMap.get(HL7InputComponent.ORDER)).intValue();
|
||||
String rowName = columnName;
|
||||
if (columnName != null && columnName.contains(":")) {
|
||||
String[] names = columnName.split(":");
|
||||
rowName = names[0];
|
||||
columnName = names[1];
|
||||
} else {
|
||||
columnName = null;
|
||||
}
|
||||
String flag = columnName + ":"; //$NON-NLS-1$
|
||||
if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
||||
temp = this.addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||
if (temp == null) {
|
||||
// should not happen
|
||||
continue;
|
||||
}
|
||||
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
||||
temp = new Attribute(newPath);
|
||||
temp.setDefaultValue(defaultValue);
|
||||
current.addChild(temp);
|
||||
} else if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
||||
temp = new NameSpaceNode(newPath);
|
||||
temp.setDefaultValue(defaultValue);
|
||||
current.addChild(temp);
|
||||
} else {
|
||||
temp = addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||
if (rootNode == null) {
|
||||
rootNode = temp;
|
||||
}
|
||||
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
||||
temp.setMain(true);
|
||||
mainNode = temp;
|
||||
mainPath = newPath;
|
||||
}
|
||||
current = temp;
|
||||
currentPath = newPath;
|
||||
}
|
||||
temp.setRepetable(repeatable);
|
||||
if (haveOrder) {
|
||||
temp.setOrder(nodeOrder);
|
||||
}
|
||||
if (columnName != null && columnName.length() > 0) {
|
||||
if (rowName != null && rowName.length() > 0) {
|
||||
temp.setRow(rowName);
|
||||
}
|
||||
|
||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
||||
columnName = columnName.replace(schemaId, ""); // $!=Nnull-1$
|
||||
if (columnName != null) {
|
||||
IMetadataTable metadataTable = schemaNameToInputTable.get(rowName);
|
||||
// group node can not get the metadata table
|
||||
if (metadataTable == null) {
|
||||
IMetadataTable metadataTableTemp = null;
|
||||
@@ -163,8 +162,8 @@ public class HL7OutputManager extends HL7Manager {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (metadataTableTemp != null) {
|
||||
temp.setColumnName(columnName);
|
||||
if (metadataTableTemp != null) {
|
||||
temp.setColumn(metadataTableTemp.getColumn(columnName));
|
||||
temp.setTable(metadataTableTemp);
|
||||
}
|
||||
@@ -175,277 +174,20 @@ public class HL7OutputManager extends HL7Manager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rootNode == null) {
|
||||
rootNode = new Element("rootTag"); //$NON-NLS-1$
|
||||
// rootNode.setParent(root);
|
||||
// root.addChild(rootNode);
|
||||
}
|
||||
|
||||
if (haveOrder) {
|
||||
orderNode(rootNode);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
if (incomingConnections.size() > 0 && rootNode == null) {
|
||||
rootNode = new Element("rootTag");
|
||||
treeData = new ArrayList<HL7TreeNode>();
|
||||
}
|
||||
if (rootNode != null && treeData != null) {
|
||||
// the root node should not set the ColumnLabel
|
||||
if (rootNode.getRow() != null) {
|
||||
rootNode.setRow(null);
|
||||
}
|
||||
treeData.add(rootNode);
|
||||
contents.put(rootNode.getColumnLabel(), treeData);
|
||||
}
|
||||
initCurrentSchema();
|
||||
|
||||
} else if (rootTable != null && rootTable.size() <= 0) {
|
||||
HL7TreeNode rootNode = null;
|
||||
// this code seems no use,but will keep like this now ...
|
||||
for (IConnection connection : incomingConnections) {
|
||||
IMetadataTable metadataTable = connection.getMetadataTable();
|
||||
metadataTable.setLabel(connection.getUniqueName());
|
||||
String metadataTableName = metadataTable.getLabel();
|
||||
String rowName = metadataTable.getLabel();
|
||||
for (Map<String, String> map : maps) {
|
||||
if (map.containsValue(rowName)) {
|
||||
if (map.get("PARENT_ROW") != null && map.get("PARENT_ROW").equals(rowName)) {
|
||||
String schemaName = map.get("SCHEMA");
|
||||
int first = schemaName.indexOf("_");
|
||||
int second = schemaName.lastIndexOf("_");
|
||||
if (first > 0 && first < second) {
|
||||
schemaName = schemaName.substring(first + 1, second);
|
||||
}
|
||||
if (!schemaList.contains(schemaName)) {
|
||||
schemaList.add(schemaName);
|
||||
rowName = schemaName;// map.get(rowName);
|
||||
schemaMap.put(metadataTableName, rowName);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
treeData = new ArrayList<HL7TreeNode>();
|
||||
if (i == 0)// the first schema as current
|
||||
currentSchema = metadataTableName;// metadataTable.getLabel();
|
||||
HL7TreeNode current = null;
|
||||
HL7TreeNode temp = null;
|
||||
HL7TreeNode mainNode = null;
|
||||
String mainPath = null;
|
||||
String currentPath = null;
|
||||
String defaultValue = null;
|
||||
int nodeOrder = 0;
|
||||
boolean haveOrder = true;
|
||||
|
||||
String schemaId = rowName + ":";//metadataTable.getLabel() + ":"; //$NON-NLS-1$
|
||||
|
||||
// build root tree
|
||||
// List<Map<String, String>> rootTable = (List<Map<String, String>>)
|
||||
// hl7Component.getTableList(HL7InputComponent.ROOT);
|
||||
if (rootTable != null) {
|
||||
for (Map<String, String> rootMap : rootTable) {
|
||||
String newPath = rootMap.get(HL7InputComponent.PATH);
|
||||
String columnName = rootMap.get(HL7InputComponent.COLUMN);
|
||||
defaultValue = rootMap.get(HL7InputComponent.VALUE);
|
||||
String orderValue = rootMap.get(HL7InputComponent.ORDER);
|
||||
boolean repeatable = Boolean.valueOf(rootMap.get("REPEATABLE"));
|
||||
if (orderValue == null || "".equals(orderValue)) {
|
||||
haveOrder = false;
|
||||
}
|
||||
if (haveOrder) {
|
||||
nodeOrder = Integer.valueOf(rootMap.get(HL7InputComponent.ORDER)).intValue();
|
||||
}
|
||||
String flag = columnName + ":"; //$NON-NLS-1$
|
||||
if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
||||
temp = new Attribute(newPath);
|
||||
temp.setDefaultValue(defaultValue);
|
||||
current.addChild(temp);
|
||||
} else if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
||||
temp = new NameSpaceNode(newPath);
|
||||
temp.setDefaultValue(defaultValue);
|
||||
current.addChild(temp);
|
||||
} else {
|
||||
temp = addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||
if (rootNode == null) {
|
||||
rootNode = temp;
|
||||
}
|
||||
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
||||
temp.setMain(true);
|
||||
mainNode = temp;
|
||||
mainPath = newPath;
|
||||
}
|
||||
current = temp;
|
||||
currentPath = newPath;
|
||||
}
|
||||
if (haveOrder) {
|
||||
temp.setOrder(nodeOrder);
|
||||
}
|
||||
temp.setRepetable(repeatable);
|
||||
temp.setRow(rowName);
|
||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
||||
columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
||||
temp.setColumn(metadataTable.getColumn(columnName));
|
||||
temp.setTable(metadataTable);
|
||||
}
|
||||
|
||||
}
|
||||
if (rootNode == null) {
|
||||
rootNode = new Element("rootTag"); //$NON-NLS-1$
|
||||
// rootNode.setParent(root);
|
||||
// root.addChild(rootNode);
|
||||
}
|
||||
|
||||
if (haveOrder) {
|
||||
orderNode(rootNode);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (rootNode != null && treeData != null) {
|
||||
// the root node should not set the ColumnLabel
|
||||
if (rootNode.getRow() != null) {
|
||||
rootNode.setRow(null);
|
||||
}
|
||||
treeData.add(rootNode);
|
||||
contents.put(rootNode.getColumnLabel(), treeData);
|
||||
initCurrentSchema();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// // build group tree
|
||||
// current = mainNode;
|
||||
// currentPath = mainPath;
|
||||
// boolean isFirst = true;
|
||||
// List<Map<String, String>> groupTable = (List<Map<String, String>>)
|
||||
// hl7Component.getTableList(HL7InputComponent.GROUP);
|
||||
// if (groupTable != null) {
|
||||
// for (Map<String, String> groupMap : groupTable) {
|
||||
// String newPath = groupMap.get(HL7InputComponent.PATH);
|
||||
// String columnName = groupMap.get(HL7InputComponent.COLUMN);
|
||||
// defaultValue = groupMap.get(HL7InputComponent.VALUE);
|
||||
// String orderValue = groupMap.get(HL7InputComponent.ORDER);
|
||||
// if (orderValue == null || "".equals(orderValue)) {
|
||||
// haveOrder = false;
|
||||
// }
|
||||
// if (haveOrder) {
|
||||
// nodeOrder = Integer.valueOf(groupMap.get(HL7InputComponent.ORDER)).intValue();
|
||||
// }
|
||||
// String flag = columnName + ":"; //$NON-NLS-1$
|
||||
// if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
||||
// continue;
|
||||
// }
|
||||
// if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
||||
// temp = new Attribute(newPath);
|
||||
// temp.setDefaultValue(defaultValue);
|
||||
// current.addChild(temp);
|
||||
// } else if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
||||
// temp = new NameSpaceNode(newPath);
|
||||
// temp.setDefaultValue(defaultValue);
|
||||
// current.addChild(temp);
|
||||
// } else {
|
||||
// temp = this.addElement(current, currentPath, newPath, defaultValue);
|
||||
// if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
||||
// temp.setMain(true);
|
||||
// mainNode = temp;
|
||||
// mainPath = newPath;
|
||||
// }
|
||||
// if (isFirst) {
|
||||
// temp.setGroup(true);
|
||||
// isFirst = false;
|
||||
// }
|
||||
// current = temp;
|
||||
// currentPath = newPath;
|
||||
// }
|
||||
// if (haveOrder) {
|
||||
// temp.setOrder(nodeOrder);
|
||||
// }
|
||||
// temp.setRow(rowName);
|
||||
// if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
||||
// columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
||||
// temp.setColumn(metadataTable.getColumn(columnName));
|
||||
// temp.setTable(metadataTable);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // build loop tree
|
||||
// current = mainNode;
|
||||
// currentPath = mainPath;
|
||||
// isFirst = true;
|
||||
// List<Map<String, String>> loopTable = (List<Map<String, String>>)
|
||||
// hl7Component.getTableList(HL7InputComponent.LOOP);
|
||||
// if (loopTable != null) {
|
||||
// for (Map<String, String> loopMap : loopTable) {
|
||||
// String newPath = loopMap.get(HL7InputComponent.PATH);
|
||||
// String columnName = loopMap.get(HL7InputComponent.COLUMN);
|
||||
// defaultValue = loopMap.get(HL7InputComponent.VALUE);
|
||||
// String orderValue = loopMap.get(HL7InputComponent.ORDER);
|
||||
// if (orderValue == null || "".equals(orderValue)) {
|
||||
// haveOrder = false;
|
||||
// }
|
||||
// if (haveOrder) {
|
||||
// nodeOrder = Integer.valueOf(loopMap.get(HL7InputComponent.ORDER)).intValue();
|
||||
// }
|
||||
// String flag = columnName + ":"; //$NON-NLS-1$
|
||||
// if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
||||
// continue;
|
||||
// }
|
||||
// if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
||||
// temp = new Attribute(newPath);
|
||||
// temp.setDefaultValue(defaultValue);
|
||||
// current.addChild(temp);
|
||||
// } else if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
||||
// temp = new NameSpaceNode(newPath);
|
||||
// temp.setDefaultValue(defaultValue);
|
||||
// current.addChild(temp);
|
||||
// } else {
|
||||
// temp = this.addElement(current, currentPath, newPath, defaultValue);
|
||||
// if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
||||
// temp.setMain(true);
|
||||
// }
|
||||
// if (isFirst) {
|
||||
// temp.setRepetable(true);
|
||||
// isFirst = false;
|
||||
// }
|
||||
// current = temp;
|
||||
// currentPath = newPath;
|
||||
// }
|
||||
// if (haveOrder) {
|
||||
// temp.setOrder(nodeOrder);
|
||||
// }
|
||||
// temp.setRow(rowName);
|
||||
// if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
||||
// columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
||||
// temp.setColumn(metadataTable.getColumn(columnName));
|
||||
// temp.setTable(metadataTable);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (rootNode == null) {
|
||||
// rootNode = new Element("rootTag"); //$NON-NLS-1$
|
||||
// // rootNode.setParent(root);
|
||||
// // root.addChild(rootNode);
|
||||
// }
|
||||
//
|
||||
// if (haveOrder) {
|
||||
// orderNode(rootNode);
|
||||
// }
|
||||
// treeData.add(rootNode);
|
||||
// rootNode.setRow(rowName);
|
||||
// contents.put(metadataTableName, treeData);
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
// this.setTreeRoot(root);
|
||||
// }
|
||||
|
||||
public List<Map<String, String>> getRootTable() {
|
||||
List<Map<String, String>> result = new ArrayList<Map<String, String>>();
|
||||
@@ -537,7 +279,7 @@ public class HL7OutputManager extends HL7Manager {
|
||||
newMap.put(HL7InputComponent.PATH, att.getLabel());
|
||||
newMap.put(HL7InputComponent.COLUMN, att.getColumnLabel());
|
||||
newMap.put(HL7InputComponent.ATTRIBUTE, "attri"); //$NON-NLS-1$
|
||||
newMap.put(HL7InputComponent.VALUE, att.getDefaultValue()); //$NON-NLS-1$
|
||||
newMap.put(HL7InputComponent.VALUE, att.getDefaultValue());
|
||||
newMap.put(HL7InputComponent.ORDER, String.valueOf(getNodeOrder(att)));
|
||||
newMap.put("REPEATABLE", String.valueOf(att.isRepetable()));
|
||||
table.add(newMap);
|
||||
@@ -547,7 +289,7 @@ public class HL7OutputManager extends HL7Manager {
|
||||
newMap.put(HL7InputComponent.PATH, att.getLabel());
|
||||
newMap.put(HL7InputComponent.COLUMN, att.getColumnLabel());
|
||||
newMap.put(HL7InputComponent.ATTRIBUTE, "ns"); //$NON-NLS-1$
|
||||
newMap.put(HL7InputComponent.VALUE, att.getDefaultValue()); //$NON-NLS-1$
|
||||
newMap.put(HL7InputComponent.VALUE, att.getDefaultValue());
|
||||
newMap.put("REPEATABLE", String.valueOf(att.isRepetable()));
|
||||
newMap.put(HL7InputComponent.ORDER, String.valueOf(getNodeOrder(att)));
|
||||
table.add(newMap);
|
||||
@@ -626,6 +368,7 @@ public class HL7OutputManager extends HL7Manager {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HL7TreeNode> getTreeData(String curSchema) {
|
||||
if (currentSchema == null) {
|
||||
if (treeData == null) {
|
||||
@@ -712,6 +455,7 @@ public class HL7OutputManager extends HL7Manager {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentSchema(boolean sign) {
|
||||
if (sign && schemaMap.get(currentSchema) != null && !"".equals(schemaMap.get(currentSchema))) {
|
||||
return schemaMap.get(currentSchema);
|
||||
@@ -811,6 +555,7 @@ public class HL7OutputManager extends HL7Manager {
|
||||
return this.contents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IMetadataColumn> getSchemaData(String currentSchema) {
|
||||
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(hl7Component, IConnectionCategory.FLOW);
|
||||
for (IConnection connection : incomingConnections) {
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.designer.hl7.model;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ca.uhn.hl7v2.HL7Exception;
|
||||
@@ -46,6 +48,42 @@ public class SegmentModel extends AbstractStructureModel {
|
||||
private void generateDataTypes() {
|
||||
int number = this.seg.numFields();
|
||||
ArrayList<TypeModel> datatypes = new ArrayList<TypeModel>();
|
||||
Method method = null;
|
||||
try {
|
||||
for (Method curMethod : seg.getClass().getDeclaredMethods()) {
|
||||
if (curMethod.getName().equals("createNewTypeWithoutReflection")) {
|
||||
method = curMethod;
|
||||
method.setAccessible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (method != null) {
|
||||
// only access we have to get all the types is reflection (protected method).
|
||||
// so add test of null in case this method doesn't exist, even if it should be in every subclass.
|
||||
for (int i = 0; i < number; i++) {
|
||||
|
||||
Type type = (Type) method.invoke(seg, i);
|
||||
TypeModel tm = new TypeModel(type, seg, 0, i + 1);
|
||||
datatypes.add(tm);
|
||||
}
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (method == null) {
|
||||
// use old code in case the reflection didn't work.
|
||||
// but it means it won't get optional fields.
|
||||
try {
|
||||
int lastNotEmptyFiledIndex = 0;
|
||||
for (int i = 1; i < number; i++) {
|
||||
@@ -71,6 +109,7 @@ public class SegmentModel extends AbstractStructureModel {
|
||||
} catch (HL7Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
this.types = datatypes.toArray(new TypeModel[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,8 @@ public class TypeModel extends AbstractStructureModel {
|
||||
|
||||
@Override
|
||||
protected void generateDisplayName() {
|
||||
String typeDispaly = type == null ? "" : TalendTextUtils.LBRACKET + this.type.getName() + TalendTextUtils.RBRACKET;
|
||||
this.displayName = getParent().getName() + "-" + index + "(" + (++rep) + ")" + typeDispaly; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
String typeDisplay = type == null ? "" : TalendTextUtils.LBRACKET + this.type.getName() + TalendTextUtils.RBRACKET;
|
||||
this.displayName = getParent().getName() + "-" + index + "(1)" + typeDisplay; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
}
|
||||
|
||||
@@ -70,12 +70,10 @@ public class TypeModel extends AbstractStructureModel {
|
||||
int numSubComp = Terser.numSubComponents(this.type, k);
|
||||
for (int m = 1; m <= numSubComp; m++) {
|
||||
Primitive p = getPrimitive(this.type, k, m);
|
||||
if (p.getValue() != null) {
|
||||
PrimitiveModel pm = new PrimitiveModel(this, p, k, m);
|
||||
pms.add(pm);
|
||||
}
|
||||
}
|
||||
}
|
||||
primitives = pms.toArray(new PrimitiveModel[0]);
|
||||
} else {
|
||||
PrimitiveModel pm = new PrimitiveModel(this, null, 1, 1);
|
||||
|
||||
@@ -54,7 +54,6 @@ import org.talend.core.model.process.IElementParameter;
|
||||
import org.talend.core.model.utils.NodeUtil;
|
||||
import org.talend.designer.core.model.components.EParameterName;
|
||||
import org.talend.designer.hl7.HL7InputComponent;
|
||||
import org.talend.designer.hl7.action.CreateHL7AttributeAction;
|
||||
import org.talend.designer.hl7.action.CreateHL7ElementAction;
|
||||
import org.talend.designer.hl7.action.DeleteHL7NodeAction;
|
||||
import org.talend.designer.hl7.action.HL7DisconnectAction;
|
||||
@@ -101,8 +100,6 @@ public class HL7OutputUI extends HL7UI {
|
||||
|
||||
private HL7FixValueAction fixValueAction;
|
||||
|
||||
private CreateHL7AttributeAction createAttributeAction;
|
||||
|
||||
private ImportHL7StructureAction importAction;
|
||||
|
||||
private SetRepetableAction setRepetableAction;
|
||||
@@ -315,6 +312,7 @@ public class HL7OutputUI extends HL7UI {
|
||||
|
||||
xmlViewer.setCellModifier(new ICellModifier() {
|
||||
|
||||
@Override
|
||||
public boolean canModify(Object element, String property) {
|
||||
HL7TreeNode node = (HL7TreeNode) element;
|
||||
if (property.equals("C1")) {
|
||||
@@ -330,6 +328,7 @@ public class HL7OutputUI extends HL7UI {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(Object element, String property) {
|
||||
HL7TreeNode node = (HL7TreeNode) element;
|
||||
if (property.equals("C1")) {
|
||||
@@ -342,6 +341,7 @@ public class HL7OutputUI extends HL7UI {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify(Object element, String property, Object value) {
|
||||
TreeItem treeItem = (TreeItem) element;
|
||||
HL7TreeNode node = (HL7TreeNode) treeItem.getData();
|
||||
@@ -376,6 +376,7 @@ public class HL7OutputUI extends HL7UI {
|
||||
menuMgr.setRemoveAllWhenShown(true);
|
||||
menuMgr.addMenuListener(new IMenuListener() {
|
||||
|
||||
@Override
|
||||
public void menuAboutToShow(IMenuManager manager) {
|
||||
HL7OutputUI.this.fillContextMenu(manager);
|
||||
}
|
||||
@@ -384,6 +385,7 @@ public class HL7OutputUI extends HL7UI {
|
||||
xmlViewer.getControl().setMenu(menu);
|
||||
xmlViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
@@ -402,8 +404,6 @@ public class HL7OutputUI extends HL7UI {
|
||||
if (!xmlViewer.getSelection().isEmpty()) {
|
||||
manager.add(createAction);
|
||||
createAction.init();
|
||||
manager.add(createAttributeAction);
|
||||
createAttributeAction.init();
|
||||
manager.add(new Separator());
|
||||
manager.add(deleteAction);
|
||||
deleteAction.init();
|
||||
@@ -430,7 +430,6 @@ public class HL7OutputUI extends HL7UI {
|
||||
|
||||
private void createAction() {
|
||||
createAction = new CreateHL7ElementAction(xmlViewer, this, "Add Sub-element");
|
||||
createAttributeAction = new CreateHL7AttributeAction(xmlViewer, this, "Add Attribute");
|
||||
deleteAction = new DeleteHL7NodeAction(xmlViewer, this, "Delete");
|
||||
disconnectAction = new HL7DisconnectAction(xmlViewer, this, "Disconnect Linker");
|
||||
fixValueAction = new HL7FixValueAction(xmlViewer, this, "Set A Fix Value");
|
||||
@@ -488,14 +487,17 @@ public class HL7OutputUI extends HL7UI {
|
||||
|
||||
Boolean validateLabel;
|
||||
|
||||
@Override
|
||||
public void applyEditorValue() {
|
||||
String text = getControl().getText();
|
||||
onValueChanged(text, true, property);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelEditor() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editorValueChanged(boolean oldValidState, boolean newValidState) {
|
||||
onValueChanged(getControl().getText(), false, property);
|
||||
}
|
||||
|
||||
@@ -39,25 +39,28 @@ import ca.uhn.hl7v2.model.Structure;
|
||||
*/
|
||||
public class HL7PublicUtil {
|
||||
|
||||
public void initNodeOrder(HL7TreeNode node, Map<String, Integer> orderMap, int order) {
|
||||
private int curOrder;
|
||||
|
||||
public void initNodeOrder(HL7TreeNode node, Map<String, Integer> orderMap) {
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
HL7TreeNode parent = node.getParent();
|
||||
if (parent == null) {
|
||||
curOrder = 1;
|
||||
node.setOrder(1);
|
||||
String path = getPath(node);
|
||||
orderMap.put(path, order);
|
||||
order++;
|
||||
orderMap.put(path, curOrder);
|
||||
curOrder++;
|
||||
}
|
||||
List<HL7TreeNode> childNode = node.getChildren();
|
||||
for (HL7TreeNode child : childNode) {
|
||||
child.setOrder(order);
|
||||
child.setOrder(curOrder);
|
||||
String path = getPath(child);
|
||||
orderMap.put(path, order);
|
||||
order++;
|
||||
orderMap.put(path, curOrder);
|
||||
curOrder++;
|
||||
if (child.getChildren().size() > 0) {
|
||||
initNodeOrder(child, orderMap, order);
|
||||
initNodeOrder(child, orderMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +191,6 @@ public class HL7PublicUtil {
|
||||
childEle.setLabel(tlabel);
|
||||
if (childEle instanceof Element) {
|
||||
((Element) childEle).setRow(childLabel);
|
||||
((Element) childEle).setColumnName(getLabel(element, true));
|
||||
}
|
||||
|
||||
node.addChild(childEle);
|
||||
@@ -341,7 +343,7 @@ public class HL7PublicUtil {
|
||||
}
|
||||
}
|
||||
if (childReps[j] instanceof Group) {
|
||||
values.add((Group) childReps[j]);
|
||||
values.add(childReps[j]);
|
||||
allSegmentFromGroup.clear();
|
||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
||||
}
|
||||
@@ -456,7 +458,7 @@ public class HL7PublicUtil {
|
||||
values.add(childReps[j]);
|
||||
}
|
||||
if (childReps[j] instanceof Group) {
|
||||
values.add((Group) childReps[j]);
|
||||
values.add(childReps[j]);
|
||||
allSegmentFromGroup.clear();
|
||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class XmlMapExpressionManager {
|
||||
|
||||
private final static String EXPRESSION_PATTERN = "(\\[)\\s*(\\w+)\\s*\\.(\\w+\\s*:\\s*(/.+?)+(/@.+?)*)\\s*(\\])|((?!\\[)\\s*\\w+)\\s*\\.\\s*(\\w+(?!\\]))";
|
||||
|
||||
private final String SUBS_PATTERN_FOR_REPLACE_LOCATION = "{0}(\\s*){1}(\\s*)\\.(\\s*){2}(\\s*){3}";
|
||||
private final String SUBS_PATTERN_FOR_REPLACE_LOCATION = "{0}(\\s*\\b){1}(\\s*)\\.(\\s*){2}(\\b\\s*){3}";
|
||||
|
||||
private Perl5Matcher matcher = new Perl5Matcher();
|
||||
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
<classpathentry exported="true" kind="lib" path="lib/commons-net-3.3.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hapi-base-1.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hapi-structures-v21-1.0.1.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/hapi-structures-v22-1.0.1.jar"/>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/jboss-serialization.jar"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
Binary file not shown.
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -415,7 +415,16 @@ public class ImportItemUtil {
|
||||
return 0;
|
||||
} else if (!(o1.getProperty().getItem() instanceof RoutineItem)
|
||||
&& !(o2.getProperty().getItem() instanceof RoutineItem)) {
|
||||
return 0;
|
||||
// TUP-2548 sort items by label
|
||||
String label = o1.getLabel();
|
||||
if (label == null) {
|
||||
return -1;
|
||||
}
|
||||
final String label2 = o2.getLabel();
|
||||
if (label2 == null) {
|
||||
return 1;
|
||||
}
|
||||
return label.compareTo(label2);
|
||||
} else if (o1.getProperty().getItem() instanceof RoutineItem) {
|
||||
return -1;
|
||||
} else {
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
@@ -32,6 +33,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||
import org.eclipse.jface.layout.GridDataFactory;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
@@ -71,6 +73,7 @@ import org.talend.core.model.properties.PropertiesFactory;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.ui.ISVNProviderService;
|
||||
import org.talend.repository.RepositoryWorkUnit;
|
||||
import org.talend.repository.model.ComponentsFactoryProvider;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
|
||||
@@ -142,6 +145,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
|
||||
componentViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
shareButton.setEnabled(!event.getSelection().isEmpty());
|
||||
}
|
||||
@@ -158,6 +162,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
|
||||
shareViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
backButton.setEnabled(!event.getSelection().isEmpty());
|
||||
}
|
||||
@@ -340,6 +345,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
protected void performApply() {
|
||||
final IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
monitor.beginTask("Save custom component setting", (sharedAdded.size() + backAdded.size()) * 100);
|
||||
finish(monitor);
|
||||
@@ -381,9 +387,18 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
if (monitorWrap != null && monitorWrap.length == 1) {
|
||||
monitor = monitorWrap[0];
|
||||
}
|
||||
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
|
||||
final IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
|
||||
|
||||
if (PluginChecker.isSVNProviderPluginLoaded() && (!sharedAdded.isEmpty() || !backAdded.isEmpty())) {
|
||||
RepositoryWorkUnit repositoryWorkUnit = new RepositoryWorkUnit("Commit new component") {
|
||||
|
||||
@Override
|
||||
public void run() throws PersistenceException {
|
||||
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor subMonitor) throws CoreException {
|
||||
|
||||
ISVNProviderService service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(
|
||||
ISVNProviderService.class);
|
||||
String projectLabel = pro.getTechnicalLabel();
|
||||
@@ -406,9 +421,10 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
|
||||
// delete share
|
||||
for (IComponent component : backAdded.keySet()) {
|
||||
service.svnEclipseHandlerDelete(eclipseProject, pro, targetRoot + File.separator + component.getName());
|
||||
if (monitor != null) {
|
||||
monitor.worked(10);
|
||||
service.svnEclipseHandlerDelete(eclipseProject, pro,
|
||||
targetRoot + File.separator + component.getName());
|
||||
if (subMonitor != null) {
|
||||
subMonitor.worked(10);
|
||||
}
|
||||
}
|
||||
if (!backAdded.isEmpty()) {
|
||||
@@ -417,6 +433,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
|
||||
FileFilter ff = new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File pathname) {
|
||||
if (FilesUtils.isSVNFolder(pathname)) {
|
||||
return false;
|
||||
@@ -428,14 +445,15 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
|
||||
// share
|
||||
for (IComponent component : sharedAdded.keySet()) {
|
||||
String sourcePath = sourceRoot + component.getPathSource() + File.separator + component.getName();
|
||||
String sourcePath = sourceRoot + component.getPathSource() + File.separator
|
||||
+ component.getName();
|
||||
File sourceFile = new File(sourcePath);
|
||||
|
||||
String targetPath = targetRoot + File.separatorChar + component.getName();
|
||||
File targetFile = new File(targetPath);
|
||||
FilesUtils.copyFolder(sourceFile, targetFile, true, ff, null, true, false);
|
||||
if (monitor != null) {
|
||||
monitor.worked(10);
|
||||
if (subMonitor != null) {
|
||||
subMonitor.worked(10);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,16 +468,45 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
}
|
||||
|
||||
try {
|
||||
eclipseProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
|
||||
eclipseProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
|
||||
} catch (CoreException e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
try {
|
||||
ISchedulingRule schedulingRule = workspace.getRoot();
|
||||
// the update the project files need to be done in the workspace runnable to avoid all
|
||||
// notification
|
||||
// of changes before the end of the modifications.
|
||||
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor());
|
||||
} catch (CoreException e) {
|
||||
throw new PersistenceException(e.getCause());
|
||||
}
|
||||
}
|
||||
};
|
||||
repositoryWorkUnit.setRefreshRepository(false);
|
||||
repositoryWorkUnit.setForceTransaction(true);
|
||||
prf.executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||
try {
|
||||
repositoryWorkUnit.throwPersistenceExceptionIfAny();
|
||||
} catch (PersistenceException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (monitor != null) {
|
||||
monitor.done();
|
||||
}
|
||||
|
||||
// refresh again after the gui closed .
|
||||
try {
|
||||
String projectLabel = pro.getTechnicalLabel();
|
||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||
IProject eclipseProject = workspace.getRoot().getProject(projectLabel);
|
||||
eclipseProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
|
||||
} catch (CoreException e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetCustomComponentSetting() {
|
||||
@@ -504,21 +551,25 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
*/
|
||||
class CustomCompSettingContentProvider implements ITreeContentProvider {
|
||||
|
||||
@Override
|
||||
public Object[] getChildren(Object parentElement) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
if (inputElement instanceof List) {
|
||||
return ((List) inputElement).toArray();
|
||||
@@ -526,11 +577,13 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user