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,25 +49,15 @@
|
|||||||
boolean hasParallelIterate = false;
|
boolean hasParallelIterate = false;
|
||||||
for (IConnection iterateConn : iterateConnSet) {
|
for (IConnection iterateConn : iterateConnSet) {
|
||||||
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
parallelIterate = "true".equals(ElementParameterParser.getValue(iterateConn, "__ENABLE_PARALLEL__"));
|
||||||
|
String iterateNodeName = iterateConn.getTarget().getUniqueName();
|
||||||
if (parallelIterate) {
|
if (parallelIterate) {
|
||||||
%>
|
%>
|
||||||
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
|
TalendThreadPool mtp_<%=iterateConn.getTarget().getUniqueName() %> = new TalendThreadPool(<%=ElementParameterParser.getValue(iterateConn,"__NUMBER_PARALLEL__") %>);
|
||||||
|
|
||||||
<%
|
globalMap.put("lockWrite_<%=iterateNodeName%>", new Object[0]);
|
||||||
if(!hasParallelIterate){
|
int threadIdCounter_<%=iterateNodeName%> =0;
|
||||||
hasParallelIterate = true;
|
|
||||||
%>
|
|
||||||
|
|
||||||
final Object[] lockWrite = new Object[0];
|
|
||||||
int threadIdCounter =0;
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
|
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
|
|
||||||
String iterateNodeName = iterateConn.getTarget().getUniqueName();
|
|
||||||
%>
|
%>
|
||||||
int NB_ITERATE_<%=iterateNodeName %> = 0; //for statistics
|
int NB_ITERATE_<%=iterateNodeName %> = 0; //for statistics
|
||||||
<%
|
<%
|
||||||
|
|||||||
@@ -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() %>);
|
mtp_<%=node.getUniqueName() %>.execute(bt_<%=node.getUniqueName() %>);
|
||||||
|
|
||||||
<%
|
<%
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ for (IConnection iterateConn : iterateConnSet) { //1
|
|||||||
rowList = rowList.substring(0, rowList.length()-1);
|
rowList = rowList.substring(0, rowList.length()-1);
|
||||||
%>
|
%>
|
||||||
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
|
class <%=node.getUniqueName() %>Thread extends TalendThread {//implements routines.system.TalendThreadPool.PropertySettable
|
||||||
|
|
||||||
class ThreadedMap extends java.util.HashMap<String, Object> {
|
class ThreadedMap extends java.util.HashMap<String, Object> {
|
||||||
|
|
||||||
private static final long serialVersionUID = 0L;
|
private static final long serialVersionUID = 0L;
|
||||||
|
|||||||
@@ -868,7 +868,6 @@ public class CodeGenerator implements ICodeGenerator {
|
|||||||
CodeGeneratorArgument argument = new CodeGeneratorArgument();
|
CodeGeneratorArgument argument = new CodeGeneratorArgument();
|
||||||
argument.setNode(node);
|
argument.setNode(node);
|
||||||
argument.setAllMainSubTreeConnections(subProcess.getAllMainSubTreeConnections());
|
argument.setAllMainSubTreeConnections(subProcess.getAllMainSubTreeConnections());
|
||||||
argument.setSubTreeContainsParallelIterate(subProcess.subTreeContainsParallelIterate());
|
|
||||||
argument.setCodePart(part);
|
argument.setCodePart(part);
|
||||||
argument.setStatistics(statistics);
|
argument.setStatistics(statistics);
|
||||||
argument.setTrace(trace);
|
argument.setTrace(trace);
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public class CodeGeneratorArgument {
|
|||||||
|
|
||||||
private int pauseTime;
|
private int pauseTime;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
private boolean subTreeContainsParallelIterate;
|
private boolean subTreeContainsParallelIterate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,10 +278,15 @@ public class CodeGeneratorArgument {
|
|||||||
this.subTree = subTree;
|
this.subTree = subTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
/*
|
||||||
|
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
|
||||||
|
*/
|
||||||
public boolean subTreeContainsParallelIterate() {
|
public boolean subTreeContainsParallelIterate() {
|
||||||
return subTreeContainsParallelIterate;
|
return subTreeContainsParallelIterate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
|
public void setSubTreeContainsParallelIterate(boolean subTreeContainsParallelIterate) {
|
||||||
this.subTreeContainsParallelIterate = 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.AbstractNode;
|
||||||
import org.talend.core.model.process.EConnectionType;
|
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.IConnection;
|
||||||
import org.talend.core.model.process.IConnectionCategory;
|
import org.talend.core.model.process.IConnectionCategory;
|
||||||
import org.talend.core.model.process.INode;
|
import org.talend.core.model.process.INode;
|
||||||
@@ -61,6 +60,7 @@ public class NodesSubTree {
|
|||||||
|
|
||||||
List<IConnection> allMainSubTreeConnections = null;
|
List<IConnection> allMainSubTreeConnections = null;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
boolean subTreeContainsParallelIterate = false;
|
boolean subTreeContainsParallelIterate = false;
|
||||||
|
|
||||||
List<INode> mergeBranchStarts;
|
List<INode> mergeBranchStarts;
|
||||||
@@ -251,10 +251,6 @@ public class NodesSubTree {
|
|||||||
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
if (connection.getLineStyle().hasConnectionCategory(IConnectionCategory.MAIN)) {
|
||||||
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
|
if (!connection.getLineStyle().hasConnectionCategory(IConnectionCategory.USE_ITERATE)) {
|
||||||
allMainSubTreeConnections.add(connection);
|
allMainSubTreeConnections.add(connection);
|
||||||
} else {
|
|
||||||
if (Boolean.TRUE.toString().equals(ElementParameterParser.getValue(connection, "__ENABLE_PARALLEL__"))) { //$NON-NLS-1$
|
|
||||||
subTreeContainsParallelIterate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
System.out.print(" -> "); //$NON-NLS-1$
|
System.out.print(" -> "); //$NON-NLS-1$
|
||||||
@@ -505,6 +501,10 @@ public class NodesSubTree {
|
|||||||
this.allMainSubTreeConnections = allMainSubTreeConnections;
|
this.allMainSubTreeConnections = allMainSubTreeConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
/*
|
||||||
|
* use org.talend.core.model.process.AbstractNode.getParallelIterator()
|
||||||
|
*/
|
||||||
public boolean subTreeContainsParallelIterate() {
|
public boolean subTreeContainsParallelIterate() {
|
||||||
return subTreeContainsParallelIterate;
|
return subTreeContainsParallelIterate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10306,7 +10306,23 @@ public class SforceServiceStub extends org.apache.axis2.client.Stub implements
|
|||||||
"urn:partner.soap.sforce.com:Soap:describeGlobalRequest");
|
"urn:partner.soap.sforce.com:Soap:describeGlobalRequest");
|
||||||
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
||||||
true);
|
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(
|
addPropertyToOperationClient(
|
||||||
_operationClient,
|
_operationClient,
|
||||||
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
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");
|
"urn:partner.soap.sforce.com:Soap:describeSObjectRequest");
|
||||||
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(
|
||||||
true);
|
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(
|
addPropertyToOperationClient(
|
||||||
_operationClient,
|
_operationClient,
|
||||||
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ imports="
|
|||||||
org.talend.core.model.utils.NodeUtil
|
org.talend.core.model.utils.NodeUtil
|
||||||
java.util.List
|
java.util.List
|
||||||
org.talend.core.model.process.IProcess
|
org.talend.core.model.process.IProcess
|
||||||
|
org.talend.core.model.process.IElementParameter
|
||||||
|
org.talend.core.model.process.AbstractNode
|
||||||
"
|
"
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
||||||
@@ -457,9 +459,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
|||||||
synchronized (multiThreadLockWrite) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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
|
org.talend.core.model.process.ElementParameterParser
|
||||||
java.util.List
|
java.util.List
|
||||||
org.talend.core.model.process.IProcess
|
org.talend.core.model.process.IProcess
|
||||||
|
org.talend.core.model.utils.NodeUtil
|
||||||
|
org.talend.core.model.process.AbstractNode
|
||||||
"
|
"
|
||||||
%>
|
%>
|
||||||
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
<%@ include file="../templates/Log4j/Log4jFileUtil.javajet"%>
|
||||||
@@ -43,9 +45,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
|||||||
synchronized (multiThreadLockWrite) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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
|
org.talend.core.model.process.ElementParameterParser
|
||||||
java.util.List
|
java.util.List
|
||||||
org.talend.core.model.process.IProcess
|
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) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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
|
java.util.List
|
||||||
org.talend.core.model.metadata.types.JavaTypesManager
|
org.talend.core.model.metadata.types.JavaTypesManager
|
||||||
org.talend.core.model.metadata.types.JavaType
|
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) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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 compress = ("true").equals(ElementParameterParser.getValue(node,"__COMPRESS__"));
|
||||||
|
|
||||||
|
boolean useOSLineSeparator = ("true").equals(ElementParameterParser.getValue(node,"__OS_LINE_SEPARATOR_AS_ROW_SEPARATOR__"));
|
||||||
|
|
||||||
boolean hasDynamic = metadata.isDynamicSchema();
|
boolean hasDynamic = metadata.isDynamicSchema();
|
||||||
IMetadataColumn dynamicCol = metadata.getDynamicColumn();
|
IMetadataColumn dynamicCol = metadata.getDynamicColumn();
|
||||||
if(hasDynamic){
|
if(hasDynamic){
|
||||||
@@ -424,9 +428,9 @@ if(("false").equals(ElementParameterParser.getValue(node,"__CSV_OPTION__"))) {
|
|||||||
synchronized (multiThreadLockWrite) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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%>)));
|
new java.io.FileOutputStream(fullName_<%=cid%> + splitedFileNo_<%=cid%> + extension_<%=cid%>, <%=isAppend%>),<%=encoding%>)));
|
||||||
CsvWriter<%=cid%>.setSeparator(csvSettings_<%=cid %>.getFieldDelim());
|
CsvWriter<%=cid%>.setSeparator(csvSettings_<%=cid %>.getFieldDelim());
|
||||||
<%}%>
|
<%}%>
|
||||||
if(csvSettings_<%=cid %>.getRowDelim()!='\r' && csvSettings_<%=cid %>.getRowDelim()!='\n')
|
|
||||||
CsvWriter<%=cid%>.setLineEnd(""+csvSettings_<%=cid %>.getRowDelim());
|
<%
|
||||||
|
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.
|
//set header.
|
||||||
<%
|
<%
|
||||||
if(isIncludeHeader && !isAppend){
|
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.designer.codegen.config.CodeGeneratorArgument
|
||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
java.util.List
|
java.util.List
|
||||||
|
org.talend.core.model.utils.NodeUtil
|
||||||
|
org.talend.core.model.process.AbstractNode
|
||||||
"
|
"
|
||||||
%>
|
%>
|
||||||
<%
|
<%
|
||||||
@@ -30,9 +32,9 @@
|
|||||||
synchronized (multiThreadLockWrite) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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.IConnectionCategory
|
||||||
org.talend.core.model.process.ElementParameterParser
|
org.talend.core.model.process.ElementParameterParser
|
||||||
org.talend.designer.codegen.config.CodeGeneratorArgument
|
org.talend.designer.codegen.config.CodeGeneratorArgument
|
||||||
|
org.talend.core.model.utils.NodeUtil
|
||||||
java.util.List
|
java.util.List
|
||||||
java.util.Map
|
java.util.Map
|
||||||
|
org.talend.core.model.process.AbstractNode
|
||||||
"
|
"
|
||||||
%>
|
%>
|
||||||
<%
|
<%
|
||||||
@@ -70,9 +72,9 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
|
|||||||
synchronized (multiThreadLockWrite) {
|
synchronized (multiThreadLockWrite) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (codeGenArgument.subTreeContainsParallelIterate()) {
|
if (((AbstractNode)node).getParallelIterator() != null) {
|
||||||
%>
|
%>
|
||||||
synchronized (lockWrite) {
|
synchronized ((Object[])globalMap.get("lockWrite_<%=((AbstractNode)node).getParallelIterator()%>")) {
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
if (isParallelize) {
|
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 validate = ("true").equals(ElementParameterParser.getValue(node,"__VALIDATE__"));
|
||||||
boolean isGenerateId = ("true").equals(ElementParameterParser.getValue(node,"__GENERATE_ID__"));
|
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__"));
|
boolean useTransaction = ("true").equals(ElementParameterParser.getValue(node,"__USE_TRANSACTION__"));
|
||||||
String transactionProvider = ElementParameterParser.getValue(node,"__TRANSACTION_PROVIDER__");
|
String transactionProvider = ElementParameterParser.getValue(node,"__TRANSACTION_PROVIDER__");
|
||||||
@@ -41,6 +42,6 @@ if(mdmTransaction_<%=cid%>!=null) {
|
|||||||
}
|
}
|
||||||
<%}%>
|
<%}%>
|
||||||
bulkloadClient_<%=cid %>.startThreadCount();
|
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;
|
int count_<%=cid%> = 0;
|
||||||
org.talend.mdm.bulkload.client.InputStreamMerger inputStreamMerger_<%=cid%> = null;
|
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>
|
<DEFAULT>false</DEFAULT>
|
||||||
</PARAMETER>
|
</PARAMETER>
|
||||||
|
|
||||||
|
<PARAMETER NAME="INSERT_ONLY" FIELD="CHECK" NUM_ROW="50">
|
||||||
|
<DEFAULT>false</DEFAULT>
|
||||||
|
</PARAMETER>
|
||||||
|
|
||||||
<PARAMETER NAME="MASS_LEVEL" FIELD="TEXT" NUM_ROW="60"
|
<PARAMETER NAME="MASS_LEVEL" FIELD="TEXT" NUM_ROW="60"
|
||||||
REQUIRED="true">
|
REQUIRED="true">
|
||||||
<DEFAULT>500</DEFAULT>
|
<DEFAULT>500</DEFAULT>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ if (count_<%=cid%> % <%=arraySize%> == 0) {
|
|||||||
if(inputStreamMerger_<%=cid%> != null)
|
if(inputStreamMerger_<%=cid%> != null)
|
||||||
inputStreamMerger_<%=cid%>.close();
|
inputStreamMerger_<%=cid%>.close();
|
||||||
inputStreamMerger_<%=cid%> = bulkloadClient_<%=cid %>.load();
|
inputStreamMerger_<%=cid%> = bulkloadClient_<%=cid %>.load();
|
||||||
|
resourceMap.put("mdmBulkStream<%=cid %>", inputStreamMerger_<%=cid%>);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(<%=conn.getName()%>.<%=xmlField %>!=null){
|
if(<%=conn.getName()%>.<%=xmlField %>!=null){
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ DATACONCEPT.NAME=Entity
|
|||||||
XMLFIELD.NAME=XML Field
|
XMLFIELD.NAME=XML Field
|
||||||
VALIDATE.NAME=Validate
|
VALIDATE.NAME=Validate
|
||||||
GENERATE_ID.NAME=Generate ID
|
GENERATE_ID.NAME=Generate ID
|
||||||
|
INSERT_ONLY.NAME=Insert only
|
||||||
MASS_LEVEL.NAME=Commit size
|
MASS_LEVEL.NAME=Commit size
|
||||||
HELP=org.talend.help.tMDMOutput
|
HELP=org.talend.help.tMDMOutput
|
||||||
LONG_NAME=Output an xml structure to the talend MDM web service
|
LONG_NAME=Output an xml structure to the talend MDM web service
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ DATACONCEPT.NAME=Entity
|
|||||||
XMLFIELD.NAME=XML Field
|
XMLFIELD.NAME=XML Field
|
||||||
VALIDATE.NAME=Validate
|
VALIDATE.NAME=Validate
|
||||||
GENERATE_ID.NAME=Generate ID
|
GENERATE_ID.NAME=Generate ID
|
||||||
|
INSERT_ONLY.NAME=Insert only
|
||||||
MASS_LEVEL.NAME=Commit size
|
MASS_LEVEL.NAME=Commit size
|
||||||
HELP=org.talend.help.tMDMOutput
|
HELP=org.talend.help.tMDMOutput
|
||||||
LONG_NAME=Output an xml structure to the talend MDM web service
|
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;
|
boolean continueFlag_<%=cid%> = true;
|
||||||
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
|
int totalCount_<%=cid%> = -1;<%//For TDI-26039%>
|
||||||
|
int totalPage_<%=cid %> = -1;
|
||||||
|
int pageNumber_<%=cid %> = 0;
|
||||||
while (continueFlag_<%=cid%>) {
|
while (continueFlag_<%=cid%>) {
|
||||||
|
pageNumber_<%=cid %>++;
|
||||||
getitems_<%=cid%>=new org.talend.mdm.webservice.WSGetItems(dataCluster_<%=cid%>, <%=concept%>, wsItem_<%=cid%>,
|
getitems_<%=cid%>=new org.talend.mdm.webservice.WSGetItems(dataCluster_<%=cid%>, <%=concept%>, wsItem_<%=cid%>,
|
||||||
<%=spellThrehold%>, //spell Threshold
|
<%=spellThrehold%>, //spell Threshold
|
||||||
skip_<%=cid%> + retrievedCount_<%=cid%>,
|
skip_<%=cid%> + retrievedCount_<%=cid%>,
|
||||||
@@ -188,6 +190,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
|
|||||||
items_<%=cid%> = xtentisWS_<%=cid%>.getItems(getitems_<%=cid%>);
|
items_<%=cid%> = xtentisWS_<%=cid%>.getItems(getitems_<%=cid%>);
|
||||||
if(totalCount_<%=cid%> < 0){
|
if(totalCount_<%=cid%> < 0){
|
||||||
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
|
totalCount_<%=cid%> = Integer.valueOf(items_<%=cid%>[0].replaceAll("<totalCount>", "").replaceAll("</totalCount>", ""));
|
||||||
|
totalPage_<%=cid %> = totalCount_<%=cid%>/recordsPerPage_<%=cid%> +1;
|
||||||
}
|
}
|
||||||
} catch(java.lang.Exception e) {
|
} catch(java.lang.Exception e) {
|
||||||
<%if(dieOnError) {%>
|
<%if(dieOnError) {%>
|
||||||
@@ -197,7 +200,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {//1
|
|||||||
<% } %>
|
<% } %>
|
||||||
}
|
}
|
||||||
retrievedCount_<%=cid%> += (items_<%=cid%>.length - 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;
|
continueFlag_<%=cid%> = false;
|
||||||
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
|
} else if (limit_<%=cid%> != -1 && limit_<%=cid%> < retrievedCount_<%=cid%> + readRecordsSize_<%=cid%>) {
|
||||||
readRecordsSize_<%=cid%> = limit_<%=cid%> - retrievedCount_<%=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.
|
PasswordController.NoteConvention=Note: Follow the usual Java convention which requires text to be surrounded by double quotes.
|
||||||
NodeSelectedDialog.title=Select node
|
NodeSelectedDialog.title=Select node
|
||||||
NodeSelectedDialog.msg=Please select a 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)
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setName(final String s) {
|
public void setName(final String s) {
|
||||||
name = s;
|
name = s;
|
||||||
}
|
}
|
||||||
@@ -167,10 +168,12 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getVariableName()
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getVariableName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getVariableName() {
|
public String getVariableName() {
|
||||||
return "__" + name + "__"; //$NON-NLS-1$ //$NON-NLS-2$
|
return "__" + name + "__"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCategory(final EComponentCategory cat) {
|
public void setCategory(final EComponentCategory cat) {
|
||||||
category = cat;
|
category = cat;
|
||||||
}
|
}
|
||||||
@@ -180,6 +183,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getCategory()
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getCategory()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public EComponentCategory getCategory() {
|
public EComponentCategory getCategory() {
|
||||||
return this.category;
|
return this.category;
|
||||||
}
|
}
|
||||||
@@ -189,6 +193,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setDisplayName(java.lang.String)
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setDisplayName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setDisplayName(final String s) {
|
public void setDisplayName(final String s) {
|
||||||
displayName = 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.
|
* @seeorg.talend.designer.core.model.components.IDesignerElementParameter#setField(org.talend.core.model.designer.
|
||||||
* EParameterFieldType)
|
* EParameterFieldType)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setFieldType(final EParameterFieldType type) {
|
public void setFieldType(final EParameterFieldType type) {
|
||||||
field = type;
|
field = type;
|
||||||
}
|
}
|
||||||
@@ -208,10 +214,12 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setValue(java.lang.Object)
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#setValue(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setValue(final Object o) {
|
public void setValue(final Object o) {
|
||||||
value = o;
|
value = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -221,6 +229,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getDisplayName()
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getDisplayName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
return displayName;
|
return displayName;
|
||||||
}
|
}
|
||||||
@@ -230,6 +239,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getField()
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getField()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public EParameterFieldType getFieldType() {
|
public EParameterFieldType getFieldType() {
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
@@ -239,26 +249,32 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getValue()
|
* @see org.talend.designer.core.model.components.IDesignerElementParameter#getValue()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setListItemsDisplayName(final String[] list) {
|
public void setListItemsDisplayName(final String[] list) {
|
||||||
itemsDisplayName = list;
|
itemsDisplayName = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getListItemsDisplayName() {
|
public String[] getListItemsDisplayName() {
|
||||||
return itemsDisplayName;
|
return itemsDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setListItemsDisplayCodeName(final String[] list) {
|
public void setListItemsDisplayCodeName(final String[] list) {
|
||||||
itemsDisplayCodeName = list;
|
itemsDisplayCodeName = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getListItemsDisplayCodeName() {
|
public String[] getListItemsDisplayCodeName() {
|
||||||
return itemsDisplayCodeName;
|
return itemsDisplayCodeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setListItemsValue(final Object[] list) {
|
public void setListItemsValue(final Object[] list) {
|
||||||
if (this.getFieldType() == EParameterFieldType.TABLE) {
|
if (this.getFieldType() == EParameterFieldType.TABLE) {
|
||||||
EParameterFieldType.AS400_CHECK.getClass();
|
EParameterFieldType.AS400_CHECK.getClass();
|
||||||
@@ -266,42 +282,52 @@ public class ElementParameter implements IElementParameter {
|
|||||||
itemsValue = list;
|
itemsValue = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getListItemsValue() {
|
public Object[] getListItemsValue() {
|
||||||
return itemsValue;
|
return itemsValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDefaultClosedListValue(Object o) {
|
public void setDefaultClosedListValue(Object o) {
|
||||||
defaultClosedListValue = o;
|
defaultClosedListValue = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getDefaultClosedListValue() {
|
public Object getDefaultClosedListValue() {
|
||||||
return defaultClosedListValue;
|
return defaultClosedListValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setListRepositoryItems(final String[] list) {
|
public void setListRepositoryItems(final String[] list) {
|
||||||
itemsRepository = list;
|
itemsRepository = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getListRepositoryItems() {
|
public String[] getListRepositoryItems() {
|
||||||
return itemsRepository;
|
return itemsRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setListItemsShowIf(String[] list) {
|
public void setListItemsShowIf(String[] list) {
|
||||||
itemsShowIf = list;
|
itemsShowIf = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getListItemsShowIf() {
|
public String[] getListItemsShowIf() {
|
||||||
return itemsShowIf;
|
return itemsShowIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setListItemsNotShowIf(String[] list) {
|
public void setListItemsNotShowIf(String[] list) {
|
||||||
itemsNotShowIf = list;
|
itemsNotShowIf = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getListItemsNotShowIf() {
|
public String[] getListItemsNotShowIf() {
|
||||||
return itemsNotShowIf;
|
return itemsNotShowIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getIndexOfItemFromList(String item) {
|
public int getIndexOfItemFromList(String item) {
|
||||||
int index = -1;
|
int index = -1;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
@@ -324,22 +350,27 @@ public class ElementParameter implements IElementParameter {
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getNbLines() {
|
public int getNbLines() {
|
||||||
return this.nbLines;
|
return this.nbLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNbLines(final int nbLines) {
|
public void setNbLines(final int nbLines) {
|
||||||
this.nbLines = nbLines;
|
this.nbLines = nbLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getNumRow() {
|
public int getNumRow() {
|
||||||
return this.numRow;
|
return this.numRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNumRow(final int numRow) {
|
public void setNumRow(final int numRow) {
|
||||||
this.numRow = numRow;
|
this.numRow = numRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isReadOnly() {
|
public boolean isReadOnly() {
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
return (this.readOnly || element.isReadOnly());
|
return (this.readOnly || element.isReadOnly());
|
||||||
@@ -351,54 +382,67 @@ public class ElementParameter implements IElementParameter {
|
|||||||
return this.readOnly;
|
return this.readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setReadOnly(final boolean readOnly) {
|
public void setReadOnly(final boolean readOnly) {
|
||||||
this.readOnly = readOnly;
|
this.readOnly = readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isRequired() {
|
public boolean isRequired() {
|
||||||
return this.required;
|
return this.required;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRequired(final boolean required) {
|
public void setRequired(final boolean required) {
|
||||||
this.required = required;
|
this.required = required;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShow(final boolean show) {
|
public void setShow(final boolean show) {
|
||||||
this.show = show;
|
this.show = show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getRepositoryValue() {
|
public String getRepositoryValue() {
|
||||||
return this.repositoryValue;
|
return this.repositoryValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRepositoryValue(String repositoryValue) {
|
public void setRepositoryValue(String repositoryValue) {
|
||||||
this.repositoryValue = repositoryValue;
|
this.repositoryValue = repositoryValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isRepositoryValueUsed() {
|
public boolean isRepositoryValueUsed() {
|
||||||
return this.repositoryValueUsed;
|
return this.repositoryValueUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRepositoryValueUsed(boolean repositoryUsed) {
|
public void setRepositoryValueUsed(boolean repositoryUsed) {
|
||||||
this.repositoryValueUsed = repositoryUsed;
|
this.repositoryValueUsed = repositoryUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getShowIf() {
|
public String getShowIf() {
|
||||||
return showIf;
|
return showIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setShowIf(String showIf) {
|
public void setShowIf(String showIf) {
|
||||||
this.showIf = showIf;
|
this.showIf = showIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getNotShowIf() {
|
public String getNotShowIf() {
|
||||||
return notShowIf;
|
return notShowIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNotShowIf(String notShowIf) {
|
public void setNotShowIf(String notShowIf) {
|
||||||
this.notShowIf = notShowIf;
|
this.notShowIf = notShowIf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isShow(List<? extends IElementParameter> listParam) {
|
public boolean isShow(List<? extends IElementParameter> listParam) {
|
||||||
boolean showParameter = false;
|
boolean showParameter = false;
|
||||||
|
|
||||||
@@ -415,6 +459,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// added by dlin for feature TDI-22421
|
// added by dlin for feature TDI-22421
|
||||||
|
@Override
|
||||||
public boolean isRequired(List<? extends IElementParameter> listParam) {
|
public boolean isRequired(List<? extends IElementParameter> listParam) {
|
||||||
boolean requiredParameter = false;
|
boolean requiredParameter = false;
|
||||||
if (this.requiredIF != null && !required) {
|
if (this.requiredIF != null && !required) {
|
||||||
@@ -425,6 +470,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
return requiredParameter;
|
return requiredParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isShow(String conditionShowIf, String conditionNotShowIf, List<? extends IElementParameter> listParam) {
|
public boolean isShow(String conditionShowIf, String conditionNotShowIf, List<? extends IElementParameter> listParam) {
|
||||||
boolean showParameter = false;
|
boolean showParameter = false;
|
||||||
|
|
||||||
@@ -454,19 +500,29 @@ public class ElementParameter implements IElementParameter {
|
|||||||
return showParameter;
|
return showParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<IElementParameterDefaultValue> getDefaultValues() {
|
public List<IElementParameterDefaultValue> getDefaultValues() {
|
||||||
return this.defaultValues;
|
return this.defaultValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDefaultValues(List<IElementParameterDefaultValue> defaultValues) {
|
public void setDefaultValues(List<IElementParameterDefaultValue> defaultValues) {
|
||||||
this.defaultValues = defaultValues;
|
this.defaultValues = defaultValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setValueToDefault(List<? extends IElementParameter> listParam) {
|
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;
|
boolean setDefaultValue = false;
|
||||||
String conditionIf = defaultValue.getIfCondition();
|
String conditionIf = iDefaultValue.getIfCondition();
|
||||||
String conditionNotIf = defaultValue.getNotIfCondition();
|
String conditionNotIf = iDefaultValue.getNotIfCondition();
|
||||||
|
|
||||||
if ((conditionIf != null) || (conditionNotIf != null)) {
|
if ((conditionIf != null) || (conditionNotIf != null)) {
|
||||||
if (conditionIf != null) {
|
if (conditionIf != null) {
|
||||||
@@ -477,26 +533,31 @@ public class ElementParameter implements IElementParameter {
|
|||||||
}
|
}
|
||||||
if (setDefaultValue) {
|
if (setDefaultValue) {
|
||||||
if (this.field.equals(EParameterFieldType.CHECK) || this.field.equals(EParameterFieldType.RADIO)) {
|
if (this.field.equals(EParameterFieldType.CHECK) || this.field.equals(EParameterFieldType.RADIO)) {
|
||||||
setValue(new Boolean(defaultValue.getDefaultValue().toString()));
|
setValue(new Boolean(iDefaultValue.getDefaultValue().toString()));
|
||||||
} else {
|
} else {
|
||||||
setValue(defaultValue.getDefaultValue());
|
setValue(iDefaultValue.getDefaultValue());
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IElement getElement() {
|
public IElement getElement() {
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setElement(IElement element) {
|
public void setElement(IElement element) {
|
||||||
this.element = element;
|
this.element = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBasedOnSchema() {
|
public boolean isBasedOnSchema() {
|
||||||
return basedOnSchema;
|
return basedOnSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setBasedOnSchema(boolean basedOnSchema) {
|
public void setBasedOnSchema(boolean basedOnSchema) {
|
||||||
this.basedOnSchema = basedOnSchema;
|
this.basedOnSchema = basedOnSchema;
|
||||||
}
|
}
|
||||||
@@ -509,10 +570,12 @@ public class ElementParameter implements IElementParameter {
|
|||||||
return name + ": " + value.toString(); //$NON-NLS-1$
|
return name + ": " + value.toString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getFilter() {
|
public String getFilter() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFilter(String filter) {
|
public void setFilter(String filter) {
|
||||||
this.filter = filter;
|
this.filter = filter;
|
||||||
}
|
}
|
||||||
@@ -522,6 +585,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @return the noCheck
|
* @return the noCheck
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isNoCheck() {
|
public boolean isNoCheck() {
|
||||||
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
|
||||||
|
|
||||||
@@ -542,6 +606,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @param noCheck the noCheck to set
|
* @param noCheck the noCheck to set
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setNoCheck(boolean noCheck) {
|
public void setNoCheck(boolean noCheck) {
|
||||||
this.noCheck = noCheck;
|
this.noCheck = noCheck;
|
||||||
}
|
}
|
||||||
@@ -551,6 +616,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @return the context
|
* @return the context
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getContext() {
|
public String getContext() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
@@ -560,6 +626,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @param context the context to set
|
* @param context the context to set
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setContext(String context) {
|
public void setContext(String context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
@@ -569,6 +636,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @return the childParameters
|
* @return the childParameters
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Map<String, IElementParameter> getChildParameters() {
|
public Map<String, IElementParameter> getChildParameters() {
|
||||||
if (childParameters == null) {
|
if (childParameters == null) {
|
||||||
childParameters = new HashMap<String, IElementParameter>();
|
childParameters = new HashMap<String, IElementParameter>();
|
||||||
@@ -576,10 +644,12 @@ public class ElementParameter implements IElementParameter {
|
|||||||
return childParameters;
|
return childParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IElementParameter getParentParameter() {
|
public IElementParameter getParentParameter() {
|
||||||
return parentParameter;
|
return parentParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setParentParameter(IElementParameter parentParameter) {
|
public void setParentParameter(IElementParameter parentParameter) {
|
||||||
this.parentParameter = parentParameter;
|
this.parentParameter = parentParameter;
|
||||||
// keep the same category with parent.
|
// keep the same category with parent.
|
||||||
@@ -614,6 +684,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getGroup()
|
* @see org.talend.core.model.process.IElementParameter#getGroup()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getGroup() {
|
public String getGroup() {
|
||||||
return this.groupName;
|
return this.groupName;
|
||||||
}
|
}
|
||||||
@@ -623,6 +694,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setGroup(java.lang.String)
|
* @see org.talend.core.model.process.IElementParameter#setGroup(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setGroup(String groupName) {
|
public void setGroup(String groupName) {
|
||||||
this.groupName = groupName;
|
this.groupName = groupName;
|
||||||
}
|
}
|
||||||
@@ -632,6 +704,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getGroupDisplayName()
|
* @see org.talend.core.model.process.IElementParameter#getGroupDisplayName()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getGroupDisplayName() {
|
public String getGroupDisplayName() {
|
||||||
return this.groupDisplayName;
|
return this.groupDisplayName;
|
||||||
}
|
}
|
||||||
@@ -641,6 +714,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setGroupDisplayName(java.lang.String)
|
* @see org.talend.core.model.process.IElementParameter#setGroupDisplayName(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setGroupDisplayName(String groupDisplayName) {
|
public void setGroupDisplayName(String groupDisplayName) {
|
||||||
this.groupDisplayName = groupDisplayName;
|
this.groupDisplayName = groupDisplayName;
|
||||||
}
|
}
|
||||||
@@ -650,6 +724,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getContextMode()
|
* @see org.talend.core.model.process.IElementParameter#getContextMode()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isContextMode() {
|
public boolean isContextMode() {
|
||||||
return this.contextMode;
|
return this.contextMode;
|
||||||
}
|
}
|
||||||
@@ -659,6 +734,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setContextMode(java.lang.String)
|
* @see org.talend.core.model.process.IElementParameter#setContextMode(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setContextMode(boolean mode) {
|
public void setContextMode(boolean mode) {
|
||||||
this.contextMode = mode;
|
this.contextMode = mode;
|
||||||
}
|
}
|
||||||
@@ -668,6 +744,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getLabelFromRepository()
|
* @see org.talend.core.model.process.IElementParameter#getLabelFromRepository()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getLabelFromRepository() {
|
public String getLabelFromRepository() {
|
||||||
return this.labelFromRepository;
|
return this.labelFromRepository;
|
||||||
}
|
}
|
||||||
@@ -677,6 +754,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setLabelFromRepository(java.lang.String)
|
* @see org.talend.core.model.process.IElementParameter#setLabelFromRepository(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setLabelFromRepository(String label) {
|
public void setLabelFromRepository(String label) {
|
||||||
this.labelFromRepository = label;
|
this.labelFromRepository = label;
|
||||||
|
|
||||||
@@ -687,6 +765,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @return the color
|
* @return the color
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public RGB getColor() {
|
public RGB getColor() {
|
||||||
return this.color;
|
return this.color;
|
||||||
}
|
}
|
||||||
@@ -696,6 +775,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @param color the color to set
|
* @param color the color to set
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setColor(RGB color) {
|
public void setColor(RGB color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
@@ -705,6 +785,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @return the backgroundColor
|
* @return the backgroundColor
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public RGB getBackgroundColor() {
|
public RGB getBackgroundColor() {
|
||||||
return this.backgroundColor;
|
return this.backgroundColor;
|
||||||
}
|
}
|
||||||
@@ -714,6 +795,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @param backgroundColor the backgroundColor to set
|
* @param backgroundColor the backgroundColor to set
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setBackgroundColor(RGB backgroundColor) {
|
public void setBackgroundColor(RGB backgroundColor) {
|
||||||
this.backgroundColor = backgroundColor;
|
this.backgroundColor = backgroundColor;
|
||||||
}
|
}
|
||||||
@@ -723,6 +805,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#isBasedOnSubjobStarts()
|
* @see org.talend.core.model.process.IElementParameter#isBasedOnSubjobStarts()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isBasedOnSubjobStarts() {
|
public boolean isBasedOnSubjobStarts() {
|
||||||
return basedOnSubjobStarts;
|
return basedOnSubjobStarts;
|
||||||
}
|
}
|
||||||
@@ -732,6 +815,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setBasedOnSubjobStarts(boolean)
|
* @see org.talend.core.model.process.IElementParameter#setBasedOnSubjobStarts(boolean)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setBasedOnSubjobStarts(boolean basedOnSubjobStarts) {
|
public void setBasedOnSubjobStarts(boolean basedOnSubjobStarts) {
|
||||||
this.basedOnSubjobStarts = basedOnSubjobStarts;
|
this.basedOnSubjobStarts = basedOnSubjobStarts;
|
||||||
}
|
}
|
||||||
@@ -741,6 +825,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#isDynamicSettings()
|
* @see org.talend.core.model.process.IElementParameter#isDynamicSettings()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isDynamicSettings() {
|
public boolean isDynamicSettings() {
|
||||||
return this.dynamicSettings;
|
return this.dynamicSettings;
|
||||||
}
|
}
|
||||||
@@ -750,6 +835,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setDynamicSettings(java.lang.Boolean)
|
* @see org.talend.core.model.process.IElementParameter#setDynamicSettings(java.lang.Boolean)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setDynamicSettings(boolean dynamicSettings) {
|
public void setDynamicSettings(boolean dynamicSettings) {
|
||||||
this.dynamicSettings = dynamicSettings;
|
this.dynamicSettings = dynamicSettings;
|
||||||
}
|
}
|
||||||
@@ -759,6 +845,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getListItemsNotReadOnlyIf()
|
* @see org.talend.core.model.process.IElementParameter#getListItemsNotReadOnlyIf()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getListItemsNotReadOnlyIf() {
|
public String[] getListItemsNotReadOnlyIf() {
|
||||||
return this.itemsNotReadOnlyIf;
|
return this.itemsNotReadOnlyIf;
|
||||||
}
|
}
|
||||||
@@ -768,6 +855,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getListItemsReadOnlyIf()
|
* @see org.talend.core.model.process.IElementParameter#getListItemsReadOnlyIf()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String[] getListItemsReadOnlyIf() {
|
public String[] getListItemsReadOnlyIf() {
|
||||||
return this.itemsReadOnlyIf;
|
return this.itemsReadOnlyIf;
|
||||||
}
|
}
|
||||||
@@ -777,6 +865,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getNotReadOnlyIf()
|
* @see org.talend.core.model.process.IElementParameter#getNotReadOnlyIf()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getNotReadOnlyIf() {
|
public String getNotReadOnlyIf() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return this.notReadonlyIf;
|
return this.notReadonlyIf;
|
||||||
@@ -787,6 +876,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#getReadOnlyIf()
|
* @see org.talend.core.model.process.IElementParameter#getReadOnlyIf()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getReadOnlyIf() {
|
public String getReadOnlyIf() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return this.readonlyIf;
|
return this.readonlyIf;
|
||||||
@@ -797,6 +887,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#isReadOnly(java.util.List)
|
* @see org.talend.core.model.process.IElementParameter#isReadOnly(java.util.List)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isReadOnly(List<? extends IElementParameter> listParam) {
|
public boolean isReadOnly(List<? extends IElementParameter> listParam) {
|
||||||
boolean readonlyParameter = false;
|
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,
|
* @see org.talend.core.model.process.IElementParameter#isReadOnly(java.lang.String, java.lang.String,
|
||||||
* java.util.Map)
|
* java.util.Map)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isReadOnly(String conditionReadOnlyIf, String conditionNotReadOnlyIf,
|
public boolean isReadOnly(String conditionReadOnlyIf, String conditionNotReadOnlyIf,
|
||||||
List<? extends IElementParameter> listParam) {
|
List<? extends IElementParameter> listParam) {
|
||||||
boolean readonlyParameter = false;
|
boolean readonlyParameter = false;
|
||||||
@@ -839,6 +931,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setListItemsNotReadOnlyIf(java.lang.String[])
|
* @see org.talend.core.model.process.IElementParameter#setListItemsNotReadOnlyIf(java.lang.String[])
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setListItemsNotReadOnlyIf(String[] list) {
|
public void setListItemsNotReadOnlyIf(String[] list) {
|
||||||
itemsNotReadOnlyIf = list;
|
itemsNotReadOnlyIf = list;
|
||||||
|
|
||||||
@@ -849,6 +942,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setListItemsReadOnlyIf(java.lang.String[])
|
* @see org.talend.core.model.process.IElementParameter#setListItemsReadOnlyIf(java.lang.String[])
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setListItemsReadOnlyIf(String[] list) {
|
public void setListItemsReadOnlyIf(String[] list) {
|
||||||
itemsReadOnlyIf = list;
|
itemsReadOnlyIf = list;
|
||||||
|
|
||||||
@@ -859,6 +953,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setNotReadOnlyIf(java.lang.String)
|
* @see org.talend.core.model.process.IElementParameter#setNotReadOnlyIf(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setNotReadOnlyIf(String notReadOnly) {
|
public void setNotReadOnlyIf(String notReadOnly) {
|
||||||
this.notReadonlyIf = notReadOnly;
|
this.notReadonlyIf = notReadOnly;
|
||||||
}
|
}
|
||||||
@@ -868,26 +963,32 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @see org.talend.core.model.process.IElementParameter#setReadOnlyIf(java.lang.String)
|
* @see org.talend.core.model.process.IElementParameter#setReadOnlyIf(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setReadOnlyIf(String readOnly) {
|
public void setReadOnlyIf(String readOnly) {
|
||||||
this.readonlyIf = readOnly;
|
this.readonlyIf = readOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isColumnsBasedOnSchema() {
|
public boolean isColumnsBasedOnSchema() {
|
||||||
return this.columnsBasedOnSchema;
|
return this.columnsBasedOnSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setColumnsBasedOnSchema(boolean columnsBasedOnSchema) {
|
public void setColumnsBasedOnSchema(boolean columnsBasedOnSchema) {
|
||||||
this.columnsBasedOnSchema = columnsBasedOnSchema;
|
this.columnsBasedOnSchema = columnsBasedOnSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isNoContextAssist() {
|
public boolean isNoContextAssist() {
|
||||||
return this.noContextAssist;
|
return this.noContextAssist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNoContextAssist(boolean enable) {
|
public void setNoContextAssist(boolean enable) {
|
||||||
this.noContextAssist = enable;
|
this.noContextAssist = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IElementParameter getClone() {
|
public IElementParameter getClone() {
|
||||||
IElementParameter clone = new ElementParameter(this.element);
|
IElementParameter clone = new ElementParameter(this.element);
|
||||||
|
|
||||||
@@ -1038,6 +1139,7 @@ public class ElementParameter implements IElementParameter {
|
|||||||
*
|
*
|
||||||
* @return the maxlength
|
* @return the maxlength
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int getMaxlength() {
|
public int getMaxlength() {
|
||||||
return this.maxlength;
|
return this.maxlength;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -311,18 +311,32 @@ public final class Expression {
|
|||||||
// #LINK@NODE, #PREVIOUS@NODE, #NEXT@NODE ----->implement them later
|
// #LINK@NODE, #PREVIOUS@NODE, #NEXT@NODE ----->implement them later
|
||||||
if ((variableName != null) && (variableValue != null)) {
|
if ((variableName != null) && (variableValue != null)) {
|
||||||
if (varNames[0].equals("#LINK@NODE")) { //$NON-NLS-1$
|
if (varNames[0].equals("#LINK@NODE")) { //$NON-NLS-1$
|
||||||
|
INode node = null;
|
||||||
if (currentParam != null && currentParam.getElement() instanceof INode) {
|
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$
|
String relatedNodeName = ElementParameterParser.getValue(node, "__" + varNames[1] + "__"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
List<? extends INode> generatingNodes = node.getProcess().getGeneratingNodes();
|
// if relatedNodeName is empty, maybe means this property have not been setted
|
||||||
for (INode aNode : generatingNodes) {
|
if (relatedNodeName != null && !relatedNodeName.trim().isEmpty()) {
|
||||||
if (aNode.getUniqueName().equals(relatedNodeName)) {
|
List<? extends INode> generatingNodes = node.getProcess().getGeneratingNodes();
|
||||||
simpleExpression = simpleExpression.replace(varNames[0] + "." + varNames[1] + ".", ""); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
|
for (INode aNode : generatingNodes) {
|
||||||
List<? extends IElementParameter> elementParameters = aNode.getElementParameters();
|
if (aNode.getUniqueName().equals(relatedNodeName)) {
|
||||||
// let's supose the currentParam = null, there won't want deal with the TABLE field, only
|
simpleExpression = simpleExpression.replace(varNames[0] + "." + varNames[1] + ".", ""); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
|
||||||
// deal with LIST/CHECKBOX
|
List<? extends IElementParameter> elementParameters = aNode.getElementParameters();
|
||||||
return evaluate(simpleExpression, elementParameters);
|
// 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,28 +676,42 @@ public final class Expression {
|
|||||||
// debug: System.out.println(leftString + " => " +
|
// debug: System.out.println(leftString + " => " +
|
||||||
// leftExpression.isValid());
|
// leftExpression.isValid());
|
||||||
}
|
}
|
||||||
String rightString = string.substring(i + 3, string.length()).trim();
|
|
||||||
Expression rightExpression = new Expression(rightString);
|
boolean needValidRightExpression = true;
|
||||||
expression.setRightExpression(rightExpression);
|
if (expression.getCondition().equals(AND) && !expression.getLeftExpression().isValid()) {
|
||||||
if (rightString.contains("(") //$NON-NLS-1$
|
// if left expression is already false, then needn't continue to validate right expression
|
||||||
|| isThereCondition(rightString, AND) || isThereCondition(rightString, OR)) {
|
expression.setValid(false);
|
||||||
evaluateExpression(rightExpression, listParam, currentParam);
|
needValidRightExpression = false;
|
||||||
} else { // no bracket == evaluate expression
|
} else if (expression.getCondition().equals(OR) && expression.getLeftExpression().isValid()) {
|
||||||
rightExpression.setValid(evaluateSimpleExpression(rightString, listParam, currentParam));
|
// if left expression is already true, then need't continue to validate right expression
|
||||||
// debug: System.out.println(rightString + " => " +
|
expression.setValid(true);
|
||||||
// rightExpression.isValid());
|
needValidRightExpression = false;
|
||||||
}
|
}
|
||||||
if (expression.getCondition().equals(AND)) {
|
|
||||||
if (expression.getLeftExpression().isValid() && expression.getRightExpression().isValid()) {
|
if (needValidRightExpression) {
|
||||||
expression.setValid(true);
|
String rightString = string.substring(i + 3, string.length()).trim();
|
||||||
} else {
|
Expression rightExpression = new Expression(rightString);
|
||||||
expression.setValid(false);
|
expression.setRightExpression(rightExpression);
|
||||||
|
if (rightString.contains("(") //$NON-NLS-1$
|
||||||
|
|| isThereCondition(rightString, AND) || isThereCondition(rightString, OR)) {
|
||||||
|
evaluateExpression(rightExpression, listParam, currentParam);
|
||||||
|
} else { // no bracket == evaluate expression
|
||||||
|
rightExpression.setValid(evaluateSimpleExpression(rightString, listParam, currentParam));
|
||||||
|
// debug: System.out.println(rightString + " => " +
|
||||||
|
// rightExpression.isValid());
|
||||||
}
|
}
|
||||||
} else if (expression.getCondition().equals(OR)) {
|
if (expression.getCondition().equals(AND)) {
|
||||||
if (expression.getLeftExpression().isValid() || expression.getRightExpression().isValid()) {
|
if (expression.getLeftExpression().isValid() && expression.getRightExpression().isValid()) {
|
||||||
expression.setValid(true);
|
expression.setValid(true);
|
||||||
} else {
|
} else {
|
||||||
expression.setValid(false);
|
expression.setValid(false);
|
||||||
|
}
|
||||||
|
} else if (expression.getCondition().equals(OR)) {
|
||||||
|
if (expression.getLeftExpression().isValid() || expression.getRightExpression().isValid()) {
|
||||||
|
expression.setValid(true);
|
||||||
|
} else {
|
||||||
|
expression.setValid(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import org.talend.core.model.process.AbstractNode;
|
|||||||
import org.talend.core.model.process.EComponentCategory;
|
import org.talend.core.model.process.EComponentCategory;
|
||||||
import org.talend.core.model.process.EConnectionType;
|
import org.talend.core.model.process.EConnectionType;
|
||||||
import org.talend.core.model.process.EParameterFieldType;
|
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.IConnection;
|
||||||
import org.talend.core.model.process.IConnectionCategory;
|
import org.talend.core.model.process.IConnectionCategory;
|
||||||
import org.talend.core.model.process.IElement;
|
import org.talend.core.model.process.IElement;
|
||||||
@@ -1770,6 +1771,20 @@ public class DataProcess implements IGeneratingProcess {
|
|||||||
dataNodeList.remove(preStaLogConNode);
|
dataNodeList.remove(preStaLogConNode);
|
||||||
dataNodeList.add(0, 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;
|
checkRefList = null;
|
||||||
checkMultipleMap = null;
|
checkMultipleMap = null;
|
||||||
checktUniteMap = 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() {
|
private void checkPigLoadComponent() {
|
||||||
// if (PluginChecker.isPigudfPluginLoaded()) {
|
// if (PluginChecker.isPigudfPluginLoaded()) {
|
||||||
// for (INode dataNode : dataNodeList) {
|
// for (INode dataNode : dataNodeList) {
|
||||||
|
|||||||
@@ -16,9 +16,15 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
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.IncrementalProjectBuilder;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
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.Notification;
|
||||||
import org.eclipse.emf.common.notify.impl.AdapterImpl;
|
import org.eclipse.emf.common.notify.impl.AdapterImpl;
|
||||||
import org.eclipse.emf.common.util.EList;
|
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.commons.utils.VersionUtils;
|
||||||
import org.talend.core.CorePlugin;
|
import org.talend.core.CorePlugin;
|
||||||
import org.talend.core.GlobalServiceRegister;
|
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.ByteArray;
|
||||||
import org.talend.core.model.properties.FileItem;
|
import org.talend.core.model.properties.FileItem;
|
||||||
import org.talend.core.model.properties.Information;
|
import org.talend.core.model.properties.Information;
|
||||||
import org.talend.core.model.properties.Item;
|
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.properties.RoutineItem;
|
||||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||||
import org.talend.core.model.repository.Folder;
|
import org.talend.core.model.repository.Folder;
|
||||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||||
import org.talend.core.model.utils.RepositoryManagerHelper;
|
import org.talend.core.model.utils.RepositoryManagerHelper;
|
||||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||||
|
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||||
import org.talend.core.ui.ILastVersionChecker;
|
import org.talend.core.ui.ILastVersionChecker;
|
||||||
import org.talend.core.ui.IUIRefresher;
|
import org.talend.core.ui.IUIRefresher;
|
||||||
import org.talend.core.ui.branding.IBrandingService;
|
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.action.SaveAsSQLPatternAction;
|
||||||
import org.talend.designer.core.ui.views.problems.Problems;
|
import org.talend.designer.core.ui.views.problems.Problems;
|
||||||
import org.talend.designer.core.utils.DesignerColorUtils;
|
import org.talend.designer.core.utils.DesignerColorUtils;
|
||||||
|
import org.talend.repository.ProjectManager;
|
||||||
import org.talend.repository.RepositoryWorkUnit;
|
import org.talend.repository.RepositoryWorkUnit;
|
||||||
import org.talend.repository.editor.RepositoryEditorInput;
|
import org.talend.repository.editor.RepositoryEditorInput;
|
||||||
import org.talend.repository.model.ERepositoryStatus;
|
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
|
@Override
|
||||||
public void doSave(final IProgressMonitor monitor) {
|
public void doSave(final IProgressMonitor monitor) {
|
||||||
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
|
IRepositoryService service = CorePlugin.getDefault().getRepositoryService();
|
||||||
@@ -325,6 +356,7 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
|
|||||||
super.doSave(monitor);
|
super.doSave(monitor);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
resetItem();
|
||||||
ByteArray byteArray = item.getContent();
|
ByteArray byteArray = item.getContent();
|
||||||
byteArray.setInnerContentFromFile(((FileEditorInput) getEditorInput()).getFile());
|
byteArray.setInnerContentFromFile(((FileEditorInput) getEditorInput()).getFile());
|
||||||
try {
|
try {
|
||||||
@@ -343,8 +375,10 @@ public class StandAloneTalendJavaEditor extends CompilationUnitEditor implements
|
|||||||
refreshJobAndSave(repFactory);
|
refreshJobAndSave(repFactory);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
repositoryWorkUnit.setAvoidSvnUpdate(true);
|
||||||
|
repositoryWorkUnit.setAvoidUnloadResources(true);
|
||||||
repFactory.executeRepositoryWorkUnit(repositoryWorkUnit);
|
repFactory.executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||||
|
repositoryWorkUnit.throwPersistenceExceptionIfAny();
|
||||||
// for bug 11930: Unable to save Routines.* in db project
|
// for bug 11930: Unable to save Routines.* in db project
|
||||||
|
|
||||||
// repFactory.save(item);
|
// 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 {
|
||||||
|
repFactory.save(item);
|
||||||
|
} catch (PersistenceException e) {
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR, DesignerPlugin.ID, "Save Routine failed!", e));
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
try {
|
||||||
// cause it to update MaxInformationLevel
|
PlatformUI.getWorkbench().getProgressService().run(false, false, iRunnableWithProgress);
|
||||||
repFactory.save(item);
|
} catch (InvocationTargetException e) {
|
||||||
} catch (Exception e) {
|
throw new PersistenceException(e);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new PersistenceException(e);
|
||||||
}
|
}
|
||||||
// update editor image
|
|
||||||
setTitleImage(getTitleImage());
|
setTitleImage(getTitleImage());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,6 +433,10 @@ public class NodesPasteCommand extends Command {
|
|||||||
copyOfMetadataList.add(newTable);
|
copyOfMetadataList.add(newTable);
|
||||||
}
|
}
|
||||||
pastedNode.setMetadataList(copyOfMetadataList);
|
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();
|
IExternalNode externalNode = pastedNode.getExternalNode();
|
||||||
if (externalNode != null) {
|
if (externalNode != null) {
|
||||||
if (copiedNode.getExternalData() != null) {
|
if (copiedNode.getExternalData() != null) {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class PropertyChangeCommand extends Command {
|
|||||||
|
|
||||||
private final Map<IElementParameter, Object> oldElementValues;
|
private final Map<IElementParameter, Object> oldElementValues;
|
||||||
|
|
||||||
private ChangeMetadataCommand changeMetadataCommand;
|
private List<ChangeMetadataCommand> changeMetadataCommands;
|
||||||
|
|
||||||
private String propertyTypeName;
|
private String propertyTypeName;
|
||||||
|
|
||||||
@@ -106,6 +106,7 @@ public class PropertyChangeCommand extends Command {
|
|||||||
newValue = propValue;
|
newValue = propValue;
|
||||||
toUpdate = false;
|
toUpdate = false;
|
||||||
oldElementValues = new HashMap<IElementParameter, Object>();
|
oldElementValues = new HashMap<IElementParameter, Object>();
|
||||||
|
changeMetadataCommands = new ArrayList<ChangeMetadataCommand>();
|
||||||
setLabel(Messages.getString("PropertyChangeCommand.Label")); //$NON-NLS-1$
|
setLabel(Messages.getString("PropertyChangeCommand.Label")); //$NON-NLS-1$
|
||||||
// for job settings extra (feature 2710)
|
// for job settings extra (feature 2710)
|
||||||
// if (JobSettingsConstants.isExtraParameter(propName) ||
|
// 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
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
IElementParameter currentParam = elem.getElementParameter(propName);
|
IElementParameter currentParam = elem.getElementParameter(propName);
|
||||||
|
changeMetadataCommands.clear();
|
||||||
oldElementValues.clear();
|
oldElementValues.clear();
|
||||||
if (currentParam == null) {
|
if (currentParam == null) {
|
||||||
return;
|
return;
|
||||||
@@ -316,74 +358,11 @@ public class PropertyChangeCommand extends Command {
|
|||||||
if (!toUpdate
|
if (!toUpdate
|
||||||
&& (currentParam.getFieldType().equals(EParameterFieldType.RADIO)
|
&& (currentParam.getFieldType().equals(EParameterFieldType.RADIO)
|
||||||
|| currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)
|
|| currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)
|
||||||
|| currentParam.getFieldType().equals(EParameterFieldType.CHECK) || currentParam.getFieldType().equals(
|
|| currentParam.getFieldType().equals(EParameterFieldType.CHECK)
|
||||||
EParameterFieldType.AS400_CHECK))) {
|
|| currentParam.getFieldType().equals(EParameterFieldType.AS400_CHECK) || currentParam.getFieldType()
|
||||||
|
.equals(EParameterFieldType.COMPONENT_LIST))) {
|
||||||
toUpdate = false;
|
toUpdate = false;
|
||||||
for (int i = 0; i < elem.getElementParameters().size(); i++) {
|
setDefaultValues(currentParam, elem);
|
||||||
IElementParameter testedParam = elem.getElementParameters().get(i);
|
|
||||||
|
|
||||||
String showIf = testedParam.getShowIf();
|
|
||||||
String notShowIf = testedParam.getNotShowIf();
|
|
||||||
|
|
||||||
if (showIf != null) {
|
|
||||||
if (showIf.contains(currentParam.getName())) {
|
|
||||||
toUpdate = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (notShowIf != null) {
|
|
||||||
if (notShowIf.contains(currentParam.getName())) {
|
|
||||||
toUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (testedParam.getFieldType() == EParameterFieldType.TABLE) {
|
|
||||||
String[] tmpShowIfs = testedParam.getListItemsShowIf();
|
|
||||||
if (tmpShowIfs != null) {
|
|
||||||
for (String show : tmpShowIfs) {
|
|
||||||
if (show != null && show.contains(currentParam.getName())) {
|
|
||||||
toUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tmpShowIfs = testedParam.getListItemsNotShowIf();
|
|
||||||
if (tmpShowIfs != null) {
|
|
||||||
for (String show : tmpShowIfs) {
|
|
||||||
if (show != null && show.contains(currentParam.getName())) {
|
|
||||||
toUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)) {
|
|
||||||
/*
|
|
||||||
* TUP-968, In order to refresh for missing modules top messages.
|
|
||||||
*/
|
|
||||||
if (EParameterName.DB_VERSION.getName().equals(currentParam.getName())
|
|
||||||
|| "HBASE_VERSION".equals(currentParam.getName()) //$NON-NLS-1$
|
|
||||||
|| "HIVE_VERSION".equals(currentParam.getName()) //$NON-NLS-1$
|
|
||||||
|| "HCAT_VERSION".equals(currentParam.getName()) //$NON-NLS-1$
|
|
||||||
|| "DISTRIBUTION".equals(currentParam.getName())) {//$NON-NLS-1$
|
|
||||||
toUpdate = true;
|
|
||||||
} else if (testedParam.getListItemsShowIf() != null) {
|
|
||||||
for (int j = 0; j < testedParam.getListItemsShowIf().length && !toUpdate; j++) {
|
|
||||||
showIf = testedParam.getListItemsShowIf()[j];
|
|
||||||
notShowIf = testedParam.getListItemsNotShowIf()[j];
|
|
||||||
if (showIf != null) {
|
|
||||||
if (showIf.contains(currentParam.getName())) {
|
|
||||||
toUpdate = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (notShowIf != null) {
|
|
||||||
if (notShowIf.contains(currentParam.getName())) {
|
|
||||||
toUpdate = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setDefaultValues(currentParam, testedParam);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
|
if (currentParam.getName().equals(EParameterName.PROCESS_TYPE_PROCESS.getName())) {
|
||||||
@@ -421,6 +400,7 @@ public class PropertyChangeCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
updateRelativeNodesIfNeeded(currentParam);
|
||||||
//
|
//
|
||||||
if (elem instanceof IGraphicalNode) {
|
if (elem instanceof IGraphicalNode) {
|
||||||
((IGraphicalNode) elem).checkAndRefreshNode();
|
((IGraphicalNode) elem).checkAndRefreshNode();
|
||||||
@@ -433,6 +413,103 @@ public class PropertyChangeCommand extends Command {
|
|||||||
refreshMR(propName);
|
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();
|
||||||
|
|
||||||
|
if (showIf != null) {
|
||||||
|
if (showIf.contains(currentParam.getName())) {
|
||||||
|
toUpdate = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (notShowIf != null) {
|
||||||
|
if (notShowIf.contains(currentParam.getName())) {
|
||||||
|
toUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (testedParam.getFieldType() == EParameterFieldType.TABLE) {
|
||||||
|
String[] tmpShowIfs = testedParam.getListItemsShowIf();
|
||||||
|
if (tmpShowIfs != null) {
|
||||||
|
for (String show : tmpShowIfs) {
|
||||||
|
if (show != null && show.contains(currentParam.getName())) {
|
||||||
|
toUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tmpShowIfs = testedParam.getListItemsNotShowIf();
|
||||||
|
if (tmpShowIfs != null) {
|
||||||
|
for (String show : tmpShowIfs) {
|
||||||
|
if (show != null && show.contains(currentParam.getName())) {
|
||||||
|
toUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentParam.getFieldType().equals(EParameterFieldType.CLOSED_LIST)) {
|
||||||
|
/*
|
||||||
|
* TUP-968, In order to refresh for missing modules top messages.
|
||||||
|
*/
|
||||||
|
if (EParameterName.DB_VERSION.getName().equals(currentParam.getName())
|
||||||
|
|| "HBASE_VERSION".equals(currentParam.getName()) //$NON-NLS-1$
|
||||||
|
|| "HIVE_VERSION".equals(currentParam.getName()) //$NON-NLS-1$
|
||||||
|
|| "HCAT_VERSION".equals(currentParam.getName()) //$NON-NLS-1$
|
||||||
|
|| "DISTRIBUTION".equals(currentParam.getName())) {//$NON-NLS-1$
|
||||||
|
toUpdate = true;
|
||||||
|
} else if (testedParam.getListItemsShowIf() != null) {
|
||||||
|
for (int j = 0; j < testedParam.getListItemsShowIf().length && !toUpdate; j++) {
|
||||||
|
showIf = testedParam.getListItemsShowIf()[j];
|
||||||
|
notShowIf = testedParam.getListItemsNotShowIf()[j];
|
||||||
|
if (showIf != null) {
|
||||||
|
if (showIf.contains(currentParam.getName())) {
|
||||||
|
toUpdate = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (notShowIf != null) {
|
||||||
|
if (notShowIf.contains(currentParam.getName())) {
|
||||||
|
toUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setDefaultValues(currentParam, testedParam, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean needUpdateMonitorConnection() {
|
private boolean needUpdateMonitorConnection() {
|
||||||
|
|
||||||
if (elem instanceof Connection) {
|
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
|
* @param testedParam Tested parameter, to know if there is a link for the default values between this parameter and
|
||||||
* the current.
|
* 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;
|
boolean contains = false;
|
||||||
|
|
||||||
// zli
|
// zli
|
||||||
@@ -495,13 +576,13 @@ public class PropertyChangeCommand extends Command {
|
|||||||
if (testedParam.getListItemsShowIf() != null) {
|
if (testedParam.getListItemsShowIf() != null) {
|
||||||
String conditionShowIf = testedParam.getListItemsShowIf()[index];
|
String conditionShowIf = testedParam.getListItemsShowIf()[index];
|
||||||
if (conditionShowIf != null) {
|
if (conditionShowIf != null) {
|
||||||
isCurrentComboValid = Expression.evaluate(conditionShowIf, elem.getElementParameters());
|
isCurrentComboValid = Expression.evaluate(conditionShowIf, elementParameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (testedParam.getListItemsNotShowIf() != null) {
|
if (testedParam.getListItemsNotShowIf() != null) {
|
||||||
String conditionNotShowIf = testedParam.getListItemsNotShowIf()[index];
|
String conditionNotShowIf = testedParam.getListItemsNotShowIf()[index];
|
||||||
if (conditionNotShowIf != null) {
|
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) {
|
if (!isCurrentComboValid && testedParam.getListItemsShowIf() != null) {
|
||||||
for (String condition : testedParam.getListItemsShowIf()) {
|
for (String condition : testedParam.getListItemsShowIf()) {
|
||||||
if (condition != null && condition.contains(currentParam.getName())) {
|
if (condition != null && condition.contains(currentParam.getName())) {
|
||||||
boolean isValid = Expression.evaluate(condition, elem.getElementParameters());
|
boolean isValid = Expression.evaluate(condition, elementParameters);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
int index = ArrayUtils.indexOf(testedParam.getListItemsShowIf(), condition);
|
int index = ArrayUtils.indexOf(testedParam.getListItemsShowIf(), condition);
|
||||||
testedParam.setValue(testedParam.getListItemsValue()[index]);
|
testedParam.setValue(testedParam.getListItemsValue()[index]);
|
||||||
@@ -521,7 +602,7 @@ public class PropertyChangeCommand extends Command {
|
|||||||
if (!isCurrentComboValid && !contains && testedParam.getListItemsNotShowIf() != null) {
|
if (!isCurrentComboValid && !contains && testedParam.getListItemsNotShowIf() != null) {
|
||||||
for (String condition : testedParam.getListItemsNotShowIf()) {
|
for (String condition : testedParam.getListItemsNotShowIf()) {
|
||||||
if (condition != null && condition.contains(currentParam.getName())) {
|
if (condition != null && condition.contains(currentParam.getName())) {
|
||||||
boolean isValid = !Expression.evaluate(condition, elem.getElementParameters());
|
boolean isValid = !Expression.evaluate(condition, elementParameters);
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
int index = ArrayUtils.indexOf(testedParam.getListItemsNotShowIf(), condition);
|
int index = ArrayUtils.indexOf(testedParam.getListItemsNotShowIf(), condition);
|
||||||
testedParam.setValue(testedParam.getListItemsValue()[index]);
|
testedParam.setValue(testedParam.getListItemsValue()[index]);
|
||||||
@@ -542,11 +623,11 @@ public class PropertyChangeCommand extends Command {
|
|||||||
&& !testedParam.getFieldType().equals(EParameterFieldType.RADIO)) {
|
&& !testedParam.getFieldType().equals(EParameterFieldType.RADIO)) {
|
||||||
oldMapping = (String) testedParam.getValue();
|
oldMapping = (String) testedParam.getValue();
|
||||||
}
|
}
|
||||||
testedParam.setValueToDefault(elem.getElementParameters());
|
testedParam.setValueToDefault(elementParameters);
|
||||||
if (testedParam.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
|
if (testedParam.getFieldType().equals(EParameterFieldType.MAPPING_TYPE)) {
|
||||||
String newMapping = (String) testedParam.getValue();
|
String newMapping = (String) testedParam.getValue();
|
||||||
if (!oldMapping.equals(newMapping)) {
|
if (!oldMapping.equals(newMapping)) {
|
||||||
Node node = (Node) elem;
|
Node node = (Node) referenceNode;
|
||||||
if (node.getMetadataList().size() > 0) {
|
if (node.getMetadataList().size() > 0) {
|
||||||
// to change with:
|
// to change with:
|
||||||
// IMetadataTable metadataTable = node.getMetadataFromConnector(testedParam.getContext());
|
// IMetadataTable metadataTable = node.getMetadataFromConnector(testedParam.getContext());
|
||||||
@@ -557,7 +638,7 @@ public class PropertyChangeCommand extends Command {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// See issue 975, update the schema.
|
// See issue 975, update the schema.
|
||||||
Node node = (Node) elem;
|
Node node = (Node) referenceNode;
|
||||||
if (node.getMetadataList().size() > 0) {
|
if (node.getMetadataList().size() > 0) {
|
||||||
IMetadataTable metadataTable = null;
|
IMetadataTable metadataTable = null;
|
||||||
IMetadataTable newMetadataTable = null;
|
IMetadataTable newMetadataTable = null;
|
||||||
@@ -629,7 +710,9 @@ public class PropertyChangeCommand extends Command {
|
|||||||
newMetadataTable = metadataTable;
|
newMetadataTable = metadataTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
changeMetadataCommand = new ChangeMetadataCommand(node, null, null, newMetadataTable);
|
ChangeMetadataCommand changeMetadataCommand = new ChangeMetadataCommand(node, null, null,
|
||||||
|
newMetadataTable);
|
||||||
|
changeMetadataCommands.add(changeMetadataCommand);
|
||||||
changeMetadataCommand.execute(true);
|
changeMetadataCommand.execute(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -670,8 +753,12 @@ public class PropertyChangeCommand extends Command {
|
|||||||
if (toUpdate) {
|
if (toUpdate) {
|
||||||
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||||
}
|
}
|
||||||
if (changeMetadataCommand != null) {
|
if (changeMetadataCommands != null) {
|
||||||
changeMetadataCommand.undo();
|
int size = changeMetadataCommands.size();
|
||||||
|
for (int i = size - 1; 0 <= i; i--) {
|
||||||
|
ChangeMetadataCommand changeMetadataCommand = changeMetadataCommands.get(i);
|
||||||
|
changeMetadataCommand.undo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CodeView.refreshCodeView(elem);
|
CodeView.refreshCodeView(elem);
|
||||||
ComponentSettings.switchToCurComponentSettingsView();
|
ComponentSettings.switchToCurComponentSettingsView();
|
||||||
@@ -726,8 +813,10 @@ public class PropertyChangeCommand extends Command {
|
|||||||
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
elem.setPropertyValue(updataComponentParamName, new Boolean(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changeMetadataCommand != null) {
|
if (changeMetadataCommands != null) {
|
||||||
changeMetadataCommand.redo();
|
for (ChangeMetadataCommand changeMetadataCommand : changeMetadataCommands) {
|
||||||
|
changeMetadataCommand.redo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CodeView.refreshCodeView(elem);
|
CodeView.refreshCodeView(elem);
|
||||||
ComponentSettings.switchToCurComponentSettingsView();
|
ComponentSettings.switchToCurComponentSettingsView();
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ public class JobletContainer extends NodeContainer {
|
|||||||
if (isCollapsed()) {
|
if (isCollapsed()) {
|
||||||
((Connection) conn).reconnect(conn.getSource(), this.node, conn.getLineStyle());
|
((Connection) conn).reconnect(conn.getSource(), this.node, conn.getLineStyle());
|
||||||
} else {
|
} else {
|
||||||
for (NodeContainer nodeContainer : this.nodeContainers) {
|
out: for (NodeContainer nodeContainer : this.nodeContainers) {
|
||||||
Node connNode = nodeContainer.getNode();
|
Node connNode = nodeContainer.getNode();
|
||||||
IElementParameter elePa = this.node.getElementParameter(connNode.getJoblet_unique_name());
|
IElementParameter elePa = this.node.getElementParameter(connNode.getJoblet_unique_name());
|
||||||
|
|
||||||
@@ -565,6 +565,11 @@ public class JobletContainer extends NodeContainer {
|
|||||||
break;
|
break;
|
||||||
} else if (getFlowInput(inputs).size() == 1 && !isTri
|
} else if (getFlowInput(inputs).size() == 1 && !isTri
|
||||||
&& new JobletUtil().isJobletInput(connNode, this.getProcess())) {
|
&& new JobletUtil().isJobletInput(connNode, this.getProcess())) {
|
||||||
|
for (IConnection flowConn : getFlowInput(inputs)) {
|
||||||
|
if (!flowConn.getUniqueName().equals(conn.getUniqueName())) {
|
||||||
|
continue out;
|
||||||
|
}
|
||||||
|
}
|
||||||
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
|
JobletConnectionReconnectCommand reConnectCommand = new JobletConnectionReconnectCommand(conn);
|
||||||
reConnectCommand.setNewTarget(connNode);
|
reConnectCommand.setNewTarget(connNode);
|
||||||
reConnectCommand.execute();
|
reConnectCommand.execute();
|
||||||
@@ -674,6 +679,7 @@ public class JobletContainer extends NodeContainer {
|
|||||||
public boolean canCollapse() {
|
public boolean canCollapse() {
|
||||||
List<String> connList = new ArrayList<String>();
|
List<String> connList = new ArrayList<String>();
|
||||||
List<String> metaList = new ArrayList<String>();
|
List<String> metaList = new ArrayList<String>();
|
||||||
|
List<String> triConnList = new ArrayList<String>();
|
||||||
if (node.getIncomingConnections().size() > 1) {
|
if (node.getIncomingConnections().size() > 1) {
|
||||||
for (IConnection conn : node.getIncomingConnections()) {
|
for (IConnection conn : node.getIncomingConnections()) {
|
||||||
if (conn.getConnectorName().startsWith("TRIGGER")) {
|
if (conn.getConnectorName().startsWith("TRIGGER")) {
|
||||||
@@ -693,6 +699,15 @@ public class JobletContainer extends NodeContainer {
|
|||||||
if (isTri) {
|
if (isTri) {
|
||||||
IElementParameter elechild = elePa.getChildParameters().get("COMPONENT_LIST");
|
IElementParameter elechild = elePa.getChildParameters().get("COMPONENT_LIST");
|
||||||
if (elechild != null) {
|
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)) {
|
if (elechild.getValue() != null && (elechild.getValue() instanceof String)) {
|
||||||
metaList.remove(elechild.getValue());
|
metaList.remove(elechild.getValue());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3391,7 +3391,7 @@ public class Node extends Element implements IGraphicalNode {
|
|||||||
"Node.differentFromSchemaDefined", inputConnecion.getName()); //$NON-NLS-1$
|
"Node.differentFromSchemaDefined", inputConnecion.getName()); //$NON-NLS-1$
|
||||||
Problems.add(ProblemStatus.ERROR, this, errorMessage);
|
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)) {
|
if (!outputMeta.sameMetadataAs(inputMeta, IMetadataColumn.OPTIONS_NONE)) {
|
||||||
schemaSynchronized = false;
|
schemaSynchronized = false;
|
||||||
String errorMessage = Messages.getString(
|
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.nodes.Node;
|
||||||
import org.talend.designer.core.ui.editor.notes.Note;
|
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.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.properties.controllers.ConnectionListController;
|
||||||
import org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer;
|
import org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainer;
|
||||||
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
|
import org.talend.designer.core.ui.preferences.TalendDesignerPrefConstants;
|
||||||
@@ -1084,6 +1085,22 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
|||||||
listParamType.add(pType);
|
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")
|
@SuppressWarnings("unchecked")
|
||||||
private void loadElementParameters(Element elemParam, EList listParamType) {
|
private void loadElementParameters(Element elemParam, EList listParamType) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
@@ -1750,6 +1767,7 @@ public class Process extends Element implements IProcess2, IGEFProcess, ILastVer
|
|||||||
loadSubjobs(processType);
|
loadSubjobs(processType);
|
||||||
|
|
||||||
initExternalComponents();
|
initExternalComponents();
|
||||||
|
initJobletComponents();
|
||||||
setActivate(true);
|
setActivate(true);
|
||||||
checkStartNodes();
|
checkStartNodes();
|
||||||
// (bug 5365)
|
// (bug 5365)
|
||||||
|
|||||||
@@ -1301,7 +1301,7 @@ public class TalendEditorDropTargetListener extends TemplateTransferDropTargetLi
|
|||||||
|
|
||||||
// fore HL7, by gcui
|
// fore HL7, by gcui
|
||||||
if (selectedNode.getObjectType() == ERepositoryObjectType.METADATA_FILE_HL7 && PluginChecker.isHL7PluginLoaded()) {
|
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,
|
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(node, IHL7Constant.TABLE_SCHEMAS,
|
||||||
table.getLabel(), ConvertionHelper.convert(table));
|
table.getLabel(), ConvertionHelper.convert(table));
|
||||||
list.add(hl7Cmd);
|
list.add(hl7Cmd);
|
||||||
|
|||||||
@@ -648,9 +648,19 @@ public class TableController extends AbstractElementPropertySectionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
contextParameterNames = contextParameterNamesList.toArray(new String[0]);
|
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
|
// update table values
|
||||||
TableViewerCreator tableViewerCreator = (TableViewerCreator) hashCurControls.get(param.getName());
|
TableViewerCreator tableViewerCreator = (TableViewerCreator) hashCurControls.get(param.getName());
|
||||||
Object[] itemsValue = param.getListItemsValue();
|
Object[] itemsValue = param.getListItemsValue();
|
||||||
@@ -694,7 +704,7 @@ public class TableController extends AbstractElementPropertySectionController {
|
|||||||
} else {
|
} else {
|
||||||
if (o instanceof String) {
|
if (o instanceof String) {
|
||||||
Integer nb = new Integer(tmpParam.getIndexOfItemFromList((String) o));
|
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());
|
currentLine.put(items[j], tmpParam.getDefaultClosedListValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -706,18 +716,6 @@ public class TableController extends AbstractElementPropertySectionController {
|
|||||||
}
|
}
|
||||||
// (bug 3740)
|
// (bug 3740)
|
||||||
boolean checked = contextParameterNames != null && contextParameterNames.length > 0;
|
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);
|
revertToolBarButtonState(checked);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import org.apache.commons.lang.ArrayUtils;
|
|||||||
import org.eclipse.emf.common.util.EList;
|
import org.eclipse.emf.common.util.EList;
|
||||||
import org.eclipse.ui.IEditorReference;
|
import org.eclipse.ui.IEditorReference;
|
||||||
import org.eclipse.ui.PlatformUI;
|
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.commons.utils.VersionUtils;
|
||||||
import org.talend.core.CorePlugin;
|
import org.talend.core.CorePlugin;
|
||||||
import org.talend.core.context.Context;
|
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 (found) {
|
||||||
if ((lineValues == null) || (lineValues.get(elementValue.getElementRef()) != null)) {
|
if ((lineValues == null) || (lineValues.get(elementValue.getElementRef()) != null)) {
|
||||||
lineValues = new HashMap<String, Object>();
|
lineValues = new HashMap<String, Object>();
|
||||||
tableValues.add(lineValues);
|
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) {
|
if (elementValue.getType() != null) {
|
||||||
lineValues.put(elementValue.getElementRef() + IEbcdicConstant.REF_TYPE,
|
lineValues.put(elementValue.getElementRef() + IEbcdicConstant.REF_TYPE,
|
||||||
elementValue.getType());
|
elementValue.getType());
|
||||||
@@ -253,6 +269,8 @@ public class ElementParameter2ParameterType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
elemParam.setPropertyValue(pTypeName, tableValues);
|
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)) {
|
} else if (param.getFieldType().equals(EParameterFieldType.ENCODING_TYPE)) {
|
||||||
// fix for bug 2193
|
// fix for bug 2193
|
||||||
boolean setToCustom = false;
|
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: .
|
Bundle-ClassPath: .
|
||||||
Export-Package: org.talend.designer.hl7,
|
Export-Package: org.talend.designer.hl7,
|
||||||
org.talend.designer.hl7.action,
|
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.data,
|
||||||
org.talend.designer.hl7.ui.edit,
|
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.AutoMapTip=Map automatically schema to xml tree (for empty column node only)
|
||||||
FooterComposite.RootElementError.Title=Error
|
FooterComposite.RootElementError.Title=Error
|
||||||
FooterComposite.RootElementError.Message=Root elements of xml tree should be the same.
|
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;
|
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.IInputValidator;
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
import org.eclipse.jface.dialogs.InputDialog;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
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.managers.HL7OutputManager;
|
||||||
import org.talend.designer.hl7.ui.HL7UI;
|
import org.talend.designer.hl7.ui.HL7UI;
|
||||||
import org.talend.designer.hl7.ui.data.Attribute;
|
import org.talend.designer.hl7.ui.data.Attribute;
|
||||||
@@ -95,13 +101,7 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||||
if (createChildNode(node)) {
|
createChildNode(node);
|
||||||
if (hl7ui != null) {
|
|
||||||
hl7ui.redrawLinkers();
|
|
||||||
} else if (from != null) {
|
|
||||||
from.refreshLinks();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,6 +126,7 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
// add validator
|
// add validator
|
||||||
IInputValidator validator = new IInputValidator() {
|
IInputValidator validator = new IInputValidator() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public String isValid(String newText) {
|
public String isValid(String newText) {
|
||||||
if (newText != null) {
|
if (newText != null) {
|
||||||
String text = newText.trim();
|
String text = newText.trim();
|
||||||
@@ -165,7 +166,37 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
// if the root not have CurSchema
|
// if the root not have CurSchema
|
||||||
if (node.getRow() == null || node.getRow().equals("")) {
|
if (node.getRow() == null || node.getRow().equals("")) {
|
||||||
if (hl7ui != null && hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
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 {
|
} else {
|
||||||
child.setRow(node.getRow());
|
child.setRow(node.getRow());
|
||||||
@@ -173,7 +204,6 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
|
|
||||||
node.addChild(child);
|
node.addChild(child);
|
||||||
this.xmlViewer.refresh();
|
this.xmlViewer.refresh();
|
||||||
this.xmlViewer.expandAll();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,8 @@ import java.util.List;
|
|||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||||
import org.talend.designer.hl7.ui.HL7UI;
|
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.Element;
|
||||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
|
||||||
import org.talend.repository.ui.swt.utils.AbstractForm;
|
import org.talend.repository.ui.swt.utils.AbstractForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,19 +92,7 @@ public class DeleteHL7NodeAction extends SelectionProviderAction {
|
|||||||
disconnectSubTree(node);
|
disconnectSubTree(node);
|
||||||
}
|
}
|
||||||
parent.removeChild(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.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()) {
|
if (node.hasLink()) {
|
||||||
node.setColumn(null);
|
node.setColumn(null);
|
||||||
}
|
}
|
||||||
if (node instanceof Attribute) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (node instanceof NameSpaceNode) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
List<HL7TreeNode> children = node.getChildren();
|
List<HL7TreeNode> children = node.getChildren();
|
||||||
for (HL7TreeNode child : children) {
|
for (HL7TreeNode child : children) {
|
||||||
disconnectSubTree(child);
|
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.metadata.builder.connection.MetadataTable;
|
||||||
import org.talend.core.model.process.IConnection;
|
import org.talend.core.model.process.IConnection;
|
||||||
import org.talend.core.model.process.IConnectionCategory;
|
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.model.utils.NodeUtil;
|
||||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||||
import org.talend.core.ui.metadata.command.RepositoryChangeMetadataForHL7Command;
|
import org.talend.core.ui.metadata.command.RepositoryChangeMetadataForHL7Command;
|
||||||
import org.talend.designer.hl7.managers.HL7OutputManager;
|
import org.talend.designer.hl7.managers.HL7OutputManager;
|
||||||
import org.talend.designer.hl7.ui.HL7UI;
|
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.Element;
|
||||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
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.form.AbstractHL7StepForm;
|
||||||
import org.talend.designer.hl7.ui.header.HL7Parse;
|
import org.talend.designer.hl7.ui.header.HL7Parse;
|
||||||
import org.talend.designer.hl7.util.HL7PublicUtil;
|
import org.talend.designer.hl7.util.HL7PublicUtil;
|
||||||
@@ -63,8 +60,6 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
|
|
||||||
private AbstractHL7StepForm form;
|
private AbstractHL7StepForm form;
|
||||||
|
|
||||||
private int order = 1;
|
|
||||||
|
|
||||||
private HL7Connection hl7Connection;
|
private HL7Connection hl7Connection;
|
||||||
|
|
||||||
private HL7PublicUtil hl7Util = new HL7PublicUtil();
|
private HL7PublicUtil hl7Util = new HL7PublicUtil();
|
||||||
@@ -115,13 +110,13 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
EList root = hl7Connection.getRoot();
|
EList root = hl7Connection.getRoot();
|
||||||
root.clear();
|
root.clear();
|
||||||
if (hl7TreeNode != null) {
|
if (hl7TreeNode != null) {
|
||||||
hl7Util.initNodeOrder(hl7TreeNode, orderMap, order);
|
hl7Util.initNodeOrder(hl7TreeNode, orderMap);
|
||||||
hl7Util.tableLoader((Element) hl7TreeNode, "", root, hl7TreeNode.getDefaultValue(), orderMap);
|
hl7Util.tableLoader((Element) hl7TreeNode, "", root, hl7TreeNode.getDefaultValue(), orderMap);
|
||||||
}
|
}
|
||||||
table.addAll(root);
|
table.addAll(root);
|
||||||
} else {
|
} else {
|
||||||
if (hl7TreeNode != null) {
|
if (hl7TreeNode != null) {
|
||||||
hl7Util.initNodeOrder(hl7TreeNode, orderMap, order);
|
hl7Util.initNodeOrder(hl7TreeNode, orderMap);
|
||||||
hl7Util.tableLoader((Element) hl7TreeNode, "", table, hl7TreeNode.getDefaultValue(), orderMap);
|
hl7Util.tableLoader((Element) hl7TreeNode, "", table, hl7TreeNode.getDefaultValue(), orderMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,130 +146,119 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
IConnectionCategory.FLOW);
|
IConnectionCategory.FLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||||
List<MetadataTable> iMetadataTables = new ArrayList<MetadataTable>();
|
List<MetadataTable> iMetadataTables = new ArrayList<MetadataTable>();
|
||||||
INode targetNode = null;
|
|
||||||
HL7TreeNode rootNode = 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;
|
IMetadataTable metadataTable = null;
|
||||||
for (IConnection connection : incomingConnections) {
|
for (IConnection connection : incomingConnections) {
|
||||||
if (connection.getUniqueName().equals(rowName)) {
|
if (connection.getUniqueName().equals(schemaName)) {
|
||||||
metadataTable = connection.getMetadataTable();
|
metadataTable = connection.getMetadataTable();
|
||||||
metadataTable.setLabel(connection.getUniqueName());
|
metadataTable.setLabel(connection.getUniqueName());
|
||||||
|
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
targetNode = connection.getTarget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MetadataTable targetMetadataTable = ConnectionFactory.eINSTANCE.createMetadataTable();
|
MetadataTable targetMetadataTable = ConnectionFactory.eINSTANCE.createMetadataTable();
|
||||||
targetMetadataTable.setId(factory.getNextId());
|
targetMetadataTable.setId(factory.getNextId());
|
||||||
targetMetadataTable.setLabel(rowName);
|
schemaNameToOutputTable.put(schemaName, targetMetadataTable);
|
||||||
|
targetMetadataTable.setLabel(schemaName);
|
||||||
iMetadataTables.add(targetMetadataTable);
|
iMetadataTables.add(targetMetadataTable);
|
||||||
List<MetadataColumn> columns = new ArrayList<MetadataColumn>();
|
}
|
||||||
|
|
||||||
HL7TreeNode current = null;
|
HL7TreeNode current = null;
|
||||||
HL7TreeNode temp = null;
|
HL7TreeNode temp = null;
|
||||||
HL7TreeNode mainNode = null;
|
String currentPath = null;
|
||||||
String mainPath = null;
|
String defaultValue = null;
|
||||||
String currentPath = null;
|
int nodeOrder = 0;
|
||||||
String defaultValue = null;
|
boolean haveOrder = true;
|
||||||
int nodeOrder = 0;
|
// build root tree
|
||||||
boolean haveOrder = true;
|
for (int i = 0; i < root.size(); i++) {
|
||||||
String schemaId = rowName + ":";//((MetadataTable) obj).getLabel() + ":"; //$NON-NLS-1$
|
HL7FileNode node = root.get(i);
|
||||||
// build root tree
|
String newPath = node.getFilePath();
|
||||||
for (int i = 0; i < root.size(); i++) {
|
defaultValue = node.getDefaultValue();
|
||||||
HL7FileNode node = (HL7FileNode) root.get(i);
|
String columnName = node.getRelatedColumn();
|
||||||
String newPath = node.getFilePath();
|
// String type = node.getType();
|
||||||
defaultValue = node.getDefaultValue();
|
String orderValue = String.valueOf(node.getOrder());
|
||||||
String columnName = node.getRelatedColumn();
|
if (orderValue == null || "".equals(orderValue)) {
|
||||||
// String type = node.getType();
|
haveOrder = false;
|
||||||
String orderValue = String.valueOf(node.getOrder());
|
|
||||||
if (orderValue == null || "".equals(orderValue)) {
|
|
||||||
haveOrder = false;
|
|
||||||
}
|
|
||||||
if (haveOrder) {
|
|
||||||
nodeOrder = node.getOrder();
|
|
||||||
}
|
|
||||||
String flag = columnName + ":"; //$NON-NLS-1$
|
|
||||||
if (columnName != null && columnName.length() > 0 && !flag.startsWith(schemaId)) {
|
|
||||||
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) {
|
|
||||||
temp.setRow(rowName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
|
||||||
columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
|
||||||
// group node can not get the metadata table
|
|
||||||
if (metadataTable == null) {
|
|
||||||
IMetadataTable metadataTableTemp = null;
|
|
||||||
for (IConnection connection : incomingConnections) {
|
|
||||||
metadataTableTemp = connection.getMetadataTable();
|
|
||||||
String connectionName = metadataTableTemp.getLabel();
|
|
||||||
if (connectionName == null) {
|
|
||||||
connectionName = connection.getUniqueName();
|
|
||||||
}
|
|
||||||
if (columnName.startsWith(connectionName)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (metadataTableTemp != null) {
|
|
||||||
temp.setColumnName(columnName);
|
|
||||||
temp.setColumn(metadataTableTemp.getColumn(columnName));
|
|
||||||
temp.setTable(metadataTableTemp);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
temp.setColumnName(columnName);
|
|
||||||
temp.setColumn(metadataTable.getColumn(columnName));
|
|
||||||
temp.setTable(metadataTable);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
if (!temp.isMain()) {
|
|
||||||
MetadataColumn newColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
|
|
||||||
newColumn.setLabel(columnName);
|
|
||||||
newColumn.setName(temp.getLabel());
|
|
||||||
newColumn.setLength(226);
|
|
||||||
newColumn.setTalendType("id_String");
|
|
||||||
columns.add(newColumn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
targetMetadataTable.getColumns().addAll(columns);
|
|
||||||
if (rootNode == null) {
|
|
||||||
rootNode = new Element("rootTag");
|
|
||||||
}
|
}
|
||||||
if (haveOrder) {
|
if (haveOrder) {
|
||||||
orderNode(rootNode);
|
nodeOrder = node.getOrder();
|
||||||
}
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
// temp.setDataType(type);
|
||||||
|
if (rootNode == null) {
|
||||||
|
rootNode = temp;
|
||||||
|
}
|
||||||
|
if (node.getAttribute().equals("main")) {
|
||||||
|
temp.setMain(true);
|
||||||
|
}
|
||||||
|
current = temp;
|
||||||
|
currentPath = newPath;
|
||||||
|
if (haveOrder) {
|
||||||
|
temp.setOrder(nodeOrder);
|
||||||
|
}
|
||||||
|
if (rowName != null && rowName.length() > 0) {
|
||||||
|
temp.setRow(rowName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (columnName != null) {
|
||||||
|
IMetadataTable metadataTable = schemaNameToInputTable.get(rowName);
|
||||||
|
// group node can not get the metadata table
|
||||||
|
if (metadataTable == null) {
|
||||||
|
IMetadataTable metadataTableTemp = null;
|
||||||
|
for (IConnection connection : incomingConnections) {
|
||||||
|
metadataTableTemp = connection.getMetadataTable();
|
||||||
|
String connectionName = metadataTableTemp.getLabel();
|
||||||
|
if (connectionName == null) {
|
||||||
|
connectionName = connection.getUniqueName();
|
||||||
|
}
|
||||||
|
if (columnName.startsWith(connectionName)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp.setColumnName(columnName);
|
||||||
|
if (metadataTableTemp != null) {
|
||||||
|
temp.setColumn(metadataTableTemp.getColumn(columnName));
|
||||||
|
temp.setTable(metadataTableTemp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
temp.setColumnName(columnName);
|
||||||
|
temp.setColumn(metadataTable.getColumn(columnName));
|
||||||
|
temp.setTable(metadataTable);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
if (!temp.isMain()) {
|
||||||
|
MetadataColumn newColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
|
||||||
|
newColumn.setLabel(columnName);
|
||||||
|
newColumn.setName(temp.getLabel());
|
||||||
|
newColumn.setLength(226);
|
||||||
|
newColumn.setTalendType("id_String");
|
||||||
|
schemaNameToOutputTable.get(rowName).getColumns().add(newColumn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rootNode == null) {
|
||||||
|
rootNode = new Element("rootTag");
|
||||||
|
}
|
||||||
|
if (haveOrder) {
|
||||||
|
orderNode(rootNode);
|
||||||
}
|
}
|
||||||
if (rootNode != null) {
|
if (rootNode != null) {
|
||||||
treeData.add(rootNode);
|
treeData.add(rootNode);
|
||||||
@@ -289,17 +273,17 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
form.getContents().put(rootNode.getColumnLabel(), hl7Node);
|
form.getContents().put(rootNode.getColumnLabel(), hl7Node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// execute the commands,initialize the propertiesView .
|
if (hl7ui != null) {
|
||||||
List<Command> commands = new ArrayList<Command>();
|
// execute the commands,initialize the propertiesView .
|
||||||
for (MetadataTable tableTemp : iMetadataTables) {
|
List<Command> commands = new ArrayList<Command>();
|
||||||
if (targetNode != null) {
|
for (MetadataTable tableTemp : iMetadataTables) {
|
||||||
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(targetNode.getExternalNode(),
|
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(hl7ui.gethl7Manager().getHl7Component(),
|
||||||
IHL7Constant.TABLE_SCHEMAS, tableTemp.getLabel(), ConvertionHelper.convert(tableTemp));
|
IHL7Constant.TABLE_SCHEMAS, tableTemp.getLabel(), ConvertionHelper.convert(tableTemp));
|
||||||
commands.add(hl7Cmd);
|
commands.add(hl7Cmd);
|
||||||
}
|
}
|
||||||
}
|
for (Command command : commands) {
|
||||||
for (Command command : commands) {
|
command.execute();
|
||||||
command.execute();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ package org.talend.designer.hl7.action;
|
|||||||
|
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
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.HL7UI;
|
||||||
import org.talend.designer.hl7.ui.data.Attribute;
|
|
||||||
import org.talend.designer.hl7.ui.data.Element;
|
import org.talend.designer.hl7.ui.data.Element;
|
||||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
|
||||||
import org.talend.repository.ui.swt.utils.AbstractForm;
|
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 {
|
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.
|
// the xml viewer, see HL7UI.
|
||||||
private TreeViewer xmlViewer;
|
private TreeViewer xmlViewer;
|
||||||
|
|
||||||
private HL7UI hl7ui;
|
public SetRepetableAction(TreeViewer xmlViewer, AbstractForm form) {
|
||||||
|
super(xmlViewer, SET_AS_REPEATABLE_ELEMENT);
|
||||||
private boolean value;
|
|
||||||
|
|
||||||
private AbstractForm form;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SetForLoopAction constructor comment.
|
|
||||||
*
|
|
||||||
* @param provider
|
|
||||||
* @param text
|
|
||||||
*/
|
|
||||||
public SetRepetableAction(TreeViewer xmlViewer, String text) {
|
|
||||||
super(xmlViewer, text);
|
|
||||||
this.xmlViewer = xmlViewer;
|
this.xmlViewer = xmlViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SetRepetableAction(TreeViewer xmlViewer, String text, AbstractForm form) {
|
|
||||||
super(xmlViewer, text);
|
|
||||||
this.xmlViewer = xmlViewer;
|
|
||||||
this.form = form;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* SetForLoopAction constructor comment.
|
* SetForLoopAction constructor comment.
|
||||||
@@ -66,39 +57,21 @@ public class SetRepetableAction extends SelectionProviderAction {
|
|||||||
public SetRepetableAction(TreeViewer xmlViewer, HL7UI hl7ui, String text, boolean value) {
|
public SetRepetableAction(TreeViewer xmlViewer, HL7UI hl7ui, String text, boolean value) {
|
||||||
super(xmlViewer, text);
|
super(xmlViewer, text);
|
||||||
this.xmlViewer = xmlViewer;
|
this.xmlViewer = xmlViewer;
|
||||||
this.hl7ui = hl7ui;
|
|
||||||
this.value = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
setText(SET_AS_REPEATABLE_ELEMENT);
|
||||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (node.getParent() == null) {
|
|
||||||
this.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (node.getParent().getParent() != null) {
|
|
||||||
this.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (node.isRepetable()) {
|
if (node.isRepetable()) {
|
||||||
this.setEnabled(false);
|
this.setEnabled(true);
|
||||||
|
this.setText(REMOVE_REPEATABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!node.isMain()) {
|
if (node.getLabel().length() != 3) {
|
||||||
this.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node instanceof Attribute) {
|
|
||||||
this.setEnabled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node instanceof NameSpaceNode) {
|
|
||||||
this.setEnabled(false);
|
this.setEnabled(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -113,45 +86,18 @@ public class SetRepetableAction extends SelectionProviderAction {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
|
||||||
if (node.isRepetable()) {
|
|
||||||
return;
|
if (!node.isRepetable()) {
|
||||||
|
if (node.isGroup()) {
|
||||||
|
node.setGroup(false);
|
||||||
|
}
|
||||||
|
node.setRepetable(true);
|
||||||
|
node.setMain(true);
|
||||||
|
upsetMainNode(node);
|
||||||
|
} else {
|
||||||
|
node.setRepetable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.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();
|
|
||||||
// }
|
|
||||||
upsetMainNode(node);
|
|
||||||
xmlViewer.refresh();
|
xmlViewer.refresh();
|
||||||
if (form != null) {
|
|
||||||
form.refreshLinks();
|
|
||||||
}
|
|
||||||
|
|
||||||
// this.hl7ui.updateStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upsetMainNode(HL7TreeNode node) {
|
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.process.IConnectionCategory;
|
||||||
import org.talend.core.model.utils.NodeUtil;
|
import org.talend.core.model.utils.NodeUtil;
|
||||||
import org.talend.designer.hl7.HL7InputComponent;
|
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.Element;
|
||||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||||
import org.talend.designer.hl7.ui.data.NameSpaceNode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOC hwang class global comment. Detailled comment
|
* DOC hwang class global comment. Detailled comment
|
||||||
@@ -57,395 +55,139 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initModel() {
|
public void initModel() {
|
||||||
int i = 0;
|
|
||||||
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(hl7Component, IConnectionCategory.FLOW);
|
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(hl7Component, IConnectionCategory.FLOW);
|
||||||
// HL7Root root = new HL7Root("root");
|
// HL7Root root = new HL7Root("root");
|
||||||
List<Map<String, String>> maps = (List<Map<String, String>>) ElementParameterParser.getObjectValue(hl7Component,
|
List<Map<String, String>> maps = (List<Map<String, String>>) ElementParameterParser.getObjectValue(hl7Component,
|
||||||
"__SCHEMAS__"); //$NON-NLS-1$
|
"__SCHEMAS__"); //$NON-NLS-1$
|
||||||
List<String> schemaList = new ArrayList<String>();
|
List<String> schemaList = new ArrayList<String>();
|
||||||
List<Map<String, String>> rootTable = (List<Map<String, String>>) hl7Component.getTableList(HL7InputComponent.ROOT);
|
for (IMetadataTable table : hl7Component.getMetadataList()) {
|
||||||
List<String> columnList = new ArrayList<String>();
|
if (table.getLabel() != null) {
|
||||||
Map<String, HL7TreeNode> mapNodes = new HashMap<String, HL7TreeNode>();
|
schemaList.add(table.getLabel());
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
HL7TreeNode rootNode = null;
|
|
||||||
for (String rowName : columnList) {
|
|
||||||
IMetadataTable metadataTable = null;
|
|
||||||
String metadataTableName = rowName;
|
|
||||||
for (IConnection connection : incomingConnections) {
|
|
||||||
if (connection.getUniqueName().equals(rowName)) {
|
|
||||||
metadataTable = connection.getMetadataTable();
|
|
||||||
metadataTable.setLabel(connection.getUniqueName());
|
|
||||||
metadataTableName = metadataTable.getLabel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 + ":";
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
temp.setRepetable(repeatable);
|
|
||||||
if (haveOrder) {
|
|
||||||
temp.setOrder(nodeOrder);
|
|
||||||
}
|
|
||||||
if (columnName != null && columnName.length() > 0) {
|
|
||||||
temp.setRow(rowName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
|
||||||
columnName = columnName.replace(schemaId, ""); // $!=Nnull-1$
|
|
||||||
// group node can not get the metadata table
|
|
||||||
if (metadataTable == null) {
|
|
||||||
IMetadataTable metadataTableTemp = null;
|
|
||||||
for (IConnection connection : incomingConnections) {
|
|
||||||
metadataTableTemp = connection.getMetadataTable();
|
|
||||||
String connectionName = metadataTableTemp.getLabel();
|
|
||||||
if (connectionName == null) {
|
|
||||||
connectionName = connection.getUniqueName();
|
|
||||||
}
|
|
||||||
if (columnName.startsWith(connectionName)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (metadataTableTemp != null) {
|
|
||||||
temp.setColumnName(columnName);
|
|
||||||
temp.setColumn(metadataTableTemp.getColumn(columnName));
|
|
||||||
temp.setTable(metadataTableTemp);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
temp.setColumnName(columnName);
|
|
||||||
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 (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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// // build group tree
|
List<Map<String, String>> rootTable = hl7Component.getTableList(HL7InputComponent.ROOT);
|
||||||
// current = mainNode;
|
Map<String, IMetadataTable> schemaNameToInputTable = new HashMap<String, IMetadataTable>();
|
||||||
// currentPath = mainPath;
|
|
||||||
// boolean isFirst = true;
|
if (!maps.isEmpty()) {
|
||||||
// List<Map<String, String>> groupTable = (List<Map<String, String>>)
|
for (Map<String, String> map : maps) {
|
||||||
// hl7Component.getTableList(HL7InputComponent.GROUP);
|
String schemaName = map.get("SCHEMA");
|
||||||
// if (groupTable != null) {
|
int first = schemaName.indexOf("_");
|
||||||
// for (Map<String, String> groupMap : groupTable) {
|
int second = schemaName.lastIndexOf("_");
|
||||||
// String newPath = groupMap.get(HL7InputComponent.PATH);
|
if (first > 0 && first < second) {
|
||||||
// String columnName = groupMap.get(HL7InputComponent.COLUMN);
|
schemaName = schemaName.substring(first + 1, second);
|
||||||
// defaultValue = groupMap.get(HL7InputComponent.VALUE);
|
}
|
||||||
// String orderValue = groupMap.get(HL7InputComponent.ORDER);
|
IMetadataTable metadataTable = null;
|
||||||
// if (orderValue == null || "".equals(orderValue)) {
|
for (IConnection connection : incomingConnections) {
|
||||||
// haveOrder = false;
|
if (connection.getUniqueName().equals(map.get("PARENT_ROW"))) {
|
||||||
// }
|
metadataTable = connection.getMetadataTable();
|
||||||
// if (haveOrder) {
|
metadataTable.setLabel(connection.getUniqueName());
|
||||||
// nodeOrder = Integer.valueOf(groupMap.get(HL7InputComponent.ORDER)).intValue();
|
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||||
// }
|
break;
|
||||||
// String flag = columnName + ":"; //$NON-NLS-1$
|
}
|
||||||
// if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
}
|
||||||
// continue;
|
}
|
||||||
// }
|
} else {
|
||||||
// if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
for (String schemaName : schemaList) {
|
||||||
// temp = new Attribute(newPath);
|
IMetadataTable metadataTable = null;
|
||||||
// temp.setDefaultValue(defaultValue);
|
for (IConnection connection : incomingConnections) {
|
||||||
// current.addChild(temp);
|
if (connection.getUniqueName().equals(schemaName)) {
|
||||||
// } else if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
metadataTable = connection.getMetadataTable();
|
||||||
// temp = new NameSpaceNode(newPath);
|
metadataTable.setLabel(connection.getUniqueName());
|
||||||
// temp.setDefaultValue(defaultValue);
|
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||||
// current.addChild(temp);
|
}
|
||||||
// } else {
|
}
|
||||||
// temp = this.addElement(current, currentPath, newPath, defaultValue);
|
}
|
||||||
// if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
}
|
||||||
// temp.setMain(true);
|
Map<String, HL7TreeNode> mapNodes = new HashMap<String, HL7TreeNode>();
|
||||||
// mainNode = temp;
|
treeData = new ArrayList<HL7TreeNode>();
|
||||||
// mainPath = newPath;
|
|
||||||
// }
|
HL7TreeNode rootNode = null;
|
||||||
// if (isFirst) {
|
HL7TreeNode current = null;
|
||||||
// temp.setGroup(true);
|
HL7TreeNode temp = null;
|
||||||
// isFirst = false;
|
String currentPath = null;
|
||||||
// }
|
String defaultValue = null;
|
||||||
// current = temp;
|
int nodeOrder = 0;
|
||||||
// currentPath = newPath;
|
boolean haveOrder = true;
|
||||||
// }
|
// build root tree
|
||||||
// if (haveOrder) {
|
for (Map<String, String> rootMap : rootTable) {
|
||||||
// temp.setOrder(nodeOrder);
|
String newPath = rootMap.get(HL7InputComponent.PATH);
|
||||||
// }
|
String columnName = rootMap.get(HL7InputComponent.COLUMN);
|
||||||
// temp.setRow(rowName);
|
defaultValue = rootMap.get(HL7InputComponent.VALUE);
|
||||||
// if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
String orderValue = rootMap.get(HL7InputComponent.ORDER);
|
||||||
// columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
boolean repeatable = Boolean.valueOf(rootMap.get("REPEATABLE"));
|
||||||
// temp.setColumn(metadataTable.getColumn(columnName));
|
if (orderValue == null || "".equals(orderValue)) {
|
||||||
// temp.setTable(metadataTable);
|
haveOrder = false;
|
||||||
// }
|
}
|
||||||
// }
|
String rowName = columnName;
|
||||||
// }
|
if (columnName != null && columnName.contains(":")) {
|
||||||
//
|
String[] names = columnName.split(":");
|
||||||
// // build loop tree
|
rowName = names[0];
|
||||||
// current = mainNode;
|
columnName = names[1];
|
||||||
// currentPath = mainPath;
|
} else {
|
||||||
// isFirst = true;
|
columnName = null;
|
||||||
// List<Map<String, String>> loopTable = (List<Map<String, String>>)
|
}
|
||||||
// hl7Component.getTableList(HL7InputComponent.LOOP);
|
temp = this.addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||||
// if (loopTable != null) {
|
if (temp == null) {
|
||||||
// for (Map<String, String> loopMap : loopTable) {
|
// should not happen
|
||||||
// String newPath = loopMap.get(HL7InputComponent.PATH);
|
continue;
|
||||||
// String columnName = loopMap.get(HL7InputComponent.COLUMN);
|
}
|
||||||
// defaultValue = loopMap.get(HL7InputComponent.VALUE);
|
if (rootNode == null) {
|
||||||
// String orderValue = loopMap.get(HL7InputComponent.ORDER);
|
rootNode = temp;
|
||||||
// if (orderValue == null || "".equals(orderValue)) {
|
}
|
||||||
// haveOrder = false;
|
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
||||||
// }
|
temp.setMain(true);
|
||||||
// if (haveOrder) {
|
}
|
||||||
// nodeOrder = Integer.valueOf(loopMap.get(HL7InputComponent.ORDER)).intValue();
|
current = temp;
|
||||||
// }
|
currentPath = newPath;
|
||||||
// String flag = columnName + ":"; //$NON-NLS-1$
|
if (haveOrder) {
|
||||||
// if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
temp.setOrder(nodeOrder);
|
||||||
// continue;
|
}
|
||||||
// }
|
if (rowName != null && rowName.length() > 0) {
|
||||||
// if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
temp.setRow(rowName);
|
||||||
// temp = new Attribute(newPath);
|
}
|
||||||
// temp.setDefaultValue(defaultValue);
|
|
||||||
// current.addChild(temp);
|
if (columnName != null) {
|
||||||
// } else if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
IMetadataTable metadataTable = schemaNameToInputTable.get(rowName);
|
||||||
// temp = new NameSpaceNode(newPath);
|
// group node can not get the metadata table
|
||||||
// temp.setDefaultValue(defaultValue);
|
if (metadataTable == null) {
|
||||||
// current.addChild(temp);
|
IMetadataTable metadataTableTemp = null;
|
||||||
// } else {
|
for (IConnection connection : incomingConnections) {
|
||||||
// temp = this.addElement(current, currentPath, newPath, defaultValue);
|
metadataTableTemp = connection.getMetadataTable();
|
||||||
// if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
String connectionName = metadataTableTemp.getLabel();
|
||||||
// temp.setMain(true);
|
if (connectionName == null) {
|
||||||
// }
|
connectionName = connection.getUniqueName();
|
||||||
// if (isFirst) {
|
}
|
||||||
// temp.setRepetable(true);
|
if (columnName.startsWith(connectionName)) {
|
||||||
// isFirst = false;
|
break;
|
||||||
// }
|
}
|
||||||
// current = temp;
|
}
|
||||||
// currentPath = newPath;
|
temp.setColumnName(columnName);
|
||||||
// }
|
if (metadataTableTemp != null) {
|
||||||
// if (haveOrder) {
|
temp.setColumn(metadataTableTemp.getColumn(columnName));
|
||||||
// temp.setOrder(nodeOrder);
|
temp.setTable(metadataTableTemp);
|
||||||
// }
|
}
|
||||||
// temp.setRow(rowName);
|
} else {
|
||||||
// if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
temp.setColumnName(columnName);
|
||||||
// columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
temp.setColumn(metadataTable.getColumn(columnName));
|
||||||
// temp.setColumn(metadataTable.getColumn(columnName));
|
temp.setTable(metadataTable);
|
||||||
// temp.setTable(metadataTable);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
if (rootNode == null) {
|
||||||
// if (rootNode == null) {
|
rootNode = new Element("rootTag");
|
||||||
// rootNode = new Element("rootTag"); //$NON-NLS-1$
|
}
|
||||||
// // rootNode.setParent(root);
|
if (haveOrder) {
|
||||||
// // root.addChild(rootNode);
|
orderNode(rootNode);
|
||||||
// }
|
}
|
||||||
//
|
// the root node should not set the ColumnLabel
|
||||||
// if (haveOrder) {
|
if (rootNode.getRow() != null) {
|
||||||
// orderNode(rootNode);
|
rootNode.setRow(null);
|
||||||
// }
|
}
|
||||||
// treeData.add(rootNode);
|
treeData.add(rootNode);
|
||||||
// rootNode.setRow(rowName);
|
contents.put(rootNode.getColumnLabel(), treeData);
|
||||||
// contents.put(metadataTableName, treeData);
|
initCurrentSchema();
|
||||||
// i++;
|
}
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// this.setTreeRoot(root);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public List<Map<String, String>> getRootTable() {
|
public List<Map<String, String>> getRootTable() {
|
||||||
List<Map<String, String>> result = new ArrayList<Map<String, String>>();
|
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.PATH, att.getLabel());
|
||||||
newMap.put(HL7InputComponent.COLUMN, att.getColumnLabel());
|
newMap.put(HL7InputComponent.COLUMN, att.getColumnLabel());
|
||||||
newMap.put(HL7InputComponent.ATTRIBUTE, "attri"); //$NON-NLS-1$
|
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(HL7InputComponent.ORDER, String.valueOf(getNodeOrder(att)));
|
||||||
newMap.put("REPEATABLE", String.valueOf(att.isRepetable()));
|
newMap.put("REPEATABLE", String.valueOf(att.isRepetable()));
|
||||||
table.add(newMap);
|
table.add(newMap);
|
||||||
@@ -547,7 +289,7 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
newMap.put(HL7InputComponent.PATH, att.getLabel());
|
newMap.put(HL7InputComponent.PATH, att.getLabel());
|
||||||
newMap.put(HL7InputComponent.COLUMN, att.getColumnLabel());
|
newMap.put(HL7InputComponent.COLUMN, att.getColumnLabel());
|
||||||
newMap.put(HL7InputComponent.ATTRIBUTE, "ns"); //$NON-NLS-1$
|
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("REPEATABLE", String.valueOf(att.isRepetable()));
|
||||||
newMap.put(HL7InputComponent.ORDER, String.valueOf(getNodeOrder(att)));
|
newMap.put(HL7InputComponent.ORDER, String.valueOf(getNodeOrder(att)));
|
||||||
table.add(newMap);
|
table.add(newMap);
|
||||||
@@ -626,6 +368,7 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<HL7TreeNode> getTreeData(String curSchema) {
|
public List<HL7TreeNode> getTreeData(String curSchema) {
|
||||||
if (currentSchema == null) {
|
if (currentSchema == null) {
|
||||||
if (treeData == null) {
|
if (treeData == null) {
|
||||||
@@ -712,6 +455,7 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getCurrentSchema(boolean sign) {
|
public String getCurrentSchema(boolean sign) {
|
||||||
if (sign && schemaMap.get(currentSchema) != null && !"".equals(schemaMap.get(currentSchema))) {
|
if (sign && schemaMap.get(currentSchema) != null && !"".equals(schemaMap.get(currentSchema))) {
|
||||||
return schemaMap.get(currentSchema);
|
return schemaMap.get(currentSchema);
|
||||||
@@ -811,6 +555,7 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
return this.contents;
|
return this.contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<IMetadataColumn> getSchemaData(String currentSchema) {
|
public List<IMetadataColumn> getSchemaData(String currentSchema) {
|
||||||
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(hl7Component, IConnectionCategory.FLOW);
|
List<? extends IConnection> incomingConnections = NodeUtil.getIncomingConnections(hl7Component, IConnectionCategory.FLOW);
|
||||||
for (IConnection connection : incomingConnections) {
|
for (IConnection connection : incomingConnections) {
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
package org.talend.designer.hl7.model;
|
package org.talend.designer.hl7.model;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import ca.uhn.hl7v2.HL7Exception;
|
import ca.uhn.hl7v2.HL7Exception;
|
||||||
@@ -46,30 +48,67 @@ public class SegmentModel extends AbstractStructureModel {
|
|||||||
private void generateDataTypes() {
|
private void generateDataTypes() {
|
||||||
int number = this.seg.numFields();
|
int number = this.seg.numFields();
|
||||||
ArrayList<TypeModel> datatypes = new ArrayList<TypeModel>();
|
ArrayList<TypeModel> datatypes = new ArrayList<TypeModel>();
|
||||||
|
Method method = null;
|
||||||
try {
|
try {
|
||||||
int lastNotEmptyFiledIndex = 0;
|
for (Method curMethod : seg.getClass().getDeclaredMethods()) {
|
||||||
for (int i = 1; i < number; i++) {
|
if (curMethod.getName().equals("createNewTypeWithoutReflection")) {
|
||||||
Type[] reps = seg.getField(i);
|
method = curMethod;
|
||||||
if (reps.length > 0) {
|
method.setAccessible(true);
|
||||||
lastNotEmptyFiledIndex = i;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 1; i <= lastNotEmptyFiledIndex; i++) {
|
|
||||||
Type[] reps = seg.getField(i);
|
if (method != null) {
|
||||||
if (reps.length > 0) {
|
// only access we have to get all the types is reflection (protected method).
|
||||||
for (int j = 0; j < reps.length; j++) {
|
// so add test of null in case this method doesn't exist, even if it should be in every subclass.
|
||||||
TypeModel tm = new TypeModel(reps[j], seg, j, i);
|
for (int i = 0; i < number; i++) {
|
||||||
datatypes.add(tm);
|
|
||||||
}
|
Type type = (Type) method.invoke(seg, i);
|
||||||
} else {
|
TypeModel tm = new TypeModel(type, seg, 0, i + 1);
|
||||||
// for empty column
|
|
||||||
TypeModel tm = new TypeModel(null, seg, 0, i);
|
|
||||||
datatypes.add(tm);
|
datatypes.add(tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (HL7Exception e) {
|
} catch (SecurityException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
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++) {
|
||||||
|
Type[] reps = seg.getField(i);
|
||||||
|
if (reps.length > 0) {
|
||||||
|
lastNotEmptyFiledIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 1; i <= lastNotEmptyFiledIndex; i++) {
|
||||||
|
Type[] reps = seg.getField(i);
|
||||||
|
if (reps.length > 0) {
|
||||||
|
for (int j = 0; j < reps.length; j++) {
|
||||||
|
TypeModel tm = new TypeModel(reps[j], seg, j, i);
|
||||||
|
datatypes.add(tm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// for empty column
|
||||||
|
TypeModel tm = new TypeModel(null, seg, 0, i);
|
||||||
|
datatypes.add(tm);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (HL7Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.types = datatypes.toArray(new TypeModel[0]);
|
this.types = datatypes.toArray(new TypeModel[0]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ public class TypeModel extends AbstractStructureModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateDisplayName() {
|
protected void generateDisplayName() {
|
||||||
String typeDispaly = type == null ? "" : TalendTextUtils.LBRACKET + this.type.getName() + TalendTextUtils.RBRACKET;
|
String typeDisplay = 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$
|
this.displayName = getParent().getName() + "-" + index + "(1)" + typeDisplay; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,10 +70,8 @@ public class TypeModel extends AbstractStructureModel {
|
|||||||
int numSubComp = Terser.numSubComponents(this.type, k);
|
int numSubComp = Terser.numSubComponents(this.type, k);
|
||||||
for (int m = 1; m <= numSubComp; m++) {
|
for (int m = 1; m <= numSubComp; m++) {
|
||||||
Primitive p = getPrimitive(this.type, k, m);
|
Primitive p = getPrimitive(this.type, k, m);
|
||||||
if (p.getValue() != null) {
|
PrimitiveModel pm = new PrimitiveModel(this, p, k, m);
|
||||||
PrimitiveModel pm = new PrimitiveModel(this, p, k, m);
|
pms.add(pm);
|
||||||
pms.add(pm);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
primitives = pms.toArray(new PrimitiveModel[0]);
|
primitives = pms.toArray(new PrimitiveModel[0]);
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ import org.talend.core.model.process.IElementParameter;
|
|||||||
import org.talend.core.model.utils.NodeUtil;
|
import org.talend.core.model.utils.NodeUtil;
|
||||||
import org.talend.designer.core.model.components.EParameterName;
|
import org.talend.designer.core.model.components.EParameterName;
|
||||||
import org.talend.designer.hl7.HL7InputComponent;
|
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.CreateHL7ElementAction;
|
||||||
import org.talend.designer.hl7.action.DeleteHL7NodeAction;
|
import org.talend.designer.hl7.action.DeleteHL7NodeAction;
|
||||||
import org.talend.designer.hl7.action.HL7DisconnectAction;
|
import org.talend.designer.hl7.action.HL7DisconnectAction;
|
||||||
@@ -101,8 +100,6 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
|
|
||||||
private HL7FixValueAction fixValueAction;
|
private HL7FixValueAction fixValueAction;
|
||||||
|
|
||||||
private CreateHL7AttributeAction createAttributeAction;
|
|
||||||
|
|
||||||
private ImportHL7StructureAction importAction;
|
private ImportHL7StructureAction importAction;
|
||||||
|
|
||||||
private SetRepetableAction setRepetableAction;
|
private SetRepetableAction setRepetableAction;
|
||||||
@@ -315,6 +312,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
|
|
||||||
xmlViewer.setCellModifier(new ICellModifier() {
|
xmlViewer.setCellModifier(new ICellModifier() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canModify(Object element, String property) {
|
public boolean canModify(Object element, String property) {
|
||||||
HL7TreeNode node = (HL7TreeNode) element;
|
HL7TreeNode node = (HL7TreeNode) element;
|
||||||
if (property.equals("C1")) {
|
if (property.equals("C1")) {
|
||||||
@@ -330,6 +328,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getValue(Object element, String property) {
|
public Object getValue(Object element, String property) {
|
||||||
HL7TreeNode node = (HL7TreeNode) element;
|
HL7TreeNode node = (HL7TreeNode) element;
|
||||||
if (property.equals("C1")) {
|
if (property.equals("C1")) {
|
||||||
@@ -342,6 +341,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void modify(Object element, String property, Object value) {
|
public void modify(Object element, String property, Object value) {
|
||||||
TreeItem treeItem = (TreeItem) element;
|
TreeItem treeItem = (TreeItem) element;
|
||||||
HL7TreeNode node = (HL7TreeNode) treeItem.getData();
|
HL7TreeNode node = (HL7TreeNode) treeItem.getData();
|
||||||
@@ -376,6 +376,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
menuMgr.setRemoveAllWhenShown(true);
|
menuMgr.setRemoveAllWhenShown(true);
|
||||||
menuMgr.addMenuListener(new IMenuListener() {
|
menuMgr.addMenuListener(new IMenuListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void menuAboutToShow(IMenuManager manager) {
|
public void menuAboutToShow(IMenuManager manager) {
|
||||||
HL7OutputUI.this.fillContextMenu(manager);
|
HL7OutputUI.this.fillContextMenu(manager);
|
||||||
}
|
}
|
||||||
@@ -384,6 +385,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
xmlViewer.getControl().setMenu(menu);
|
xmlViewer.getControl().setMenu(menu);
|
||||||
xmlViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
xmlViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
@@ -402,8 +404,6 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
if (!xmlViewer.getSelection().isEmpty()) {
|
if (!xmlViewer.getSelection().isEmpty()) {
|
||||||
manager.add(createAction);
|
manager.add(createAction);
|
||||||
createAction.init();
|
createAction.init();
|
||||||
manager.add(createAttributeAction);
|
|
||||||
createAttributeAction.init();
|
|
||||||
manager.add(new Separator());
|
manager.add(new Separator());
|
||||||
manager.add(deleteAction);
|
manager.add(deleteAction);
|
||||||
deleteAction.init();
|
deleteAction.init();
|
||||||
@@ -430,7 +430,6 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
|
|
||||||
private void createAction() {
|
private void createAction() {
|
||||||
createAction = new CreateHL7ElementAction(xmlViewer, this, "Add Sub-element");
|
createAction = new CreateHL7ElementAction(xmlViewer, this, "Add Sub-element");
|
||||||
createAttributeAction = new CreateHL7AttributeAction(xmlViewer, this, "Add Attribute");
|
|
||||||
deleteAction = new DeleteHL7NodeAction(xmlViewer, this, "Delete");
|
deleteAction = new DeleteHL7NodeAction(xmlViewer, this, "Delete");
|
||||||
disconnectAction = new HL7DisconnectAction(xmlViewer, this, "Disconnect Linker");
|
disconnectAction = new HL7DisconnectAction(xmlViewer, this, "Disconnect Linker");
|
||||||
fixValueAction = new HL7FixValueAction(xmlViewer, this, "Set A Fix Value");
|
fixValueAction = new HL7FixValueAction(xmlViewer, this, "Set A Fix Value");
|
||||||
@@ -488,14 +487,17 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
|
|
||||||
Boolean validateLabel;
|
Boolean validateLabel;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void applyEditorValue() {
|
public void applyEditorValue() {
|
||||||
String text = getControl().getText();
|
String text = getControl().getText();
|
||||||
onValueChanged(text, true, property);
|
onValueChanged(text, true, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void cancelEditor() {
|
public void cancelEditor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void editorValueChanged(boolean oldValidState, boolean newValidState) {
|
public void editorValueChanged(boolean oldValidState, boolean newValidState) {
|
||||||
onValueChanged(getControl().getText(), false, property);
|
onValueChanged(getControl().getText(), false, property);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,25 +39,28 @@ import ca.uhn.hl7v2.model.Structure;
|
|||||||
*/
|
*/
|
||||||
public class HL7PublicUtil {
|
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) {
|
if (node == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HL7TreeNode parent = node.getParent();
|
HL7TreeNode parent = node.getParent();
|
||||||
if (parent == null) {
|
if (parent == null) {
|
||||||
|
curOrder = 1;
|
||||||
node.setOrder(1);
|
node.setOrder(1);
|
||||||
String path = getPath(node);
|
String path = getPath(node);
|
||||||
orderMap.put(path, order);
|
orderMap.put(path, curOrder);
|
||||||
order++;
|
curOrder++;
|
||||||
}
|
}
|
||||||
List<HL7TreeNode> childNode = node.getChildren();
|
List<HL7TreeNode> childNode = node.getChildren();
|
||||||
for (HL7TreeNode child : childNode) {
|
for (HL7TreeNode child : childNode) {
|
||||||
child.setOrder(order);
|
child.setOrder(curOrder);
|
||||||
String path = getPath(child);
|
String path = getPath(child);
|
||||||
orderMap.put(path, order);
|
orderMap.put(path, curOrder);
|
||||||
order++;
|
curOrder++;
|
||||||
if (child.getChildren().size() > 0) {
|
if (child.getChildren().size() > 0) {
|
||||||
initNodeOrder(child, orderMap, order);
|
initNodeOrder(child, orderMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +191,6 @@ public class HL7PublicUtil {
|
|||||||
childEle.setLabel(tlabel);
|
childEle.setLabel(tlabel);
|
||||||
if (childEle instanceof Element) {
|
if (childEle instanceof Element) {
|
||||||
((Element) childEle).setRow(childLabel);
|
((Element) childEle).setRow(childLabel);
|
||||||
((Element) childEle).setColumnName(getLabel(element, true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node.addChild(childEle);
|
node.addChild(childEle);
|
||||||
@@ -341,7 +343,7 @@ public class HL7PublicUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Group) {
|
if (childReps[j] instanceof Group) {
|
||||||
values.add((Group) childReps[j]);
|
values.add(childReps[j]);
|
||||||
allSegmentFromGroup.clear();
|
allSegmentFromGroup.clear();
|
||||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
getAllSegmentsFromGroup((Group) childReps[j]);
|
||||||
}
|
}
|
||||||
@@ -456,7 +458,7 @@ public class HL7PublicUtil {
|
|||||||
values.add(childReps[j]);
|
values.add(childReps[j]);
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Group) {
|
if (childReps[j] instanceof Group) {
|
||||||
values.add((Group) childReps[j]);
|
values.add(childReps[j]);
|
||||||
allSegmentFromGroup.clear();
|
allSegmentFromGroup.clear();
|
||||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
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 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();
|
private Perl5Matcher matcher = new Perl5Matcher();
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -3,6 +3,5 @@
|
|||||||
<classpathentry exported="true" kind="lib" path="lib/commons-net-3.3.jar"/>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<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-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-v21-1.0.1.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/hapi-structures-v22-1.0.1.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/hapi-structures-v22-1.0.1.jar"/>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</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.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/jboss-serialization.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/jboss-serialization.jar"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
Binary file not shown.
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<classpath>
|
<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.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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -415,7 +415,16 @@ public class ImportItemUtil {
|
|||||||
return 0;
|
return 0;
|
||||||
} else if (!(o1.getProperty().getItem() instanceof RoutineItem)
|
} else if (!(o1.getProperty().getItem() instanceof RoutineItem)
|
||||||
&& !(o2.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) {
|
} else if (o1.getProperty().getItem() instanceof RoutineItem) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
|||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.FileLocator;
|
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.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
|
||||||
import org.eclipse.jface.layout.GridDataFactory;
|
import org.eclipse.jface.layout.GridDataFactory;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
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.model.repository.ERepositoryObjectType;
|
||||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||||
import org.talend.core.ui.ISVNProviderService;
|
import org.talend.core.ui.ISVNProviderService;
|
||||||
|
import org.talend.repository.RepositoryWorkUnit;
|
||||||
import org.talend.repository.model.ComponentsFactoryProvider;
|
import org.talend.repository.model.ComponentsFactoryProvider;
|
||||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||||
|
|
||||||
@@ -142,6 +145,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
|||||||
|
|
||||||
componentViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
componentViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
shareButton.setEnabled(!event.getSelection().isEmpty());
|
shareButton.setEnabled(!event.getSelection().isEmpty());
|
||||||
}
|
}
|
||||||
@@ -158,6 +162,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
|||||||
|
|
||||||
shareViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
shareViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
public void selectionChanged(SelectionChangedEvent event) {
|
||||||
backButton.setEnabled(!event.getSelection().isEmpty());
|
backButton.setEnabled(!event.getSelection().isEmpty());
|
||||||
}
|
}
|
||||||
@@ -340,6 +345,7 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
|||||||
protected void performApply() {
|
protected void performApply() {
|
||||||
final IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
final IRunnableWithProgress runnable = new IRunnableWithProgress() {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
monitor.beginTask("Save custom component setting", (sharedAdded.size() + backAdded.size()) * 100);
|
monitor.beginTask("Save custom component setting", (sharedAdded.size() + backAdded.size()) * 100);
|
||||||
finish(monitor);
|
finish(monitor);
|
||||||
@@ -369,97 +375,138 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean performCancel() {
|
public boolean performCancel() {
|
||||||
if (componentViewer != null) {
|
if (componentViewer != null) {
|
||||||
resetCustomComponentSetting();
|
resetCustomComponentSetting();
|
||||||
}
|
}
|
||||||
return super.performCancel();
|
return super.performCancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finish(IProgressMonitor... monitorWrap) {
|
private void finish(IProgressMonitor... monitorWrap) {
|
||||||
IProgressMonitor monitor = null;
|
IProgressMonitor monitor = null;
|
||||||
if (monitorWrap != null && monitorWrap.length == 1) {
|
if (monitorWrap != null && monitorWrap.length == 1) {
|
||||||
monitor = monitorWrap[0];
|
monitor = monitorWrap[0];
|
||||||
}
|
}
|
||||||
IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
|
final IProxyRepositoryFactory prf = CorePlugin.getDefault().getProxyRepositoryFactory();
|
||||||
|
|
||||||
if (PluginChecker.isSVNProviderPluginLoaded() && (!sharedAdded.isEmpty() || !backAdded.isEmpty())) {
|
if (PluginChecker.isSVNProviderPluginLoaded() && (!sharedAdded.isEmpty() || !backAdded.isEmpty())) {
|
||||||
ISVNProviderService service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(
|
RepositoryWorkUnit repositoryWorkUnit = new RepositoryWorkUnit("Commit new component") {
|
||||||
ISVNProviderService.class);
|
|
||||||
String projectLabel = pro.getTechnicalLabel();
|
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
|
||||||
IProject eclipseProject = workspace.getRoot().getProject(projectLabel);
|
|
||||||
|
|
||||||
String targetRoot = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath()
|
@Override
|
||||||
+ File.separatorChar + projectLabel + File.separatorChar
|
public void run() throws PersistenceException {
|
||||||
+ ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS);
|
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||||
File componentFolder = new File(targetRoot);
|
|
||||||
URL url = null;
|
|
||||||
try {
|
|
||||||
if (!componentFolder.exists()) {
|
|
||||||
FilesUtils.createFoldersIfNotExists(targetRoot, false);
|
|
||||||
}
|
|
||||||
Bundle b = Platform.getBundle(IComponentsFactory.COMPONENTS_LOCATION);
|
|
||||||
url = FileLocator.toFileURL(FileLocator.find(b, new Path(""), null));
|
|
||||||
|
|
||||||
String sourceRoot = url.getFile();
|
@Override
|
||||||
|
public void run(IProgressMonitor subMonitor) throws CoreException {
|
||||||
|
|
||||||
// delete share
|
ISVNProviderService service = (ISVNProviderService) GlobalServiceRegister.getDefault().getService(
|
||||||
for (IComponent component : backAdded.keySet()) {
|
ISVNProviderService.class);
|
||||||
service.svnEclipseHandlerDelete(eclipseProject, pro, targetRoot + File.separator + component.getName());
|
String projectLabel = pro.getTechnicalLabel();
|
||||||
if (monitor != null) {
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
monitor.worked(10);
|
IProject eclipseProject = workspace.getRoot().getProject(projectLabel);
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!backAdded.isEmpty()) {
|
|
||||||
getCustomComponentSettings().removeAll(backAdded.values());
|
|
||||||
}
|
|
||||||
|
|
||||||
FileFilter ff = new FileFilter() {
|
String targetRoot = new Path(Platform.getInstanceLocation().getURL().getPath()).toFile().getPath()
|
||||||
|
+ File.separatorChar + projectLabel + File.separatorChar
|
||||||
|
+ ERepositoryObjectType.getFolderName(ERepositoryObjectType.COMPONENTS);
|
||||||
|
File componentFolder = new File(targetRoot);
|
||||||
|
URL url = null;
|
||||||
|
try {
|
||||||
|
if (!componentFolder.exists()) {
|
||||||
|
FilesUtils.createFoldersIfNotExists(targetRoot, false);
|
||||||
|
}
|
||||||
|
Bundle b = Platform.getBundle(IComponentsFactory.COMPONENTS_LOCATION);
|
||||||
|
url = FileLocator.toFileURL(FileLocator.find(b, new Path(""), null));
|
||||||
|
|
||||||
public boolean accept(File pathname) {
|
String sourceRoot = url.getFile();
|
||||||
if (FilesUtils.isSVNFolder(pathname)) {
|
|
||||||
return false;
|
// delete share
|
||||||
|
for (IComponent component : backAdded.keySet()) {
|
||||||
|
service.svnEclipseHandlerDelete(eclipseProject, pro,
|
||||||
|
targetRoot + File.separator + component.getName());
|
||||||
|
if (subMonitor != null) {
|
||||||
|
subMonitor.worked(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!backAdded.isEmpty()) {
|
||||||
|
getCustomComponentSettings().removeAll(backAdded.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
FileFilter ff = new FileFilter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean accept(File pathname) {
|
||||||
|
if (FilesUtils.isSVNFolder(pathname)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// share
|
||||||
|
for (IComponent component : sharedAdded.keySet()) {
|
||||||
|
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 (subMonitor != null) {
|
||||||
|
subMonitor.worked(10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
resetCustomComponentSetting();
|
||||||
|
ExceptionHandler.process(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
prf.saveProject(pro);
|
||||||
|
} catch (PersistenceException e) {
|
||||||
|
ExceptionHandler.process(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
eclipseProject.refreshLocal(IResource.DEPTH_INFINITE, subMonitor);
|
||||||
|
} catch (CoreException e1) {
|
||||||
|
ExceptionHandler.process(e1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
};
|
||||||
}
|
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
|
||||||
// share
|
// notification
|
||||||
for (IComponent component : sharedAdded.keySet()) {
|
// of changes before the end of the modifications.
|
||||||
String sourcePath = sourceRoot + component.getPathSource() + File.separator + component.getName();
|
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, new NullProgressMonitor());
|
||||||
File sourceFile = new File(sourcePath);
|
} catch (CoreException e) {
|
||||||
|
throw new PersistenceException(e.getCause());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
} catch (Exception e) {
|
repositoryWorkUnit.setRefreshRepository(false);
|
||||||
resetCustomComponentSetting();
|
repositoryWorkUnit.setForceTransaction(true);
|
||||||
ExceptionHandler.process(e);
|
prf.executeRepositoryWorkUnit(repositoryWorkUnit);
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
prf.saveProject(pro);
|
repositoryWorkUnit.throwPersistenceExceptionIfAny();
|
||||||
} catch (PersistenceException e) {
|
} catch (PersistenceException e) {
|
||||||
ExceptionHandler.process(e);
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
eclipseProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
|
|
||||||
} catch (CoreException e1) {
|
|
||||||
ExceptionHandler.process(e1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (monitor != null) {
|
if (monitor != null) {
|
||||||
monitor.done();
|
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() {
|
private void resetCustomComponentSetting() {
|
||||||
@@ -504,21 +551,25 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
|||||||
*/
|
*/
|
||||||
class CustomCompSettingContentProvider implements ITreeContentProvider {
|
class CustomCompSettingContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getParent(Object element) {
|
public Object getParent(Object element) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
if (inputElement instanceof List) {
|
if (inputElement instanceof List) {
|
||||||
return ((List) inputElement).toArray();
|
return ((List) inputElement).toArray();
|
||||||
@@ -526,11 +577,13 @@ public class CustomComponentSettingPage extends ProjectSettingPage {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user