Compare commits
12 Commits
codegen_ba
...
patch/5.3.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36f40e47c7 | ||
|
|
5a57a533c1 | ||
|
|
6659a31f24 | ||
|
|
60f0ca72a9 | ||
|
|
4e4b936c4b | ||
|
|
ab112c658c | ||
|
|
f4bf3a8efc | ||
|
|
3e32d94637 | ||
|
|
4ed1c20d19 | ||
|
|
439990117b | ||
|
|
d6d3883e15 | ||
|
|
c8659a0c0f |
@@ -65,24 +65,6 @@ if(("false").equals(useExistingConn)){
|
|||||||
env_<%=cid%>.put(javax.naming.Context.REFERRAL, "<%=referrals%>");
|
env_<%=cid%>.put(javax.naming.Context.REFERRAL, "<%=referrals%>");
|
||||||
env_<%=cid%>.put("java.naming.ldap.derefAliases","<%=aliases%>");
|
env_<%=cid%>.put("java.naming.ldap.derefAliases","<%=aliases%>");
|
||||||
<%
|
<%
|
||||||
// Types binaires
|
|
||||||
if(useFieldOptions){
|
|
||||||
boolean isBinary = false;
|
|
||||||
for(IMetadataColumn column:columnList){
|
|
||||||
for(Map<String, String> line:fieldOptions){// search in the configuration table
|
|
||||||
String columnName = line.get("SCHEMA_COLUMN");
|
|
||||||
if(column.getLabel().equals(columnName)){
|
|
||||||
isBinary = "true".equals(line.get("BINARY"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(isBinary){
|
|
||||||
%>
|
|
||||||
env_<%=cid%>.put("java.naming.ldap.attributes.binary","<%=column.getOriginalDbColumnName()%>");
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(baseDN == null || baseDN.length()<=2){
|
if(baseDN == null || baseDN.length()<=2){
|
||||||
%>
|
%>
|
||||||
env_<%=cid%>.put(javax.naming.Context.PROVIDER_URL, "ldap://"+<%=host%>+":"+<%=port%>);
|
env_<%=cid%>.put(javax.naming.Context.PROVIDER_URL, "ldap://"+<%=host%>+":"+<%=port%>);
|
||||||
@@ -145,6 +127,14 @@ if(("false").equals(useExistingConn)){
|
|||||||
|
|
||||||
javax.naming.directory.SearchControls searchCtls_<%=cid%> = new javax.naming.directory.SearchControls();
|
javax.naming.directory.SearchControls searchCtls_<%=cid%> = new javax.naming.directory.SearchControls();
|
||||||
searchCtls_<%=cid%>.setSearchScope(javax.naming.directory.SearchControls.SUBTREE_SCOPE);
|
searchCtls_<%=cid%>.setSearchScope(javax.naming.directory.SearchControls.SUBTREE_SCOPE);
|
||||||
|
<%
|
||||||
|
boolean isDynamic = metadata.isDynamicSchema();
|
||||||
|
if(isDynamic){
|
||||||
|
%>
|
||||||
|
routines.system.Dynamic dcg_<%=cid%> = new routines.system.Dynamic();
|
||||||
|
<%
|
||||||
|
}else{
|
||||||
|
%>
|
||||||
searchCtls_<%=cid%>.setReturningAttributes(new String[]{
|
searchCtls_<%=cid%>.setReturningAttributes(new String[]{
|
||||||
<%
|
<%
|
||||||
for(IMetadataColumn column:columnList){
|
for(IMetadataColumn column:columnList){
|
||||||
@@ -154,6 +144,9 @@ if(("false").equals(useExistingConn)){
|
|||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
});
|
});
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
searchCtls_<%=cid%>.setTimeLimit(<%=timeout%>*1000);
|
searchCtls_<%=cid%>.setTimeLimit(<%=timeout%>*1000);
|
||||||
searchCtls_<%=cid%>.setCountLimit(<%=limit %>);
|
searchCtls_<%=cid%>.setCountLimit(<%=limit %>);
|
||||||
<%
|
<%
|
||||||
@@ -180,6 +173,85 @@ if(("false").equals(useExistingConn)){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
<%
|
||||||
|
String binaryColumns = "";
|
||||||
|
boolean hasDynamicBinary=false;
|
||||||
|
if(useFieldOptions){
|
||||||
|
for(int i = 0;i<fieldOptions.size();i++){// search in the configuration table
|
||||||
|
Map<String, String> line = fieldOptions.get(i);
|
||||||
|
String columnName = line.get("SCHEMA_COLUMN");
|
||||||
|
Boolean isBinary = "true".equals(line.get("BINARY"));
|
||||||
|
if(isBinary){
|
||||||
|
IMetadataColumn column = columnList.get(i);
|
||||||
|
if(!column.getTalendType().equals("id_Dynamic")){
|
||||||
|
if(binaryColumns.length()>0){
|
||||||
|
binaryColumns+=" ";
|
||||||
|
}
|
||||||
|
binaryColumns+=column.getOriginalDbColumnName();
|
||||||
|
}else{
|
||||||
|
hasDynamicBinary = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean hasBinaryColumn = binaryColumns.length()>0 || hasDynamicBinary;
|
||||||
|
if(hasBinaryColumn){
|
||||||
|
%>
|
||||||
|
String binaryColumns_<%=cid%> = "<%=binaryColumns%>";
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
if(isDynamic){
|
||||||
|
String columnsStr = "";
|
||||||
|
for(IMetadataColumn column:columnList){
|
||||||
|
columnsStr += column.getOriginalDbColumnName() + ",";
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
String[] columnsInSchema_<%=cid%> = "<%=columnsStr%>".split(",");
|
||||||
|
java.util.Arrays.sort(columnsInSchema_<%=cid%>);
|
||||||
|
javax.naming.directory.Attributes attrsDyn_<%=cid%> = null;
|
||||||
|
javax.naming.NamingEnumeration answerDyn_<%=cid%> = ctx_<%=cid%>.search(<%if(("false").equals(useExistingConn)){%>baseDN_<%=cid%><%}else{%>""<%}%>, <%=filter%>, searchCtls_<%=cid%>);
|
||||||
|
while (answerDyn_<%=cid%> .hasMoreElements()) {
|
||||||
|
javax.naming.directory.SearchResult srDyn_<%=cid%> = (javax.naming.directory.SearchResult) answerDyn_<%=cid%>.next();
|
||||||
|
attrsDyn_<%=cid%> = srDyn_<%=cid%>.getAttributes();
|
||||||
|
javax.naming.NamingEnumeration ne_<%=cid%> =attrsDyn_<%=cid%>.getAll();
|
||||||
|
while(ne_<%=cid%>.hasMoreElements()){
|
||||||
|
String element_<%=cid%> = ne_<%=cid%>.nextElement().toString();
|
||||||
|
int splitorIndex_<%=cid%> = element_<%=cid%>.indexOf(":");
|
||||||
|
if(splitorIndex_<%=cid%>>0){
|
||||||
|
String columnName_<%=cid%> = element_<%=cid%>.substring(0,splitorIndex_<%=cid%>);
|
||||||
|
if(java.util.Arrays.binarySearch(columnsInSchema_<%=cid%>,columnName_<%=cid%>) < 0 || "<%=metadata.getDynamicColumn().getOriginalDbColumnName()%>".equals(columnName_<%=cid%>)){
|
||||||
|
DynamicMetadata dm_<%=cid%> = new DynamicMetadata();
|
||||||
|
dm_<%=cid%>.setName(columnName_<%=cid%>);
|
||||||
|
dm_<%=cid%>.setDbName(columnName_<%=cid%>);
|
||||||
|
dm_<%=cid%>.setType("id_String");
|
||||||
|
if(!dcg_<%=cid%>.metadatas.contains(dm_<%=cid%>)){
|
||||||
|
dcg_<%=cid%>.metadatas.add(dm_<%=cid%>);
|
||||||
|
<%
|
||||||
|
if(hasDynamicBinary){
|
||||||
|
if(binaryColumns.length()==0){
|
||||||
|
%>
|
||||||
|
if(binaryColumns_<%=cid%>.length()>0){
|
||||||
|
binaryColumns_<%=cid%>+=" ";
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}else{
|
||||||
|
%>
|
||||||
|
binaryColumns_<%=cid%>+=" ";
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
binaryColumns_<%=cid%>+=columnName_<%=cid%>;
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
<%if(paging){%>
|
<%if(paging){%>
|
||||||
// Set the page size and initialize the cookie that we pass back in subsequent pages
|
// Set the page size and initialize the cookie that we pass back in subsequent pages
|
||||||
int pageSize_<%=cid%> = <%=pageSize %>;
|
int pageSize_<%=cid%> = <%=pageSize %>;
|
||||||
@@ -190,6 +262,17 @@ if(("false").equals(useExistingConn)){
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
<%}%>
|
<%}%>
|
||||||
|
<%
|
||||||
|
if(hasBinaryColumn){
|
||||||
|
%>
|
||||||
|
if(binaryColumns_<%=cid%>.length()>0){
|
||||||
|
java.util.Hashtable orignal_env_<%=cid%>= ctx_<%=cid%>.getEnvironment();
|
||||||
|
orignal_env_<%=cid%>.put("java.naming.ldap.attributes.binary",binaryColumns_<%=cid%>);
|
||||||
|
ctx_<%=cid%> = new javax.naming.ldap.InitialLdapContext(orignal_env_<%=cid%>, null);
|
||||||
|
}
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
|
||||||
javax.naming.NamingEnumeration answer_<%=cid%> = ctx_<%=cid%>.search(<%if(("false").equals(useExistingConn)){%>baseDN_<%=cid%><%}else{%>""<%}%>, <%=filter%>, searchCtls_<%=cid%>);
|
javax.naming.NamingEnumeration answer_<%=cid%> = ctx_<%=cid%>.search(<%if(("false").equals(useExistingConn)){%>baseDN_<%=cid%><%}else{%>""<%}%>, <%=filter%>, searchCtls_<%=cid%>);
|
||||||
while (answer_<%=cid%> .hasMoreElements()) {//a
|
while (answer_<%=cid%> .hasMoreElements()) {//a
|
||||||
@@ -267,6 +350,29 @@ do {
|
|||||||
<%=conn.getName()%>.<%=column.getLabel()%> = ("".equals(sr_<%=cid%>.getName())?sr_<%=cid%>.getName():(sr_<%=cid%>.getName()+ ",")) + baseDN_<%=cid%>;
|
<%=conn.getName()%>.<%=column.getLabel()%> = ("".equals(sr_<%=cid%>.getName())?sr_<%=cid%>.getName():(sr_<%=cid%>.getName()+ ",")) + baseDN_<%=cid%>;
|
||||||
<%
|
<%
|
||||||
}else{
|
}else{
|
||||||
|
%>
|
||||||
|
<%
|
||||||
|
if("id_Dynamic".equals(column.getTalendType())) {
|
||||||
|
%>
|
||||||
|
dcg_<%=cid%>.clearColumnValues();
|
||||||
|
for(DynamicMetadata dm_<%=cid%> :dcg_<%=cid%>.metadatas){
|
||||||
|
javax.naming.directory.Attribute attr_<%=column.getLabel()%>_<%=cid%> = attrs_<%=cid%>.get(dm_<%=cid%>.getDbName());
|
||||||
|
if(attr_<%=column.getLabel()%>_<%=cid%> != null){
|
||||||
|
StringBuilder attrStr_<%=cid%> = new StringBuilder();
|
||||||
|
for (javax.naming.NamingEnumeration e_<%=cid%> = attr_<%=column.getLabel()%>_<%=cid%>.getAll(); e_<%=cid%>.hasMore();){
|
||||||
|
if(attrStr_<%=cid%>.length()>0){
|
||||||
|
attrStr_<%=cid%>.append(<%=separator%>);
|
||||||
|
}
|
||||||
|
attrStr_<%=cid%>.append(e_<%=cid%>.next().toString());
|
||||||
|
}
|
||||||
|
dcg_<%=cid%>.addColumnValue(attrStr_<%=cid%>.toString());
|
||||||
|
}else{
|
||||||
|
dcg_<%=cid%>.addColumnValue(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<%=conn.getName() %>.<%=column.getLabel() %> = dcg_<%=cid%>;
|
||||||
|
<%
|
||||||
|
}else{
|
||||||
%>
|
%>
|
||||||
javax.naming.directory.Attribute attr_<%=column.getLabel()%>_<%=cid%> = attrs_<%=cid%>.get("<%=column.getOriginalDbColumnName()%>");
|
javax.naming.directory.Attribute attr_<%=column.getLabel()%>_<%=cid%> = attrs_<%=cid%>.get("<%=column.getOriginalDbColumnName()%>");
|
||||||
if(attr_<%=column.getLabel()%>_<%=cid%> != null){
|
if(attr_<%=column.getLabel()%>_<%=cid%> != null){
|
||||||
@@ -299,6 +405,7 @@ do {
|
|||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}//5
|
}//5
|
||||||
%>
|
%>
|
||||||
}//b
|
}//b
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.talend.core.model.metadata.QueryUtil;
|
|||||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||||
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
import org.talend.core.model.metadata.builder.connection.DatabaseConnection;
|
||||||
import org.talend.core.model.metadata.builder.connection.FTPConnection;
|
import org.talend.core.model.metadata.builder.connection.FTPConnection;
|
||||||
|
import org.talend.core.model.metadata.builder.connection.HL7Connection;
|
||||||
import org.talend.core.model.metadata.builder.connection.MDMConnection;
|
import org.talend.core.model.metadata.builder.connection.MDMConnection;
|
||||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||||
import org.talend.core.model.metadata.builder.connection.Query;
|
import org.talend.core.model.metadata.builder.connection.Query;
|
||||||
@@ -551,6 +552,16 @@ public class ChangeValuesFromRepository extends ChangeMetadataCommand {
|
|||||||
if (curParam.getFieldType().equals(EParameterFieldType.AS400_CHECK)) {
|
if (curParam.getFieldType().equals(EParameterFieldType.AS400_CHECK)) {
|
||||||
setOtherProperties();
|
setOtherProperties();
|
||||||
}
|
}
|
||||||
|
// change the HL7 Version
|
||||||
|
if (connection instanceof HL7Connection) {
|
||||||
|
if (curParam.getName().equals("HL7_VER")) {
|
||||||
|
String hl7VersionString = connection.getVersion();
|
||||||
|
if (hl7VersionString != null) {
|
||||||
|
hl7VersionString = hl7VersionString.replace(".", "");
|
||||||
|
curParam.setValue(hl7VersionString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem instanceof Node) {
|
if (elem instanceof Node) {
|
||||||
|
|||||||
@@ -81,9 +81,12 @@ public class ConnectionFigure extends PolylineConnection {
|
|||||||
|
|
||||||
if (PluginChecker.isAutoParalelPluginLoaded()) {
|
if (PluginChecker.isAutoParalelPluginLoaded()) {
|
||||||
addParallelFigure();
|
addParallelFigure();
|
||||||
|
// TDI-26611
|
||||||
|
if (connection != null) {
|
||||||
initFigureMap();
|
initFigureMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void initFigureMap() {
|
private void initFigureMap() {
|
||||||
figureMap.clear();
|
figureMap.clear();
|
||||||
|
|||||||
@@ -1260,7 +1260,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);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import org.eclipse.swt.widgets.Control;
|
|||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
|
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
|
||||||
|
import org.talend.commons.exception.LoginException;
|
||||||
import org.talend.commons.exception.PersistenceException;
|
import org.talend.commons.exception.PersistenceException;
|
||||||
import org.talend.commons.exception.SystemException;
|
import org.talend.commons.exception.SystemException;
|
||||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||||
@@ -91,6 +92,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.RoutinesParameterType
|
|||||||
import org.talend.designer.core.ui.editor.nodes.Node;
|
import org.talend.designer.core.ui.editor.nodes.Node;
|
||||||
import org.talend.designer.runprocess.IRunProcessService;
|
import org.talend.designer.runprocess.IRunProcessService;
|
||||||
import org.talend.repository.ProjectManager;
|
import org.talend.repository.ProjectManager;
|
||||||
|
import org.talend.repository.RepositoryWorkUnit;
|
||||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||||
import org.talend.repository.model.IRepositoryService;
|
import org.talend.repository.model.IRepositoryService;
|
||||||
import org.talend.repository.ui.views.IRepositoryView;
|
import org.talend.repository.ui.views.IRepositoryView;
|
||||||
@@ -245,9 +247,11 @@ public class WSDL2JAVAController extends AbstractElementPropertySectionControlle
|
|||||||
*/
|
*/
|
||||||
private void generateJavaFile() {
|
private void generateJavaFile() {
|
||||||
|
|
||||||
final IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||||
|
RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {//$NON-NLS-1$
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
@Override
|
||||||
|
protected void run() throws PersistenceException {
|
||||||
Node node = (Node) elem;
|
Node node = (Node) elem;
|
||||||
|
|
||||||
IProcess process = node.getProcess();
|
IProcess process = node.getProcess();
|
||||||
@@ -382,30 +386,9 @@ public class WSDL2JAVAController extends AbstractElementPropertySectionControlle
|
|||||||
// }
|
// }
|
||||||
FilesUtils.removeFolder(dir, true);
|
FilesUtils.removeFolder(dir, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
|
workUnit.setAvoidUnloadResources(true);
|
||||||
|
factory.executeRepositoryWorkUnit(workUnit);
|
||||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
|
||||||
try {
|
|
||||||
ISchedulingRule schedulingRule = workspace.getRoot();
|
|
||||||
// the update the project files need to be done in the workspace runnable to avoid all
|
|
||||||
// notification
|
|
||||||
// of changes before the end of the modifications.
|
|
||||||
workspace.run(op, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
// throw new InvocationTargetException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
PlatformUI.getWorkbench().getProgressService().run(true, true, iRunnableWithProgress);
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
ExceptionHandler.process(e);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
ExceptionHandler.process(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshProject() {
|
private void refreshProject() {
|
||||||
|
|||||||
@@ -225,30 +225,6 @@ public class PropertiesTableEditorView<B> extends AbstractDataTableEditorView<B>
|
|||||||
} else {
|
} else {
|
||||||
returnedValue = null;
|
returnedValue = null;
|
||||||
}
|
}
|
||||||
if (element instanceof INode) {
|
|
||||||
INode node = (INode) element;
|
|
||||||
if (node.getComponent().getName() != null && node.getComponent().getName().equals("tHL7Output")) {
|
|
||||||
IElementParameter rootParameter = element.getElementParameter("ROOT");
|
|
||||||
if (rootParameter != null) {
|
|
||||||
List<Map<String, String>> rootValue = (List<Map<String, String>>) rootParameter
|
|
||||||
.getValue();
|
|
||||||
if (rootValue != null) {
|
|
||||||
for (int i = 0; i < rootValue.size(); i++) {
|
|
||||||
Map<String, String> map = (Map<String, String>) rootValue.get(i);
|
|
||||||
String columnName = map.get("COLUMN");
|
|
||||||
String split[] = columnName.split(":");
|
|
||||||
if (split.length == 2 && !returnedValue.equals("<Empty>")) {
|
|
||||||
String newName = returnedValue + ":" + split[1];
|
|
||||||
map.put("COLUMN", newName);
|
|
||||||
} else if (split.length == 1 && !returnedValue.equals("<Empty>")) {
|
|
||||||
String newName = (String) returnedValue;
|
|
||||||
map.put("COLUMN", newName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returnedValue;
|
return returnedValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -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,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -29,6 +29,7 @@ import org.talend.core.model.process.EParameterFieldType;
|
|||||||
import org.talend.core.model.process.IComponentDocumentation;
|
import org.talend.core.model.process.IComponentDocumentation;
|
||||||
import org.talend.core.model.process.IElementParameter;
|
import org.talend.core.model.process.IElementParameter;
|
||||||
import org.talend.core.model.process.IExternalData;
|
import org.talend.core.model.process.IExternalData;
|
||||||
|
import org.talend.core.model.process.INode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOC Administrator class global comment. Detailled comment
|
* DOC Administrator class global comment. Detailled comment
|
||||||
@@ -63,6 +64,7 @@ public class HL7InputComponent extends AbstractExternalNode {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IExternalData getExternalData() {
|
public IExternalData getExternalData() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -102,26 +104,24 @@ public class HL7InputComponent extends AbstractExternalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void renameInputConnection(String oldName, String newName) {
|
public void renameInputConnection(String oldName, String newName) {
|
||||||
List<Map<String, String>> listRoot = (List<Map<String, String>>) this.getElementParameter(ROOT).getValue();
|
INode node = getOriginalNode();
|
||||||
boolean flagRoot = false;
|
if (oldName != null) {
|
||||||
String schemaId = oldName + ":";
|
IElementParameter elementParameter = this.getElementParameter("SCHEMAS");
|
||||||
|
if (elementParameter != null) {
|
||||||
|
Object listItemsValue = elementParameter.getValue();
|
||||||
|
if (listItemsValue instanceof List) {
|
||||||
|
for (Object obj : (List) listItemsValue) {
|
||||||
|
if (obj instanceof Map) {
|
||||||
|
Object row = ((Map) obj).get("PARENT_ROW");
|
||||||
|
if (oldName.equals(row)) {
|
||||||
|
((Map) obj).put("PARENT_ROW", newName);
|
||||||
|
}
|
||||||
|
|
||||||
for (Map<String, String> map : listRoot) {
|
|
||||||
String rowName = map.get(COLUMN);
|
|
||||||
if (rowName == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (rowName.equals(oldName)) {
|
|
||||||
map.put(COLUMN, newName);
|
|
||||||
flagRoot = true;
|
|
||||||
} else if (rowName.startsWith(schemaId)) {
|
|
||||||
rowName = newName + rowName.substring(rowName.indexOf(":"));
|
|
||||||
map.put(COLUMN, rowName);
|
|
||||||
flagRoot = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flagRoot) {
|
}
|
||||||
this.getElementParameter(ROOT).setValue(listRoot);
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public class HL7InputComponent extends AbstractExternalNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
@SuppressWarnings("unchecked")
|
||||||
public List<Map<String, String>> getTableList(String paraName) {
|
public List<Map<String, String>> getTableList(String paraName) {
|
||||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||||
List<IElementParameter> eps = (List<IElementParameter>) this.getElementParameters();
|
List<IElementParameter> eps = (List<IElementParameter>) this.getElementParameters();
|
||||||
@@ -159,14 +159,14 @@ public class HL7InputComponent extends AbstractExternalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean istFileInputHL7() {
|
public boolean istFileInputHL7() {
|
||||||
return getComponent().getName().equals("tFileInputHL7"); //$NON-NLS-1$ //$NON-NLS-2$
|
return getComponent().getName().equals("tFileInputHL7"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHL7Output() {
|
public boolean isHL7Output() {
|
||||||
return getComponent().getName().equals("tHL7Output");//$NON-NLS-1$
|
return getComponent().getName().equals("tHL7Output");//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
@SuppressWarnings("unchecked")
|
||||||
public boolean setTableElementParameter(List<Map<String, String>> epsl, String paraName) {
|
public boolean setTableElementParameter(List<Map<String, String>> epsl, String paraName) {
|
||||||
List<IElementParameter> eps = (List<IElementParameter>) this.getElementParameters();
|
List<IElementParameter> eps = (List<IElementParameter>) this.getElementParameters();
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
@@ -190,7 +190,7 @@ public class HL7InputComponent extends AbstractExternalNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setValueToParameter(String paraName, Object value) {
|
public void setValueToParameter(String paraName, Object value) {
|
||||||
IElementParameter parameter = this.getElementParameter(paraName); //$NON-NLS-N$
|
IElementParameter parameter = this.getElementParameter(paraName);
|
||||||
if (parameter != null && value != null) {
|
if (parameter != null && value != null) {
|
||||||
parameter.setValue(value);
|
parameter.setValue(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -12,10 +12,18 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
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.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.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;
|
||||||
import org.talend.designer.hl7.ui.data.Element;
|
import org.talend.designer.hl7.ui.data.Element;
|
||||||
@@ -93,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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,9 +109,11 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
*
|
*
|
||||||
* @param node
|
* @param node
|
||||||
*/
|
*/
|
||||||
private boolean createChildNode(HL7TreeNode node) {
|
private boolean createChildNode(final HL7TreeNode node) {
|
||||||
if (node.getColumn() != null) {
|
if (node.getColumn() != null) {
|
||||||
if (!MessageDialog.openConfirm(xmlViewer.getControl().getShell(), "Warning",
|
if (!MessageDialog.openConfirm(
|
||||||
|
xmlViewer.getControl().getShell(),
|
||||||
|
"Warning",
|
||||||
"Do you want to disconnect the existing linker and then add an sub element for the selected element"
|
"Do you want to disconnect the existing linker and then add an sub element for the selected element"
|
||||||
+ node.getLabel() + "\"?")) {
|
+ node.getLabel() + "\"?")) {
|
||||||
return false;
|
return false;
|
||||||
@@ -119,8 +123,23 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
String label = "";
|
String label = "";
|
||||||
final String nodeLabel = node.getLabel() + "-";
|
final String nodeLabel = node.getLabel() + "-";
|
||||||
while (!StringUtil.validateLabelForXML(label)) {
|
while (!StringUtil.validateLabelForXML(label)) {
|
||||||
|
// add validator
|
||||||
|
IInputValidator validator = new IInputValidator() {
|
||||||
|
|
||||||
|
public String isValid(String newText) {
|
||||||
|
if (newText != null) {
|
||||||
|
String text = newText.trim();
|
||||||
|
for (HL7TreeNode children : node.getChildren()) {
|
||||||
|
if (text.equals(children.getLabel())) {
|
||||||
|
return "The name already existed."; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
InputDialog dialog = new InputDialog(null, "Input element's label", "Input the new element's valid label", nodeLabel,
|
InputDialog dialog = new InputDialog(null, "Input element's label", "Input the new element's valid label", nodeLabel,
|
||||||
null) {
|
validator) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
@@ -129,13 +148,7 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void okPressed() {
|
protected void okPressed() {
|
||||||
String eleName = this.getValue();
|
|
||||||
// if (eleName.startsWith(nodeLabel)) {
|
|
||||||
super.okPressed();
|
super.okPressed();
|
||||||
// } else {
|
|
||||||
// setErrorMessage("Element's label must start with " + "\"" + nodeLabel + "\"");
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -149,10 +162,46 @@ public class CreateHL7ElementAction extends SelectionProviderAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
HL7TreeNode child = new Element(label);
|
HL7TreeNode child = new Element(label);
|
||||||
|
// if the root not have CurSchema
|
||||||
|
if (node.getRow() == null || node.getRow().equals("")) {
|
||||||
|
if (hl7ui != null && hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
||||||
|
if (label.length() == 3) {
|
||||||
|
child.setRow(label);
|
||||||
|
IMetadataTable table = null;
|
||||||
|
for (IMetadataTable curTable : hl7ui.gethl7Manager().getHl7Component().getMetadataList()) {
|
||||||
|
if (label.equals(curTable.getLabel())) {
|
||||||
|
table = curTable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (table == null) {
|
||||||
|
table = new MetadataTable();
|
||||||
|
table.setLabel(label);
|
||||||
|
table.setTableName(label);
|
||||||
|
hl7ui.gethl7Manager().getHl7Component().getMetadataList().add(table);
|
||||||
|
}
|
||||||
|
List<Map<String, String>> maps = (List<Map<String, String>>) hl7ui.gethl7Manager().getHl7Component()
|
||||||
|
.getElementParameter("SCHEMAS").getValue(); //$NON-NLS-1$
|
||||||
|
boolean found = false;
|
||||||
|
for (Map<String, String> map : maps) {
|
||||||
|
if (map.get("SCHEMA").equals(table.getTableName())) {
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
Map<String, String> hl7Schema = new HashMap<String, String>();
|
||||||
|
maps.add(hl7Schema);
|
||||||
|
hl7Schema.put("SCHEMA", table.getTableName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (label.length() == 3) {
|
||||||
|
child.setRow(label);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
child.setRow(node.getRow());
|
child.setRow(node.getRow());
|
||||||
|
}
|
||||||
node.addChild(child);
|
node.addChild(child);
|
||||||
this.xmlViewer.refresh();
|
this.xmlViewer.refresh();
|
||||||
this.xmlViewer.expandAll();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -18,22 +18,34 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.emf.common.util.EList;
|
import org.eclipse.emf.common.util.EList;
|
||||||
|
import org.eclipse.gef.commands.Command;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.swt.widgets.TreeItem;
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
import org.eclipse.ui.actions.SelectionProviderAction;
|
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||||
|
import org.talend.commons.exception.ExceptionHandler;
|
||||||
|
import org.talend.core.model.metadata.IHL7Constant;
|
||||||
|
import org.talend.core.model.metadata.IMetadataTable;
|
||||||
|
import org.talend.core.model.metadata.builder.ConvertionHelper;
|
||||||
|
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
|
||||||
import org.talend.core.model.metadata.builder.connection.HL7Connection;
|
import org.talend.core.model.metadata.builder.connection.HL7Connection;
|
||||||
import org.talend.core.model.metadata.builder.connection.HL7FileNode;
|
import org.talend.core.model.metadata.builder.connection.HL7FileNode;
|
||||||
|
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||||
|
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||||
|
import org.talend.core.model.process.IConnection;
|
||||||
|
import org.talend.core.model.process.IConnectionCategory;
|
||||||
|
import org.talend.core.model.utils.NodeUtil;
|
||||||
|
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||||
|
import org.talend.core.ui.metadata.command.RepositoryChangeMetadataForHL7Command;
|
||||||
import org.talend.designer.hl7.managers.HL7OutputManager;
|
import org.talend.designer.hl7.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;
|
||||||
|
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||||
|
|
||||||
import ca.uhn.hl7v2.model.Message;
|
import ca.uhn.hl7v2.model.Message;
|
||||||
|
|
||||||
@@ -48,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();
|
||||||
@@ -76,7 +86,7 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List treeNodeAdapt() {
|
private List treeNodeAdapt() {
|
||||||
List<HL7TreeNode> list = new ArrayList<HL7TreeNode>();
|
List<HL7TreeNode> treeData = new ArrayList<HL7TreeNode>();
|
||||||
FileDialog f = null;
|
FileDialog f = null;
|
||||||
if (hl7ui != null) {
|
if (hl7ui != null) {
|
||||||
f = new FileDialog(hl7ui.getHl7UIParent().getShell());
|
f = new FileDialog(hl7ui.getHl7UIParent().getShell());
|
||||||
@@ -85,7 +95,7 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
}
|
}
|
||||||
String file = f.open();
|
String file = f.open();
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
return list;
|
return treeData;
|
||||||
}
|
}
|
||||||
HL7Parse hl7Parse = new HL7Parse();
|
HL7Parse hl7Parse = new HL7Parse();
|
||||||
List<String> msgContentList = new ArrayList<String>();
|
List<String> msgContentList = new ArrayList<String>();
|
||||||
@@ -93,14 +103,6 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
List<Message> messageList = hl7Parse.doParse(file, "'\\u000b'", "'\\u001c'");
|
List<Message> messageList = hl7Parse.doParse(file, "'\\u000b'", "'\\u001c'");
|
||||||
List<HL7TreeNode> nodeList = hl7Util.getHL7TreeNodes(messageList);
|
List<HL7TreeNode> nodeList = hl7Util.getHL7TreeNodes(messageList);
|
||||||
|
|
||||||
List schemaList = new ArrayList();
|
|
||||||
|
|
||||||
for (Message message : messageList) {
|
|
||||||
schemaList.addAll(hl7Util.getFirstLevelChild(message));
|
|
||||||
}
|
|
||||||
// for (Object obj : schemaList) {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
if (!nodeList.isEmpty()) {
|
if (!nodeList.isEmpty()) {
|
||||||
HL7TreeNode hl7TreeNode = nodeList.get(0);
|
HL7TreeNode hl7TreeNode = nodeList.get(0);
|
||||||
List<HL7FileNode> table = new ArrayList<HL7FileNode>();
|
List<HL7FileNode> table = new ArrayList<HL7FileNode>();
|
||||||
@@ -108,64 +110,74 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// list.add(hl7TreeNode);
|
List<String> schemaList = new ArrayList<String>();
|
||||||
initXmlTreeData(schemaList, table, list);
|
for (HL7FileNode node : table) {
|
||||||
|
String columnName = node.getRelatedColumn();
|
||||||
|
if (columnName.contains(":")) {
|
||||||
|
columnName = columnName.substring(0, columnName.indexOf(":"));
|
||||||
|
}
|
||||||
|
if (!schemaList.contains(columnName) && !"".equals(columnName)) {
|
||||||
|
schemaList.add(columnName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
initXmlTreeData(schemaList, table, treeData);
|
||||||
|
}
|
||||||
|
return treeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// try {
|
private void initXmlTreeData(List<String> schemaList, List<HL7FileNode> root, List<HL7TreeNode> treeData) {
|
||||||
// ATreeNode treeNode = SchemaPopulationUtil.getSchemaTree(file, true, 0);
|
Map<String, HL7TreeNode> mapNodes = new HashMap<String, HL7TreeNode>();
|
||||||
// String schemaName = getSelectedSchema();
|
List<? extends IConnection> incomingConnections = new ArrayList<IConnection>();
|
||||||
// HL7TreeNode root = cloneATreeNode(treeNode, schemaName);
|
|
||||||
// root = ((Element) root).getElementChildren().get(0);
|
|
||||||
// root.setParent(null);
|
|
||||||
// list.add(root);
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// // e.printStackTrace();
|
|
||||||
// ExceptionHandler.process(e);
|
|
||||||
// }
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initXmlTreeData(List schemaList, List<HL7FileNode> root, List<HL7TreeNode> list) {
|
|
||||||
if (hl7ui != null) {
|
if (hl7ui != null) {
|
||||||
if (hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
if (hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
||||||
((HL7OutputManager) hl7ui.gethl7Manager()).getContents().clear();
|
((HL7OutputManager) hl7ui.gethl7Manager()).getContents().clear();
|
||||||
|
incomingConnections = NodeUtil.getIncomingConnections(hl7ui.gethl7Manager().getHl7Component(),
|
||||||
|
IConnectionCategory.FLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Object obj : schemaList) {
|
IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
|
||||||
List<HL7TreeNode> treeNodes = null;
|
List<MetadataTable> iMetadataTables = new ArrayList<MetadataTable>();
|
||||||
HL7TreeNode rootNode = null;
|
HL7TreeNode rootNode = null;
|
||||||
|
Map<String, IMetadataTable> schemaNameToInputTable = new HashMap<String, IMetadataTable>();
|
||||||
|
Map<String, MetadataTable> schemaNameToOutputTable = new HashMap<String, MetadataTable>();
|
||||||
|
for (String schemaName : schemaList) {
|
||||||
|
IMetadataTable metadataTable = null;
|
||||||
|
for (IConnection connection : incomingConnections) {
|
||||||
|
if (connection.getUniqueName().equals(schemaName)) {
|
||||||
|
metadataTable = connection.getMetadataTable();
|
||||||
|
metadataTable.setLabel(connection.getUniqueName());
|
||||||
|
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MetadataTable targetMetadataTable = ConnectionFactory.eINSTANCE.createMetadataTable();
|
||||||
|
targetMetadataTable.setId(factory.getNextId());
|
||||||
|
schemaNameToOutputTable.put(schemaName, targetMetadataTable);
|
||||||
|
targetMetadataTable.setLabel(schemaName);
|
||||||
|
iMetadataTables.add(targetMetadataTable);
|
||||||
|
}
|
||||||
|
|
||||||
HL7TreeNode current = null;
|
HL7TreeNode current = null;
|
||||||
HL7TreeNode temp = null;
|
HL7TreeNode temp = null;
|
||||||
HL7TreeNode mainNode = null;
|
|
||||||
String mainPath = null;
|
|
||||||
String currentPath = null;
|
String currentPath = null;
|
||||||
String defaultValue = null;
|
String defaultValue = null;
|
||||||
int nodeOrder = 0;
|
int nodeOrder = 0;
|
||||||
boolean haveOrder = true;
|
boolean haveOrder = true;
|
||||||
String schemaId = hl7Util.getLabel(obj, true) + ":";//((MetadataTable) obj).getLabel() + ":"; //$NON-NLS-1$
|
|
||||||
if (hl7ui != null) {
|
|
||||||
if (hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
|
||||||
treeNodes = ((HL7OutputManager) hl7ui.gethl7Manager()).getTreeData(hl7Util.getLabel(obj, true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (treeNodes == null) {
|
|
||||||
treeNodes = new ArrayList<HL7TreeNode>();
|
|
||||||
}
|
|
||||||
// build root tree
|
// build root tree
|
||||||
for (int i = 0; i < root.size(); i++) {
|
for (int i = 0; i < root.size(); i++) {
|
||||||
HL7FileNode node = (HL7FileNode) root.get(i);
|
HL7FileNode node = root.get(i);
|
||||||
String newPath = node.getFilePath();
|
String newPath = node.getFilePath();
|
||||||
defaultValue = node.getDefaultValue();
|
defaultValue = node.getDefaultValue();
|
||||||
String columnName = node.getRelatedColumn();
|
String columnName = node.getRelatedColumn();
|
||||||
@@ -177,92 +189,102 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
if (haveOrder) {
|
if (haveOrder) {
|
||||||
nodeOrder = node.getOrder();
|
nodeOrder = node.getOrder();
|
||||||
}
|
}
|
||||||
String flag = columnName + ":"; //$NON-NLS-1$
|
String rowName = columnName;
|
||||||
if (columnName != null && columnName.length() > 0 && !flag.startsWith(schemaId)) {
|
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;
|
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);
|
|
||||||
// temp.setDataType(type);
|
// temp.setDataType(type);
|
||||||
if (rootNode == null) {
|
if (rootNode == null) {
|
||||||
rootNode = temp;
|
rootNode = temp;
|
||||||
}
|
}
|
||||||
if (node.getAttribute().equals("main")) {
|
if (node.getAttribute().equals("main")) {
|
||||||
temp.setMain(true);
|
temp.setMain(true);
|
||||||
mainNode = temp;
|
|
||||||
mainPath = newPath;
|
|
||||||
}
|
}
|
||||||
current = temp;
|
current = temp;
|
||||||
currentPath = newPath;
|
currentPath = newPath;
|
||||||
}
|
|
||||||
if (haveOrder) {
|
if (haveOrder) {
|
||||||
temp.setOrder(nodeOrder);
|
temp.setOrder(nodeOrder);
|
||||||
}
|
}
|
||||||
// if (columnName != null && columnName.length() > 0) {
|
if (rowName != null && rowName.length() > 0) {
|
||||||
// temp.setColumn(getColumn(columnName));
|
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()) {
|
||||||
temp.setRow(hl7Util.getLabel(obj, true));
|
MetadataColumn newColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
|
||||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
newColumn.setLabel(columnName);
|
||||||
columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
newColumn.setName(temp.getLabel());
|
||||||
// IMetadataTable iTable = ConvertionHelper.convert((MetadataTable) obj);
|
newColumn.setLength(226);
|
||||||
// // temp.setColumn(iTable.getColumn(columnName));
|
newColumn.setTalendType("id_String");
|
||||||
// temp.setTable(iTable);
|
schemaNameToOutputTable.get(rowName).getColumns().add(newColumn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// build group tree
|
|
||||||
current = mainNode;
|
|
||||||
currentPath = mainPath;
|
|
||||||
boolean isFirst = true;
|
|
||||||
|
|
||||||
// build loop tree
|
|
||||||
current = mainNode;
|
|
||||||
currentPath = mainPath;
|
|
||||||
isFirst = true;
|
|
||||||
|
|
||||||
if (rootNode == null) {
|
if (rootNode == null) {
|
||||||
rootNode = new Element("rootTag");
|
rootNode = new Element("rootTag");
|
||||||
}
|
}
|
||||||
// rootNode.setParent(null);
|
|
||||||
if (haveOrder) {
|
if (haveOrder) {
|
||||||
orderNode(rootNode);
|
orderNode(rootNode);
|
||||||
}
|
}
|
||||||
list.add(rootNode);
|
if (rootNode != null) {
|
||||||
rootNode.setRow(hl7Util.getLabel(obj, true));
|
treeData.add(rootNode);
|
||||||
// contents.put(((MetadataTable) obj).getLabel(), rootNode);
|
}
|
||||||
treeNodes.clear();
|
|
||||||
treeNodes.add(rootNode);
|
|
||||||
if (hl7ui != null) {
|
if (hl7ui != null) {
|
||||||
if (hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
if (hl7ui.gethl7Manager() instanceof HL7OutputManager) {
|
||||||
((HL7OutputManager) hl7ui.gethl7Manager()).getContents().put(hl7Util.getLabel(obj, true), treeNodes);
|
((HL7OutputManager) hl7ui.gethl7Manager()).getContents().put(rootNode.getColumnLabel(), treeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (form != null) {
|
} else if (form != null) {
|
||||||
for (HL7TreeNode hl7Node : treeNodes) {
|
for (HL7TreeNode hl7Node : treeData) {
|
||||||
form.getContents().put(hl7Util.getLabel(obj, true), hl7Node);
|
form.getContents().put(rootNode.getColumnLabel(), hl7Node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hl7ui != null) {
|
||||||
|
// execute the commands,initialize the propertiesView .
|
||||||
|
List<Command> commands = new ArrayList<Command>();
|
||||||
|
for (MetadataTable tableTemp : iMetadataTables) {
|
||||||
|
Command hl7Cmd = new RepositoryChangeMetadataForHL7Command(hl7ui.gethl7Manager().getHl7Component(),
|
||||||
|
IHL7Constant.TABLE_SCHEMAS, tableTemp.getLabel(), ConvertionHelper.convert(tableTemp));
|
||||||
|
commands.add(hl7Cmd);
|
||||||
|
}
|
||||||
|
for (Command command : commands) {
|
||||||
|
command.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (haveOrder) {
|
|
||||||
// orderNode(rootNode);
|
|
||||||
// }
|
|
||||||
// treeData.add(rootNode);
|
|
||||||
// rootNode.setRow(metadataTable.getLabel());
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void orderNode(HL7TreeNode node) {
|
private void orderNode(HL7TreeNode node) {
|
||||||
@@ -316,40 +338,26 @@ public class ImportHL7StructureAction extends SelectionProviderAction {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HL7TreeNode addElement(HL7TreeNode current, String currentPath, String newPath, String defaultValue) {
|
protected HL7TreeNode addElement(HL7TreeNode current, String currentPath, String newPath, String defaultValue,
|
||||||
|
Map<String, HL7TreeNode> mapNodes) {
|
||||||
|
HL7TreeNode temp = mapNodes.get(newPath);
|
||||||
|
if (temp == null) {
|
||||||
|
// if node is not existing, create it.
|
||||||
String name = newPath.substring(newPath.lastIndexOf("/") + 1); //$NON-NLS-1$
|
String name = newPath.substring(newPath.lastIndexOf("/") + 1); //$NON-NLS-1$
|
||||||
String parentPath = newPath.substring(0, newPath.lastIndexOf("/")); //$NON-NLS-1$
|
temp = new Element(name, defaultValue);
|
||||||
HL7TreeNode temp = new Element(name, defaultValue);
|
|
||||||
|
|
||||||
if (current == null) {// root node
|
if (current == null) {// root node
|
||||||
|
mapNodes.put(newPath, temp);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
mapNodes.put(newPath, temp);
|
||||||
if (currentPath.equals(parentPath)) {
|
String parentPath = newPath.substring(0, newPath.lastIndexOf("/")); //$NON-NLS-1$
|
||||||
current.addChild(temp);
|
HL7TreeNode parentNode = mapNodes.get(parentPath);
|
||||||
|
if (parentNode != null) {
|
||||||
|
parentNode.addChild(temp);
|
||||||
} else {
|
} else {
|
||||||
String[] nods = currentPath.split("/"); //$NON-NLS-1$
|
ExceptionHandler.log("Error when parsing the HL7 data, parent not existing for:" + parentPath);
|
||||||
String[] newNods = parentPath.split("/"); //$NON-NLS-1$
|
|
||||||
int parentLevel = 0;
|
|
||||||
int checkLength = nods.length < newNods.length ? nods.length : newNods.length;
|
|
||||||
for (int i = 1; i < checkLength; i++) {
|
|
||||||
if (nods[i].equals(newNods[i])) {
|
|
||||||
parentLevel = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HL7TreeNode parent = current;
|
|
||||||
for (int i = 0; i < nods.length - (parentLevel + 1); i++) {
|
|
||||||
HL7TreeNode tmpParent = parent.getParent();
|
|
||||||
if (tmpParent == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
parent = tmpParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent != null)
|
|
||||||
parent.addChild(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// HL7Manager hl7Manager = hl7ui.gethl7Manager();
|
|
||||||
|
|
||||||
// HL7TreeNode rootTreeData = hl7Manager.getRootHL7TreeNode(node);
|
|
||||||
// TreeUtil.clearSubGroupNode(node);
|
|
||||||
// // make sure group element is a ancestor of loop, or no group element.
|
|
||||||
// if (TreeUtil.findUpGroupNode(node) == null) {
|
|
||||||
// TreeUtil.clearSubGroupNode(rootTreeData);
|
|
||||||
// }
|
|
||||||
// TreeUtil.clearLoopNode(rootTreeData);
|
|
||||||
// TreeUtil.clearMainNode(rootTreeData);
|
|
||||||
|
|
||||||
|
if (!node.isRepetable()) {
|
||||||
if (node.isGroup()) {
|
if (node.isGroup()) {
|
||||||
node.setGroup(false);
|
node.setGroup(false);
|
||||||
}
|
}
|
||||||
node.setRepetable(true);
|
node.setRepetable(true);
|
||||||
// if (this.value) {
|
node.setMain(true);
|
||||||
// if (hl7ui != null && node.isGroup()) {
|
|
||||||
// // hl7ui.updateStatus();
|
|
||||||
// }
|
|
||||||
// // TreeUtil.upsetMainNode(node);
|
|
||||||
// // xmlViewer.refresh();
|
|
||||||
// } else {
|
|
||||||
// // if (hl7ui != null) {
|
|
||||||
// // hl7ui.updateStatus();
|
|
||||||
// // }
|
|
||||||
// // upsetMainNode(node);
|
|
||||||
// // xmlViewer.refresh();
|
|
||||||
// }
|
|
||||||
upsetMainNode(node);
|
upsetMainNode(node);
|
||||||
xmlViewer.refresh();
|
} else {
|
||||||
if (form != null) {
|
node.setRepetable(false);
|
||||||
form.refreshLinks();
|
|
||||||
}
|
}
|
||||||
|
xmlViewer.refresh();
|
||||||
// this.hl7ui.updateStatus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void upsetMainNode(HL7TreeNode node) {
|
public void upsetMainNode(HL7TreeNode node) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -20,6 +20,7 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.talend.commons.exception.ExceptionHandler;
|
||||||
import org.talend.core.model.metadata.IMetadataColumn;
|
import org.talend.core.model.metadata.IMetadataColumn;
|
||||||
import org.talend.core.model.metadata.IMetadataTable;
|
import org.talend.core.model.metadata.IMetadataTable;
|
||||||
import org.talend.core.model.process.ElementParameterParser;
|
import org.talend.core.model.process.ElementParameterParser;
|
||||||
@@ -27,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
|
||||||
@@ -56,184 +55,61 @@ 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) {
|
||||||
if (rootTable != null && rootTable.size() > 0) {
|
schemaList.add(table.getLabel());
|
||||||
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)) {
|
|
||||||
columnList.add(columnName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (Map<String, String> map : maps) {
|
List<Map<String, String>> rootTable = hl7Component.getTableList(HL7InputComponent.ROOT);
|
||||||
// if (map.containsValue(rowName)) {
|
Map<String, IMetadataTable> schemaNameToInputTable = new HashMap<String, IMetadataTable>();
|
||||||
// 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 (!maps.isEmpty()) {
|
||||||
if (i == 0)// the first schema as current
|
|
||||||
currentSchema = metadataTableName;// metadataTable.getLabel();
|
|
||||||
|
|
||||||
HL7TreeNode rootNode = null;
|
|
||||||
HL7TreeNode current = null;
|
|
||||||
HL7TreeNode temp = null;
|
|
||||||
HL7TreeNode mainNode = null;
|
|
||||||
String mainPath = null;
|
|
||||||
String currentPath = null;
|
|
||||||
String defaultValue = null;
|
|
||||||
int nodeOrder = 0;
|
|
||||||
boolean haveOrder = true;
|
|
||||||
|
|
||||||
String schemaId = rowName + ":";
|
|
||||||
|
|
||||||
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);
|
|
||||||
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, ""); // $!=Nnull-1$
|
|
||||||
if (metadataTable != null) {
|
|
||||||
temp.setColumn(metadataTable.getColumn(columnName));
|
|
||||||
temp.setTable(metadataTable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rootNode == null) {
|
|
||||||
rootNode = new Element("rootTag"); //$NON-NLS-1$
|
|
||||||
// rootNode.setParent(root);
|
|
||||||
// root.addChild(rootNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (haveOrder) {
|
|
||||||
orderNode(rootNode);
|
|
||||||
}
|
|
||||||
treeData.add(rootNode);
|
|
||||||
rootNode.setRow(rowName);
|
|
||||||
contents.put(metadataTableName, treeData);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
initCurrentSchema();
|
|
||||||
|
|
||||||
} else if (rootTable != null && rootTable.size() <= 0) {
|
|
||||||
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) {
|
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");
|
String schemaName = map.get("SCHEMA");
|
||||||
int first = schemaName.indexOf("_");
|
int first = schemaName.indexOf("_");
|
||||||
int second = schemaName.lastIndexOf("_");
|
int second = schemaName.lastIndexOf("_");
|
||||||
if (first > 0 && first < second) {
|
if (first > 0 && first < second) {
|
||||||
schemaName = schemaName.substring(first + 1, second);
|
schemaName = schemaName.substring(first + 1, second);
|
||||||
}
|
}
|
||||||
if (!schemaList.contains(schemaName)) {
|
IMetadataTable metadataTable = null;
|
||||||
schemaList.add(schemaName);
|
for (IConnection connection : incomingConnections) {
|
||||||
rowName = schemaName;// map.get(rowName);
|
if (connection.getUniqueName().equals(map.get("PARENT_ROW"))) {
|
||||||
schemaMap.put(metadataTableName, rowName);
|
metadataTable = connection.getMetadataTable();
|
||||||
|
metadataTable.setLabel(connection.getUniqueName());
|
||||||
|
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (String schemaName : schemaList) {
|
||||||
|
IMetadataTable metadataTable = null;
|
||||||
|
for (IConnection connection : incomingConnections) {
|
||||||
|
if (connection.getUniqueName().equals(schemaName)) {
|
||||||
|
metadataTable = connection.getMetadataTable();
|
||||||
|
metadataTable.setLabel(connection.getUniqueName());
|
||||||
|
schemaNameToInputTable.put(schemaName, metadataTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Map<String, HL7TreeNode> mapNodes = new HashMap<String, HL7TreeNode>();
|
||||||
treeData = new ArrayList<HL7TreeNode>();
|
treeData = new ArrayList<HL7TreeNode>();
|
||||||
if (i == 0)// the first schema as current
|
|
||||||
currentSchema = metadataTableName;// metadataTable.getLabel();
|
|
||||||
HL7TreeNode rootNode = null;
|
HL7TreeNode rootNode = null;
|
||||||
HL7TreeNode current = null;
|
HL7TreeNode current = null;
|
||||||
HL7TreeNode temp = null;
|
HL7TreeNode temp = null;
|
||||||
HL7TreeNode mainNode = null;
|
|
||||||
String mainPath = null;
|
|
||||||
String currentPath = null;
|
String currentPath = null;
|
||||||
String defaultValue = null;
|
String defaultValue = null;
|
||||||
int nodeOrder = 0;
|
int nodeOrder = 0;
|
||||||
boolean haveOrder = true;
|
boolean haveOrder = true;
|
||||||
|
|
||||||
String schemaId = rowName + ":";//metadataTable.getLabel() + ":"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
// build root tree
|
// 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) {
|
for (Map<String, String> rootMap : rootTable) {
|
||||||
String newPath = rootMap.get(HL7InputComponent.PATH);
|
String newPath = rootMap.get(HL7InputComponent.PATH);
|
||||||
String columnName = rootMap.get(HL7InputComponent.COLUMN);
|
String columnName = rootMap.get(HL7InputComponent.COLUMN);
|
||||||
@@ -243,191 +119,75 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
if (orderValue == null || "".equals(orderValue)) {
|
if (orderValue == null || "".equals(orderValue)) {
|
||||||
haveOrder = false;
|
haveOrder = false;
|
||||||
}
|
}
|
||||||
if (haveOrder) {
|
String rowName = columnName;
|
||||||
nodeOrder = Integer.valueOf(rootMap.get(HL7InputComponent.ORDER)).intValue();
|
if (columnName != null && columnName.contains(":")) {
|
||||||
|
String[] names = columnName.split(":");
|
||||||
|
rowName = names[0];
|
||||||
|
columnName = names[1];
|
||||||
|
} else {
|
||||||
|
columnName = null;
|
||||||
}
|
}
|
||||||
String flag = columnName + ":"; //$NON-NLS-1$
|
temp = this.addElement(current, currentPath, newPath, defaultValue, mapNodes);
|
||||||
if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
if (temp == null) {
|
||||||
|
// should not happen
|
||||||
continue;
|
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);
|
|
||||||
if (rootNode == null) {
|
if (rootNode == null) {
|
||||||
rootNode = temp;
|
rootNode = temp;
|
||||||
}
|
}
|
||||||
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
if (rootMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
||||||
temp.setMain(true);
|
temp.setMain(true);
|
||||||
mainNode = temp;
|
|
||||||
mainPath = newPath;
|
|
||||||
}
|
}
|
||||||
current = temp;
|
current = temp;
|
||||||
currentPath = newPath;
|
currentPath = newPath;
|
||||||
}
|
|
||||||
if (haveOrder) {
|
if (haveOrder) {
|
||||||
temp.setOrder(nodeOrder);
|
temp.setOrder(nodeOrder);
|
||||||
}
|
}
|
||||||
temp.setRepetable(repeatable);
|
if (rowName != null && rowName.length() > 0) {
|
||||||
temp.setRow(rowName);
|
temp.setRow(rowName);
|
||||||
if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
}
|
||||||
columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
|
||||||
|
if (columnName != null) {
|
||||||
|
IMetadataTable metadataTable = schemaNameToInputTable.get(rowName);
|
||||||
|
// group node can not get the metadata table
|
||||||
|
if (metadataTable == null) {
|
||||||
|
IMetadataTable metadataTableTemp = null;
|
||||||
|
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.setColumn(metadataTable.getColumn(columnName));
|
||||||
temp.setTable(metadataTable);
|
temp.setTable(metadataTable);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (rootNode == null) {
|
if (rootNode == null) {
|
||||||
rootNode = new Element("rootTag"); //$NON-NLS-1$
|
rootNode = new Element("rootTag");
|
||||||
// rootNode.setParent(root);
|
|
||||||
// root.addChild(rootNode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (haveOrder) {
|
if (haveOrder) {
|
||||||
orderNode(rootNode);
|
orderNode(rootNode);
|
||||||
}
|
}
|
||||||
|
// the root node should not set the ColumnLabel
|
||||||
|
if (rootNode.getRow() != null) {
|
||||||
|
rootNode.setRow(null);
|
||||||
|
}
|
||||||
treeData.add(rootNode);
|
treeData.add(rootNode);
|
||||||
rootNode.setRow(rowName);
|
contents.put(rootNode.getColumnLabel(), treeData);
|
||||||
contents.put(metadataTableName, treeData);
|
initCurrentSchema();
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// // build group tree
|
|
||||||
// current = mainNode;
|
|
||||||
// currentPath = mainPath;
|
|
||||||
// boolean isFirst = true;
|
|
||||||
// List<Map<String, String>> groupTable = (List<Map<String, String>>)
|
|
||||||
// hl7Component.getTableList(HL7InputComponent.GROUP);
|
|
||||||
// if (groupTable != null) {
|
|
||||||
// for (Map<String, String> groupMap : groupTable) {
|
|
||||||
// String newPath = groupMap.get(HL7InputComponent.PATH);
|
|
||||||
// String columnName = groupMap.get(HL7InputComponent.COLUMN);
|
|
||||||
// defaultValue = groupMap.get(HL7InputComponent.VALUE);
|
|
||||||
// String orderValue = groupMap.get(HL7InputComponent.ORDER);
|
|
||||||
// if (orderValue == null || "".equals(orderValue)) {
|
|
||||||
// haveOrder = false;
|
|
||||||
// }
|
|
||||||
// if (haveOrder) {
|
|
||||||
// nodeOrder = Integer.valueOf(groupMap.get(HL7InputComponent.ORDER)).intValue();
|
|
||||||
// }
|
|
||||||
// String flag = columnName + ":"; //$NON-NLS-1$
|
|
||||||
// if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
|
||||||
// temp = new Attribute(newPath);
|
|
||||||
// temp.setDefaultValue(defaultValue);
|
|
||||||
// current.addChild(temp);
|
|
||||||
// } else if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
|
||||||
// temp = new NameSpaceNode(newPath);
|
|
||||||
// temp.setDefaultValue(defaultValue);
|
|
||||||
// current.addChild(temp);
|
|
||||||
// } else {
|
|
||||||
// temp = this.addElement(current, currentPath, newPath, defaultValue);
|
|
||||||
// if (groupMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
|
||||||
// temp.setMain(true);
|
|
||||||
// mainNode = temp;
|
|
||||||
// mainPath = newPath;
|
|
||||||
// }
|
|
||||||
// if (isFirst) {
|
|
||||||
// temp.setGroup(true);
|
|
||||||
// isFirst = false;
|
|
||||||
// }
|
|
||||||
// current = temp;
|
|
||||||
// currentPath = newPath;
|
|
||||||
// }
|
|
||||||
// if (haveOrder) {
|
|
||||||
// temp.setOrder(nodeOrder);
|
|
||||||
// }
|
|
||||||
// temp.setRow(rowName);
|
|
||||||
// if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
|
||||||
// columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
|
||||||
// temp.setColumn(metadataTable.getColumn(columnName));
|
|
||||||
// temp.setTable(metadataTable);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // build loop tree
|
|
||||||
// current = mainNode;
|
|
||||||
// currentPath = mainPath;
|
|
||||||
// isFirst = true;
|
|
||||||
// List<Map<String, String>> loopTable = (List<Map<String, String>>)
|
|
||||||
// hl7Component.getTableList(HL7InputComponent.LOOP);
|
|
||||||
// if (loopTable != null) {
|
|
||||||
// for (Map<String, String> loopMap : loopTable) {
|
|
||||||
// String newPath = loopMap.get(HL7InputComponent.PATH);
|
|
||||||
// String columnName = loopMap.get(HL7InputComponent.COLUMN);
|
|
||||||
// defaultValue = loopMap.get(HL7InputComponent.VALUE);
|
|
||||||
// String orderValue = loopMap.get(HL7InputComponent.ORDER);
|
|
||||||
// if (orderValue == null || "".equals(orderValue)) {
|
|
||||||
// haveOrder = false;
|
|
||||||
// }
|
|
||||||
// if (haveOrder) {
|
|
||||||
// nodeOrder = Integer.valueOf(loopMap.get(HL7InputComponent.ORDER)).intValue();
|
|
||||||
// }
|
|
||||||
// String flag = columnName + ":"; //$NON-NLS-1$
|
|
||||||
// if (columnName != null && columnName.length() > 0 && !flag.startsWith(rowName + ":")) { //$NON-NLS-1$
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("attri")) { //$NON-NLS-1$
|
|
||||||
// temp = new Attribute(newPath);
|
|
||||||
// temp.setDefaultValue(defaultValue);
|
|
||||||
// current.addChild(temp);
|
|
||||||
// } else if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("ns")) { //$NON-NLS-1$
|
|
||||||
// temp = new NameSpaceNode(newPath);
|
|
||||||
// temp.setDefaultValue(defaultValue);
|
|
||||||
// current.addChild(temp);
|
|
||||||
// } else {
|
|
||||||
// temp = this.addElement(current, currentPath, newPath, defaultValue);
|
|
||||||
// if (loopMap.get(HL7InputComponent.ATTRIBUTE).equals("main")) { //$NON-NLS-1$
|
|
||||||
// temp.setMain(true);
|
|
||||||
// }
|
|
||||||
// if (isFirst) {
|
|
||||||
// temp.setRepetable(true);
|
|
||||||
// isFirst = false;
|
|
||||||
// }
|
|
||||||
// current = temp;
|
|
||||||
// currentPath = newPath;
|
|
||||||
// }
|
|
||||||
// if (haveOrder) {
|
|
||||||
// temp.setOrder(nodeOrder);
|
|
||||||
// }
|
|
||||||
// temp.setRow(rowName);
|
|
||||||
// if (columnName != null && columnName.length() > 0 && columnName.startsWith(schemaId)) {
|
|
||||||
// columnName = columnName.replace(schemaId, ""); //$NON-NLS-1$
|
|
||||||
// temp.setColumn(metadataTable.getColumn(columnName));
|
|
||||||
// temp.setTable(metadataTable);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (rootNode == null) {
|
|
||||||
// rootNode = new Element("rootTag"); //$NON-NLS-1$
|
|
||||||
// // rootNode.setParent(root);
|
|
||||||
// // root.addChild(rootNode);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (haveOrder) {
|
|
||||||
// orderNode(rootNode);
|
|
||||||
// }
|
|
||||||
// treeData.add(rootNode);
|
|
||||||
// rootNode.setRow(rowName);
|
|
||||||
// contents.put(metadataTableName, treeData);
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// this.setTreeRoot(root);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public List<Map<String, String>> getRootTable() {
|
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>>();
|
||||||
@@ -519,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);
|
||||||
@@ -529,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);
|
||||||
@@ -608,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) {
|
||||||
@@ -694,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);
|
||||||
@@ -717,44 +479,26 @@ public class HL7OutputManager extends HL7Manager {
|
|||||||
return this.currentSchema;
|
return this.currentSchema;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HL7TreeNode addElement(HL7TreeNode current, String currentPath, String newPath, String defaultValue) {
|
protected HL7TreeNode addElement(HL7TreeNode current, String currentPath, String newPath, String defaultValue,
|
||||||
|
Map<String, HL7TreeNode> mapNodes) {
|
||||||
|
HL7TreeNode temp = mapNodes.get(newPath);
|
||||||
|
if (temp == null) {
|
||||||
|
// if node is not existing, create it.
|
||||||
String name = newPath.substring(newPath.lastIndexOf("/") + 1); //$NON-NLS-1$
|
String name = newPath.substring(newPath.lastIndexOf("/") + 1); //$NON-NLS-1$
|
||||||
String parentPath = "";
|
temp = new Element(name, defaultValue);
|
||||||
if (newPath.contains("/")) {
|
|
||||||
parentPath = newPath.substring(0, newPath.lastIndexOf("/")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
// String parentPath = newPath.substring(0, newPath.lastIndexOf("/")); //$NON-NLS-1$
|
|
||||||
HL7TreeNode temp = new Element(name, defaultValue);
|
|
||||||
|
|
||||||
if (current == null) {// root node
|
if (current == null) {// root node
|
||||||
|
mapNodes.put(newPath, temp);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
mapNodes.put(newPath, temp);
|
||||||
if (currentPath.equals(parentPath)) {
|
String parentPath = newPath.substring(0, newPath.lastIndexOf("/")); //$NON-NLS-1$
|
||||||
current.addChild(temp);
|
HL7TreeNode parentNode = mapNodes.get(parentPath);
|
||||||
|
if (parentNode != null) {
|
||||||
|
parentNode.addChild(temp);
|
||||||
} else {
|
} else {
|
||||||
String[] nods = currentPath.split("/"); //$NON-NLS-1$
|
ExceptionHandler.log("Error when parsing the HL7 data, parent not existing for:" + parentPath);
|
||||||
String[] newNods = parentPath.split("/"); //$NON-NLS-1$
|
|
||||||
int parentLevel = 0;
|
|
||||||
int checkLength = nods.length < newNods.length ? nods.length : newNods.length;
|
|
||||||
for (int i = 1; i < checkLength; i++) {
|
|
||||||
if (nods[i].equals(newNods[i])) {
|
|
||||||
parentLevel = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HL7TreeNode parent = current;
|
|
||||||
for (int i = 0; i < nods.length - (parentLevel + 1); i++) {
|
|
||||||
HL7TreeNode tmpParent = parent.getParent();
|
|
||||||
if (tmpParent == null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
parent = tmpParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parent != null)
|
|
||||||
parent.addChild(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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) {
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ package org.talend.designer.hl7.model;
|
|||||||
import org.talend.core.model.utils.TalendTextUtils;
|
import org.talend.core.model.utils.TalendTextUtils;
|
||||||
|
|
||||||
import ca.uhn.hl7v2.model.Primitive;
|
import ca.uhn.hl7v2.model.Primitive;
|
||||||
|
import ca.uhn.hl7v2.model.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DOC gcui class global comment. Detailled comment
|
||||||
|
*/
|
||||||
public class PrimitiveModel extends AbstractStructureModel {
|
public class PrimitiveModel extends AbstractStructureModel {
|
||||||
|
|
||||||
private int componentindex;
|
private int componentindex;
|
||||||
@@ -37,18 +41,24 @@ public class PrimitiveModel extends AbstractStructureModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generateDisplayName() {
|
protected void generateDisplayName() {
|
||||||
String parentName = "";
|
String parentName = ""; //$NON-NLS-1$
|
||||||
if (parent instanceof TypeModel) {
|
if (parent instanceof TypeModel) {
|
||||||
TypeModel tm = (TypeModel) parent;
|
TypeModel tm = (TypeModel) parent;
|
||||||
String extensionName = tm.getType().getName();
|
Type type = tm.getType();
|
||||||
String parentDisplayName = tm.getDisplayName();
|
String parentDisplayName = tm.getDisplayName();
|
||||||
|
parentName = parentDisplayName;
|
||||||
|
if (type != null) {
|
||||||
|
String extensionName = type.getName();
|
||||||
// int extensionIndex = parentDisplayName.indexOf(extensionName);
|
// int extensionIndex = parentDisplayName.indexOf(extensionName);
|
||||||
int extensionIndex = parentDisplayName.lastIndexOf(extensionName);// changed for bug TDI-19467
|
int extensionIndex = parentDisplayName.lastIndexOf(extensionName);// changed for bug TDI-19467
|
||||||
parentName = parentDisplayName.substring(0, extensionIndex - 1);
|
parentName = parentDisplayName.substring(0, extensionIndex - 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
String typeDispaly = primitive == null ? "" : TalendTextUtils.LBRACKET + this.primitive.getName()
|
||||||
|
+ TalendTextUtils.RBRACKET;
|
||||||
|
|
||||||
|
this.displayName = parentName + "-" + this.componentindex + "-" + this.subcomponentindex + typeDispaly; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
this.displayName = parentName + "-" + this.componentindex + "-" + this.subcomponentindex + TalendTextUtils.LBRACKET
|
|
||||||
+ this.primitive.getName() + TalendTextUtils.RBRACKET;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -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;
|
||||||
@@ -38,6 +40,7 @@ public class SegmentModel extends AbstractStructureModel {
|
|||||||
generateDataTypes();
|
generateDataTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void generateDisplayName() {
|
protected void generateDisplayName() {
|
||||||
this.displayName = seg.getName();
|
this.displayName = seg.getName();
|
||||||
}
|
}
|
||||||
@@ -45,13 +48,64 @@ 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>();
|
||||||
for (int i = 1; i < number; i++) {
|
Method method = null;
|
||||||
try {
|
try {
|
||||||
|
for (Method curMethod : seg.getClass().getDeclaredMethods()) {
|
||||||
|
if (curMethod.getName().equals("createNewTypeWithoutReflection")) {
|
||||||
|
method = curMethod;
|
||||||
|
method.setAccessible(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (method != null) {
|
||||||
|
// only access we have to get all the types is reflection (protected method).
|
||||||
|
// so add test of null in case this method doesn't exist, even if it should be in every subclass.
|
||||||
|
for (int i = 0; i < number; i++) {
|
||||||
|
|
||||||
|
Type type = (Type) method.invoke(seg, i);
|
||||||
|
TypeModel tm = new TypeModel(type, seg, 0, i + 1);
|
||||||
|
datatypes.add(tm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (method == null) {
|
||||||
|
// use old code in case the reflection didn't work.
|
||||||
|
// but it means it won't get optional fields.
|
||||||
|
try {
|
||||||
|
int lastNotEmptyFiledIndex = 0;
|
||||||
|
for (int i = 1; i < number; i++) {
|
||||||
Type[] reps = seg.getField(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++) {
|
for (int j = 0; j < reps.length; j++) {
|
||||||
TypeModel tm = new TypeModel(reps[j], seg, j, i);
|
TypeModel tm = new TypeModel(reps[j], seg, j, i);
|
||||||
datatypes.add(tm);
|
datatypes.add(tm);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// for empty column
|
||||||
|
TypeModel tm = new TypeModel(null, seg, 0, i);
|
||||||
|
datatypes.add(tm);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} catch (HL7Exception e) {
|
} catch (HL7Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -55,26 +55,30 @@ public class TypeModel extends AbstractStructureModel {
|
|||||||
generatePrimitive();
|
generatePrimitive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void generateDisplayName() {
|
protected void generateDisplayName() {
|
||||||
|
String typeDisplay = type == null ? "" : TalendTextUtils.LBRACKET + this.type.getName() + TalendTextUtils.RBRACKET;
|
||||||
|
this.displayName = getParent().getName() + "-" + index + "(1)" + typeDisplay; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
this.displayName = getParent().getName() + "-" + index + "(" + (++rep) + ")" + TalendTextUtils.LBRACKET + type.getName() //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
||||||
+ TalendTextUtils.RBRACKET;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generatePrimitive() {
|
private void generatePrimitive() {
|
||||||
|
if (type != null) {
|
||||||
List<PrimitiveModel> pms = new ArrayList<PrimitiveModel>();
|
List<PrimitiveModel> pms = new ArrayList<PrimitiveModel>();
|
||||||
int numComp = Terser.numComponents(this.type);
|
int numComp = Terser.numComponents(this.type);
|
||||||
for (int k = 1; k <= numComp; k++) {
|
for (int k = 1; k <= numComp; k++) {
|
||||||
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]);
|
||||||
|
} else {
|
||||||
|
PrimitiveModel pm = new PrimitiveModel(this, null, 1, 1);
|
||||||
|
primitives = new PrimitiveModel[] { pm };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Primitive getPrimitive(Type type, int component, int subcomponent) {
|
public Primitive getPrimitive(Type type, int component, int subcomponent) {
|
||||||
@@ -101,8 +105,9 @@ public class TypeModel extends AbstractStructureModel {
|
|||||||
Varies v = (Varies) type;
|
Varies v = (Varies) type;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (comp > 1 && GenericPrimitive.class.isAssignableFrom(v.getData().getClass()))
|
if (comp > 1 && GenericPrimitive.class.isAssignableFrom(v.getData().getClass())) {
|
||||||
v.setData(new GenericComposite(v.getMessage()));
|
v.setData(new GenericComposite(v.getMessage()));
|
||||||
|
}
|
||||||
} catch (DataTypeException de) {
|
} catch (DataTypeException de) {
|
||||||
String message = "Unexpected exception copying data to generic composite: " + de.getMessage();
|
String message = "Unexpected exception copying data to generic composite: " + de.getMessage();
|
||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -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;
|
||||||
@@ -64,7 +63,6 @@ import org.talend.designer.hl7.action.SetRepetableAction;
|
|||||||
import org.talend.designer.hl7.action.StringUtil;
|
import org.talend.designer.hl7.action.StringUtil;
|
||||||
import org.talend.designer.hl7.managers.HL7Manager;
|
import org.talend.designer.hl7.managers.HL7Manager;
|
||||||
import org.talend.designer.hl7.managers.HL7OutputManager;
|
import org.talend.designer.hl7.managers.HL7OutputManager;
|
||||||
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.data.NameSpaceNode;
|
||||||
import org.talend.designer.hl7.ui.edit.HL7OutputTableViewerProvider;
|
import org.talend.designer.hl7.ui.edit.HL7OutputTableViewerProvider;
|
||||||
@@ -102,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;
|
||||||
@@ -137,6 +133,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
/**
|
/**
|
||||||
* bqian Comment method "init".
|
* bqian Comment method "init".
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
createContent(hl7UIParent);
|
createContent(hl7UIParent);
|
||||||
}
|
}
|
||||||
@@ -175,17 +172,10 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
linker.setManager(hl7Manager);
|
linker.setManager(hl7Manager);
|
||||||
initSchemaTable();
|
initSchemaTable();
|
||||||
new FooterComposite(mainComposite, SWT.NONE, hl7Manager);
|
new FooterComposite(mainComposite, SWT.NONE, hl7Manager);
|
||||||
Tree xmlTree = xmlViewer.getTree();
|
|
||||||
|
|
||||||
if (xmlTree.getItems().length > 0) {
|
|
||||||
TreeItem root = xmlTree.getItem(0);
|
|
||||||
TableItem[] tableItems = schemaViewer.getTable().getItems();
|
|
||||||
redrawLinkers();
|
redrawLinkers();
|
||||||
// initLinker(root, tableItems);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void createCombo(Composite mainComposite) {
|
protected void createCombo(Composite mainComposite) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -199,62 +189,35 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
|
|
||||||
if (column != null) {
|
if (column != null) {
|
||||||
if (this.gethl7Manager().getHl7Component().isHL7Output() && treeNode.getChildren().size() <= 0) {
|
if (this.gethl7Manager().getHl7Component().isHL7Output() && treeNode.getChildren().size() <= 0) {
|
||||||
for (int i = 0; i < tableItems.length; i++) {
|
for (TableItem tableItem : tableItems) {
|
||||||
IMetadataColumn mColumn = (IMetadataColumn) tableItems[i].getData();
|
IMetadataColumn mColumn = (IMetadataColumn) tableItem.getData();
|
||||||
if (mColumn.getLabel().equals(column.getLabel())) {
|
if (mColumn.getLabel().equals(column.getLabel())) {
|
||||||
linker.addLoopLink(tableItems[i], tableItems[i].getData(), xmlViewer.getTree(), treeNode, true);
|
linker.addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), treeNode, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < tableItems.length; i++) {
|
for (TableItem tableItem : tableItems) {
|
||||||
IMetadataColumn mColumn = (IMetadataColumn) tableItems[i].getData();
|
IMetadataColumn mColumn = (IMetadataColumn) tableItem.getData();
|
||||||
if (mColumn.getLabel().equals(column.getLabel())) {
|
if (mColumn.getLabel().equals(column.getLabel())) {
|
||||||
linker.addLoopLink(tableItems[i], tableItems[i].getData(), xmlViewer.getTree(), treeNode, true);
|
linker.addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), treeNode, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TreeItem[] children = node.getItems();
|
TreeItem[] children = node.getItems();
|
||||||
for (int i = 0; i < children.length; i++) {
|
for (TreeItem element : children) {
|
||||||
initLinker(children[i], tableItems);
|
initLinker(element, tableItems);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void redrawLinkers() {
|
public void redrawLinkers() {
|
||||||
linker.removeAllLinks();
|
linker.removeAllLinks();
|
||||||
if (xmlViewer.getTree().getItems().length <= 0) {
|
if (xmlViewer.getTree().getItems().length <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TreeItem root = xmlViewer.getTree().getItem(0);
|
linker.createLinks();
|
||||||
if (this.gethl7Manager().getHl7Component().isHL7Output()) {
|
|
||||||
if (this.hl7Manager != null) {
|
|
||||||
List<HL7TreeNode> treeData = this.hl7Manager.getTreeData(this.hl7Manager.getCurrentSchema(false));
|
|
||||||
if (treeData != null && treeData.size() > 0) {
|
|
||||||
HL7TreeNode rootTreeData = treeData.get(0);
|
|
||||||
if (rootTreeData != null) {
|
|
||||||
for (TreeItem item : xmlViewer.getTree().getItems()) {
|
|
||||||
if (rootTreeData == item.getData()) {
|
|
||||||
root = item;
|
|
||||||
break;
|
|
||||||
} else if (item.getData() instanceof Element) {
|
|
||||||
if (((Element) item.getData()).getRow().equals(rootTreeData.getRow())) {
|
|
||||||
root = item;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TableItem[] tableItems = schemaViewer.getTable().getItems();
|
|
||||||
initLinker(root, tableItems);
|
|
||||||
if (linker.linkSize() == 0) {
|
|
||||||
linker.updateLinksStyleAndControlsSelection(xmlViewer.getTree(), true);
|
|
||||||
}
|
|
||||||
xmlViewer.refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshXMLViewer(HL7TreeNode targetNode) {
|
public void refreshXMLViewer(HL7TreeNode targetNode) {
|
||||||
@@ -436,8 +399,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();
|
||||||
@@ -464,7 +425,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");
|
||||||
@@ -505,6 +465,7 @@ public class HL7OutputUI extends HL7UI {
|
|||||||
return this.hl7UIParent;
|
return this.hl7UIParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public HL7Manager gethl7Manager() {
|
public HL7Manager gethl7Manager() {
|
||||||
return this.hl7Manager;
|
return this.hl7Manager;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -215,12 +215,15 @@ public class SchemaXMLDragAndDropHandler {
|
|||||||
Item targetItem = (Item) event.item;
|
Item targetItem = (Item) event.item;
|
||||||
if (targetItem != null) {
|
if (targetItem != null) {
|
||||||
Object data = targetItem.getData();
|
Object data = targetItem.getData();
|
||||||
if (data instanceof HL7TreeNode) {
|
if (data != null && data instanceof HL7TreeNode) {
|
||||||
HL7TreeNode rootElement = getRootElement((HL7TreeNode) data);
|
HL7TreeNode treeNode = ((HL7TreeNode) data);
|
||||||
|
if (treeNode.getParent() == null) {
|
||||||
if (rootElement != null) {// && !(rootElement instanceof HL7Root)
|
MessageDialog.openConfirm(event.display.getActiveShell(), "Warning", "\"" + treeNode.getLabel()
|
||||||
return currentSchema.equals(rootElement.getRow());
|
+ "\" " + "is root, can not have linker,you should create sub-elements or attributes.");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
String columnLabel = treeNode.getRow();
|
||||||
|
return columnLabel != null ? columnLabel.startsWith(currentSchema) : false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,7 +235,7 @@ public class SchemaXMLDragAndDropHandler {
|
|||||||
// System.out.println("\n>>drop");
|
// System.out.println("\n>>drop");
|
||||||
DropTarget dropTarget = (DropTarget) event.getSource();
|
DropTarget dropTarget = (DropTarget) event.getSource();
|
||||||
Item targetItem = (Item) event.item;
|
Item targetItem = (Item) event.item;
|
||||||
if (targetItem == null || !isEnabled(event)) {
|
if (targetItem == null) {
|
||||||
event.detail = DND.DROP_NONE;
|
event.detail = DND.DROP_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -279,7 +282,7 @@ public class SchemaXMLDragAndDropHandler {
|
|||||||
// System.out.println("\n>>drop");
|
// System.out.println("\n>>drop");
|
||||||
DropTarget dropTarget = (DropTarget) event.getSource();
|
DropTarget dropTarget = (DropTarget) event.getSource();
|
||||||
Item targetItem = (Item) event.item;
|
Item targetItem = (Item) event.item;
|
||||||
if (targetItem == null) {
|
if (targetItem == null || !isEnabled(event)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,8 +469,9 @@ public class SchemaXMLDragAndDropHandler {
|
|||||||
|
|
||||||
// reset all the treeNode add row to relative column
|
// reset all the treeNode add row to relative column
|
||||||
private void setTreeNodeRow(HL7TreeNode root, String row) {
|
private void setTreeNodeRow(HL7TreeNode root, String row) {
|
||||||
if (root == null)
|
if (root == null) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
root.setRow(row);
|
root.setRow(row);
|
||||||
if (root instanceof Element) {
|
if (root instanceof Element) {
|
||||||
Element element = (Element) root;
|
Element element = (Element) root;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -167,29 +167,24 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
public void run(IProgressMonitor monitor) {
|
public void run(IProgressMonitor monitor) {
|
||||||
|
|
||||||
TreeItem root = xmlViewer.getTree().getItem(0);
|
TreeItem root = xmlViewer.getTree().getItem(0);
|
||||||
|
//
|
||||||
|
List<HL7TreeNode> mappableNodes = new ArrayList<HL7TreeNode>();
|
||||||
if (getManager().getHl7Component().isHL7Output()) {
|
if (getManager().getHl7Component().isHL7Output()) {
|
||||||
if (getManager() instanceof HL7OutputManager) {
|
if (getManager() instanceof HL7OutputManager) {
|
||||||
List<HL7TreeNode> treeData = ((HL7OutputManager) getManager())
|
mappableNodes = ((HL7OutputManager) getManager()).getTreeData(""); //$NON-NLS-1$
|
||||||
.getTreeData(((HL7OutputManager) getManager()).getCurrentSchema(false));
|
createLoopLinks(mappableNodes);
|
||||||
if (treeData != null && treeData.size() > 0) {
|
xmlViewer.refresh();
|
||||||
HL7TreeNode rootTreeData = treeData.get(0);
|
getBackgroundRefresher().refreshBackground();
|
||||||
for (TreeItem item : xmlViewer.getTree().getItems()) {
|
|
||||||
if (rootTreeData == item.getData()) {
|
|
||||||
root = item;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} else {
|
||||||
List<TreeItem> allItems = TreeUtils.collectAllItems(root);
|
List<TreeItem> allItems = TreeUtils.collectAllItems(root);
|
||||||
monitorWrap = new EventLoopProgressMonitor(monitor);
|
monitorWrap = new EventLoopProgressMonitor(monitor);
|
||||||
|
|
||||||
String taskName = Messages.getString("XmlToXPathLinker.Loop"); //$NON-NLS-1$
|
String taskName = Messages.getString("XmlToXPathLinker.Loop"); //$NON-NLS-1$
|
||||||
int totalWork = allItems.size();
|
int totalWork = allItems.size();
|
||||||
|
|
||||||
monitorWrap.beginTask(taskName, totalWork); //$NON-NLS-1$
|
monitorWrap.beginTask(taskName, totalWork);
|
||||||
|
|
||||||
for (int i = 0; i < totalWork; i++) {
|
for (int i = 0; i < totalWork; i++) {
|
||||||
|
|
||||||
@@ -199,7 +194,7 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
|
|
||||||
TreeItem treeItem = allItems.get(i);
|
TreeItem treeItem = allItems.get(i);
|
||||||
HL7TreeNode node = (HL7TreeNode) treeItem.getData();
|
HL7TreeNode node = (HL7TreeNode) treeItem.getData();
|
||||||
if (node.getColumn() == null) { //$NON-NLS-1$
|
if (node.getColumn() == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// add now parameter for bug 9279
|
// add now parameter for bug 9279
|
||||||
@@ -210,6 +205,7 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
|
|
||||||
monitorWrap.done();
|
monitorWrap.done();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -320,11 +316,36 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
|
|
||||||
TableItem treeItemFromAbsoluteXPath = getItem(xPathExpression);
|
TableItem treeItemFromAbsoluteXPath = getItem(xPathExpression);
|
||||||
if (treeItemFromAbsoluteXPath != null) {
|
if (treeItemFromAbsoluteXPath != null) {
|
||||||
addLoopLink(treeItemFromAbsoluteXPath, (Object) treeItemFromAbsoluteXPath.getData(), tableItemTarget.getParent(),
|
addLoopLink(treeItemFromAbsoluteXPath, treeItemFromAbsoluteXPath.getData(), tableItemTarget.getParent(),
|
||||||
(HL7TreeNode) tableItemTarget.getData(), lastOne);
|
(HL7TreeNode) tableItemTarget.getData(), lastOne);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createLoopLinks(List<HL7TreeNode> treeData) {
|
||||||
|
for (HL7TreeNode treeNode : treeData) {
|
||||||
|
if (treeNode.getColumn() != null) {
|
||||||
|
TableItem tableItem = null;
|
||||||
|
for (TableItem curTableItem : getSource().getItems()) {
|
||||||
|
if (curTableItem.getText().equals(treeNode.getColumn().getLabel())) {
|
||||||
|
tableItem = curTableItem;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tableItem == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String path = tableItem.getText();
|
||||||
|
if (path != null) {
|
||||||
|
TreeItem treeItem = getTreeItem(treeNode);
|
||||||
|
if (treeItem != null) {
|
||||||
|
addLoopLink(tableItem, tableItem.getData(), xmlViewer.getTree(), (HL7TreeNode) treeItem.getData(), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createLoopLinks(treeNode.getChildren());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private TableItem getItem(String path) {
|
private TableItem getItem(String path) {
|
||||||
this.getSource().getItems();
|
this.getSource().getItems();
|
||||||
for (int i = 0; i < this.getSource().getItems().length; i++) {
|
for (int i = 0; i < this.getSource().getItems().length; i++) {
|
||||||
@@ -346,7 +367,7 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
return this.xmlViewer;
|
return this.xmlViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
@SuppressWarnings("unchecked")
|
||||||
public void updateLinksStyleAndControlsSelection(Control currentControl, boolean lastOne) {
|
public void updateLinksStyleAndControlsSelection(Control currentControl, boolean lastOne) {
|
||||||
// super.updateLinksStyleAndControlsSelection(currentControl);
|
// super.updateLinksStyleAndControlsSelection(currentControl);
|
||||||
boolean isTarget = false;
|
boolean isTarget = false;
|
||||||
@@ -363,14 +384,12 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
getTarget().deselectAll();
|
getTarget().deselectAll();
|
||||||
|
|
||||||
TreeItem[] selection = getTarget().getSelection();
|
TreeItem[] selection = getTarget().getSelection();
|
||||||
for (int i = 0; i < selection.length; i++) {
|
for (TreeItem tableItem : selection) {
|
||||||
TreeItem tableItem = selection[i];
|
|
||||||
selectedItems.add(tableItem.getData());
|
selectedItems.add(tableItem.getData());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
TableItem[] selection = getSource().getSelection();
|
TableItem[] selection = getSource().getSelection();
|
||||||
for (int i = 0; i < selection.length; i++) {
|
for (TableItem treeItem : selection) {
|
||||||
TableItem treeItem = selection[i];
|
|
||||||
selectedItems.add(treeItem.getData());
|
selectedItems.add(treeItem.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -398,7 +417,7 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
styleLink = getSelectedStyleLink();
|
styleLink = getSelectedStyleLink();
|
||||||
if (isTarget) {
|
if (isTarget) {
|
||||||
|
|
||||||
itemsToSelect.put((TableItem) otherExtremity.getGraphicalObject(), null);
|
itemsToSelect.put(otherExtremity.getGraphicalObject(), null);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -430,7 +449,7 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
for (Table table : set) {
|
for (Table table : set) {
|
||||||
ArrayList<TableItem> tableItemsToSelect = (ArrayList<TableItem>) itemsToSelect.get(table);
|
ArrayList<TableItem> tableItemsToSelect = (ArrayList<TableItem>) itemsToSelect.get(table);
|
||||||
table.deselectAll();
|
table.deselectAll();
|
||||||
TableItem[] tableItems = (TableItem[]) tableItemsToSelect.toArray(new TableItem[0]);
|
TableItem[] tableItems = tableItemsToSelect.toArray(new TableItem[0]);
|
||||||
table.setSelection(tableItems);
|
table.setSelection(tableItems);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -532,4 +551,58 @@ public class SchemaXMLLinker extends TableToTreeLinker<Object, Object> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean containsTreeNode(HL7TreeNode currentNode, HL7TreeNode leafNode) {
|
||||||
|
HL7TreeNode parentOfLeafNode = leafNode.getParent();
|
||||||
|
if (parentOfLeafNode != null) {
|
||||||
|
if (parentOfLeafNode.equals(currentNode)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return containsTreeNode(currentNode, parentOfLeafNode);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeItem getTreeItem(TreeItem[] items, HL7TreeNode treeNode, boolean expandedOnly) {
|
||||||
|
TreeItem item = null;
|
||||||
|
for (TreeItem curItem : items) {
|
||||||
|
// call getText method since we are in a lazy tree.
|
||||||
|
// it will force to load this item in the GUI (since it should be displayed in all cases)
|
||||||
|
// without this, the data will be null, and we can't retrieve anything
|
||||||
|
curItem.getText();
|
||||||
|
if (curItem.getData() != null) {
|
||||||
|
if (curItem.getData().equals(treeNode)) {
|
||||||
|
return curItem;
|
||||||
|
}
|
||||||
|
// will check if one of the parent of the treeNode is this one.
|
||||||
|
if (containsTreeNode((HL7TreeNode) curItem.getData(), treeNode)) {
|
||||||
|
if (!expandedOnly || curItem.getExpanded()) {
|
||||||
|
return getTreeItem(curItem.getItems(), treeNode, expandedOnly);
|
||||||
|
} else {
|
||||||
|
return curItem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeItem getTreeItem(HL7TreeNode hl7TreeNode) {
|
||||||
|
TreeItem[] items = xmlViewer.getTree().getItems();
|
||||||
|
return getTreeItem(items, hl7TreeNode, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeItem getFirstVisibleTreeItemOfPath(HL7TreeNode hl7TreeNode) {
|
||||||
|
TreeItem[] items = xmlViewer.getTree().getItems();
|
||||||
|
return getTreeItem(items, hl7TreeNode, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.talend.commons.ui.swt.linking.TableToTreeLinker#getFirstVisibleTreeItemOfPath(java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected TreeItem getFirstVisibleTreeItemOfPath(Object dataItem) {
|
||||||
|
return getFirstVisibleTreeItemOfPath((HL7TreeNode) dataItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.eclipse.swt.widgets.Composite;
|
|||||||
import org.talend.core.model.metadata.builder.connection.HL7Connection;
|
import org.talend.core.model.metadata.builder.connection.HL7Connection;
|
||||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||||
import org.talend.core.model.properties.ConnectionItem;
|
import org.talend.core.model.properties.ConnectionItem;
|
||||||
|
import org.talend.core.model.utils.RepositoryManagerHelper;
|
||||||
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
import org.talend.designer.hl7.ui.data.HL7TreeNode;
|
||||||
import org.talend.repository.ui.swt.utils.AbstractForm;
|
import org.talend.repository.ui.swt.utils.AbstractForm;
|
||||||
import org.talend.repository.ui.utils.FileConnectionContextUtils.EFileParamName;
|
import org.talend.repository.ui.utils.FileConnectionContextUtils.EFileParamName;
|
||||||
@@ -31,6 +32,8 @@ import org.talend.repository.ui.utils.OtherConnectionContextUtils.EParamName;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractHL7StepForm extends AbstractForm {
|
public abstract class AbstractHL7StepForm extends AbstractForm {
|
||||||
|
|
||||||
|
protected int maximumRowsToPreview = RepositoryManagerHelper.getMaximumRowsToPreview();
|
||||||
|
|
||||||
protected HL7Connection connection;
|
protected HL7Connection connection;
|
||||||
|
|
||||||
public AbstractHL7StepForm(Composite parent, ConnectionItem connectionItem, String[] existingNames) {
|
public AbstractHL7StepForm(Composite parent, ConnectionItem connectionItem, String[] existingNames) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
package org.talend.designer.hl7.ui.provider;
|
package org.talend.designer.hl7.ui.provider;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -54,11 +53,9 @@ public class HL7MessageTreeContentProvider implements ITreeContentProvider {
|
|||||||
values.add(childReps[j]);
|
values.add(childReps[j]);
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Group) {
|
if (childReps[j] instanceof Group) {
|
||||||
|
values.add(childReps[j]);
|
||||||
allSegmentFromGroup.clear();
|
allSegmentFromGroup.clear();
|
||||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
getAllSegmentsFromGroup((Group) childReps[j]);
|
||||||
if (allSegmentFromGroup.size() > 0) {
|
|
||||||
values.addAll(Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0])));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Segment) {
|
if (childReps[j] instanceof Segment) {
|
||||||
SegmentModel sModel = new SegmentModel((Segment) childReps[j], messParent, i, j);
|
SegmentModel sModel = new SegmentModel((Segment) childReps[j], messParent, i, j);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class HL7MessageTreeLabelProvider extends LabelProvider implements ITable
|
|||||||
// }
|
// }
|
||||||
if (element instanceof Group) {
|
if (element instanceof Group) {
|
||||||
Group group = (Group) element;
|
Group group = (Group) element;
|
||||||
String groupName = group.getClass().getName();
|
String groupName = group.getName();
|
||||||
groupName = groupName.substring(groupName.lastIndexOf('.') + 1, groupName.length());
|
groupName = groupName.substring(groupName.lastIndexOf('.') + 1, groupName.length());
|
||||||
return groupName;
|
return groupName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
//
|
//
|
||||||
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
// Copyright (C) 2006-2014 Talend Inc. - www.talend.com
|
||||||
//
|
//
|
||||||
// This source code is available under agreement available at
|
// This source code is available under agreement available at
|
||||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,9 +147,6 @@ public class HL7PublicUtil {
|
|||||||
HL7TreeNode node = new Element();
|
HL7TreeNode node = new Element();
|
||||||
String nodeLabel = getLabel(treeNode, true);
|
String nodeLabel = getLabel(treeNode, true);
|
||||||
node.setLabel(nodeLabel);
|
node.setLabel(nodeLabel);
|
||||||
// if (node instanceof Element) {
|
|
||||||
// ((Element) node).setRow(nodeLabel);
|
|
||||||
// }
|
|
||||||
node.setMain(true);
|
node.setMain(true);
|
||||||
List children = getFirstLevelChild(treeNode);
|
List children = getFirstLevelChild(treeNode);
|
||||||
if (children != null) {
|
if (children != null) {
|
||||||
@@ -155,7 +155,7 @@ public class HL7PublicUtil {
|
|||||||
HL7TreeNode childEle = cloneATreeNode(child, label);
|
HL7TreeNode childEle = cloneATreeNode(child, label);
|
||||||
|
|
||||||
childEle.setLabel(label);
|
childEle.setLabel(label);
|
||||||
if (childEle instanceof Element) {
|
if (!(child instanceof Group)) {
|
||||||
((Element) childEle).setRow(label);
|
((Element) childEle).setRow(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +169,12 @@ public class HL7PublicUtil {
|
|||||||
HL7TreeNode node = new Element();
|
HL7TreeNode node = new Element();
|
||||||
String nodeLabel = getLabel(treeNode, true);
|
String nodeLabel = getLabel(treeNode, true);
|
||||||
node.setLabel(nodeLabel);
|
node.setLabel(nodeLabel);
|
||||||
if (node instanceof Element) {
|
String rowLabel = label;
|
||||||
((Element) node).setRow(label);
|
if (treeNode instanceof SegmentModel) {
|
||||||
|
((Element) node).setRow(nodeLabel);
|
||||||
|
rowLabel = nodeLabel;
|
||||||
|
} else if (!(treeNode instanceof Group)) {
|
||||||
|
((Element) node).setRow(rowLabel);
|
||||||
}
|
}
|
||||||
node.setMain(true);
|
node.setMain(true);
|
||||||
Object[] children = getChildList(treeNode);// treeNode.getChildren();
|
Object[] children = getChildList(treeNode);// treeNode.getChildren();
|
||||||
@@ -178,11 +182,15 @@ public class HL7PublicUtil {
|
|||||||
for (Object element : children) {
|
for (Object element : children) {
|
||||||
|
|
||||||
if (getChildList(element).length > 0) {
|
if (getChildList(element).length > 0) {
|
||||||
HL7TreeNode childEle = cloneATreeNode(element, label);
|
|
||||||
String tlabel = getLabel(element, true);
|
String tlabel = getLabel(element, true);
|
||||||
|
String childLabel = rowLabel;
|
||||||
|
HL7TreeNode childEle = cloneATreeNode(element, rowLabel);
|
||||||
|
if (element instanceof SegmentModel) {
|
||||||
|
childLabel = tlabel;
|
||||||
|
}
|
||||||
childEle.setLabel(tlabel);
|
childEle.setLabel(tlabel);
|
||||||
if (childEle instanceof Element) {
|
if (childEle instanceof Element) {
|
||||||
((Element) childEle).setRow(label);
|
((Element) childEle).setRow(childLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
node.addChild(childEle);
|
node.addChild(childEle);
|
||||||
@@ -197,12 +205,6 @@ public class HL7PublicUtil {
|
|||||||
childEle.setMain(false);
|
childEle.setMain(false);
|
||||||
node.addChild(childEle);
|
node.addChild(childEle);
|
||||||
}
|
}
|
||||||
// if (children[i] instanceof ATreeNode) {
|
|
||||||
// ATreeNode child = (ATreeNode) children[i];
|
|
||||||
// HL7TreeNode HL7Child = cloneATreeNode(child);
|
|
||||||
// // HL7Child.setRow(schemaName);
|
|
||||||
// node.addChild(HL7Child);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
@@ -341,16 +343,9 @@ public class HL7PublicUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Group) {
|
if (childReps[j] instanceof Group) {
|
||||||
|
values.add(childReps[j]);
|
||||||
allSegmentFromGroup.clear();
|
allSegmentFromGroup.clear();
|
||||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
getAllSegmentsFromGroup((Group) childReps[j]);
|
||||||
if (allSegmentFromGroup.size() > 0) {
|
|
||||||
values.addAll(Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0])));
|
|
||||||
for (SegmentModel sm : Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0]))) {
|
|
||||||
if (getChildren(sm).size() > 0) {
|
|
||||||
values.add(getChildren(sm));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Segment) {
|
if (childReps[j] instanceof Segment) {
|
||||||
SegmentModel sModel = new SegmentModel((Segment) childReps[j], messParent, i, j);
|
SegmentModel sModel = new SegmentModel((Segment) childReps[j], messParent, i, j);
|
||||||
@@ -463,11 +458,9 @@ public class HL7PublicUtil {
|
|||||||
values.add(childReps[j]);
|
values.add(childReps[j]);
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Group) {
|
if (childReps[j] instanceof Group) {
|
||||||
|
values.add(childReps[j]);
|
||||||
allSegmentFromGroup.clear();
|
allSegmentFromGroup.clear();
|
||||||
getAllSegmentsFromGroup((Group) childReps[j]);
|
getAllSegmentsFromGroup((Group) childReps[j]);
|
||||||
if (allSegmentFromGroup.size() > 0) {
|
|
||||||
values.addAll(Arrays.asList(allSegmentFromGroup.toArray(new SegmentModel[0])));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (childReps[j] instanceof Segment) {
|
if (childReps[j] instanceof Segment) {
|
||||||
SegmentModel sModel = new SegmentModel((Segment) childReps[j], messParent, i, j);
|
SegmentModel sModel = new SegmentModel((Segment) childReps[j], messParent, i, j);
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ public class WebServiceTreeLabelProvider extends LabelProvider implements ITable
|
|||||||
*
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Image getColumnImage(Object element, int columnIndex) {
|
public Image getColumnImage(Object element, int columnIndex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -40,6 +41,7 @@ public class WebServiceTreeLabelProvider extends LabelProvider implements ITable
|
|||||||
*
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
* @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getColumnText(Object element, int columnIndex) {
|
public String getColumnText(Object element, int columnIndex) {
|
||||||
if (element instanceof ParameterInfo) {
|
if (element instanceof ParameterInfo) {
|
||||||
ParameterInfo para = (ParameterInfo) element;
|
ParameterInfo para = (ParameterInfo) element;
|
||||||
@@ -60,11 +62,6 @@ public class WebServiceTreeLabelProvider extends LabelProvider implements ITable
|
|||||||
} else if (columnIndex == 1) {
|
} else if (columnIndex == 1) {
|
||||||
if (para.getArraySize() != 0) {
|
if (para.getArraySize() != 0) {
|
||||||
return para.getIndex() == null ? "*" : para.getIndex();
|
return para.getIndex() == null ? "*" : para.getIndex();
|
||||||
} else if (para.getParameterInfos().size() > 1) {
|
|
||||||
String index = para.getIndex() == null ? "*" : para.getIndex();
|
|
||||||
para.setArraySize(-1);
|
|
||||||
para.setIndex("*");
|
|
||||||
return index;
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -79,6 +76,7 @@ public class WebServiceTreeLabelProvider extends LabelProvider implements ITable
|
|||||||
*
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int)
|
* @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Color getBackground(Object element, int columnIndex) {
|
public Color getBackground(Object element, int columnIndex) {
|
||||||
if (element instanceof ParameterInfo) {
|
if (element instanceof ParameterInfo) {
|
||||||
ParameterInfo para = (ParameterInfo) element;
|
ParameterInfo para = (ParameterInfo) element;
|
||||||
@@ -94,6 +92,7 @@ public class WebServiceTreeLabelProvider extends LabelProvider implements ITable
|
|||||||
*
|
*
|
||||||
* @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int)
|
* @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Color getForeground(Object element, int columnIndex) {
|
public Color getForeground(Object element, int columnIndex) {
|
||||||
if (element instanceof ParameterInfo) {
|
if (element instanceof ParameterInfo) {
|
||||||
ParameterInfo para = (ParameterInfo) element;
|
ParameterInfo para = (ParameterInfo) element;
|
||||||
|
|||||||
@@ -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"/>
|
<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 kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -3,6 +3,5 @@
|
|||||||
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/cssparser-0.9.5.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/cssparser-0.9.5.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>
|
||||||
|
|||||||
@@ -3,6 +3,5 @@
|
|||||||
<classpathentry exported="true" kind="lib" path="lib/talend_file_enhanced_20070724.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/talend_file_enhanced_20070724.jar"/>
|
||||||
<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 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>
|
||||||
|
|||||||
@@ -5,6 +5,5 @@
|
|||||||
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.9-20121203.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/poi-ooxml-schemas-3.9-20121203.jar"/>
|
||||||
<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 kind="output" path="class"/>
|
<classpathentry kind="output" path="class"/>
|
||||||
</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"/>
|
<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 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"/>
|
<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 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 exported="true" kind="lib" path="lib/ldapjdk.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/ldapjdk.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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -4,6 +4,5 @@
|
|||||||
<classpathentry exported="true" kind="lib" path="lib/salesforce_enterprise.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/salesforce_enterprise.jar"/>
|
||||||
<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/main/java"/>
|
|
||||||
<classpathentry kind="output" path="class"/>
|
<classpathentry kind="output" path="class"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
<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 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"/>
|
<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 kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry exported="true" kind="lib" path="lib/sequence-library.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/sequence-library.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/svnkit-javahl.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/svnkit-javahl.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/svnkit.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/svnkit.jar"/>
|
||||||
|
|||||||
@@ -3,6 +3,5 @@
|
|||||||
<classpathentry exported="true" kind="lib" path="lib/uniserv.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/uniserv.jar"/>
|
||||||
<classpathentry exported="true" kind="lib" path="lib/talendUniservAPI.jar"/>
|
<classpathentry exported="true" kind="lib" path="lib/talendUniservAPI.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 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>
|
||||||
|
|||||||
@@ -737,6 +737,12 @@ ImportItemUtil.taskMonitor=apply migration task {0} on item {1}
|
|||||||
ImportItemUtil.tdqErrorInfor=Can't import tdq item {0}
|
ImportItemUtil.tdqErrorInfor=Can't import tdq item {0}
|
||||||
ImportItemUtil.unknowException=Unknow language: {0}
|
ImportItemUtil.unknowException=Unknow language: {0}
|
||||||
ImportItemUtil.unsupportItem=Can not import the item, Please ensure the items are valid in current product.
|
ImportItemUtil.unsupportItem=Can not import the item, Please ensure the items are valid in current product.
|
||||||
|
ImportItemUtil.ErrorCreateEmfResource=Load EMF Resource failed.
|
||||||
|
ImportItemUtil.MissingItemFile=missing item file.
|
||||||
|
ImportItemUtil.NotHrefCurrentItemFile=original item file has some errors, it has been recovered from file name, please recheck.
|
||||||
|
ImportItemUtil.MissingItemError={0};Missing '{1}' file!;{2}
|
||||||
|
ImportItemUtil.LoadEMFResourceError={0};Load EMF Resource failed;{1}
|
||||||
|
|
||||||
ImportItemWizardPage.0=The 2 following items haves the same ID, please unselect one of them : \n [{0}] [{1}]
|
ImportItemWizardPage.0=The 2 following items haves the same ID, please unselect one of them : \n [{0}] [{1}]
|
||||||
ImportItemWizardPage.ItemsList=Items List
|
ImportItemWizardPage.ItemsList=Items List
|
||||||
ImportItemWizardPage.ImportDescription=Import items from an archive file or directory.
|
ImportItemWizardPage.ImportDescription=Import items from an archive file or directory.
|
||||||
@@ -786,3 +792,10 @@ UseDynamicJobSelectionDialog.downBtnText=Down
|
|||||||
RepositoryService.projectNotFound=The project '{0}' is not found.
|
RepositoryService.projectNotFound=The project '{0}' is not found.
|
||||||
RepositoryService.projectReadonlyTitle=Information
|
RepositoryService.projectReadonlyTitle=Information
|
||||||
RepositoryService.projectReadonly=The current login project is readonly.
|
RepositoryService.projectReadonly=The current login project is readonly.
|
||||||
|
|
||||||
|
JobScriptsManager.ResourceNotFoundForExport="Resource cannot be found for export: " {0}
|
||||||
|
|
||||||
|
ShowErrorsDuringImportItemsDialog_title=Errors during the import items
|
||||||
|
ShowErrorsDuringImportItemsDialog_exportLogButton_title=Export Log
|
||||||
|
ShowErrorsDuringImportItemsDialog_exportLogEntry=Export Log Entry
|
||||||
|
ShowErrorsDuringImportItemsDialog_confirmOverwrite_message = File " {0}" exists. Would you like to overwrite it?
|
||||||
@@ -54,6 +54,7 @@ import org.eclipse.emf.common.util.URI;
|
|||||||
import org.eclipse.emf.ecore.EObject;
|
import org.eclipse.emf.ecore.EObject;
|
||||||
import org.eclipse.emf.ecore.EPackage;
|
import org.eclipse.emf.ecore.EPackage;
|
||||||
import org.eclipse.emf.ecore.InternalEObject;
|
import org.eclipse.emf.ecore.InternalEObject;
|
||||||
|
import org.eclipse.emf.ecore.impl.EObjectImpl;
|
||||||
import org.eclipse.emf.ecore.resource.Resource;
|
import org.eclipse.emf.ecore.resource.Resource;
|
||||||
import org.eclipse.emf.ecore.resource.ResourceSet;
|
import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||||
import org.eclipse.emf.ecore.resource.URIConverter;
|
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||||
@@ -641,6 +642,9 @@ public class ImportItemUtil {
|
|||||||
final IProgressMonitor monitor) {
|
final IProgressMonitor monitor) {
|
||||||
monitor.subTask(Messages.getString("ImportItemWizardPage.Importing") + itemRecord.getItemName()); //$NON-NLS-1$
|
monitor.subTask(Messages.getString("ImportItemWizardPage.Importing") + itemRecord.getItemName()); //$NON-NLS-1$
|
||||||
resolveItem(manager, itemRecord);
|
resolveItem(manager, itemRecord);
|
||||||
|
if (!itemRecord.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (Object obj : itemRecord.getResourceSet().getResources()) {
|
for (Object obj : itemRecord.getResourceSet().getResources()) {
|
||||||
@@ -1478,6 +1482,20 @@ public class ImportItemUtil {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get relative Path of the Item
|
||||||
|
*/
|
||||||
|
private IPath getValidItemRelativePath(ResourcesManager resManager, IPath path) {
|
||||||
|
IPath projectFilePath = getValidProjectFilePath(resManager, path, null);
|
||||||
|
if (projectFilePath != null) {
|
||||||
|
// remove the last segments "talend.project"
|
||||||
|
IPath projectRootPath = projectFilePath.removeLastSegments(1);
|
||||||
|
// relative to import project
|
||||||
|
return path.makeRelativeTo(projectRootPath);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private ItemRecord computeItemRecord(ResourcesManager collector, IPath path) {
|
private ItemRecord computeItemRecord(ResourcesManager collector, IPath path) {
|
||||||
ItemRecord itemRecord = new ItemRecord(path);
|
ItemRecord itemRecord = new ItemRecord(path);
|
||||||
computeProperty(collector, itemRecord);
|
computeProperty(collector, itemRecord);
|
||||||
@@ -1538,6 +1556,16 @@ public class ImportItemUtil {
|
|||||||
final Item item = itemRecord.getItem();
|
final Item item = itemRecord.getItem();
|
||||||
boolean byteArray = (item instanceof FileItem);
|
boolean byteArray = (item instanceof FileItem);
|
||||||
IPath itemPath = getItemPath(itemRecord.getPath(), item);
|
IPath itemPath = getItemPath(itemRecord.getPath(), item);
|
||||||
|
IPath itemRelativePath = getValidItemRelativePath(manager, itemPath);
|
||||||
|
Set<IPath> paths = manager.getPaths();
|
||||||
|
// check the item file
|
||||||
|
if (!paths.contains(itemPath)) {
|
||||||
|
itemRecord.addError(Messages.getString("ImportItemUtil.MissingItemError", itemRecord.getItemName(),
|
||||||
|
itemPath.lastSegment(), itemRelativePath));
|
||||||
|
log.error(itemRecord.getItemName()
|
||||||
|
+ " " + Messages.getString("ImportItemUtil.MissingItemFile") + " - " + itemPath); //$NON-NLS-1$
|
||||||
|
return;
|
||||||
|
}
|
||||||
stream = manager.getStream(itemPath);
|
stream = manager.getStream(itemPath);
|
||||||
Resource resource = createResource(itemRecord, itemPath, byteArray);
|
Resource resource = createResource(itemRecord, itemPath, byteArray);
|
||||||
|
|
||||||
@@ -1563,8 +1591,27 @@ public class ImportItemUtil {
|
|||||||
Resource rfResource = createResource(itemRecord, itemPath, true);
|
Resource rfResource = createResource(itemRecord, itemPath, true);
|
||||||
rfResource.load(stream, null);
|
rfResource.load(stream, null);
|
||||||
}
|
}
|
||||||
resetItemReference(itemRecord, resource);
|
|
||||||
// EcoreUtil.resolveAll(itemRecord.getResourceSet());
|
Iterator<EObject> itRef = item.eCrossReferences().iterator();
|
||||||
|
IPath parentPath = itemRecord.getPath().removeLastSegments(1);
|
||||||
|
while (itRef.hasNext()) {
|
||||||
|
EObject object = itRef.next();
|
||||||
|
String linkedFile = EcoreUtil.getURI(object).toFileString();
|
||||||
|
IPath linkedPath = parentPath.append(linkedFile);
|
||||||
|
if (!paths.contains(linkedPath)) {
|
||||||
|
if (linkedFile != null && !linkedFile.equals(itemPath.lastSegment())
|
||||||
|
&& linkedFile.endsWith(itemPath.getFileExtension())) {
|
||||||
|
if (object.eIsProxy()) {
|
||||||
|
// if original href of the item point to some missing item file
|
||||||
|
// and if we can get the original item file from the name, recover it, but add a warning
|
||||||
|
((EObjectImpl) object).eSetProxyURI(URI.createFileURI(itemPath.lastSegment()));
|
||||||
|
log.warn(itemRecord.getItemName()
|
||||||
|
+ " " + Messages.getString("ImportItemUtil.NotHrefCurrentItemFile") + " - " + itemRecord.getPath()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EcoreUtil.resolve(object, resource);
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// ignore
|
// ignore
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ import org.eclipse.swt.layout.GridLayout;
|
|||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
@@ -1036,6 +1037,23 @@ class ImportItemWizardPage extends WizardPage {
|
|||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
//
|
//
|
||||||
|
} finally {
|
||||||
|
// Check Error Items
|
||||||
|
final List<String> errors = new ArrayList<String>();
|
||||||
|
for (ItemRecord itemRecord : checkedItemRecords) {
|
||||||
|
errors.addAll(itemRecord.getErrors());
|
||||||
|
}
|
||||||
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!errors.isEmpty()) {
|
||||||
|
ShowErrorsDuringImportItemsDialog dialog = new ShowErrorsDuringImportItemsDialog(Display.getCurrent()
|
||||||
|
.getActiveShell(), errors);
|
||||||
|
dialog.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
ResourcesManager curManager = this.manager;
|
ResourcesManager curManager = this.manager;
|
||||||
if (curManager instanceof ProviderManager) {
|
if (curManager instanceof ProviderManager) {
|
||||||
|
|||||||
@@ -0,0 +1,270 @@
|
|||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Copyright (C) 2006-2013 Talend Inc. - www.talend.com
|
||||||
|
//
|
||||||
|
// This source code is available under agreement available at
|
||||||
|
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||||
|
//
|
||||||
|
// You should have received a copy of the agreement
|
||||||
|
// along with this program; if not, write to Talend SA
|
||||||
|
// 9 rue Pages 92150 Suresnes, France
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
package org.talend.repository.imports;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.dnd.Clipboard;
|
||||||
|
import org.eclipse.swt.dnd.TextTransfer;
|
||||||
|
import org.eclipse.swt.dnd.Transfer;
|
||||||
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
|
import org.eclipse.swt.events.KeyListener;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
import org.eclipse.swt.widgets.Menu;
|
||||||
|
import org.eclipse.swt.widgets.MenuItem;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
import org.talend.commons.ui.runtime.image.EImage;
|
||||||
|
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||||
|
import org.talend.repository.i18n.Messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DOC hcyi class global comment. Detailled comment
|
||||||
|
*/
|
||||||
|
public class ShowErrorsDuringImportItemsDialog extends Dialog {
|
||||||
|
|
||||||
|
public List<String> errors = new ArrayList<String>();
|
||||||
|
|
||||||
|
public Table table;
|
||||||
|
|
||||||
|
private String fDirectory;
|
||||||
|
|
||||||
|
private File fInputFile;
|
||||||
|
|
||||||
|
public ShowErrorsDuringImportItemsDialog(Shell shell, List<String> errors) {
|
||||||
|
super(shell);
|
||||||
|
this.setShellStyle(this.getShellStyle() | SWT.MIN | SWT.MAX | SWT.RESIZE);
|
||||||
|
this.errors = errors;
|
||||||
|
fInputFile = Platform.getLogFileLocation().toFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configureShell(Shell newShell) {
|
||||||
|
super.configureShell(newShell);
|
||||||
|
newShell.setText(Messages.getString("ShowErrorsDuringImportItemsDialog_title")); //$NON-NLS-1$
|
||||||
|
newShell.setImage(ImageProvider.getImage(EImage.ERROR_ICON));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createButtonsForButtonBar(Composite parent) {
|
||||||
|
createButton(parent, IDialogConstants.OK_ID,
|
||||||
|
Messages.getString("ShowErrorsDuringImportItemsDialog_exportLogButton_title"), true);
|
||||||
|
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void okPressed() {
|
||||||
|
handleExport(true);
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
Composite tableComposite = new Composite(parent, SWT.NONE);
|
||||||
|
tableComposite.setLayout(new GridLayout());
|
||||||
|
|
||||||
|
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||||
|
gd.heightHint = 500;
|
||||||
|
gd.widthHint = 900;
|
||||||
|
tableComposite.setLayoutData(gd);
|
||||||
|
|
||||||
|
// List Table
|
||||||
|
table = new Table(tableComposite, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
|
||||||
|
table.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
table.setHeaderVisible(true);
|
||||||
|
table.setLinesVisible(true);
|
||||||
|
|
||||||
|
TableColumn itemName = new TableColumn(table, SWT.NONE);
|
||||||
|
itemName.setText("Item Name"); //$NON-NLS-1$
|
||||||
|
itemName.setWidth(230);
|
||||||
|
|
||||||
|
TableColumn errorLog = new TableColumn(table, SWT.NONE);
|
||||||
|
errorLog.setText("Error Log"); //$NON-NLS-1$
|
||||||
|
errorLog.setWidth(330);
|
||||||
|
|
||||||
|
TableColumn path = new TableColumn(table, SWT.NONE);
|
||||||
|
path.setText("Path"); //$NON-NLS-1$
|
||||||
|
path.setWidth(350);
|
||||||
|
setMenu(table);
|
||||||
|
addItemElements(errors);
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
private void setMenu(final Table table) {
|
||||||
|
Listener popUpListener = new Listener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(Event event) {
|
||||||
|
StringBuffer sbf = new StringBuffer();
|
||||||
|
for (int i : table.getSelectionIndices()) {
|
||||||
|
TableItem item = table.getItem(i);
|
||||||
|
sbf.append(item.getData());
|
||||||
|
sbf.append("\n");
|
||||||
|
}
|
||||||
|
Object[] data = { "" + sbf };
|
||||||
|
Clipboard clipboard = new Clipboard(Display.getCurrent());
|
||||||
|
Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
|
||||||
|
clipboard.setContents(data, transfers);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Menu menu = new Menu(table);
|
||||||
|
MenuItem copy = new MenuItem(menu, SWT.PUSH);
|
||||||
|
copy.setText("Copy");
|
||||||
|
copy.setImage(ImageProvider.getImage(EImage.COPY_ICON));
|
||||||
|
copy.addListener(SWT.Selection, popUpListener);
|
||||||
|
table.setMenu(menu);
|
||||||
|
|
||||||
|
// add key Listener
|
||||||
|
table.addKeyListener(new KeyListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyReleased(KeyEvent arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyPressed(KeyEvent e) {
|
||||||
|
if (e.keyCode == 99 && (e.stateMask & SWT.CTRL) != 0) {
|
||||||
|
StringBuffer sbf = new StringBuffer();
|
||||||
|
for (int i : table.getSelectionIndices()) {
|
||||||
|
TableItem item = table.getItem(i);
|
||||||
|
sbf.append(item.getData());
|
||||||
|
sbf.append("\n");
|
||||||
|
}
|
||||||
|
Object[] data = { "" + sbf };
|
||||||
|
Clipboard clipboard = new Clipboard(Display.getCurrent());
|
||||||
|
Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
|
||||||
|
clipboard.setContents(data, transfers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addItemElements(List<String> errors) {
|
||||||
|
table.setRedraw(false);
|
||||||
|
for (String error : errors) {
|
||||||
|
if (error != null) {
|
||||||
|
String[] messages = error.split(";");
|
||||||
|
if (messages.length != 3) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
TableItem tableItem = new TableItem(table, SWT.NONE);
|
||||||
|
tableItem.setData(error);
|
||||||
|
tableItem.setImage(0, ImageProvider.getImage(EImage.ERROR_SMALL));
|
||||||
|
tableItem.setText(0, messages[0]);
|
||||||
|
tableItem.setText(1, messages[1]);
|
||||||
|
tableItem.setText(2, messages[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table.setRedraw(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleExport(boolean exportWholeLog) {
|
||||||
|
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
|
||||||
|
dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
|
||||||
|
if (fDirectory != null) {
|
||||||
|
dialog.setFilterPath(fDirectory);
|
||||||
|
}
|
||||||
|
String path = dialog.open();
|
||||||
|
if (path != null) {
|
||||||
|
if (path.indexOf('.') == -1 && !path.endsWith(".log")) {
|
||||||
|
path += ".log"; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
File outputFile = new Path(path).toFile();
|
||||||
|
fDirectory = outputFile.getParent();
|
||||||
|
if (outputFile.exists()) {
|
||||||
|
String message = NLS.bind(Messages.getString("ShowErrorsDuringImportItemsDialog_confirmOverwrite_message"),
|
||||||
|
outputFile.toString());
|
||||||
|
if (!MessageDialog.openQuestion(getShell(),
|
||||||
|
(exportWholeLog ? Messages.getString("ShowErrorsDuringImportItemsDialog_exportLogButton_title")
|
||||||
|
: Messages.getString("ShowErrorsDuringImportItemsDialog_exportLogEntry")), message)) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Reader in = null;
|
||||||
|
Writer out = null;
|
||||||
|
try {
|
||||||
|
out = new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"); //$NON-NLS-1$
|
||||||
|
if (exportWholeLog) {
|
||||||
|
in = new InputStreamReader(new FileInputStream(fInputFile), "UTF-8"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
copy(in, out);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
try {
|
||||||
|
if (in != null) {
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
if (out != null) {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e1) { // do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void copy(Reader input, Writer output) {
|
||||||
|
BufferedReader reader = null;
|
||||||
|
BufferedWriter writer = null;
|
||||||
|
try {
|
||||||
|
reader = new BufferedReader(input);
|
||||||
|
writer = new BufferedWriter(output);
|
||||||
|
String line;
|
||||||
|
while (reader.ready() && ((line = reader.readLine()) != null)) {
|
||||||
|
writer.write(line);
|
||||||
|
writer.newLine();
|
||||||
|
}
|
||||||
|
} catch (IOException e) { // do nothing
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
if (writer != null) {
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e1) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -375,7 +375,7 @@ public class RepositoryReviewDialog extends Dialog {
|
|||||||
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "finshed add Filters"); //$NON-NLS-1$
|
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "finshed add Filters"); //$NON-NLS-1$
|
||||||
|
|
||||||
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "set input"); //$NON-NLS-1$
|
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "set input"); //$NON-NLS-1$
|
||||||
repositoryTreeViewer.expandAll();
|
repositoryTreeViewer.expandToLevel(2);
|
||||||
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "expandAll"); //$NON-NLS-1$
|
TimeMeasure.step(RepositoryReviewDialog.class.getSimpleName(), "expandAll"); //$NON-NLS-1$
|
||||||
|
|
||||||
// see feature 0003664: tRunJob: When opening the tree dialog to select the job target, it could be useful to
|
// see feature 0003664: tRunJob: When opening the tree dialog to select the job target, it could be useful to
|
||||||
@@ -610,7 +610,7 @@ class ViewerTextFilter extends ViewerFilter {
|
|||||||
*/
|
*/
|
||||||
class DatabaseTypeFilter extends ViewerFilter {
|
class DatabaseTypeFilter extends ViewerFilter {
|
||||||
|
|
||||||
private String[] filterItems;
|
private final String[] filterItems;
|
||||||
|
|
||||||
public DatabaseTypeFilter(String[] filterItems) {
|
public DatabaseTypeFilter(String[] filterItems) {
|
||||||
this.filterItems = filterItems;
|
this.filterItems = filterItems;
|
||||||
|
|||||||
@@ -825,22 +825,37 @@ public abstract class JobScriptsManager {
|
|||||||
|
|
||||||
IPath itemFilePath;
|
IPath itemFilePath;
|
||||||
String itemVersionString = (itemVersion == null) ? "" : "_" + itemVersion;
|
String itemVersionString = (itemVersion == null) ? "" : "_" + itemVersion;
|
||||||
|
|
||||||
|
if (itemPath.startsWith(typeFolderPath.toString())) {
|
||||||
|
itemPath = itemPath.substring(typeFolderPath.toString().length());
|
||||||
|
}
|
||||||
if (item.getFileExtension() == null || "".equals(item.getFileExtension())) { //$NON-NLS-1$
|
if (item.getFileExtension() == null || "".equals(item.getFileExtension())) { //$NON-NLS-1$
|
||||||
itemFilePath = projectRootPath.append(typeFolderPath).append(itemPath)
|
itemFilePath = projectRootPath.append(typeFolderPath).append(itemPath)
|
||||||
.append(itemName + itemVersionString + "." + FileConstants.ITEM_EXTENSION); //$NON-NLS-1$ //$NON-NLS-2$
|
.append(itemName + itemVersionString + "." + FileConstants.ITEM_EXTENSION); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
itemFilePath = projectRootPath.append(typeFolderPath).append(itemPath)
|
itemFilePath = projectRootPath.append(typeFolderPath).append(itemPath)
|
||||||
.append(itemName + itemVersionString + "." + item.getFileExtension()); //$NON-NLS-1$ //$NON-NLS-2$
|
.append(itemName + itemVersionString + "." + item.getFileExtension()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
IPath propertiesFilePath = projectRootPath.append(typeFolderPath).append(itemPath)
|
IPath propertiesFilePath = projectRootPath.append(typeFolderPath).append(itemPath)
|
||||||
.append(itemName + itemVersionString + "." //$NON-NLS-1$ //$NON-NLS-2$
|
.append(itemName + itemVersionString + "." //$NON-NLS-1$
|
||||||
+ FileConstants.PROPERTIES_EXTENSION);
|
+ FileConstants.PROPERTIES_EXTENSION);
|
||||||
|
|
||||||
List<URL> metadataNameFileUrls = new ArrayList<URL>();
|
List<URL> metadataNameFileUrls = new ArrayList<URL>();
|
||||||
|
|
||||||
metadataNameFileUrls.add(FileLocator.toFileURL(itemFilePath.toFile().toURL()));
|
File itemFile = itemFilePath.toFile();
|
||||||
metadataNameFileUrls.add(FileLocator.toFileURL(propertiesFilePath.toFile().toURL()));
|
if (itemFile.exists()) {
|
||||||
|
metadataNameFileUrls.add(FileLocator.toFileURL(itemFile.toURI().toURL()));
|
||||||
|
} else {
|
||||||
|
ExceptionHandler.log(Messages.getString("JobScriptsManager.ResourceNotFoundForExport", itemFilePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
File propertiesFile = propertiesFilePath.toFile();
|
||||||
|
if (propertiesFile.exists()) {
|
||||||
|
metadataNameFileUrls.add(FileLocator.toFileURL(propertiesFile.toURI().toURL()));
|
||||||
|
} else {
|
||||||
|
ExceptionHandler.log(Messages.getString("JobScriptsManager.ResourceNotFoundForExport", propertiesFilePath));
|
||||||
|
}
|
||||||
|
|
||||||
String basePath = JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + projectName + PATH_SEPARATOR
|
String basePath = JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + projectName + PATH_SEPARATOR
|
||||||
+ typeFolderPath.toString();
|
+ typeFolderPath.toString();
|
||||||
|
|||||||
@@ -12,10 +12,6 @@
|
|||||||
// ============================================================================
|
// ============================================================================
|
||||||
package org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb;
|
package org.talend.repository.ui.wizards.exportjob.scriptsmanager.esb;
|
||||||
|
|
||||||
import aQute.bnd.osgi.Analyzer;
|
|
||||||
import aQute.bnd.osgi.FileResource;
|
|
||||||
import aQute.bnd.osgi.Jar;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
@@ -87,6 +83,10 @@ import org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobJavaScriptsM
|
|||||||
import org.talend.repository.utils.EmfModelUtils;
|
import org.talend.repository.utils.EmfModelUtils;
|
||||||
import org.talend.repository.utils.TemplateProcessor;
|
import org.talend.repository.utils.TemplateProcessor;
|
||||||
|
|
||||||
|
import aQute.bnd.osgi.Analyzer;
|
||||||
|
import aQute.bnd.osgi.FileResource;
|
||||||
|
import aQute.bnd.osgi.Jar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOC ycbai class global comment. Detailled comment
|
* DOC ycbai class global comment. Detailled comment
|
||||||
*/
|
*/
|
||||||
@@ -115,6 +115,9 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
|||||||
|
|
||||||
private final File classesLocation = new File(getTmpFolder() + File.separator + "classes"); //$NON-NLS-1$;
|
private final File classesLocation = new File(getTmpFolder() + File.separator + "classes"); //$NON-NLS-1$;
|
||||||
|
|
||||||
|
//patch for TESB-12909
|
||||||
|
private boolean isRefJobBycTalendJob = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ExportFileResource> getExportResources(ExportFileResource[] processes, String... codeOptions)
|
public List<ExportFileResource> getExportResources(ExportFileResource[] processes, String... codeOptions)
|
||||||
throws ProcessorException {
|
throws ProcessorException {
|
||||||
@@ -589,6 +592,11 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
|||||||
// job OSGi DataSources
|
// job OSGi DataSources
|
||||||
jobInfo.put("dataSources", DataSourceConfig.getAliases(processItem)); //$NON-NLS-1$
|
jobInfo.put("dataSources", DataSourceConfig.getAliases(processItem)); //$NON-NLS-1$
|
||||||
|
|
||||||
|
//patch for TESB-12909
|
||||||
|
if(isRefJobBycTalendJob && null != EmfModelUtils.getComponentByName(processItem, "tRouteInput")){
|
||||||
|
jobInfo.put("name", jobClassName); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
// velocity template context
|
// velocity template context
|
||||||
Map<String, Object> contextParams = new HashMap<String, Object>();
|
Map<String, Object> contextParams = new HashMap<String, Object>();
|
||||||
contextParams.put("job", jobInfo); //$NON-NLS-1$
|
contextParams.put("job", jobInfo); //$NON-NLS-1$
|
||||||
@@ -1033,4 +1041,8 @@ public class JobJavaScriptOSGIForESBManager extends JobJavaScriptsManager {
|
|||||||
}
|
}
|
||||||
return providedModulesSet;
|
return providedModulesSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsRefJobByCTalendJob(boolean isRefJobBycTalendJob) {
|
||||||
|
this.isRefJobBycTalendJob = isRefJobBycTalendJob;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user