Compare commits

...

49 Commits

Author SHA1 Message Date
SunChaoqun
adaf9f3f96 TESB-26174:Error on Job with multiple tRunJob calling Call another Child (#2592)
job with tESBConsumer component
2019-08-07 12:10:19 +08:00
hzhao-talendbj
03944cda7e fix(TUP-23571)issue for download jar to local nexus (#2644) 2019-08-07 10:51:33 +08:00
jiezhang-tlnd
7cb53dd732 fix(TUP-23998)Studio language not working as expected (#2643)
https://jira.talendforge.org/browse/TUP-23998
2019-08-06 15:31:06 +08:00
jiezhang-tlnd
cdbee411a0 fix(TUP-23998)Studio language not working as expected (#2642)
https://jira.talendforge.org/browse/TUP-23998
2019-08-06 14:43:22 +08:00
jiezhang-tlnd
085bc038a2 fix(TUP-20372) Use Project Settings is not checked as default for job (#2638)
* fix(TUP-20372) Use Project Settings is not checked as default for job
https://jira.talendforge.org/browse/TUP-20372

* fix(TUP-20372)[git] Use Project Settings is not checked as default for
job
https://jira.talendforge.org/browse/TUP-20372

* fix(TUP-20372)[git] Use Project Settings is not checked as default for
job
https://jira.talendforge.org/browse/TUP-20372
2019-08-06 10:48:49 +08:00
hbhong
666e9060fb TMDM-13806 Fixed "Guess" schema return an empty schema for Talend MDM connection (#2636) 2019-08-02 16:49:43 +08:00
jiezhang-tlnd
7de7c1c24a fix(TUP-23933)Metadata connection for Redshift SSO considers username & (#2637)
password as separate field
https://jira.talendforge.org/browse/TUP-23933
2019-08-02 10:32:14 +08:00
Emmanuel GALLOIS
faa61885aa fix(TDI-41662): change ExcelReader.parse signature (#2639) 2019-08-01 18:24:30 +02:00
jiezhang-tlnd
5f31fe7286 fix(TUP-23998)Studio language not working as expected (#2630)
* fix(TUP-23998)Studio language not working as expected
https://jira.talendforge.org/browse/TUP-23998

* fix(TUP-23998)Studio language not working as expected
https://jira.talendforge.org/browse/TUP-23998
2019-08-01 16:36:58 +08:00
sbliu
57c6b45cf0 TMDM-13648 fix the event loop exception when refreshing wizard page during edit receive type entity. 2019-08-01 02:40:21 +00:00
SunChaoqun
624c33c8ce TESB-24597:Docker Support for Microservice - CI Part (#2634) 2019-07-31 18:37:45 +08:00
Chao MENG
a2847353fa fix(TUP-20943): Code generates with an error when Pattern check fails if (#2629)
contain back slash
https://jira.talendforge.org/browse/TUP-20943
2019-07-31 17:39:35 +08:00
sbliu
e5306d1924 TMDM-13648 Metadata / Talend MDM / Export as context / Retrieve Entity => Error / entities list empty after Studio restart
* TMDM-13648 Fix bug that can not retrieve entity after connection parameters exported as context;
           fix bug that can not switch to previous page;
           fix can not set correct name after change the mdm concept type(mdm model).
           fix Spelling case error of password label when editing mdm connection.

* TMDM-13648 Show correct mdm file step form according to first step mdm type selection.

* TMDM-13648 Fix problem:
     1. Not editable for input/receive type schema page;
     2. Can not refresh receive type schema page according to selected entity;
     3. Can not perform finish for receive type schema page introduced by schema file deleted;
     4. thread exception caused by widget disposed.

* TMDM-13648 remove commented code.
2019-07-31 07:31:52 +00:00
Chao MENG
6ee8a1c151 Cmeng/bugfix/tup 23914 json wizard encoding (#2628)
* fix(TUP-23914): JSON with accented characters is not being recognized
when creating a new JSON file in Metadata.
https://jira.talendforge.org/browse/TUP-23914
2019-07-31 10:04:24 +08:00
qiongli
d826efb9e9 fix(TDQ-17308) Update the new driver name and mvn url (#2621) 2019-07-29 17:43:41 +08:00
jiezhang-tlnd
5ea77ef738 fix(TUP-23854)Can't create EDI until I open error log view (#2615)
https://jira.talendforge.org/browse/TUP-23854
2019-07-29 15:26:36 +08:00
Jane Ding
804d715dec fix(TUP-22943)checkbox with empty item name display on window Save (#2618)
Resources
https://jira.talendforge.org/browse/TUP-22943
2019-07-29 15:11:59 +08:00
hcyi
5dc7a930db fix(TUP-20928):Suggestable doesn't work for TextArea in Studio (#2626) 2019-07-29 14:55:57 +08:00
SunChaoqun
8f9a411c43 TESB-24597:Docker Support for Microservice - CI Part (#2606)
* TESB-24597:Docker Support for Microservice - CI Part
2019-07-26 10:39:51 +08:00
kjwang-talend
92fda0840e TUP-23950 Error in calling spark job from trunjob job inside standard (#2613) (#2614)
job
https://jira.talendforge.org/browse/TUP-23950
2019-07-25 17:52:16 +08:00
Chao MENG
17abd3cff4 fix(TUP-23984): JSON metadata wizard for output mode throws class cast (#2624)
exception on Linux and Mac
https://jira.talendforge.org/browse/TUP-23984
2019-07-25 15:41:46 +08:00
msjian
6f6943a58f chore(TDQ-16113): fix exception (#2623) 2019-07-25 14:30:41 +08:00
msjian
8a73c53a82 fix(TDQ-16113): fix not use insecure source of entropy (Random) (#2611) 2019-07-25 09:55:46 +08:00
Jane Ding
15396b7aa2 fix(TUP-23789)Pom files are not generated sometimes for the jobs in (#2610)
* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789

* fix(TUP-23789)Pom files are not generated sometimes for the jobs in
7.1.1
https://jira.talendforge.org/browse/TUP-23789
Add a junit.
2019-07-24 16:18:56 +08:00
jiezhang-tlnd
3e1101aebd fix(TUP-23588)For tCreateTable, the Database Type is always Mysql after dragging and dropping from database Metadata (#2603)
* fix(TUP-23588)For tCreateTable, the Database Type is always Mysql after
dragging and dropping from database Metadata

* fix(TUP-23588)For tCreateTable, the Database Type is always Mysql after
dragging and dropping from database Metadata
2019-07-23 10:10:43 +08:00
msjian
7dd62f1758 fix(TDQ-13393): readonly user logon remote project only can read (#2599) 2019-07-17 17:37:09 +08:00
pyzhou
5d20f69fb6 Fix(TDI-42572):upgrade EXAUtil version (#2602) 2019-07-17 10:07:20 +08:00
hzhao-talendbj
85a78d76b9 fix(TUP-23536)Component cannot share to Nexus3.15 from local (#2601) 2019-07-16 18:19:21 +08:00
jiezhang-tlnd
d26568a1f0 fix(TUP-23520)add junit (#2594) 2019-07-16 11:20:05 +08:00
zshen-talend
160da94c84 chor(TDQ-17069): remove unused code (#2522) 2019-07-15 15:53:53 +08:00
hcyi
9d3b31a842 fix(TUP-23743):ERROR when Job in MDM project calling Job in Reference DI (#2585)
project:import routines.DataQuality cannot be resolved.
2019-07-15 11:39:34 +08:00
hcyi
176e4b3f64 fix(TUP-23106):Tacokit components cannot be copy-pasted in Job Design (#2588)
* fix(TUP-23106):Tacokit components cannot be copy-pasted in Job Design

* fix(TUP-23106):Tacokit components cannot be copy-pasted in Job Design
2019-07-12 19:08:10 +08:00
sbliu
0e4896e7f9 TMDM-13549 Adapt the the dialog type and change the success connection message. 2019-07-11 08:59:34 +00:00
kjwang-talend
c907379c7b Fix TUP-22582 [CVE:high] Backend : (#2587)
pkg:maven/org.codehaus.plexus:plexus-utils:1.5.15 requires version
upgrade (Fix can't build job with sub job)
https://jira.talendforge.org/browse/TUP-22583
2019-07-10 15:08:06 +08:00
hzhao-talendbj
125546f661 fix(TUP-23701) DB connection settings screen does not display all field (#2584)
items
2019-07-10 10:30:54 +08:00
kjwang-talend
06112e76e2 Kjwang/fix tup 22582 cve plexus utils (#2581)
* Fix TUP-22582 [CVE:high] Backend :
pkg:maven/org.codehaus.plexus:plexus-utils:1.5.15 requires version
upgrade
https://jira.talendforge.org/browse/TUP-22583

* Fix TUP-22582 [CVE:high] Backend :
pkg:maven/org.codehaus.plexus:plexus-utils:1.5.15 requires version
upgrade
https://jira.talendforge.org/browse/TUP-22583

* Fix TUP-22582 [CVE:high] Backend :
pkg:maven/org.codehaus.plexus:plexus-utils:1.5.15 requires version
upgrade
https://jira.talendforge.org/browse/TUP-22583

* Fix TUP-22582 [CVE:high] Backend :
pkg:maven/org.codehaus.plexus:plexus-utils:1.5.15 requires version
upgrade
https://jira.talendforge.org/browse/TUP-22583

* Fix TUP-22582 [CVE:high] Backend :
pkg:maven/org.codehaus.plexus:plexus-utils:1.5.15 requires version
upgrade
https://jira.talendforge.org/browse/TUP-22583
2019-07-09 17:53:12 +08:00
Pingwen Lin
8648d38ee5 TMDM-13727 Remove dependency from Studio to MDM CE artifacts (#2582) 2019-07-08 14:19:45 +08:00
Zhiwei Xue
f0d02b4be9 refix assembly problem (#2578) 2019-07-05 18:14:18 +08:00
hzhao-talendbj
475dc1b0f4 fix(TUP-23363)'save the property' to metadata get error (#2574) 2019-07-05 10:50:00 +08:00
kjwang-talend
66203e0497 Fix TUP-22583 [CVE:high] Backend : pkg:maven/ch.qos.logback:logback-core:1.0.6 requires version upgrade (#2563)
* Fix TUP-22583 [CVE:high] Backend :
pkg:maven/ch.qos.logback:logback-core:1.0.6 requires version upgrade
https://jira.talendforge.org/browse/TUP-22583

* Fix TUP-22583 [CVE:high] Backend :
pkg:maven/ch.qos.logback:logback-core:1.0.6 requires version upgrade
https://jira.talendforge.org/browse/TUP-22583
2019-07-04 18:45:55 +08:00
Jane Ding
47391d8c10 fix(TUP-22200)Import XML tree from xsd file throw (#2565)
* fix(TUP-22200)Import XML tree from xsd file throw
indexOutOfBoundsException
https://jira.talendforge.org/browse/TUP-22200

* fix(TUP-22200)Import XML tree from xsd file throw
indexOutOfBoundsException
https://jira.talendforge.org/browse/TUP-22200

* fix(TUP-22200)Import XML tree from xsd file throw
indexOutOfBoundsException
https://jira.talendforge.org/browse/TUP-22200

* fix(TUP-22200)Import XML tree from xsd file throw
indexOutOfBoundsException
https://jira.talendforge.org/browse/TUP-22200
2019-07-04 10:24:43 +08:00
jiezhang-tlnd
06a591b004 fix(TUP-23371)Studio_will_dead_when_TAC_accidentally_disconnected (#2568)
* fix(TUP-23371)Studio_will_dead_when_TAC_accidentally_disconnected

* fix(TUP-23371): Studio_will_dead_when_TAC_accidentally_disconnected
https://jira.talendforge.org/browse/TUP-23371

* fix(TUP-23371)Studio will dead when TAC accidentally disconnected
https://jira.talendforge.org/browse/TUP-23371

* fix(TUP-23371)Studio will dead when TAC accidentally disconnected
https://jira.talendforge.org/browse/TUP-23371

* fix(TUP-23371)[GIT] Studio will dead when TAC accidentally disconnected
https://jira.talendforge.org/browse/TUP-23371

* fix(TUP-23371)[GIT] Studio will dead when TAC accidentally disconnected
https://jira.talendforge.org/browse/TUP-23371

* fix(TUP-23371)Studio will dead when TAC accidentally disconnected
2019-07-03 18:01:39 +08:00
Pierre Teyssier
6edb8fbcd0 TDI-42616 : bump tacokit/connector to 1.3.0-SNAPSHOT (#2572) 2019-07-03 15:20:51 +08:00
msjian
4583b8cb4c fix(TDQ-17268): for mssql datatime2 type should be interval (#2571) 2019-07-03 12:48:30 +08:00
jiezhang-tlnd
42ea72df1b fix(TUP-23520)Change schema order function doesnot work (#2543) 2019-07-03 10:48:31 +08:00
Ivan Gonchar
b6d46c501b chore(TDI-42600): upgrade Components version to 0.28.0-SNAPSHOT (#2569) 2019-07-03 09:24:48 +08:00
hcyi
85f5299f5e fix(TUP-23264):Studio can't find dependencies for tacokit components. (#2566) 2019-07-01 11:29:14 +08:00
Chao MENG
764d39dd8a fix(TUP-20577): [BUG]Cannot support 2 kinds of versions (#2554)
fix(TUP-20577): [BUG]Cannot support 2 kinds of versions
https://jira.talendforge.org/browse/TUP-20577
2019-07-01 11:10:19 +08:00
Irene Wang
97a8f63e69 Revert "DEVOPS-3416 Deploy all plugins for Black Duck scans"
This reverts commit c648e147a8.
2019-06-28 12:11:58 +02:00
78 changed files with 1367 additions and 533 deletions

View File

@@ -136,3 +136,4 @@ ArchiveDirectoryChooser.DataTransfer_browse=B&rowse...
ArchiveDirectoryChooser.WizardProjectsImportPage_ArchiveSelectTitle=Select &archive file:
ArchiveDirectoryChooser.FileExport_selectDestinationMessage=Select a directory to export to.
ArchiveDirectoryChooser.ArchiveExport_description=Export resources to an archive file on the local file system.
DisplayUtils.NotSupportedExceptionOnLinux=Linux/Unit doesn't support multiple display.

View File

@@ -20,6 +20,8 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.i18n.Messages;
import org.talend.commons.utils.system.EnvironmentUtils;
/**
* Utility methods to work with Display object
@@ -128,6 +130,13 @@ public class DisplayUtils {
}
public static void syncExecInNewUIThread(Runnable runnable, DeviceData deviceData) throws Exception {
/**
* Linux doesn't allow creating a display instance in a new thread after upgrading eclipse platform 4.10, we can
* remove this check if future eclipse version support it again
*/
if (EnvironmentUtils.isLinuxUnixSystem()) {
throw new UnsupportedOperationException(Messages.getString("DisplayUtils.NotSupportedExceptionOnLinux"));//$NON-NLS-1$
}
final Semaphore semaphore = new Semaphore(1, true);
semaphore.acquire();
Thread thread = new Thread(new Runnable() {

View File

@@ -22,6 +22,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
@@ -111,7 +112,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
*/
@Override
protected void execute(final boolean isFinalExecution, Object data) {
drawableComposite.getBgDrawableComposite().getDisplay().syncExec(new Runnable() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
if (isFinalExecution) {
@@ -339,7 +340,7 @@ public class BackgroundRefresher implements IBackgroundRefresher {
}
if ((WindowSystem.isGTK() || EnvironmentUtils.isMacOsSytem()) && child instanceof Tree) {
returnedPoint.y += ((Tree) child).getHeaderHeight();
returnedPoint.y += ((Table) child).getItemHeight();
returnedPoint.y += ((Tree) child).getItemHeight();
}
child = child.getParent();
ScrollBar vScrollBar = child.getVerticalBar();

View File

@@ -212,4 +212,5 @@ RenameFolderAction.warning.cannotFind.message=Cannot rename folder, it may have
RenameFolderAction.warning.cannotFind.title=Action not available
ConvertJobsUtil.warning.title=Warning
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Create stats log and implicit parameters

View File

@@ -2,12 +2,25 @@ package org.talend.core.repository.logintask;
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.LoginException;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.ICoreService;
import org.talend.core.repository.i18n.Messages;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.repository.utils.ProjectDataJsonProvider;
import org.talend.login.AbstractLoginTask;
import org.talend.repository.ProjectManager;
import org.talend.repository.RepositoryWorkUnit;
public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnableWithProgress {
@@ -20,7 +33,37 @@ public class SyncLibrariesLoginTask extends AbstractLoginTask implements IRunnab
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
coreService.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
try {
if (ProjectDataJsonProvider.hasFilledProjectSettingFile(ProjectManager.getInstance().getCurrentProject())) {
return;
}
} catch (PersistenceException e1) {
ExceptionHandler.process(e1);
return;
}
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(
new RepositoryWorkUnit<Void>(Messages.getString("SyncLibrariesLoginTask.createStatsLogAndImplicitParamter")) {
@Override
protected void run() throws LoginException, PersistenceException {
try {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
ProjectManager projectManager = ProjectManager.getInstance();
ISchedulingRule refreshRule = ruleFactory
.refreshRule(projectManager.getResourceProject(getProject().getEmfProject()));
workspace.run(new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
coreService.createStatsLogAndImplicitParamter(ProjectManager.getInstance().getCurrentProject());
}
}, refreshRule, IWorkspace.AVOID_UPDATE, monitor);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
});
}
}

View File

@@ -406,6 +406,38 @@ public class ProjectDataJsonProvider {
return null;
}
public static boolean hasFilledProjectSettingFile(org.talend.core.model.general.Project project) throws PersistenceException {
FileInputStream InputStream = null;
boolean hasFilled = false;
try {
IProject physProject = ResourceUtils.getProject(project);
IPath location = physProject.getLocation();
File file = ProjectDataJsonProvider.getLoadingConfigurationFile(location, FileConstants.PROJECTSETTING_FILE_NAME);
if (file != null && file.exists()) {
InputStream = new FileInputStream(file);
ProjectSettings projectSetting = new ObjectMapper().readValue(new FileInputStream(file), ProjectSettings.class);
if (projectSetting != null) {
ImplicitContextSettingJson implicitContextSettingJson = projectSetting.getImplicitContextSettingJson();
if (implicitContextSettingJson != null) {
ParametersTypeJson parametersTypeJson = implicitContextSettingJson.getParametersTypeJson();
if (parametersTypeJson != null) {
List<ElementParameterTypeJson> elementParameters = parametersTypeJson.getElementParameters();
if (elementParameters.size() > 0) {
hasFilled = true;
}
}
}
}
}
} catch (Exception e1) {
throw new PersistenceException(e1);
} finally {
closeInputStream(InputStream);
}
return hasFilled;
}
protected static ImplicitContextSettingJson getImplicitContextSettingJson(ImplicitContextSettings implicitContextSettings) {
if (implicitContextSettings != null) {
ImplicitContextSettingJson implicitContextSettingJson = new ImplicitContextSettingJson(implicitContextSettings);

View File

@@ -131,4 +131,22 @@ public class ProjectHelper {
}
return null;
}
/**
* define the different value for the project types the string value in the licence files Matcht the java enum name
* this is a copy of org.talend.commons.model.KeyConstants.ProjectType to avoid adding the all library
*
*/
public static enum ProjectType {
DI,
DQ,
MDM;
}
public static int getProjectTypeOrdinal(org.talend.core.model.properties.Project project) {
if (project != null && project.getType() != null) {
return ProjectType.valueOf(project.getType()).ordinal();
}
return 0;
}
}

View File

@@ -12,11 +12,14 @@
// ============================================================================
package org.talend.core;
import java.util.List;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.IProcess;
import org.talend.core.model.properties.Item;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.utils.IXSDPopulationUtil;
@@ -47,6 +50,8 @@ public interface IESBService extends IService {
public StringBuffer getAllTheJObNames(IRepositoryNode jobList);
public List<String> getSerivceRelatedJobIds(Item serviceItem);
public void deleteOldRelation(String jobID);
// public void setSelectedItem(Item, )
@@ -59,6 +64,8 @@ public interface IESBService extends IService {
public void copyDataServiceRelateJob(Item newItem);
public boolean isRESTService(ProcessItem processItem);
public IXSDPopulationUtil getXSDPopulationUtil();
public boolean isWSDLEditor(IWorkbenchPart part);

View File

@@ -316,7 +316,7 @@ public class ClassLoaderFactory {
String jarsStr = (String) metadataConn.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS);
moduleList = jarsStr.split(";"); //$NON-NLS-1$
} else {
String index = getDistributionIndex(metadataConn); //$NON-NLS-1$
String index = getDistributionIndex(metadataConn);
moduleList = getDriverModuleList(index);
}
return moduleList;
@@ -365,39 +365,41 @@ public class ClassLoaderFactory {
return hdClassLoader;
}
private static synchronized IConfigurationElement[] getConfigurationElements() {
if (isCacheChanged()) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
}
private static IConfigurationElement[] getConfigurationElements() {
checkCache();
return configurationElements;
}
private static boolean isCacheChanged() {
if (classLoadersMap == null) {
return true;
}
if (configurationElements == null) {
return true;
}
private synchronized static void checkCache() {
boolean isCacheChanged = false;
if (configurationElements != null) {
for (IConfigurationElement configElement : configurationElements) {
if (!configElement.isValid()) {
return true;
isCacheChanged = true;
}
}
}
if (cacheVersion != null && !cacheVersion.equals(BigDataBasicUtil.getDynamicDistributionCacheVersion())) {
return true;
if (!StringUtils.equals(cacheVersion, BigDataBasicUtil.getDynamicDistributionCacheVersion())) {
isCacheChanged = true;
}
if (isCacheChanged) {
init();
IExtensionRegistry registry = Platform.getExtensionRegistry();
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
cacheVersion = BigDataBasicUtil.getDynamicDistributionCacheVersion();
} else {
if (classLoadersMap == null) {
init();
}
if (configurationElements == null) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
configurationElements = registry.getConfigurationElementsFor(EXTENSION_POINT_ID);
}
}
return false;
}
private static Map<String, DynamicClassLoader> getClassLoaderMap() {
if (isCacheChanged()) {
init();
cacheVersion = BigDataBasicUtil.getDynamicDistributionCacheVersion();
}
checkCache();
return classLoadersMap;
}
}

View File

@@ -107,7 +107,7 @@ public enum EDatabaseVersion4Drivers {
PLUSPSQL_PRIOR_TO_V9(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL,
"Prior to v9", "PRIOR_TO_V9", "postgresql-8.4-703.jdbc4.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9.X", "V9_X", "postgresql-9.4-1201.jdbc41.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PLUSPSQL_V9_X(new DbVersion4Drivers(EDatabaseTypeName.PLUSPSQL, "v9 and later", "V9_X", "postgresql-9.4-1201.jdbc41.jar")), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IBMDB2(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$
"db2jcc_license_cisuz.jar" })), //$NON-NLS-1$
IBMDB2ZOS(new DbVersion4Drivers(EDatabaseTypeName.IBMDB2ZOS, new String[] { "db2jcc4.jar", "db2jcc_license_cu.jar", //$NON-NLS-1$ //$NON-NLS-2$

View File

@@ -153,7 +153,7 @@ public class MetadataTable implements IMetadataTable, Cloneable {
List<IMetadataColumn> temp = new ArrayList<IMetadataColumn>();
temp.addAll(this.listColumns);
temp.addAll(this.unusedColumns);
if (originalColumns != null) {
if (originalColumns != null && isRepository) {
Collections.sort(temp, new Comparator<IMetadataColumn>() {
@Override

View File

@@ -585,11 +585,6 @@ public final class MetadataToolHelper {
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
boolean avoidUsedColumnsFromInput) {
copyTable(source, target, targetDbms, avoidUsedColumnsFromInput, false);
}
public static void copyTable(IMetadataTable source, IMetadataTable target, String targetDbms,
boolean avoidUsedColumnsFromInput, boolean withCustoms) {
if (source == null || target == null) {
return;
}
@@ -609,7 +604,7 @@ public final class MetadataToolHelper {
List<IMetadataColumn> columnsTAdd = new ArrayList<IMetadataColumn>();
for (IMetadataColumn column : source.getListColumns(!avoidUsedColumnsFromInput)) {
IMetadataColumn targetColumn = target.getColumn(column.getLabel());
IMetadataColumn newTargetColumn = column.clone(withCustoms);
IMetadataColumn newTargetColumn = column.clone();
if (targetColumn == null) {
columnsTAdd.add(newTargetColumn);
newTargetColumn
@@ -674,7 +669,7 @@ public final class MetadataToolHelper {
List<IMetadataColumn> targetColumns = target.getListColumns();
List<String> temp = new ArrayList<String>(tColumns);
if (targetColumns != null) {
List<String> columnNames = new ArrayList<String>();
final List<String> columnNames = new ArrayList<String>();
for(IMetadataColumn column : targetColumns){
columnNames.add(column.getLabel());
}

View File

@@ -93,10 +93,10 @@ public class ComponentToRepositoryProperty {
// impossible to use OCI in oracle
IElementParameter elementParameter = node.getElementParameter("CONNECTION_TYPE"); //$NON-NLS-1$
if (elementParameter != null) {
if ("ORACLE_OCI".equals(elementParameter.getValue())) { //$NON-NLS-1$
if ("ORACLE_WALLET".equals(elementParameter.getValue())) { //$NON-NLS-1$
Shell shell = Display.getCurrent().getActiveShell();
String title = Messages.getString("ComponentToRepositoryProperty.error"); //$NON-NLS-1$
String message = Messages.getString("ComponentToRepositoryProperty.ImpossibleUseOCI"); //$NON-NLS-1$
String message = Messages.getString("ComponentToRepositoryProperty.ImpossibleUseWALLET"); //$NON-NLS-1$
MessageDialog.openError(shell, title, message);
return false;
}
@@ -503,6 +503,10 @@ public class ComponentToRepositoryProperty {
parameter = node.getElementParameter("CONNECTION_TYPE"); //$NON-NLS-1$
// if ("ORACLE_OCI".equals(parameter.getValue())) {
// }
if ("ORACLE_OCI".equals(parameter.getValue())) {
connection.setDatabaseType(EDatabaseTypeName.ORACLE_OCI.getDisplayName());
connection.setProductId(EDatabaseTypeName.ORACLE_OCI.getProduct());
}
if ("ORACLE_SERVICE_NAME".equals(parameter.getValue()) || "service_name".equals(parameter.getValue())) { //$NON-NLS-1$ //$NON-NLS-2$
connection.setDatabaseType(EDatabaseTypeName.ORACLESN.getDisplayName());
@@ -510,7 +514,8 @@ public class ComponentToRepositoryProperty {
} else if ("ORACLE_SID".equals(parameter.getValue()) || "sid".equals(parameter.getValue())) { //$NON-NLS-1$ //$NON-NLS-2$
connection.setDatabaseType(EDatabaseTypeName.ORACLEFORSID.getDisplayName());
connection.setProductId(EDatabaseTypeName.ORACLESN.getProduct());
} else if ("ORACLE_CUSTOM".equals(parameter.getValue()) || "rac".equals(parameter.getValue())) { //$NON-NLS-1$ //$NON-NLS-2$
} else if ("ORACLE_CUSTOM".equals(parameter.getValue()) || "rac".equals(parameter.getValue()) //$NON-NLS-1$ //$NON-NLS-2$
|| "ORACLE_RAC".equals(parameter.getValue())) {
connection.setDatabaseType(EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName());
connection.setProductId(EDatabaseTypeName.ORACLESN.getProduct());
}
@@ -668,6 +673,12 @@ public class ComponentToRepositoryProperty {
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLESN.getDisplayName())) {
setDatabaseValueForOracleSeverName(connection, node, param);
}
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLE_CUSTOM.getDisplayName())) {
setDatabaseValueForOracleCustom(connection, node, param);
}
if (connection.getDatabaseType().equals(EDatabaseTypeName.ORACLE_OCI.getDisplayName())) {
setDatabaseValueForOracleOci(connection, node, param);
}
if (connection.getDatabaseType().equals(EDatabaseTypeName.ACCESS.getDisplayName())) {
setDatabaseValueForAccess(connection, node, param);
}
@@ -683,6 +694,9 @@ public class ComponentToRepositoryProperty {
if (connection.getDatabaseType().equals(EDatabaseTypeName.PSQL.getDisplayName())) {
setDatabaseValueForPSQL(connection, node, param);
}
if (connection.getDatabaseType().equals(EDatabaseTypeName.PLUSPSQL.getDisplayName())) {
setDatabaseValueForPLUSPSQL(connection, node, param);
}
if (connection.getDatabaseType().equals(EDatabaseTypeName.SYBASEASE.getDisplayName())
|| connection.getDatabaseType().equals(EDatabaseTypeName.SYBASEIQ.getDisplayName())) {
setDatabaseValueForSysbase(connection, node, param);
@@ -699,6 +713,11 @@ public class ComponentToRepositoryProperty {
if (connection.getDatabaseType().equals(EDatabaseTypeName.GENERAL_JDBC.getDisplayName())) {
setDatabaseValueForJdbc(connection, node, param);
}
if (connection.getDatabaseType().equals(EDatabaseTypeName.MSSQL.getDisplayName())) {
setDatabaseValueForMSSql(connection, node, param);
}
}
/**
@@ -756,6 +775,53 @@ public class ComponentToRepositoryProperty {
}
}
private static void setDatabaseValueForOracleCustom(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param);
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.ORACLE_CUSTOM, value);
if (value != null) {
connection.setDbVersionString(dbVersionName);
}
}
if ("SID".equals(param.getRepositoryValue())) { //$NON-NLS-1$
if (param != null && "ORACLE_OCI".equals(param.getValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, node.getElementParameter("LOCAL_SERVICE_NAME")); //$NON-NLS-1$
if (value != null) {
connection.setSID(value);
}
} else {
String value = getParameterValue(connection, node, node.getElementParameter("DBNAME")); //$NON-NLS-1$
if (value != null) {
connection.setSID(value);
}
}
}
}
private static void setDatabaseValueForOracleOci(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param);
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.ORACLE_OCI, value);
if (value != null) {
connection.setDbVersionString(dbVersionName);
}
}
if ("SID".equals(param.getRepositoryValue())) { //$NON-NLS-1$
if (param != null && "ORACLE_OCI".equals(param.getValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, node.getElementParameter("LOCAL_SERVICE_NAME")); //$NON-NLS-1$
if (value != null) {
connection.setSID(value);
}
} else {
String value = getParameterValue(connection, node, node.getElementParameter("DBNAME")); //$NON-NLS-1$
if (value != null) {
connection.setSID(value);
}
}
}
}
private static void setDatabaseValueForAs400(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param);
@@ -797,6 +863,16 @@ public class ComponentToRepositoryProperty {
}
}
}
private static void setDatabaseValueForPLUSPSQL(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param);
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.PLUSPSQL, value);
if (value != null) {
connection.setDbVersionString(dbVersionName);
}
}
}
private static void setDatabaseValueForSysbase(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param); // $NON-NLS-1$
@@ -806,6 +882,16 @@ public class ComponentToRepositoryProperty {
}
}
}
private static void setDatabaseValueForMSSql(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DRIVER".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param);
String dbVersionName = EDatabaseVersion4Drivers.getDbVersionName(EDatabaseTypeName.MSSQL, value);
if (value != null) {
connection.setDbVersionString(dbVersionName);
}
}
}
private static void setDatabaseValueForAccess(DatabaseConnection connection, INode node, IElementParameter param) {
if ("DB_VERSION".equals(param.getRepositoryValue())) { //$NON-NLS-1$
String value = getParameterValue(connection, node, param);

View File

@@ -1697,6 +1697,11 @@ public class RepositoryToComponentProperty {
return "STANDARD";
}
}
if (value.equals("DBTYPE")) {
String repositoryType = connection.getDatabaseType();
EDatabaseTypeName typeFromDbType = EDatabaseTypeName.getTypeFromDbType(repositoryType);
return typeFromDbType.getXMLType();
}
return null;

View File

@@ -123,7 +123,8 @@ public enum EParameterFieldType {
TACOKIT_GUESS_SCHEMA,
TACOKIT_BUTTON,
TACOKIT_SUGGESTABLE_TABLE,
TACOKIT_VALUE_SELECTION;
TACOKIT_VALUE_SELECTION,
TACOKIT_TEXT_AREA_SELECTION;
public String getName() {
return toString();

View File

@@ -77,21 +77,24 @@ public final class ParameterValueUtil {
}
}
} else if (param.getValue() instanceof List) { // for TABLE
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
for (Map<String, Object> line : tableValues) {
for (String key : line.keySet()) {
Object cellValue = line.get(key);
if (cellValue instanceof String) { // cell is text so
// rename data if
// needed
String value = (String) cellValue;
if (value.contains(oldName)) {
// line.put(key, value.replaceAll(oldName,
// newName));
// String newValue = renameValues(value, oldName, newName, flag);
String newValue = splitQueryData(oldName, newName, value);
if (!value.equals(newValue)) {
line.put(key, newValue);
List tableValues = (List) param.getValue();
for (Object current : tableValues) {
if (current != null && current instanceof Map) {
Map<String, Object> line = (Map<String, Object>) current;
for (String key : line.keySet()) {
Object cellValue = line.get(key);
if (cellValue instanceof String) { // cell is text so
// rename data if
// needed
String value = (String) cellValue;
if (value.contains(oldName)) {
// line.put(key, value.replaceAll(oldName,
// newName));
// String newValue = renameValues(value, oldName, newName, flag);
String newValue = splitQueryData(oldName, newName, value);
if (!value.equals(newValue)) {
line.put(key, newValue);
}
}
}
}
@@ -721,13 +724,22 @@ public final class ParameterValueUtil {
return true;
}
} else if (param.getValue() instanceof List) { // for TABLE
List<Map<String, Object>> tableValues = (List<Map<String, Object>>) param.getValue();
for (Map<String, Object> line : tableValues) {
for (String key : line.keySet()) {
Object cellValue = line.get(key);
if (cellValue instanceof String) { // cell is text so
// test data
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
List tableValues = (List) param.getValue();
for (Object current : tableValues) {
if (current != null) {
if (current instanceof Map) {
Map<String, Object> line = (Map<String, Object>) current;
for (String key : line.keySet()) {
Object cellValue = line.get(key);
if (cellValue instanceof String) { // cell is text so
// test data
if (ParameterValueUtil.valueContains((String) cellValue, name)) {
return true;
}
}
}
} else if (current instanceof String) {
if (ParameterValueUtil.valueContains((String) current, name)) {
return true;
}
}

View File

@@ -23,6 +23,10 @@ public interface IAdditionalInfo {
void onEvent(final String event, final Object... parameters);
default Object func(final String funcName, final Object... params) throws Exception {
throw new UnsupportedOperationException();
}
void cloneAddionalInfoTo(final IAdditionalInfo targetAdditionalInfo);
}

View File

@@ -19,6 +19,7 @@ import java.util.Set;
import org.talend.core.model.general.ModuleNeeded;
import org.talend.core.model.process.JobInfo;
import org.talend.core.model.process.ProcessUtils;
/**
* DOC nrousseau class global comment. Detailled comment
@@ -78,7 +79,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<ModuleNeeded> getModulesNeededWithSubjobPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!modulesNeededWithSubjobPerJob.containsKey(key)) {
modulesNeededWithSubjobPerJob.put(key, new HashSet<ModuleNeeded>());
}
@@ -90,7 +91,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<ModuleNeeded> getModulesNeededPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!modulesNeededPerJob.containsKey(key)) {
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>());
}
@@ -103,7 +104,7 @@ public class LastGenerationInfo {
* @return the contextPerJob
*/
public Set<String> getContextPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!contextPerJob.containsKey(key)) {
contextPerJob.put(key, new HashSet<String>());
}
@@ -116,7 +117,7 @@ public class LastGenerationInfo {
* @param modulesNeededPerJob the modulesNeededPerJob to set
*/
public void setModulesNeededPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
modulesNeededPerJob.put(key, new HashSet<ModuleNeeded>(modulesNeeded));
}
@@ -125,8 +126,8 @@ public class LastGenerationInfo {
*
* @param modulesNeededWithSubjobPerJob the modulesNeededWithSubjobPerJob to set
*/
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
public void setModulesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<ModuleNeeded> modulesNeeded) {
String key = this.getProcessKey(jobId, jobVersion);
if (modulesNeeded == null) {
modulesNeededWithSubjobPerJob.put(key, null);
} else {
@@ -140,17 +141,17 @@ public class LastGenerationInfo {
* @param contextPerJob the contextPerJob to set
*/
public void setContextPerJob(String jobId, String jobVersion, Set<String> contexts) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
contextPerJob.put(key, new HashSet<String>(contexts));
}
public void setUseDynamic(String jobId, String jobVersion, boolean dynamic) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
useDynamic.put(key, dynamic);
}
public boolean isUseDynamic(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!useDynamic.containsKey(key)) {
return false;
}
@@ -162,12 +163,12 @@ public class LastGenerationInfo {
}
public void setUseRules(String jobId, String jobVersion, boolean useRules) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
this.useRules.put(key, useRules);
}
public boolean isUseRules(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!useRules.containsKey(key)) {
return false;
}
@@ -179,12 +180,12 @@ public class LastGenerationInfo {
}
public void setUsePigUDFs(String jobId, String jobVersion, boolean useRules) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
this.usedPigUDFs.put(key, useRules);
}
public boolean isUsePigUDFs(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!usedPigUDFs.containsKey(key)) {
return false;
}
@@ -251,7 +252,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<String> getRoutinesNeededPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!routinesNeededPerJob.containsKey(key)) {
routinesNeededPerJob.put(key, new HashSet<String>());
}
@@ -279,7 +280,8 @@ public class LastGenerationInfo {
}
private String getProcessKey(String jobId, String jobVersion) {
return jobId + "_" + jobVersion; //$NON-NLS-1$
String pureJobId = ProcessUtils.getPureItemId(jobId);
return pureJobId + "_" + jobVersion; //$NON-NLS-1$
}
/**
@@ -288,7 +290,7 @@ public class LastGenerationInfo {
* @return the pigudfNeededPerJob
*/
public Set<String> getPigudfNeededPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!pigudfNeededPerJob.containsKey(key)) {
pigudfNeededPerJob.put(key, new HashSet<String>());
}
@@ -302,7 +304,7 @@ public class LastGenerationInfo {
* @param modulesNeededPerJob the modulesNeededPerJob to set
*/
public void setRoutinesNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
routinesNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
}
@@ -312,7 +314,7 @@ public class LastGenerationInfo {
* @param pigudfNeededPerJob the pigudfNeededPerJob to set
*/
public void setPigudfNeededPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
pigudfNeededPerJob.put(key, new HashSet<String>(modulesNeeded));
}
@@ -321,7 +323,7 @@ public class LastGenerationInfo {
* @return the modulesNeededPerJob
*/
public Set<String> getRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!routinesNeededWithSubjobPerJob.containsKey(key)) {
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>());
}
@@ -334,7 +336,7 @@ public class LastGenerationInfo {
* @return the pigudfNeededWithSubjobPerJob
*/
public Set<String> getPigudfNeededWithSubjobPerJob(String jobId, String jobVersion) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
if (!pigudfNeededWithSubjobPerJob.containsKey(key)) {
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>());
}
@@ -348,7 +350,7 @@ public class LastGenerationInfo {
* @param modulesNeededPerJob the modulesNeededPerJob to set
*/
public void setRoutinesNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
routinesNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
}
@@ -358,7 +360,7 @@ public class LastGenerationInfo {
* @param pigudfNeededWithSubjobPerJob the pigudfNeededWithSubjobPerJob to set
*/
public void setPigudfNeededWithSubjobPerJob(String jobId, String jobVersion, Set<String> modulesNeeded) {
String key = jobId + "_" + jobVersion; //$NON-NLS-1$
String key = this.getProcessKey(jobId, jobVersion);
pigudfNeededWithSubjobPerJob.put(key, new HashSet<String>(modulesNeeded));
}

View File

@@ -71,7 +71,12 @@ public class ItemCacheManager {
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
} else {
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
processItem = getProcessItem(project, parsedArray[1]);
if (project != null) {
processItem = getProcessItem(project, parsedArray[1]);
}
if (processItem == null) {
processItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1]);
}
}
return processItem;
}
@@ -112,7 +117,12 @@ public class ItemCacheManager {
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
} else {
Project project = ProjectManager.getInstance().getProjectFromProjectTechLabel(parsedArray[0]);
refProcessItem = getProcessItem(project, parsedArray[1], version);
if (project != null) {
refProcessItem = getProcessItem(project, parsedArray[1], version);
}
if (refProcessItem == null) {
refProcessItem = getRefProcessItem(ProjectManager.getInstance().getCurrentProject(), parsedArray[1], version);
}
}
return refProcessItem;
}

View File

@@ -138,4 +138,6 @@ public interface IRepositoryService extends IService {
boolean isGIT();
public void setShouldCheckRepoViewCommonNavigatorDirty(IRepositoryView repView, boolean shouldFlag);
}

View File

@@ -152,11 +152,11 @@ public class FilteredCheckboxTree extends Composite {
*/
static {
ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID,
"$nl$/icons/full/etool16/clear_co.gif"); //$NON-NLS-1$
"$nl$/icons/full/etool16/clear_co.png"); //$NON-NLS-1$
if (descriptor != null) {
JFaceResources.getImageRegistry().put(CLEAR_ICON, descriptor);
}
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.gif"); //$NON-NLS-1$
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PlatformUI.PLUGIN_ID, "$nl$/icons/full/dtool16/clear_co.png"); //$NON-NLS-1$
if (descriptor != null) {
JFaceResources.getImageRegistry().put(DCLEAR_ICON, descriptor);
}

View File

@@ -47,7 +47,9 @@ import org.talend.commons.utils.VersionUtils;
import org.talend.core.CorePlugin;
import org.talend.core.model.genhtml.FileCopyUtils;
import org.talend.core.prefs.ITalendCorePrefConstants;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.ui.i18n.Messages;
import org.talend.repository.model.IProxyRepositoryFactory;
public abstract class I18nPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
@@ -138,19 +140,27 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
serbian = "Serbian"; //$NON-NLS-1$
}
String[][] entryNamesAndValues =
{ { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH), Locale.FRENCH.getLanguage() },
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE), "zh_CN" },
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN), Locale.GERMAN.getLanguage() },
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE), Locale.JAPANESE.getLanguage() },
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN), Locale.ITALIAN.getLanguage() },
{ "Brasil", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
{ spanish, "es" }, { russian, "ru" }, //$NON-NLS-1$ //$NON-NLS-2$
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA), "kr" }, { "Turkish", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
{ greek, "el" }, { "Hrvatski", "hr" }, { arabic, "ar" }, { serbian, "sr" }, { "Polski", "pl" },
{ "Romanian", "ro" }, { "Netherlands", "nl" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// // /$NON-NLS-7$
String slovak = "Sloven\u010dina";//$NON-NLS-1$
try {
utf8Bytes = slovak.getBytes("UTF8");//$NON-NLS-1$
slovak = new String(utf8Bytes, "UTF8");//$NON-NLS-1$
} catch (UnsupportedEncodingException e2) {
slovak = "Slovak";//$NON-NLS-1$
}
String[][] entryNamesAndValues = { { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() },
{ Locale.FRENCH.getDisplayLanguage(Locale.FRENCH) + " (French)", Locale.FRENCH.getLanguage() }, //$NON-NLS-1$
{ Locale.CHINESE.getDisplayLanguage(Locale.CHINESE) + " (Chinese)", "zh_CN" }, //$NON-NLS-1$ //$NON-NLS-2$
{ Locale.GERMAN.getDisplayLanguage(Locale.GERMAN) + " (German)", Locale.GERMAN.getLanguage() }, //$NON-NLS-1$
{ Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE) + " (Japanese)", Locale.JAPANESE.getLanguage() }, //$NON-NLS-1$
{ Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN) + " (Italian)", Locale.ITALIAN.getLanguage() }, //$NON-NLS-1$
{ "Brasil (Brazilian)", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$
{ spanish + " (Spanish)", "es" }, { russian + " (Russion)", "ru" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{ Locale.KOREA.getDisplayLanguage(Locale.KOREA) + " (Korean)", "kr" }, { "Turkish (Turkish)", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{ greek + " (Greek)", "el" }, { "Hrvatski (Croatian)", "hr" }, { arabic + " (Arabic)", "ar" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
{ serbian + " (Serbian)", "sr" }, { "Polski (Polish)", "pl" }, { "Romanian (Romanian)", "ro" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$
{ "Netherlands (Netherlands)", "nl" }, { slovak + " (Slovak)", "sk" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
{ "Current OS Language", Locale.getDefault().getLanguage() } };//$NON-NLS-1$
languageSelectionEditor = new OneLineComboFieldEditor(ITalendCorePrefConstants.LANGUAGE_SELECTOR,
Messages.getString("I18nPreferencePage.needRestart"), entryNamesAndValues, getFieldEditorParent()); //$NON-NLS-1$
addField(languageSelectionEditor);
@@ -219,6 +229,8 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
}
}
});
handleUserReadOnlyStatus(composite);
}
private void applyBabiliResource(String zipFileName) {
@@ -649,4 +661,27 @@ public abstract class I18nPreferencePage extends FieldEditorPreferencePage imple
fields.add(editor);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.PreferencePage#contributeButtons(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void contributeButtons(Composite parent) {
super.contributeButtons(parent);
handleUserReadOnlyStatus(parent);
}
/**
*
* When the user is read only for current project then setting composite is disable
*
* @param mainComposite
*/
public void handleUserReadOnlyStatus(Composite mainComposite) {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
if (factory.isUserReadOnlyOnCurrentProject()) {
mainComposite.setEnabled(false);
}
}
}

View File

@@ -16,7 +16,7 @@ import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.talend.commons.exception.WarningException;
import org.talend.commons.exception.ExceptionHandler;
/**
* cli class global comment. Detailled comment
@@ -104,26 +104,31 @@ public final class ProcessStreamTrashReaderUtil {
public static void readAndForget(final Process process) {
try {
final String encoding = "UTF-8";
// input stream thread
new Thread() {
public void run() {
InputStream is = process.getInputStream();
InputStreamReader din = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(din);
try {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getInputStream " + line); //$NON-NLS-1$
}
} catch (Exception ex) {
// nothing to do
} finally {
InputStream is = process.getInputStream();
InputStreamReader din = new InputStreamReader(is, encoding);
BufferedReader reader = new BufferedReader(din);
try {
is.close();
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getInputStream " + line); //$NON-NLS-1$
}
} catch (Exception ex) {
// nothing to do
} finally {
try {
is.close();
} catch (Exception ex) {
// nothing to do
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}.start();
@@ -132,23 +137,31 @@ public final class ProcessStreamTrashReaderUtil {
new Thread() {
public void run() {
InputStream is = process.getErrorStream();
InputStreamReader din = new InputStreamReader(is);
BufferedReader reader = new BufferedReader(din);
try {
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getErrorStream " + line); //$NON-NLS-1$
throw new WarningException("AAAAA");
}
} catch (Exception ex) {
// nothing to do
} finally {
InputStream is = process.getErrorStream();
InputStreamReader din = new InputStreamReader(is, encoding);
BufferedReader reader = new BufferedReader(din);
StringBuilder strBuilder = new StringBuilder();
try {
is.close();
String line = null;
while ((line = reader.readLine()) != null) {
System.out.println("getErrorStream " + line); //$NON-NLS-1$
strBuilder.append(line).append("\n");
}
} catch (Exception ex) {
// nothing to do
} finally {
try {
is.close();
} catch (Exception ex) {
// nothing to do
}
}
if (!strBuilder.toString().replaceAll("[\n]", " ").trim().isEmpty()) {
throw new Exception(strBuilder.toString());
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}.start();

View File

@@ -1073,9 +1073,11 @@ public class ProcessorUtilities {
JobInfo parentJob = jobInfo.getFatherJobInfo();
if (parentJob != null && (parentJob.getProcessor() != null)) {
for (JobInfo subJob : parentJob.getProcessor().getBuildChildrenJobs()) {
if (ProcessUtils.isSameProperty(subJob.getJobId(), jobInfo.getJobId(), false)) {
subJob.setProcessor(processor);
}
}
}
if (!timerStarted) {
@@ -2588,15 +2590,32 @@ public class ProcessorUtilities {
return doSupportDynamicHadoopConfLoading(property) && !isExportAsOSGI();
}
public static boolean isEsbJob(String processId, String version) {
return esbJobs.contains(esbJobKey(processId, version));
public static boolean isEsbJob(IProcess process) {
if (process instanceof IProcess2) {
Set<JobInfo> infos = ProcessorUtilities.getChildrenJobInfo(((IProcess2) process).getProperty().getItem(), false);
for (JobInfo jobInfo : infos) {
ProcessType processType = jobInfo.getProcessItem().getProcess();
EList<NodeType> nodes = processType.getNode();
for (NodeType nodeType : nodes) {
if (isEsbComponentName(nodeType.getComponentName())) {
return true;
}
}
}
return false;
}
return false;
}
private static void addEsbJob(JobInfo jobInfo) {
if (esbJobs.contains(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()))) {
return;
}
esbJobs.add(esbJobKey(jobInfo.getJobId(), jobInfo.getJobVersion()));
if (jobInfo.getFatherJobInfo() != null) {
addEsbJob(jobInfo.getFatherJobInfo());
@@ -2628,5 +2647,4 @@ public class ProcessorUtilities {
public static boolean isNeedProjectProcessId(String componentName) {
return "tRunJob".equalsIgnoreCase(componentName) || "cTalendJob".equalsIgnoreCase(componentName);
}
}

View File

@@ -10,7 +10,7 @@
<artifactId>studio-components-dependencies</artifactId>
<packaging>pom</packaging>
<properties>
<components.version>0.27.3</components.version>
<components.version>0.28.0-SNAPSHOT</components.version>
</properties>
<repositories>
<repository>

View File

@@ -10,7 +10,7 @@
<artifactId>studio-tacokit-dependencies</artifactId>
<packaging>pom</packaging>
<properties>
<tacokit.components.version>1.1.0</tacokit.components.version>
<tacokit.components.version>1.3.0-SNAPSHOT</tacokit.components.version>
</properties>
<repositories>
<repository>

View File

@@ -36,17 +36,36 @@
<artifactId>tycho-compiler-jdt</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
@@ -57,11 +76,49 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.24</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>

View File

@@ -684,6 +684,23 @@ public class AggregatorPomsHelper {
new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, runnableWithProgress);
}
public void syncParentJobPomsForPropertyChange(Property property) {
IRunProcessService runProcessService = getRunProcessService();
ProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
List<Relation> itemsHaveRelationWith = RelationshipItemBuilder.getInstance().getItemsHaveRelationWith(property.getId(),
property.getVersion());
try {
for (Relation relation : itemsHaveRelationWith) {
IRepositoryViewObject object = factory.getSpecificVersion(relation.getId(), relation.getVersion(), true);
if (runProcessService != null) {
runProcessService.generatePom(object.getProperty().getItem());
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
private String getModulePath(IFile pomFile) {
IFile parentPom = getProjectRootPom();
if (parentPom != null) {

View File

@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -43,6 +44,7 @@ import org.talend.designer.maven.launch.MavenPomCommandLauncher;
import org.talend.designer.maven.model.BuildCacheInfo;
import org.talend.designer.maven.model.TalendMavenConstants;
import org.talend.designer.maven.utils.MavenProjectUtils;
import org.talend.designer.maven.utils.PomIdsHelper;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IRunProcessService;
import org.talend.repository.ProjectManager;
@@ -314,7 +316,11 @@ public class BuildCacheManager {
model.setModules(new ArrayList<String>());
model.getModules().addAll(currentJobmodules);
model.getModules().addAll(currentJobletmodules);
Parent parent = new Parent();
parent.setGroupId(PomIdsHelper.getProjectGroupId());
parent.setArtifactId(PomIdsHelper.getProjectArtifactId());
parent.setVersion(PomIdsHelper.getProjectVersion());
model.setParent(parent);
PomUtil.savePom(null, model, pomFile);
}

View File

@@ -45,6 +45,7 @@ import org.talend.core.model.utils.JavaResourcesHelper;
import org.talend.core.runtime.maven.MavenArtifact;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.maven.MavenUrlHelper;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
import org.talend.core.runtime.projectsetting.IProjectSettingTemplateConstants;
import org.talend.core.runtime.repository.build.IMavenPomCreator;
import org.talend.core.ui.ITestContainerProviderService;
@@ -269,6 +270,7 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
protected void addChildrenDependencies(final List<Dependency> dependencies) {
String parentId = getJobProcessor().getProperty().getId();
final Set<JobInfo> clonedChildrenJobInfors = getJobProcessor().getBuildFirstChildrenJobs();
for (JobInfo jobInfo : clonedChildrenJobInfors) {
if (jobInfo.getFatherJobInfo() != null && jobInfo.getFatherJobInfo().getJobId().equals(parentId)) {
@@ -284,6 +286,10 @@ public abstract class AbstractMavenProcessorPom extends CreateMavenBundleTemplat
property = jobInfo.getProcessItem().getProperty();
groupId = PomIdsHelper.getJobGroupId(property);
artifactId = PomIdsHelper.getJobArtifactId(jobInfo);
if ("OSGI".equals(property.getAdditionalProperties().get(TalendProcessArgumentConstant.ARG_BUILD_TYPE))) {
artifactId = artifactId + "-bundle";
}
version = PomIdsHelper.getJobVersion(property);
// try to get the pom version of children job and load from the pom file.
String childPomFileName = PomUtil.getPomFileName(jobInfo.getJobName(), jobInfo.getJobVersion());

View File

@@ -33,7 +33,10 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Activation;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.Profile;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.CoreException;
@@ -742,12 +745,12 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
// add talend libs & codes
setupDependencySetNode(document, talendLibCoordinateMap, "lib", "${artifact.artifactId}.${artifact.extension}",
false);
false, false);
// add 3rd party libs <dependencySet>
setupDependencySetNode(document, _3rdDepLibMap, "lib", null, false);
setupDependencySetNode(document, _3rdDepLibMap, "lib", null, false, false);
// add jobs
setupDependencySetNode(document, jobCoordinateMap, "${talend.job.name}",
"${artifact.build.finalName}.${artifact.extension}", true);
"${artifact.build.finalName}.${artifact.extension}", true, false);
// add duplicate dependencies if exists
setupFileNode(document, duplicateLibs);
@@ -816,7 +819,7 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
}
protected void setupDependencySetNode(Document document, Map<String, Dependency> libIncludes, String outputDir,
String fileNameMapping, boolean useProjectArtifact) {
String fileNameMapping, boolean useProjectArtifact, boolean unpack) {
if (libIncludes.isEmpty()) {
return;
}
@@ -827,9 +830,11 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
Node dependencySetNode = document.createElement("dependencySet");
dependencySetsNode.appendChild(dependencySetNode);
Node outputDirNode = document.createElement("outputDirectory");
outputDirNode.setTextContent(outputDir);
dependencySetNode.appendChild(outputDirNode);
if (StringUtils.isNotBlank(outputDir)) {
Node outputDirNode = document.createElement("outputDirectory");
outputDirNode.setTextContent(outputDir);
dependencySetNode.appendChild(outputDirNode);
}
Node includesNode = document.createElement("includes");
dependencySetNode.appendChild(includesNode);
@@ -850,6 +855,12 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
useProjectArtifactNode.setTextContent(Boolean.toString(useProjectArtifact));
dependencySetNode.appendChild(useProjectArtifactNode);
if (unpack) {
Node unpackNode = document.createElement("unpack");
unpackNode.setTextContent(Boolean.TRUE.toString());
dependencySetNode.appendChild(unpackNode);
}
}
private void setupFileNode(Document document, Map<String, Set<Dependency>> duplicateDependencies) {
@@ -890,4 +901,40 @@ public class CreateMavenJobPom extends AbstractMavenProcessorPom {
}
}
protected Plugin addSkipDockerMavenPlugin() {
Plugin plugin = new Plugin();
plugin.setGroupId("io.fabric8");
plugin.setArtifactId("fabric8-maven-plugin");
plugin.setVersion("4.0.0");
Xpp3Dom skip = new Xpp3Dom("skip");
// skip.setValue("${docker.skip}");
skip.setValue("true");
Xpp3Dom configuration = new Xpp3Dom("configuration");
configuration.addChild(skip);
List<PluginExecution> pluginExecutions = new ArrayList<PluginExecution>();
PluginExecution pluginExecutionStart = new PluginExecution();
pluginExecutionStart.setId("start");
pluginExecutionStart.setPhase("none");
pluginExecutionStart.setConfiguration(configuration);
pluginExecutions.add(pluginExecutionStart);
PluginExecution pluginExecutionPushImage = new PluginExecution();
pluginExecutionPushImage.setId("push-image");
pluginExecutionPushImage.setPhase("none");
pluginExecutionPushImage.setConfiguration(configuration);
pluginExecutions.add(pluginExecutionPushImage);
plugin.setExecutions(pluginExecutions);
plugin.setConfiguration(configuration);
return plugin;
}
}

View File

@@ -33,11 +33,18 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IProgressMonitor;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.exception.PersistenceException;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.IESBService;
import org.talend.core.PluginChecker;
import org.talend.core.model.process.JobInfo;
import org.talend.core.model.properties.ProcessItem;
import org.talend.core.model.properties.Property;
import org.talend.core.model.relationship.Relation;
import org.talend.core.model.relationship.RelationshipItemBuilder;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.maven.MavenConstants;
import org.talend.core.runtime.process.ITalendProcessJavaProject;
import org.talend.core.runtime.process.TalendProcessArgumentConstant;
@@ -50,6 +57,7 @@ import org.talend.designer.maven.tools.AggregatorPomsHelper;
import org.talend.designer.maven.utils.PomIdsHelper;
import org.talend.designer.maven.utils.PomUtil;
import org.talend.designer.runprocess.IProcessor;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.utils.io.FilesUtils;
import org.w3c.dom.Document;
@@ -108,8 +116,9 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
@Override
protected Model createModel() {
Model model = super.createModel();
boolean isServiceOperation = isServiceOperation(getJobProcessor().getProperty());
List<Profile> profiles = model.getProfiles();
for (Profile profile : profiles) {
@@ -141,12 +150,23 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
}
model.setName(model.getName() + " Bundle");
model.addProperty("talend.job.finalName", "${talend.job.name}-bundle-${project.version}");
Build build = model.getBuild();
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
if (isServiceOperation || service.isRESTService((ProcessItem) getJobProcessor().getProperty().getItem())
|| isRouteOperation(getJobProcessor().getProperty())) {
build.addPlugin(addSkipDockerMavenPlugin());
}
if (isServiceOperation) {
model.addProperty("cloud.publisher.skip", "true");
Build build = model.getBuild();
build = model.getBuild();
List<Plugin> removePlugins = new ArrayList<Plugin>();
if (build != null) {
List<Plugin> plugins = build.getPlugins();
for (Plugin p : plugins) {
if (p.getArtifactId().equals("maven-deploy-plugin")) {
@@ -227,8 +247,8 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
try {
Document document = PomUtil.loadAssemblyFile(null, assemblyFile);
// add jobs
setupDependencySetNode(document, jobCoordinateMap, "${talend.job.name}",
"${artifact.build.finalName}.${artifact.extension}", true);
setupDependencySetNode(document, jobCoordinateMap, null, "${artifact.build.finalName}.${artifact.extension}", true,
true);
PomUtil.saveAssemblyFile(assemblyFile, document);
} catch (Exception e) {
ExceptionHandler.process(e);
@@ -260,14 +280,63 @@ public class CreateMavenStandardJobOSGiPom extends CreateMavenJobPom {
* @return
*/
public boolean isServiceOperation(Property property) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(property.getId(),
property.getVersion(), RelationshipItemBuilder.JOB_RELATION);
List<IRepositoryViewObject> serviceRepoList = null;
for (Relation relation : relations) {
if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) {
return true;
boolean isDataServiceOperation = false;
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
try {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
serviceRepoList = factory.getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class, "SERVICES"));
for (IRepositoryViewObject serviceItem : serviceRepoList) {
if (service != null) {
List<String> jobIds = service.getSerivceRelatedJobIds(serviceItem.getProperty().getItem());
if (jobIds.contains(property.getId())) {
isDataServiceOperation = true;
break;
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return false;
return isDataServiceOperation;
}
public boolean isRouteOperation(Property property) {
List<IRepositoryViewObject> routeRepoList = null;
boolean isRouteOperation = false;
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
try {
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
routeRepoList = factory.getAll(ERepositoryObjectType.valueOf(ERepositoryObjectType.class, "ROUTE"));
for (IRepositoryViewObject routeItem : routeRepoList) {
if (service != null) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(routeItem.getId(),
routeItem.getVersion(), RelationshipItemBuilder.JOB_RELATION);
for (Relation relation : relations) {
if (relation.getType() == RelationshipItemBuilder.JOB_RELATION) {
if (relation.getId().equals(property.getId())) {
isRouteOperation = true;
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return isRouteOperation;
}
}

View File

@@ -511,6 +511,10 @@ public class PomUtil {
return repoPath + "/" + artifactPath; //$NON-NLS-1$
}
public static String getLocalRepositoryPath() {
return MavenPlugin.getMaven().getLocalRepositoryPath();
}
/**
* Get absolute path for installed artifact
*
@@ -1127,4 +1131,20 @@ public class PomUtil {
|| pathname.getName().equals("m2e-lastUpdated.properties"); //$NON-NLS-1$
}
};
public static boolean checkIfJobDependencyExist(IFile parentJobPom, Property property) throws Exception {
boolean found = false;
Model model = MavenPlugin.getMavenModelManager().readMavenModel(parentJobPom);
String groupId = PomIdsHelper.getJobGroupId(property);
String artifactId = PomIdsHelper.getJobArtifactId(property);
String version = PomIdsHelper.getJobVersion(property);
for (Dependency dependency : model.getDependencies()) {
if (dependency.getGroupId().equals(groupId) && dependency.getArtifactId().equals(artifactId)
&& dependency.getVersion().equals(version)) {
found = true;
break;
}
}
return found;
}
}

View File

@@ -6,7 +6,7 @@
context="plugin:org.talend.libraries.jdbc.as400"
language="java"
message="Needed for AS400 jdbc plugin"
name="jt400_V5R3.jar" mvn_uri="mvn:org.talend.libraries/jt400_V5R3/6.0.0"
name="jt400-9.8.jar" mvn_uri="mvn:net.sf.jt400/jt400/9.8/jar"
required="true">
</libraryNeeded>
</extension>

View File

@@ -47,7 +47,7 @@
<artifactItem>
<groupId>org.talend.libraries</groupId>
<artifactId>talend-db-exasol</artifactId>
<version>2.1.2</version>
<version>2.1.3</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${libs.dir}</outputDirectory>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/mdm_webservice_tomcat.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.talend.libraries.mdm.webservice.ce</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -1,9 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: webservice.ce
Bundle-SymbolicName: org.talend.libraries.mdm.webservice.ce
Bundle-Version: 7.3.1.qualifier
Bundle-ClassPath: lib/mdm_webservice_tomcat.jar
Bundle-Vendor: Talend
Fragment-Host: org.talend.libraries.mdm
Export-Package: org.talend.mdm.webservice

View File

@@ -1,2 +0,0 @@
bin.includes = META-INF/,\
lib/mdm_webservice_tomcat.jar

View File

@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.talend.studio</groupId>
<artifactId>tcommon-studio-se</artifactId>
<version>7.3.1-SNAPSHOT</version>
<relativePath>../../../</relativePath>
</parent>
<artifactId>org.talend.libraries.mdm.webservice.ce</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-webservice-jar</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
<artifactItems>
<artifactItem>
<groupId>org.talend.mdm</groupId>
<artifactId>org.talend.mdm.webservice</artifactId>
<classifier>ce</classifier>
<version>${project.version}</version>
<overWrite>true</overWrite>
<destFileName>mdm_webservice_tomcat.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -36,7 +36,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.swt.formtools.Form;
@@ -282,6 +281,10 @@ public abstract class AbstractForm extends Composite {
this.listener = listener;
}
public ICheckListener getListener() {
return listener;
}
/**
* update Status of the Wizard OR of the label Status.
*
@@ -634,4 +637,8 @@ public abstract class AbstractForm extends Composite {
}
}
}
public ConnectionItem getConnectionItem() {
return this.connectionItem;
}
}

View File

@@ -19,20 +19,26 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.xerces.xs.XSModel;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.xsd.XSDImport;
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.XSDSchemaContent;
import org.osgi.framework.Bundle;
import org.talend.commons.exception.PersistenceException;
import org.talend.commons.runtime.xml.XmlUtil;
@@ -849,6 +855,61 @@ public class TreeUtil {
return schema;
}
/**
* There maybe some import reference schema for one main schema, check if they are exist or not DOC jding Comment
* method "getNotExistImportSchema".
*
* @return
*/
public static Set<String> getNotExistImportSchema(String schemaFileName, XSDSchema xsdSchema) {
Set<String> importRefSchemaNotExist = new HashSet<String>();
checkImportSchemaExist(importRefSchemaNotExist, schemaFileName, xsdSchema);
return importRefSchemaNotExist;
}
private static void checkImportSchemaExist(Set<String> importRefSchemaNotExist, String schemaFileName, XSDSchema xsdSchema) {
EList<XSDSchemaContent> contents = xsdSchema.getContents();
for (XSDSchemaContent xsdSchemaContent : contents) {
if (xsdSchemaContent instanceof XSDImport) {
XSDImport xsdImport = (XSDImport) xsdSchemaContent;
if (StringUtils.isEmpty(xsdImport.getSchemaLocation())) {
continue;
}
String schemaLocation = xsdImport.getSchemaLocation();
File importFile = new File(schemaLocation);
String existedFile = null;
if (importFile.isAbsolute()) {
if (!importFile.exists()) {
importRefSchemaNotExist.add(schemaLocation);
} else {
// check deep import schema
checkImportSchemaExist(importRefSchemaNotExist, schemaLocation, getXSDSchema(schemaLocation));
}
} else {
String parent = new File(schemaFileName).getParent();
File importSchemaFile = new File(parent, schemaLocation);
String canonicalPath = null;
try {
canonicalPath = importSchemaFile.getCanonicalPath();
} catch (IOException e) {
ExceptionHandler.process(e);
}
if (canonicalPath != null) {
if (!importSchemaFile.exists()) {
importRefSchemaNotExist.add(canonicalPath);
} else {
// check deep import schema
checkImportSchemaExist(importRefSchemaNotExist, canonicalPath, getXSDSchema(canonicalPath));
}
}
}
}
}
}
private static IPath getTempPath() {
Project project = ProjectManager.getInstance().getCurrentProject();
IProject fsProject = null;

View File

@@ -1739,6 +1739,8 @@ public class DBConnectionFillerImpl extends MetadataFillerImpl<DatabaseConnectio
// obviously
// the sql
// data type it is null and results in a NPE
} else if (typeName.toLowerCase().equals("datetime2")) { //$NON-NLS-1$
dataType = 93;
}
}

View File

@@ -454,7 +454,18 @@ public class ImportExportHandlersManager {
return 0;
}
});
Collections.sort(checkedItemRecords, new Comparator<ImportItem>() {
@Override
public int compare(ImportItem o1, ImportItem o2) {
if (o1.getRepositoryType().getType().equals("SERVICES")) {
return -1;
} else if (o2.getRepositoryType().getType().equals("SERVICES")) {
return 1;
}
return 0;
}
});
ImportCacheHelper importCacheHelper = ImportCacheHelper.getInstance();
try {
// cache

View File

@@ -10,10 +10,10 @@ MdmConceptWizardPage1_select_model=Select one model to create MDM metadata
MdmConceptWizardPage2_mdm_entity=MDM Entity
MdmConceptWizardPage3_mdm_entity=MDM Entity
MDMForm_check=Check
MDMForm_connect_successful=MDM connected successfully\!
MDMForm_connect_successful=Successful connection.
MDMForm_connection_failure=Failed to connect to MDM, please change MDM settings.
MDMForm_link_para=Link Parameter
MDMForm_pass=password
MDMForm_pass=Password
MDMForm_pass_null=Password can not be null\!
MDMForm_port_null=Port can not be null\!
MDMForm_server_url=Server URL

View File

@@ -24,7 +24,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.MessageBox;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.swt.formtools.Form;
import org.talend.commons.ui.swt.formtools.LabelledCombo;
@@ -258,10 +257,8 @@ public class MDMForm extends AbstractForm {
}
if (stub != null) {
page.setPageComplete(true);
MessageBox box = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WORKING | SWT.OK | SWT.CANCEL);
box.setText(Messages.getString("MDMForm_success")); //$NON-NLS-1$
box.setMessage(Messages.getString("MDMForm_connect_successful")); //$NON-NLS-1$
box.open();
MessageDialog.openInformation(Display.getCurrent().getActiveShell(), Messages.getString("MDMForm_success"),
Messages.getString("MDMForm_connect_successful"));
} else {
String titleMsg = Messages.getString("MDMForm_error_message");
String mainMsg = Messages.getString("MDMForm_connection_failure");
@@ -277,10 +274,6 @@ public class MDMForm extends AbstractForm {
*/
@Override
protected boolean checkFieldsValue() {
if (isContextMode()) {
return true;
}
if (mdmUsernameText.getCharCount() == 0) {
updateStatus(IStatus.ERROR, Messages.getString("MDMForm_username_null")); //$NON-NLS-1$
checkButton.setEnabled(false);

View File

@@ -16,12 +16,14 @@ import java.io.File;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.beanutils.BeanUtils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.xsd.XSDSchema;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
import org.talend.core.model.metadata.builder.connection.MDMConnection;
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
@@ -29,6 +31,7 @@ import org.talend.core.model.properties.ConnectionItem;
import org.talend.datatools.xml.utils.ATreeNode;
import org.talend.datatools.xml.utils.OdaException;
import org.talend.datatools.xml.utils.XSDPopulationUtil2;
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
import org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode;
import org.talend.metadata.managment.ui.wizard.metadata.xml.utils.TreeUtil;
import org.talend.repository.mdm.util.MDMUtil;
@@ -115,6 +118,21 @@ public abstract class AbstractMDMFileStepForm extends AbstractXmlStepForm {
// IPath temp = new Path(System.getProperty("user.dir")).append("temp");
// xsdFilePath = temp.toOSString() + "\\template.xsd";
MDMConnection mdmConn = (MDMConnection) connectionItem.getConnection();
if (mdmConn.isContextMode()) {
MDMConnection _mdmConn = ConnectionFactory.eINSTANCE.createMDMConnection();
try {
BeanUtils.copyProperties(_mdmConn, mdmConn);
} catch (Exception e) {
ExceptionHandler.process(e);
}
String username = ConnectionContextHelper.getParamValueOffContext(mdmConn, mdmConn.getUsername());
String password = ConnectionContextHelper.getParamValueOffContext(mdmConn, mdmConn.getPassword());
String serverurl = ConnectionContextHelper.getParamValueOffContext(mdmConn, mdmConn.getServerUrl());
_mdmConn.setUsername(username);
_mdmConn.setPassword(password);
_mdmConn.setServerUrl(serverurl);
mdmConn = _mdmConn;
}
File file = MDMUtil.getTempTemplateXSDFile();
xsdFilePath = file.getAbsolutePath();
try {

View File

@@ -14,17 +14,12 @@ package org.talend.repository.mdm.ui.wizard.concept;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
@@ -47,13 +42,10 @@ import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.model.properties.MDMConnectionItem;
import org.talend.core.model.properties.PropertiesFactory;
import org.talend.core.model.properties.Property;
import org.talend.core.model.repository.ERepositoryObjectType;
import org.talend.core.model.repository.IRepositoryViewObject;
import org.talend.core.model.repository.RepositoryManager;
import org.talend.core.model.update.RepositoryUpdateManager;
import org.talend.core.repository.model.ProxyRepositoryFactory;
import org.talend.core.runtime.CoreRuntimePlugin;
import org.talend.cwm.helper.ConnectionHelper;
import org.talend.datatools.xml.utils.ATreeNode;
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
import org.talend.metadata.managment.ui.wizard.RepositoryWizard;
@@ -63,8 +55,6 @@ import org.talend.repository.model.IRepositoryService;
import org.talend.repository.model.RepositoryNode;
import org.talend.repository.model.RepositoryNodeUtilities;
import orgomg.cwm.objectmodel.core.Package;
/**
* DOC hwang class global comment. Detailled comment
*/
@@ -241,24 +231,28 @@ public class CreateConceptWizard extends RepositoryWizard implements INewWizard
*/
@Override
public boolean performFinish() {
IPath sasPath = new Path(System.getProperty("user.dir")).append("temp");//$NON-NLS-1$ //$NON-NLS-2$
File sasDir = sasPath.toFile();
if (sasDir.exists()) {
delete(sasDir);
}
boolean success = false;
if (creation && schemaPage.isPageComplete()) {
// RepositoryUpdateManager.updateMultiSchema(connectionItem, oldMetadataTable, oldTableMap);
schemaPage.createMetadataTable();
updateRelation();
return true;
success = true;
} else if (!creation && tablePage.isPageComplete()) {
// applyCopy();
EObject eObject = metadataTable.eContainer();
RepositoryUpdateManager.updateMultiSchema(connectionItem, oldMetadataTable, oldTableMap);
updateRelation();
return true;
success = true;
}
return false;
IPath sasPath = new Path(System.getProperty("user.dir")).append("temp");//$NON-NLS-1$ //$NON-NLS-2$
File sasDir = sasPath.toFile();
if (sasDir.exists()) {
delete(sasDir);
}
return success;
}
// protected void applyCopy() {

View File

@@ -1035,6 +1035,7 @@ public class MDMOutputSchemaForm extends AbstractMDMFileStepForm {
String selectedEntity = null;
if (wizardPage != null && wizardPage.getPreviousPage() instanceof MdmConceptWizardPage2) {
selectedEntity = ((MdmConceptWizardPage2) wizardPage.getPreviousPage()).getSelectedEntity();
getSelectedTreeNode(xsdFilePath, selectedEntity);
}
initXmlTreeData(selectedEntity);
initSchemaTable();

View File

@@ -14,9 +14,11 @@ package org.talend.repository.mdm.ui.wizard.concept;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
@@ -31,6 +33,7 @@ import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.xsd.XSDSchema;
import org.talend.commons.ui.swt.formtools.Form;
import org.talend.commons.ui.swt.formtools.LabelledText;
import org.talend.commons.ui.swt.formtools.UtilsButton;
@@ -43,13 +46,17 @@ import org.talend.core.model.metadata.builder.connection.Concept;
import org.talend.core.model.metadata.builder.connection.ConceptTarget;
import org.talend.core.model.metadata.builder.connection.ConnectionFactory;
import org.talend.core.model.metadata.builder.connection.MDMConnection;
import org.talend.core.model.metadata.builder.connection.MdmConceptType;
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.metadata.builder.connection.XMLFileNode;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.core.ui.metadata.editor.MetadataEmfTableEditor;
import org.talend.core.ui.metadata.editor.MetadataEmfTableEditorView;
import org.talend.core.utils.TalendQuoteUtils;
import org.talend.datatools.xml.utils.ATreeNode;
import org.talend.datatools.xml.utils.OdaException;
import org.talend.datatools.xml.utils.XSDPopulationUtil2;
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
import org.talend.metadata.managment.ui.utils.ConnectionContextHelper;
import org.talend.repository.mdm.i18n.Messages;
@@ -62,7 +69,9 @@ import org.talend.repository.ui.wizards.metadata.connection.files.xml.TreePopula
*/
public class MDMTableForm extends AbstractMDMFileStepForm {
private static Logger log = Logger.getLogger(MDMTableForm.class);
private static final String XS_PREFIX = "xs:";
private static final Logger LOG = Logger.getLogger(MDMTableForm.class);
private static final int WIDTH_GRIDDATA_PIXEL = 750;
@@ -143,8 +152,8 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
.setText(Messages.getString("FileStep3.informationLabel") + " "); //$NON-NLS-1$ //$NON-NLS-2$
informationLabel.setSize(500, HEIGHT_BUTTON_PIXEL);
guessButton = new UtilsButton(compositeGuessButton,
Messages.getString("FileStep3.guess"), WIDTH_BUTTON_PIXEL, HEIGHT_BUTTON_PIXEL); //$NON-NLS-1$
guessButton = new UtilsButton(compositeGuessButton, Messages.getString("FileStep3.guess"), WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
HEIGHT_BUTTON_PIXEL);
guessButton.setToolTipText(Messages.getString("FileStep3.guessTip")); //$NON-NLS-1$
// Composite MetadataTableEditorView
@@ -169,8 +178,9 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
concept.setLabel(newName);
// Caz if the label of concept is empty, concept.getLabel() will get the concept name.
concept.setName(newName);
} else
} else {
concept.setLabel(newName);
}
}
/**
@@ -181,6 +191,7 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
// metadataNameText : Event modifyText
metadataNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
MetadataToolHelper.validateSchema(metadataNameText.getText());
changeConceptName(metadataNameText.getText());
@@ -200,6 +211,7 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
// metadataCommentText : Event modifyText
metadataCommentText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
metadataTable.setComment(metadataCommentText.getText());
}
@@ -208,6 +220,7 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
// add listener to tableMetadata (listen the event of the toolbars)
tableEditorView.getMetadataEditor().addAfterOperationListListener(new IListenableListListener() {
@Override
public void handleEvent(ListenableListEvent event) {
checkFieldsValue();
}
@@ -268,19 +281,39 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
* run a ShadowProcess to determined the Metadata.
*/
protected void runShadowProcess() {
MDMConnection connection2 = getConnection();
refreshMetaDataTable(((Concept) connection2.getSchemas().get(0)).getConceptTargets());
Concept concept = ((MdmConceptWizardPage3) getPage().getWizard().getPages()[2]).getConcept();
refreshMetaDataTable(concept);
checkFieldsValue();
return;
}
private void prepareColumnsFromXSD(List<MetadataColumn> columns, List<ConceptTarget> schemaTarget) {
private void prepareColumnsFromXSD(List<MetadataColumn> columns, Concept concept) {
Composite composite = Form.startNewGridLayout(this, 2, false, SWT.CENTER, SWT.CENTER);
composite.setVisible(false);
TreePopulator treePopulator = new TreePopulator(new Tree(composite, SWT.None));
ATreeNode node = null;
XSDSchema xsdSchema = ((CreateConceptWizard) getPage().getWizard()).getXSDSchema();
if (xsdSchema != null) {
String entityName = ((MdmConceptWizardPage2) getPage().getWizard().getPages()[1]).getSelectedEntity();
try {
List<ATreeNode> allRootNodes = (new XSDPopulationUtil2()).getAllRootNodes(xsdSchema);
Optional<ATreeNode> treeNode = allRootNodes.stream().filter(n -> n.getDataType().equals(entityName)).findFirst();
ATreeNode selectedNode = treeNode.isPresent() ? treeNode.get() : allRootNodes.get(0);
treePopulator.populateTree(xsdSchema, selectedNode, null);
} catch (OdaException ex) {
LOG.error("Error occurred while parsing xsd schema.", ex);
}
}
MdmConceptType conceptType = concept.getConceptType();
if (conceptType == MdmConceptType.INPUT || conceptType == MdmConceptType.RECEIVE) {
genColumnsByConceptTarget(columns, concept, treePopulator);
} else if (conceptType == MdmConceptType.OUTPUT) {
genColumnsByLoops(columns, concept, treePopulator);
}
}
private void genColumnsByConceptTarget(List<MetadataColumn> columns, Concept concept, TreePopulator treePopulator) {
MappingTypeRetriever retriever = MetadataTalendType.getMappingTypeRetriever("xsd_id"); //$NON-NLS-1$
for (ConceptTarget schema : schemaTarget) {
for (ConceptTarget schema : concept.getConceptTargets()) {
String relativeXpath = schema.getRelativeLoopExpression();
String fullPath = schema.getSchema().getLoopExpression();
if (isContextMode()) {
@@ -310,10 +343,41 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
if (curNode == null || retriever == null) {
metadataColumn.setTalendType(MetadataTalendType.getDefaultTalendType());
} else {
metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType("xs:" + curNode.getOriginalDataType())); //$NON-NLS-1$
String originalDataType = curNode.getOriginalDataType();
if (!originalDataType.startsWith(XS_PREFIX)) {
originalDataType = XS_PREFIX + originalDataType;
}
metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType(originalDataType));
columns.add(metadataColumn);
}
}
}
}
private void genColumnsByLoops(List<MetadataColumn> columns, Concept concept, TreePopulator treePopulator) {
MappingTypeRetriever retriever = MetadataTalendType.getMappingTypeRetriever("xsd_id"); //$NON-NLS-1$
for (EObject eobj : concept.eContents()) {
XMLFileNode node = (XMLFileNode) eobj;
if (!node.getRelatedColumn().equals("")) {
String fullPath = node.getXMLPath();
TreeItem treeItem = treePopulator.getTreeItem(fullPath);
if (treeItem != null) {
ATreeNode curNode = (ATreeNode) treeItem.getData();
MetadataColumn metadataColumn = ConnectionFactory.eINSTANCE.createMetadataColumn();
metadataColumn
.setLabel(tableEditorView.getMetadataEditor().getNextGeneratedColumnName(node.getRelatedColumn()));
if (curNode == null || retriever == null) {
metadataColumn.setTalendType(MetadataTalendType.getDefaultTalendType());
} else {
String originalDataType = curNode.getOriginalDataType();
if (!originalDataType.startsWith(XS_PREFIX)) {
originalDataType = XS_PREFIX + originalDataType;
}
metadataColumn.setTalendType(retriever.getDefaultSelectedTalendType(originalDataType));
}
columns.add(metadataColumn);
}
columns.add(metadataColumn);
}
}
}
@@ -323,7 +387,7 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
*
* @param csvArray
*/
public void refreshMetaDataTable(List<ConceptTarget> schemaTarget) {
public void refreshMetaDataTable(Concept concept) {
informationLabel.setText(" " + Messages.getString("FileStep3.guessIsDone")); //$NON-NLS-1$ //$NON-NLS-2$
// clear all items
@@ -333,7 +397,7 @@ public class MDMTableForm extends AbstractMDMFileStepForm {
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection(), true);
}
prepareColumnsFromXSD(columns, schemaTarget);
prepareColumnsFromXSD(columns, concept);
tableEditorView.getMetadataEditor().addAll(columns);
checkFieldsValue();

View File

@@ -191,11 +191,6 @@ public class MDMXSDFileForm extends AbstractMDMFileStepForm {
}
fieldsModel.setConcept(concept.getConceptTargets());
fieldsTableEditorView.getTableViewerCreator().layout();
if (isContextMode()) {
adaptFormToEditable();
}
}
@Override
@@ -621,11 +616,6 @@ public class MDMXSDFileForm extends AbstractMDMFileStepForm {
this.linker.createLinks();
}
checkFilePathAndManageIt();
if (isContextMode()) {
adaptFormToEditable();
}
}
}

View File

@@ -12,8 +12,8 @@
// ============================================================================
package org.talend.repository.mdm.ui.wizard.concept;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.widgets.Composite;
import org.talend.core.model.metadata.builder.connection.MdmConceptType;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.metadata.managment.ui.wizard.AbstractForm;
@@ -25,6 +25,8 @@ import org.talend.repository.model.RepositoryNode;
*/
public class MdmConceptWizardPage2 extends AbstractRetrieveConceptPage {
private MdmConceptType oldConceptType;
private SetNameForm form;
private String[] existingNames;
@@ -38,6 +40,7 @@ public class MdmConceptWizardPage2 extends AbstractRetrieveConceptPage {
this.existingNames = existingNames;
this.isRepositoryObjectEditable = isRepositoryObjectEditable;
this.oldConceptType = getConcept().getConceptType();
}
/*
@@ -80,15 +83,15 @@ public class MdmConceptWizardPage2 extends AbstractRetrieveConceptPage {
return form.getSelectedEntity();
}
@Override
public IWizardPage getPreviousPage() {
return null;
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
MdmConceptType conceptType = concept.getConceptType();
if (conceptType != oldConceptType) {
form.fireConceptTypeChange();
oldConceptType = conceptType;
}
((CreateConceptWizard) getWizard()).setCurrentPage(this);
}
}

View File

@@ -13,11 +13,14 @@
package org.talend.repository.mdm.ui.wizard.concept;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.widgets.Composite;
import org.talend.core.model.metadata.builder.connection.MdmConceptType;
import org.talend.core.model.metadata.builder.connection.MetadataTable;
import org.talend.core.model.properties.ConnectionItem;
import org.talend.metadata.managment.ui.wizard.AbstractForm;
import org.talend.metadata.managment.ui.wizard.AbstractForm.ICheckListener;
import org.talend.repository.mdm.i18n.Messages;
import org.talend.repository.model.RepositoryNode;
@@ -53,16 +56,9 @@ public class MdmConceptWizardPage3 extends AbstractRetrieveConceptPage {
*/
public void createControl(Composite parent) {
if (getConcept() != null) {
if (MdmConceptType.INPUT.equals(getConcept().getConceptType())) {
if (getPreviousPage() instanceof MdmConceptWizardPage2) {
xsdFileForm = new MDMXSDFileForm(parent, connectionItem, metadataTable, getConcept(), this, creation);
}
} else if (MdmConceptType.OUTPUT.equals(getConcept().getConceptType())) {
xsdFileForm = new MDMOutputSchemaForm(parent, connectionItem, metadataTable, getConcept(), this, creation);
} else if (MdmConceptType.RECEIVE.equals(getConcept().getConceptType())) {
xsdFileForm = new MdmReceiveForm(parent, connectionItem, metadataTable, getConcept(), this, creation);
}
xsdFileForm.setReadOnly(!isRepositoryObjectEditable);
container = new Composite(parent, SWT.NONE);
StackLayout stackLayout = getContainerLayout();
container.setLayout(stackLayout);
AbstractForm.ICheckListener listener = new AbstractForm.ICheckListener() {
@@ -77,25 +73,73 @@ public class MdmConceptWizardPage3 extends AbstractRetrieveConceptPage {
}
}
};
xsdFileForm.setListener(listener);
this.setPageComplete(false);
setControl(xsdFileForm);
xsdFileForm.setPage(this);
mdmXsdFileForm = new MDMXSDFileForm(container, connectionItem, metadataTable, getConcept(), this, creation);
mdmOutputFileForm = new MDMOutputSchemaForm(container, connectionItem, metadataTable, getConcept(), this, creation);
mdmReceiveFileForm = new MdmReceiveForm(container, connectionItem, metadataTable, getConcept(), this, creation);
for (AbstractMDMFileStepForm fileForm : new AbstractMDMFileStepForm[] { mdmXsdFileForm, mdmOutputFileForm,
mdmReceiveFileForm }) {
fileForm.setReadOnly(!isRepositoryObjectEditable);
fileForm.setListener(listener);
fileForm.setPage(this);
}
setTopControl();
setControl(container);
setPageComplete(false);
}
}
private void setTopControl() {
StackLayout stackLayout = getContainerLayout();
if (MdmConceptType.INPUT.equals(getConcept().getConceptType())) {
if (getPreviousPage() instanceof MdmConceptWizardPage2) {
stackLayout.topControl = mdmXsdFileForm;
}
} else if (MdmConceptType.OUTPUT.equals(getConcept().getConceptType())) {
stackLayout.topControl = mdmOutputFileForm;
} else if (MdmConceptType.RECEIVE.equals(getConcept().getConceptType())) {
stackLayout.topControl = mdmReceiveFileForm;
}
xsdFileForm = (AbstractMDMFileStepForm) stackLayout.topControl;
}
private StackLayout stackLayout;
private MDMXSDFileForm mdmXsdFileForm;
private MDMOutputSchemaForm mdmOutputFileForm;
private MdmReceiveForm mdmReceiveFileForm;
private Composite container;
private StackLayout getContainerLayout() {
if (stackLayout == null) {
stackLayout = new StackLayout();
}
return stackLayout;
}
// public void setConceptName(String name) {
// xsdFileForm.setConceptName(name);
// }
//
public void createMetadataTable() {
ICheckListener listener = xsdFileForm.getListener();
xsdFileForm.setListener(null);
xsdFileForm.createTable();
xsdFileForm.setListener(listener);
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
setTopControl();
container.layout();
((CreateConceptWizard) getWizard()).setCurrentPage(this);
}
}

View File

@@ -54,12 +54,16 @@ public class MdmConceptWizardPage4 extends WizardPage {
*
* @see IDialogPage#createControl(Composite)
*/
@Override
public void createControl(final Composite parent) {
tableForm = new MDMTableForm(parent, connectionItem, metadataTable, TableHelper.getTableNames(connectionItem
tableForm = new MDMTableForm(parent, connectionItem, metadataTable,
TableHelper.getTableNames(connectionItem
.getConnection(), metadataTable.getLabel()));
tableForm.setPage(this);
tableForm.setReadOnly(!isRepositoryObjectEditable);
final AbstractForm.ICheckListener listener = new AbstractForm.ICheckListener() {
@Override
public void checkPerformed(final AbstractForm source) {
if (source.isStatusOnError()) {
MdmConceptWizardPage4.this.setPageComplete(false);

View File

@@ -139,8 +139,6 @@ public class MdmReceiveForm extends AbstractMDMFileStepForm {
private boolean creation;
private boolean populated;
/**
* Constructor to use by RCP Wizard.
*
@@ -202,11 +200,6 @@ public class MdmReceiveForm extends AbstractMDMFileStepForm {
} else {
prefixCombo.setText(getXPathPrefix(concept.getXPathPrefix()));
}
if (isContextMode()) {
adaptFormToEditable();
}
}
@Override
@@ -637,10 +630,6 @@ public class MdmReceiveForm extends AbstractMDMFileStepForm {
}
private void populateTree() {
if (populated) {
return;
}
populated = true;
String selectedEntity = null;
if (wizardPage != null && wizardPage.getPreviousPage() instanceof MdmConceptWizardPage2) {
selectedEntity = ((MdmConceptWizardPage2) wizardPage.getPreviousPage()).getSelectedEntity();
@@ -668,11 +657,6 @@ public class MdmReceiveForm extends AbstractMDMFileStepForm {
this.linker.createLinks();
}
checkFilePathAndManageIt();
if (isContextMode()) {
adaptFormToEditable();
}
}
private void resetStatusIfNecessary(String selectedEntity) {

View File

@@ -161,18 +161,6 @@ public class SetNameForm extends AbstractMDMFileStepForm {
public void modifyText(ModifyEvent e) {
selectedEntity = entityCombo.getText();
String type = ""; //$NON-NLS-1$
switch (concept.getConceptType()) {
case INPUT:
type = "In"; //$NON-NLS-1$
break;
case OUTPUT:
type = "Out"; //$NON-NLS-1$
break;
case RECEIVE:
type = "Receive"; //$NON-NLS-1$
break;
}
selectedEntity = selectedEntity.trim();
@@ -186,17 +174,7 @@ public class SetNameForm extends AbstractMDMFileStepForm {
selectedEntity = "a" + selectedEntity; //$NON-NLS-1$
}
String name = selectedEntity + type;
int counter = 0;
boolean exists = true;
while (exists) {
exists = !isValidName(name);
if (!exists) {
break;
}
counter++;
name = name + counter;
}
String name = getNextName();
if (creation || firstTime != true) {
nameText.setText(name);
@@ -208,6 +186,34 @@ public class SetNameForm extends AbstractMDMFileStepForm {
});
}
private String getNextName() {
String type = ""; //$NON-NLS-1$
switch (concept.getConceptType()) {
case INPUT:
type = "In"; //$NON-NLS-1$
break;
case OUTPUT:
type = "Out"; //$NON-NLS-1$
break;
case RECEIVE:
type = "Receive"; //$NON-NLS-1$
break;
}
String name = selectedEntity + type;
int counter = 0;
boolean exists = true;
while (exists) {
exists = !isValidName(name);
if (!exists) {
break;
}
counter++;
name = name + counter;
}
return name;
}
private boolean isValidName(String name) {
if (existingNames == null) {
return true;
@@ -318,6 +324,10 @@ public class SetNameForm extends AbstractMDMFileStepForm {
}
}
public void fireConceptTypeChange() {
nameText.setText(getNextName());
}
public String getSelectedEntity() {
return this.selectedEntity;
}

View File

@@ -8,7 +8,7 @@ public class Messages extends MessagesCore {
private static final String BUNDLE_NAME = "org.talend.repository.metadata.i18n.messages"; //$NON-NLS-1$
private static final String PLUGIN_ID = "org.talend.repository.metadata"; //$NON-NLS-1$
public static final String PLUGIN_ID = "org.talend.repository.metadata"; //$NON-NLS-1$
private static ResourceBundle resourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);

View File

@@ -1409,6 +1409,7 @@ XmlFileStep1.sourceSchema=Source Schema
XmlFileStep1Form.limitation=Limit
XmlFileStep1Form.limitToolTip=Limit the hierarchy depth to {0} levels.
XmlFileStep1Form.notFound="{0}" is not found or the xml format is incorrect.
XmlFileStep1Form.ImportSchemaNotExistError=Required reference schema files are missing.
XmlFileStep2Form.previewNotAvailable=No preview available for XSD file
XmlFileWizard.windowTitleCreate=New Xml File
XmlFileWizard.windowTitleUpdate=Edit an existing Xml File
@@ -1457,4 +1458,7 @@ DatabaseForm.ZnodeParent.checkBtn=Set Zookeeper znode parent
DatabaseForm.maprdb.tableInfo.tableNSMapping.label=Table Namespace mappings
DatabaseForm.set_table_ns_mapping.checkBtn=Set table Namespace mappings
BrowerDialog.empryUrl=the url can not be empty
DatabaseForm.canNotUsableInDataProfiler=some database types are not usable in the Data Profiler perspective.
DatabaseForm.canNotUsableInDataProfiler=some database types are not usable in the Data Profiler perspective.
ImportTreeFromXMLAction.ImportSchemaNotExistError=Required reference schema files are missing.
ImportTreeFromXMLAction.schemaFileNotExistDetailTitle=The following files do not exist:

View File

@@ -35,7 +35,6 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.EMap;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -57,7 +56,6 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
@@ -904,19 +902,7 @@ public class DatabaseForm extends AbstractForm {
@Override
public void controlResized(ControlEvent e) {
Rectangle r = scrolledComposite.getClientArea();
// scrolledComposite.setMinSize(newParent.computeSize(r.width-100, 550));
if (getConnection().getDatabaseType() != null
&& getConnection().getDatabaseType().equals(EDatabaseConnTemplate.HIVE.getDBDisplayName())) {
if (Platform.getOS().equals(Platform.OS_LINUX)) {
scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, 900));
} else {
scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, 820));
}
} else {
scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, 550));
}
scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
});
}
@@ -1779,6 +1765,9 @@ public class DatabaseForm extends AbstractForm {
hiveExecutionGrp.setVisible(!hide);
hiveExecutionGrp.setLayoutData(hadoopData);
hiveExecutionGrp.getParent().layout();
if (!hide) {
adjustScrolledComHeight();
}
}
private void initForHBaseAuthentication() {
@@ -2058,6 +2047,7 @@ public class DatabaseForm extends AbstractForm {
}
urlConnectionStringText.setText(getStringConnection());
modifyFieldValue();
adjustScrolledComHeight();
}
});
@@ -2116,6 +2106,7 @@ public class DatabaseForm extends AbstractForm {
}
authenticationGrpForHBase.layout();
authenticationGrpForHBase.getParent().layout();
adjustScrolledComHeight();
}
});
@@ -2134,6 +2125,7 @@ public class DatabaseForm extends AbstractForm {
authenticationComForHBase.getParent().layout();
authenticationGrpForHBase.layout();
authenticationGrpForHBase.getParent().layout();
adjustScrolledComHeight();
}
});
@@ -2311,6 +2303,7 @@ public class DatabaseForm extends AbstractForm {
}
authenticationGrpForMaprdb.layout();
authenticationGrpForMaprdb.getParent().layout();
adjustScrolledComHeight();
}
});
@@ -2329,6 +2322,7 @@ public class DatabaseForm extends AbstractForm {
authenticationComForMaprdb.getParent().layout();
authenticationGrpForMaprdb.layout();
authenticationGrpForMaprdb.getParent().layout();
adjustScrolledComHeight();
}
});
@@ -2421,6 +2415,7 @@ public class DatabaseForm extends AbstractForm {
}
authenticationGrpForMaprdb.layout();
authenticationGrpForMaprdb.getParent().layout();
adjustScrolledComHeight();
}
});
@@ -2493,6 +2488,7 @@ public class DatabaseForm extends AbstractForm {
authenticationGrp.getParent().layout();
getConnection().getParameters().put(ConnParameterKeys.CONN_PARA_KEY_USEKEYTAB, "false"); //$NON-NLS-1$
}
adjustScrolledComHeight();
}
});
@@ -2523,6 +2519,7 @@ public class DatabaseForm extends AbstractForm {
}
updateSSLEncryptionDetailsDisplayStatus();
urlConnectionStringText.setText(getStringConnection());
adjustScrolledComHeight();
}
});
@@ -2715,6 +2712,7 @@ public class DatabaseForm extends AbstractForm {
String.valueOf(useSSLEncryption.getSelection()));
updateSSLEncryptionDetailsDisplayStatus();
urlConnectionStringText.setText(getStringConnection());
adjustScrolledComHeight();
}
}
@@ -4016,6 +4014,7 @@ public class DatabaseForm extends AbstractForm {
moveButton.setToolTipText(Messages.getString("DatabaseForm.hideContext")); //$NON-NLS-1$
moveButton.setText(DOWN);
}
adjustScrolledComHeight();
}
});
}
@@ -6624,10 +6623,12 @@ public class DatabaseForm extends AbstractForm {
schemaText.hide();
}
}
if(asRedshiftSSOVersionEnable()) {
passwordText.hide();
usernameText.hide();
}
if (asRedshiftSSOVersionEnable()) {
passwordText.hide();
usernameText.hide();
addContextParams(EDBParamName.Login, false);
addContextParams(EDBParamName.Password, false);
}
doHiveUIContentsLayout();
hbaseSettingGroup.layout();
maprdbSettingGroup.layout();
@@ -8701,4 +8702,8 @@ public class DatabaseForm extends AbstractForm {
}
return getConnection().getDatabaseType();
}
private void adjustScrolledComHeight() {
scrolledComposite.setMinSize(newParent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}

View File

@@ -225,7 +225,7 @@ public class ExcelReader {
try {
com.talend.excel.xssf.event.ExcelReader reader = new com.talend.excel.xssf.event.ExcelReader();
reader.addSheetName(sheetName, false);
reader.parse(excelPath, "UTF-8");//$NON-NLS-1$
reader.parse(excelPath, "UTF-8", null);//$NON-NLS-1$
while (reader.hasNext()) {
if (recordReadRow >= maximumRowsToPreview) {
reader.stopRead();

View File

@@ -22,6 +22,8 @@ import org.talend.datatools.xml.utils.ATreeNode;
*/
public abstract class AbstractTreePopulator {
private String encoding;
protected String filePath;
protected static int limit;
@@ -36,6 +38,14 @@ public abstract class AbstractTreePopulator {
abstract public String getAbsoluteXPath(TreeItem treeItem);
public String getEncoding() {
return this.encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
/**
* Getter for filePath.
*

View File

@@ -95,7 +95,7 @@ public class JsonTreePopulator extends AbstractTreePopulator {
SchemaPopulationUtil.fetchTreeNode((JsonTreeNode) selectedEntity, 1);
treeNode = (ATreeNode) selectedEntity;
} else {
treeNode = SchemaPopulationUtil.getSchemaTree(fileValue, limit);
treeNode = SchemaPopulationUtil.getSchemaTree(fileValue, getEncoding(), limit);
}
if (treeNode == null) {
return false;

View File

@@ -14,11 +14,15 @@ package org.talend.repository.ui.wizards.metadata.connection.files.json;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Stream;
import org.apache.commons.lang.StringUtils;
import org.talend.commons.exception.CommonExceptionHandler;
import com.fasterxml.jackson.databind.JsonNode;
@@ -65,11 +69,21 @@ public class SchemaPopulationUtil {
return null;
}
public static JsonTreeNode getSchemaTree(File jsonFile, int numberOfElementsAccessiable) {
public static JsonTreeNode getSchemaTree(File jsonFile, String charset, int numberOfElementsAccessiable) {
JsonTreeNode jsonTreeNode = null;
try {
StringBuilder strBuilder = new StringBuilder();
Charset charSet = null;
if (StringUtils.isBlank(charset)) {
charSet = Charset.forName("UTF-8");
} else {
charSet = Charset.forName(charset);
}
try (Stream<String> lines = Files.lines(jsonFile.toPath(), charSet)) {
lines.forEach(line -> strBuilder.append(line).append("\n"));
}
ObjectMapper objMapper = new ObjectMapper();
JsonNode jsonNode = objMapper.readTree(jsonFile);
JsonNode jsonNode = objMapper.readTree(strBuilder.toString());
jsonTreeNode = new JsonTreeNode();
jsonTreeNode.addValue(jsonNode);
String label = "$"; //$NON-NLS-1$

View File

@@ -26,6 +26,7 @@ import java.nio.charset.Charset;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
import org.apache.oro.text.regex.MalformedPatternException;
@@ -99,6 +100,8 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
private static Logger log = Logger.getLogger(XmlFileStep1Form.class);
private static final String LINEFEED = "\n";//$NON-NLS-1$
/**
* Settings.
*/
@@ -193,45 +196,52 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
if (XmlUtil.isXSDFile(convertedFilePath)) {
try {
XSDSchema schema = TreeUtil.getXSDSchema(convertedFilePath);
List<ATreeNode> rootNodes = new XSDPopulationUtil2().getAllRootNodes(schema);
if (rootNodes.size() > 0) {
ATreeNode rootNode = getDefaultRootNode(rootNodes);
if (rootNode != null) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(schema, rootNode, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
} else {
String xmlPath = getConnection().getSchema().get(0).getAbsoluteXPathQuery();
if (xmlPath != null && xmlPath.length() > 0) {
xmlPath = xmlPath.substring(xmlPath.lastIndexOf("/") + 1); //$NON-NLS-1$
boolean found = false;
for (int i = 0; i < rootNodes.size(); i++) {
ATreeNode node = rootNodes.get(i);
if (xmlPath.equals(node.getValue())) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(schema, node, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
found = true;
break;
}
// check if there have some (<xs:import>) import reference schema xsd file don't exist
boolean missing = checkIfImportReferenceSchemaNotExist(convertedFilePath, schema);
if (missing) {
missingReferenceSchema = true;
} else {
List<ATreeNode> rootNodes = new XSDPopulationUtil2().getAllRootNodes(schema);
if (rootNodes.size() > 0) {
ATreeNode rootNode = getDefaultRootNode(rootNodes);
if (rootNode != null) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(schema, rootNode, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
if (!found) {
} else {
String xmlPath = getConnection().getSchema().get(0).getAbsoluteXPathQuery();
if (xmlPath != null && xmlPath.length() > 0) {
xmlPath = xmlPath.substring(xmlPath.lastIndexOf("/") + 1); //$NON-NLS-1$
boolean found = false;
for (int i = 0; i < rootNodes.size(); i++) {
ATreeNode node = rootNodes.get(i);
String[] nodeValue = ((String) node.getValue()).split(":");
if (nodeValue.length > 1) {
if (xmlPath.equals(nodeValue[1])) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(schema, node, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
if (xmlPath.equals(node.getValue())) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(schema, node, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
found = true;
break;
}
}
if (!found) {
for (int i = 0; i < rootNodes.size(); i++) {
ATreeNode node = rootNodes.get(i);
String[] nodeValue = ((String) node.getValue()).split(":");
if (nodeValue.length > 1) {
if (xmlPath.equals(nodeValue[1])) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
valid = treePopulator.populateTree(schema, node, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
found = true;
break;
}
found = true;
break;
}
}
}
@@ -420,6 +430,8 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
}
boolean valid = true;
boolean missingReferenceSchema = false;
/**
* Main Fields addControls.
@@ -454,59 +466,70 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
File file = new File(text);
if (file.exists()) {
if (XmlUtil.isXSDFile(text)) {
if (!validXsd) {
if (!validXsd && !missingReferenceSchema) {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
try {
XSDSchema xsdSchema = updateXSDSchema(text);
List<ATreeNode> list = updateRootNodes(xsdSchema, true);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(null, list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
valid = treePopulator.populateTree(xsdSchema, selectedNode, treeNodes);
// check if there have some (<xs:import>) import reference schema xsd file don't exist
// if delete those import xsd files, restart studio and edit the file xml
// will pop up error. better check here
boolean missing = checkIfImportReferenceSchemaNotExist(text, xsdSchema);
if (missing) {
missingReferenceSchema = true;
} else {
List<ATreeNode> list = updateRootNodes(xsdSchema, true);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(null, list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
valid = treePopulator.populateTree(xsdSchema, selectedNode, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
} else {
return;
}
} else {
valid = treePopulator.populateTree(xsdSchema, list.get(0), treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
} else {
return;
}
} else {
valid = treePopulator.populateTree(xsdSchema, list.get(0), treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
}
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
XmlFileWizard wizard = ((XmlFileWizard) getPage().getWizard());
wizard.setRootNodes(treeNodes);
wizard.setTreeRootNode(treeNode);
List<FOXTreeNode> nodeList = getCorrespondingFoxTreeNodes(treeNode, true);
if (nodeList.size() > 0) {
FOXTreeNode foxTreeNode = nodeList.get(0);
EList root = getConnection().getRoot();
if (root == null) {
return;
if (!missingReferenceSchema) {
XmlFileWizard wizard = ((XmlFileWizard) getPage().getWizard());
wizard.setRootNodes(treeNodes);
wizard.setTreeRootNode(treeNode);
List<FOXTreeNode> nodeList = getCorrespondingFoxTreeNodes(treeNode, true);
if (nodeList.size() > 0) {
FOXTreeNode foxTreeNode = nodeList.get(0);
EList root = getConnection().getRoot();
if (root == null) {
return;
}
XMLFileNode xmlFileNode = ConnectionFactory.eINSTANCE.createXMLFileNode();
String currentPath = "/" + foxTreeNode.getLabel();
xmlFileNode.setXMLPath(currentPath);
xmlFileNode.setRelatedColumn(foxTreeNode.getColumnLabel());
xmlFileNode.setAttribute(foxTreeNode.isMain() ? "main" : "branch");
xmlFileNode.setDefaultValue(foxTreeNode.getDefaultValue());
xmlFileNode.setType(foxTreeNode.getDataType());
XMLFileNode originalXmlNode = null;
if (root.size() > 0) {
originalXmlNode = (XMLFileNode) root.get(0);
}
if (originalXmlNode != null && !currentPath.equals(originalXmlNode.getXMLPath())) {
wizard.setXsdRootChange(true);
} else {
wizard.setXsdRootChange(false);
}
root.clear();
root.add(xmlFileNode);
}
XMLFileNode xmlFileNode = ConnectionFactory.eINSTANCE.createXMLFileNode();
String currentPath = "/" + foxTreeNode.getLabel();
xmlFileNode.setXMLPath(currentPath);
xmlFileNode.setRelatedColumn(foxTreeNode.getColumnLabel());
xmlFileNode.setAttribute(foxTreeNode.isMain() ? "main" : "branch");
xmlFileNode.setDefaultValue(foxTreeNode.getDefaultValue());
xmlFileNode.setType(foxTreeNode.getDataType());
XMLFileNode originalXmlNode = null;
if (root.size() > 0) {
originalXmlNode = (XMLFileNode) root.get(0);
}
if (originalXmlNode != null && !currentPath.equals(originalXmlNode.getXMLPath())) {
wizard.setXsdRootChange(true);
} else {
wizard.setXsdRootChange(false);
}
root.clear();
root.add(xmlFileNode);
}
}
} else {
@@ -650,56 +673,65 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
List<ATreeNode> treeNodes = new ArrayList<ATreeNode>();
try {
XSDSchema xsdSchema = updateXSDSchema(text);
List<ATreeNode> list = updateRootNodes(xsdSchema, true);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(null, list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
valid = treePopulator.populateTree(xsdSchema, selectedNode, treeNodes);
// check if there have some (<xs:import>) import reference schema xsd file don't exist
boolean missing = checkIfImportReferenceSchemaNotExist(text, xsdSchema);
if (missing) {
missingReferenceSchema = true;
} else {
List<ATreeNode> list = updateRootNodes(xsdSchema, true);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(null, list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
valid = treePopulator.populateTree(xsdSchema, selectedNode, treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
validXsd = true;
} else {
return;
}
} else {
valid = treePopulator.populateTree(xsdSchema, list.get(0), treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
validXsd = true;
} else {
return;
}
} else {
valid = treePopulator.populateTree(xsdSchema, list.get(0), treeNodes);
if (treeNodes.size() > 0) {
treeNode = treeNodes.get(0);
}
}
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
XmlFileWizard wizard1 = ((XmlFileWizard) getPage().getWizard());
wizard1.setRootNodes(treeNodes);
wizard1.setTreeRootNode(treeNode);
List<FOXTreeNode> nodeList = getCorrespondingFoxTreeNodes(treeNode, true);
if (nodeList.size() > 0) {
FOXTreeNode foxTreeNode = nodeList.get(0);
EList root = getConnection().getRoot();
if (root == null) {
return;
if (!missingReferenceSchema) {
XmlFileWizard wizard1 = ((XmlFileWizard) getPage().getWizard());
wizard1.setRootNodes(treeNodes);
wizard1.setTreeRootNode(treeNode);
List<FOXTreeNode> nodeList = getCorrespondingFoxTreeNodes(treeNode, true);
if (nodeList.size() > 0) {
FOXTreeNode foxTreeNode = nodeList.get(0);
EList root = getConnection().getRoot();
if (root == null) {
return;
}
XMLFileNode xmlFileNode = ConnectionFactory.eINSTANCE.createXMLFileNode();
String currentPath = "/" + foxTreeNode.getLabel();
xmlFileNode.setXMLPath(currentPath);
xmlFileNode.setRelatedColumn(foxTreeNode.getColumnLabel());
xmlFileNode.setAttribute(foxTreeNode.isMain() ? "main" : "branch");
xmlFileNode.setDefaultValue(foxTreeNode.getDefaultValue());
xmlFileNode.setType(foxTreeNode.getDataType());
XMLFileNode originalXmlNode = null;
if (root.size() > 0) {
originalXmlNode = (XMLFileNode) root.get(0);
}
if (originalXmlNode != null && !currentPath.equals(originalXmlNode.getXMLPath())) {
wizard1.setXsdRootChange(true);
} else {
wizard1.setXsdRootChange(false);
}
root.clear();
root.add(xmlFileNode);
}
XMLFileNode xmlFileNode = ConnectionFactory.eINSTANCE.createXMLFileNode();
String currentPath = "/" + foxTreeNode.getLabel();
xmlFileNode.setXMLPath(currentPath);
xmlFileNode.setRelatedColumn(foxTreeNode.getColumnLabel());
xmlFileNode.setAttribute(foxTreeNode.isMain() ? "main" : "branch");
xmlFileNode.setDefaultValue(foxTreeNode.getDefaultValue());
xmlFileNode.setType(foxTreeNode.getDataType());
XMLFileNode originalXmlNode = null;
if (root.size() > 0) {
originalXmlNode = (XMLFileNode) root.get(0);
}
if (originalXmlNode != null && !currentPath.equals(originalXmlNode.getXMLPath())) {
wizard1.setXsdRootChange(true);
} else {
wizard1.setXsdRootChange(false);
}
root.clear();
root.add(xmlFileNode);
}
} else {
valid = treePopulator.populateTree(text, treeNode);
@@ -747,6 +779,11 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
return false;
}
if (missingReferenceSchema) {
updateStatus(IStatus.ERROR, Messages.getString("XmlFileStep1Form.ImportSchemaNotExistError", xmlXsdFilePathText)); //$NON-NLS-1$
return false;
}
// Valid File
if (xmlXsdFilePathText != null && !xmlXsdFilePathText.equals("") && (xsdPathChanged || creation)) {
if (treePopulator.isValidFile(xmlXsdFilePathText)) {
@@ -897,4 +934,28 @@ public class XmlFileStep1Form extends AbstractXmlFileStepForm {
// valid = this.treePopulator.populateTree(tempXmlXsdPath, treeNode);
// temfile.delete();
}
/**
* Check if there have some (<xs:import>) import reference schema xsd file don't exist DOC jding Comment method
* "checkIfImportReferenceSchemaNotExist".
*
* @param filePath
* @param xsdSchema
* @return
*/
private boolean checkIfImportReferenceSchemaNotExist(String filePath, XSDSchema xsdSchema) {
boolean flag = false;
Set<String> notExistImportSchema = TreeUtil.getNotExistImportSchema(filePath, xsdSchema);
if (!notExistImportSchema.isEmpty()) {
flag = true;
StringBuffer detail = new StringBuffer();
detail.append(Messages.getString("ImportTreeFromXMLAction.schemaFileNotExistDetailTitle")).append(LINEFEED);//$NON-NLS-1$
for (String xsdfilePath : notExistImportSchema) {
detail.append(xsdfilePath).append(LINEFEED);
}
new ErrorDialogWidthDetailArea(this.getShell(), Messages.PLUGIN_ID,
Messages.getString("ImportTreeFromXMLAction.ImportSchemaNotExistError"), detail.toString());//$NON-NLS-1$
}
return flag;
}
}

View File

@@ -14,6 +14,7 @@ package org.talend.repository.ui.wizards.metadata.connection.files.xml.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -23,11 +24,13 @@ import org.eclipse.ui.actions.SelectionProviderAction;
import org.eclipse.xsd.XSDSchema;
import org.talend.commons.runtime.xml.XmlUtil;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.swt.dialogs.ErrorDialogWidthDetailArea;
import org.talend.datatools.xml.utils.ATreeNode;
import org.talend.datatools.xml.utils.XSDPopulationUtil2;
import org.talend.metadata.managment.ui.dialog.RootNodeSelectDialog;
import org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode;
import org.talend.metadata.managment.ui.wizard.metadata.xml.utils.TreeUtil;
import org.talend.repository.metadata.i18n.Messages;
import org.talend.repository.metadata.ui.wizards.form.AbstractXmlStepForm;
import org.talend.repository.ui.wizards.metadata.connection.files.xml.XmlFileOutputStep2Form;
@@ -36,6 +39,8 @@ import org.talend.repository.ui.wizards.metadata.connection.files.xml.XmlFileOut
*/
public class ImportTreeFromXMLAction extends SelectionProviderAction {
private static final String LINEFEED = "\n";//$NON-NLS-1$
private TreeViewer xmlViewer;
private AbstractXmlStepForm form;
@@ -64,22 +69,36 @@ public class ImportTreeFromXMLAction extends SelectionProviderAction {
try {
if (XmlUtil.isXSDFile(filePath)) {
XSDSchema xsdSchema = TreeUtil.getXSDSchema(filePath);
List<ATreeNode> list = new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(xmlViewer.getControl().getShell(), list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, selectedNode);
if (form instanceof XmlFileOutputStep2Form) {
((XmlFileOutputStep2Form) form).resetRootCombo();
}
changed = true;
} else {
changed = false;
// check if there have some (<xs:import>) import reference schema xsd file don't exist
Set<String> notExistImportSchema = TreeUtil.getNotExistImportSchema(filePath, xsdSchema);
if (!notExistImportSchema.isEmpty()) {
StringBuffer detail = new StringBuffer();
detail.append(Messages.getString("ImportTreeFromXMLAction.schemaFileNotExistDetailTitle")).append(LINEFEED);//$NON-NLS-1$
for (String xsdfilePath : notExistImportSchema) {
detail.append(xsdfilePath).append(LINEFEED);
}
new ErrorDialogWidthDetailArea(xmlViewer.getControl().getShell(), Messages.PLUGIN_ID,
Messages.getString("ImportTreeFromXMLAction.ImportSchemaNotExistError"), detail.toString());//$NON-NLS-1$
} else {
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, list.get(0));
changed = true;
List<ATreeNode> list = new XSDPopulationUtil2().getAllRootNodes(xsdSchema);
if (list.size() > 1) {
RootNodeSelectDialog dialog = new RootNodeSelectDialog(xmlViewer.getControl().getShell(), list);
if (dialog.open() == IDialogConstants.OK_ID) {
ATreeNode selectedNode = dialog.getSelectedNode();
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, selectedNode);
if (form instanceof XmlFileOutputStep2Form) {
((XmlFileOutputStep2Form) form).resetRootCombo();
}
changed = true;
} else {
changed = false;
}
} else {
newInput = TreeUtil.getFoxTreeNodesByRootNode(xsdSchema, list.get(0));
changed = true;
}
}
} else {
newInput = TreeUtil.getFoxTreeNodes(filePath);

View File

@@ -22,4 +22,6 @@ RunInBackgroundProgressMonitorDialog.waitInBackground=Wait in background
RepoDoubleClickAction.wait4run=[{0}]: Studio is busy with [{1}], please wait...
RepoDoubleClickAction.unknown=unknown work
progress.interrupted=Work is interrupted
progress.cancelled=Work is cancelled
progress.cancelled=Work is cancelled
RepoDoubleClickAction.Warning=Failed to Execute {0}
RepoDoubleClickAction.Warning.msg=Studio is busy with background jobs, please try again later.\n\n(you can find all background jobs from the Process view)

View File

@@ -20,13 +20,13 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.graphics.DeviceData;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.ui.gmf.util.DisplayUtils;
import org.talend.commons.ui.swt.actions.ITreeContextualAction;
@@ -163,7 +163,6 @@ public class RepoDoubleClickAction extends Action {
}
final String info = Messages.getString("RepoDoubleClickAction.wait4run", clonedAction.getText(), //$NON-NLS-1$
name);
Shell shell = DisplayUtils.getDefaultShell(false);
final Job waitForRunJob = new Job(info) {
@Override
@@ -192,7 +191,7 @@ public class RepoDoubleClickAction extends Action {
return org.eclipse.core.runtime.Status.OK_STATUS;
}
};
RunInBackgroundProgressMonitorDialog dialog = new RunInBackgroundProgressMonitorDialog(shell);
RunInBackgroundProgressMonitorDialog dialog = new RunInBackgroundProgressMonitorDialog(null);
try {
waitForRunJob.schedule();
dialog.run(true, true, new IRunnableWithProgress() {
@@ -234,6 +233,15 @@ public class RepoDoubleClickAction extends Action {
}, deviceData);
} catch (Exception e) {
ExceptionHandler.process(e);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openInformation(DisplayUtils.getDefaultShell(false),
Messages.getString("RepoDoubleClickAction.Warning", clonedAction.getText()),
Messages.getString("RepoDoubleClickAction.Warning.msg"));
}
});
}
}
});

View File

@@ -67,7 +67,7 @@ public class PluginOptionalMissingJarsExtraUpdatesFactory extends AbstractExtraU
// jface because it adds graphical
// dependencies.
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance().getNotInstalledModulesRunnable(
unistalledModulesNeeded, modulesRequiredToBeInstalled, true, true, true);
unistalledModulesNeeded, modulesRequiredToBeInstalled, false, true, true);
if (notInstalledModulesRunnable != null) {// some data need to be fetched
try {
notInstalledModulesRunnable.run(mainSubMonitor.newChild(1));

View File

@@ -59,10 +59,8 @@ public class PluginRequiredMissingJarsExtraUpdatesFactory extends AbstractExtraU
// fetch missing jar information from remote web site.
ArrayList<ModuleToInstall> modulesRequiredToBeInstalled = new ArrayList<ModuleToInstall>();
IRunnableWithProgress notInstalledModulesRunnable = RemoteModulesHelper.getInstance().getNotInstalledModulesRunnable(
allUninstalledModules, modulesRequiredToBeInstalled, true, !isCheckUpdateOnLine, false);// IRunnableWithProgress should not be part
// of
// jface because it adds graphical
// dependencies.
allUninstalledModules, modulesRequiredToBeInstalled, false, !isCheckUpdateOnLine, false);
// IRunnableWithProgress should not of jface because it adds graphical dependencies.
if (notInstalledModulesRunnable != null) {// some data need to be fetched
try {
notInstalledModulesRunnable.run(mainSubMonitor.newChild(1));

View File

@@ -17,6 +17,7 @@ import java.io.IOException;
import java.util.Collection;
import java.util.Dictionary;
import java.util.Hashtable;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -131,6 +132,11 @@ public class ComponentsDeploymentManager {
return false;
}
try {
List<MavenArtifact> search = handler.search(mvnArtifact.getGroupId(), mvnArtifact.getArtifactId(),
mvnArtifact.getVersion(), true, true);
if (search != null && search.size() > 0) {
return false;
}
handler.deploy(componentFile, mvnArtifact.getGroupId(), mvnArtifact.getArtifactId(), mvnArtifact.getClassifier(),
mvnArtifact.getType(), mvnArtifact.getVersion());
@@ -177,7 +183,6 @@ public class ComponentsDeploymentManager {
handler.deploy(indexFile, indexArtifact.getGroupId(), indexArtifact.getArtifactId(), indexArtifact.getClassifier(),
indexArtifact.getType(), indexArtifact.getVersion());
moveToSharedFolder(componentFile);
return true;
} catch (Exception e) {
ExceptionHandler.process(e);

View File

@@ -14,7 +14,6 @@ package org.talend.utils.string;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;
import org.talend.utils.sugars.ReturnCode;
@@ -91,14 +90,7 @@ public final class StringUtilities {
* @return
*/
public static String getRandomString(int length) {
String str = "abcdefghigklmnopkrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ0123456789"; //$NON-NLS-1$
Random random = new Random();
StringBuffer sf = new StringBuffer();
for (int i = 0; i < length; i++) {
int number = random.nextInt(62);// 0~61
sf.append(str.charAt(number));
}
return sf.toString();
return java.util.UUID.randomUUID().toString().replace("-", "").substring(8, 8 + length); //$NON-NLS-1$ //$NON-NLS-2$
}
public static String removeEndingString(String fullStr, String endingStr) {

12
pom.xml
View File

@@ -129,7 +129,6 @@
<module>main/plugins/org.talend.libraries.jboss.jars</module>
<module>main/plugins/org.talend.libraries.jxplorer</module>
<module>main/plugins/org.talend.libraries.mdm</module>
<module>main/plugins/org.talend.libraries.mdm.webservice.ce</module>
<module>main/plugins/org.talend.libraries.netsuite</module>
<module>main/plugins/org.talend.libraries.ui</module>
<module>main/plugins/org.talend.librariesmanager</module>
@@ -200,6 +199,17 @@
<version>${tycho.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,72 @@
package org.talend.core.model.metadata;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
public class MetadataTableTest {
private List<IMetadataColumn> unusedColumns;
private List<IMetadataColumn> listColumns;
private List<String> originalColumns;
@Before
public void setUp() {
init();
}
private void init() {
originalColumns = new ArrayList<String>();
originalColumns.add("B");
originalColumns.add("C");
originalColumns.add("A");
unusedColumns = new ArrayList<IMetadataColumn>();
listColumns = new ArrayList<IMetadataColumn>();
MetadataColumn metadataColumn0 = new MetadataColumn();
metadataColumn0.setLabel("A");
listColumns.add(metadataColumn0);
MetadataColumn metadataColumn1 = new MetadataColumn();
metadataColumn1.setLabel("C");
listColumns.add(metadataColumn1);
MetadataColumn metadataColumn2 = new MetadataColumn();
metadataColumn2.setLabel("B");
listColumns.add(metadataColumn2);
}
@Test
public void testGetListColumns() {
IMetadataTable table = new MetadataTable();
table.setOriginalColumns(originalColumns);
table.setListColumns(listColumns);
table.setUnusedColumns(unusedColumns);
table.setRepository(false);
List<IMetadataColumn> listColumns = table.getListColumns(true);
String label0 = listColumns.get(0).getLabel();
assertEquals(label0, "A");
String label1 = listColumns.get(1).getLabel();
assertEquals(label1, "C");
String label2 = listColumns.get(2).getLabel();
assertEquals(label2, "B");
table.setRepository(true);
List<IMetadataColumn> OrderedlistColumns = table.getListColumns(true);
String label00 = OrderedlistColumns.get(0).getLabel();
assertEquals(label00, "B");
String label11 = OrderedlistColumns.get(1).getLabel();
assertEquals(label11, "C");
String label22 = OrderedlistColumns.get(2).getLabel();
assertEquals(label22, "A");
}
}

View File

@@ -12,9 +12,11 @@
// ============================================================================
package org.talend.core.model.metadata.designerproperties;
import static org.junit.Assert.*;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.HashMap;
@@ -26,7 +28,7 @@ import org.eclipse.emf.common.util.BasicEMap;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.EMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.model.metadata.IMetadataColumn;
import org.talend.core.model.metadata.IMetadataTable;
@@ -35,10 +37,10 @@ import org.talend.core.model.metadata.builder.connection.ConceptTarget;
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.MDMConnection;
import org.talend.core.model.metadata.builder.connection.impl.ConnectionFactoryImpl;
import org.talend.core.model.metadata.types.JavaType;
import org.talend.core.model.metadata.types.JavaTypesManager;
import org.talend.core.model.process.IElementParameter;
import org.talend.core.model.utils.ContextParameterUtils;
/**
* DOC ycbai class global comment. Detailled comment
@@ -171,6 +173,22 @@ public class RepositoryToComponentPropertyTest {
assertTrue(result == null);
}
@Test
public void testGetValueOfCreateTable() {
DatabaseConnection dbConnection = ConnectionFactoryImpl.eINSTANCE.createDatabaseConnection();
dbConnection.setDatabaseType(EDatabaseTypeName.MSSQL.getDbType());
Object result = RepositoryToComponentProperty.getValue(dbConnection, "DBTYPE", null); //$NON-NLS-1$
assertEquals(EDatabaseTypeName.MSSQL.getXMLType(), result);
dbConnection.setDatabaseType(EDatabaseTypeName.ORACLE_OCI.getDbType());
Object result1 = RepositoryToComponentProperty.getValue(dbConnection, "DBTYPE", null); //$NON-NLS-1$
assertEquals(EDatabaseTypeName.ORACLE_OCI.getXMLType(), result1);
dbConnection.setDatabaseType(EDatabaseTypeName.INGRES.getDbType());
Object result2 = RepositoryToComponentProperty.getValue(dbConnection, "DBTYPE", null); //$NON-NLS-1$
assertEquals(EDatabaseTypeName.INGRES.getXMLType(), result2);
}
private void checkIfWithoutQuotes(DatabaseConnection connection, String value) {
Object result = RepositoryToComponentProperty.getValue(connection, value, null);
assertFalse(isSurroundWithQuotes(String.valueOf(result)));