Compare commits

...

24 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
42 changed files with 642 additions and 211 deletions

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

@@ -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

@@ -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

@@ -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

@@ -140,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);

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

@@ -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

@@ -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;
@@ -898,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")) {
@@ -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

@@ -1131,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

@@ -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

@@ -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

@@ -13,7 +13,7 @@ MDMForm_check=Check
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

@@ -274,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

@@ -6623,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();

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

@@ -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

@@ -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) {