Compare commits

..

10 Commits

Author SHA1 Message Date
ilazebny
0801504e07 Update version in poms to 5.2.0
git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92812 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-25 12:04:08 +00:00
rdubois
ac402846f0 merge r92745 from trunk to branch-tempbuild-5_2_0
Fixed Bug TDI-23411: NodeUtil.getPrivateConnClassName(final IConnection conn)  return value is not correct
https://jira.talendforge.org/browse/TDI-23411
Note:
Another problem about tExtractEBCDICFields special circumstances lead code generate error.


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92810 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-25 11:26:45 +00:00
rdubois
3263ab3c56 merge r92690 from trunk to branch-tempbuild-5_2_0
Fixed Bug TDI-23411: NodeUtil.getPrivateConnClassName(final IConnection conn)  return value is not correct
https://jira.talendforge.org/browse/TDI-23411
Note:
Another problem about tExtractEBCDICFields special circumstances lead code generate error.


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92808 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-25 11:25:15 +00:00
rdubois
1e176ed6d6 merge r92798 from trunk to branch-tempbuild-5_2_0
fix Bug TDI-23434: Fix the components part for the drivers IMPORT
https://jira.talendforge.org/browse/TDI-23434


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92805 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-25 11:23:23 +00:00
nrousseau
056197eccc merge r92749 from trunk to branch 5.2.0
bug TDI-23416 fixed: TOS_BD Studio freezes when trying to download a jar after launching a job which has an error


git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92756 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-25 06:22:18 +00:00
nrousseau
be58d3d48c TDI-23413: fix update system with schema columns and rename table
git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92747 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-25 04:43:57 +00:00
scorreia
6a6803a8df last minute Babili import
git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92716 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-24 13:58:32 +00:00
rdubois
2ee02183d4 Add new images and htmls to subversion
git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92670 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-24 08:38:49 +00:00
rdubois
3a6f338f8b Remove old images and htmls from subversion
git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92657 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-24 07:25:51 +00:00
cli
9c40e53170 TDI-23403: fixed the problem for bundle name with empty.
git-svn-id: http://talendforge.org/svn/tos/branches/branch-tempbuild-5_2_0@92649 f6f1c999-d317-4740-80b0-e6d1abc6f99e
2012-10-24 03:32:54 +00:00
2699 changed files with 245540 additions and 262148 deletions

View File

@@ -740,7 +740,7 @@
download-size="0"
install-size="0"
version="0.0.0"
unpack="true"/>
unpack="false"/>
<plugin
id="org.eclipse.jet.core"

View File

@@ -2,7 +2,6 @@ PushToPaletteActionProvider.Error2=Fout
PushToPaletteActionProvider.Error=Fout
NewActionProvider.New=Nieuw
NewActionProvider.NewComponent=Nieuw Component
AbstractXMLConfigPage.Delete=Verwijderen
CreateComponentWizard.NewComponent=Nieuw Component
WizardComponentFolderPage.Name=Naam
AbstractXMLConfigPage.New=Nieuw

View File

@@ -1,2 +1,3 @@
PushToPaletteActionProvider.Error2=Gre\u0161ka
PushToPaletteActionProvider.Error=Gre\u0161ka
AbstractXMLConfigPage.Delete=DELETE

View File

@@ -557,16 +557,5 @@
level="20"
name="ReadDiagramAction"/>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
<definition
id="isActiveEditorOfBusinessModelEditor">
<not>
<instanceof
value="org.talend.designer.business.model.business.diagram.part.BusinessDiagramEditor">
</instanceof>
</not>
</definition>
</extension>
</plugin>

View File

@@ -56,7 +56,7 @@
if(param != null && !"__UNIQUE_NAME__".equals(param.getValue())){
cid = (String)param.getValue()+"_"+cid;
}
String endpointVar = "endpoint_" + node.getUniqueName();
String endpointVar = "endpoint" + cid;
String uriRef = "uriMap.get(\"" + cid + "\")";
%>
// CXF endpoint for <%=cid%>

View File

@@ -32,19 +32,9 @@ INode node = (INode) codeGenArgument.getArgument();
List< ? extends IConnection> connsIf = node.getIncomingConnections();
if(connsIf.size()>0) {
if(connsIf.get(0).getLineStyle()==EConnectionType.ROUTE_WHEN) {
INode sourceNode = connsIf.get(0).getSource();
String languageType = connsIf.get(0).getRouteConnectionType();
String condition = connsIf.get(0).getCondition();
String expression = "none".equals(languageType)?condition:languageType+"("+condition+")";
if("cIntercept".equals(sourceNode.getComponent().getName())){
%>
.when(<%=expression%>)
.when().<%=connsIf.get(0).getRouteConnectionType()%>(<%=connsIf.get(0).getCondition()%>)
<%
}else{
%>
.when().<%=expression%>
<%
}
} else if(connsIf.get(0).getLineStyle()==EConnectionType.ROUTE_OTHER) {
%>
.otherwise()

File diff suppressed because it is too large Load Diff

View File

@@ -99,8 +99,8 @@ import java.util.Comparator;
String talendJobInterfaces = "TalendJob";
boolean talendMdmJob = !process.getNodesOfType("tMDMTriggerInput").isEmpty() || !process.getNodesOfType("tMDMTriggerOutput").isEmpty();
boolean talendEsbJob = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tESBConsumer").isEmpty() || !process.getNodesOfType("tRouteInput").isEmpty();
boolean talendEsbJobFactory = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tRouteInput").isEmpty();
boolean talendEsbJob = !process.getNodesOfType("tESBProviderRequest").isEmpty() || !process.getNodesOfType("tESBConsumer").isEmpty();
boolean talendEsbJobFactory = !process.getNodesOfType("tESBProviderRequest").isEmpty();
if (talendMdmJob) {
talendJobInterfaces += ", TalendMDMJob"; // Talend MDM job
@@ -126,8 +126,6 @@ public class <%=process.getName()%> implements <%=talendJobInterfaces%> {
}
talendESBJob.setDataSources(dataSources);
}
// fix for TESB-7714
talendESBJob.setEndpointRegistry(registry);
return talendESBJob;
}
<% } %>

View File

@@ -69,7 +69,7 @@ import org.talend.core.model.components.IComponentsFactory;
import org.talend.core.model.general.Project;
import org.talend.core.model.properties.ComponentSetting;
import org.talend.core.ui.branding.IBrandingService;
import org.talend.core.utils.TalendCacheUtils;
import org.talend.core.utils.BrandingChecker;
import org.talend.designer.codegen.CodeGeneratorActivator;
import org.talend.designer.codegen.i18n.Messages;
import org.talend.designer.core.ITisLocalProviderService;
@@ -159,7 +159,7 @@ public class ComponentsFactory implements IComponentsFactory {
Project currentProject = ProjectManager.getInstance().getCurrentProject();
if (currentProject != null && currentProject.getEmfProject() != null) {
List<ComponentSetting> components = currentProject.getEmfProject().getComponentsSettings();
List<ComponentSetting> components = (List<ComponentSetting>) currentProject.getEmfProject().getComponentsSettings();
return components;
}
return Collections.emptyList();
@@ -231,7 +231,8 @@ public class ComponentsFactory implements IComponentsFactory {
ProjectManager manager = ProjectManager.getInstance();
List<Project> referencedProjects = manager.getReferencedProjects();
for (Project curProject : referencedProjects) {
List<ComponentSetting> componentsSettings = curProject.getEmfProject().getComponentsSettings();
List<ComponentSetting> componentsSettings = (List<ComponentSetting>) curProject.getEmfProject()
.getComponentsSettings();
for (ComponentSetting setting : componentsSettings) {
if (setting.isHidden() && setting.getName().equals(settingInMain.getName())
&& setting.getFamily().equals(settingInMain.getFamily())) {
@@ -261,7 +262,7 @@ public class ComponentsFactory implements IComponentsFactory {
skeletonList = new ArrayList<String>();
String installLocation = new Path(Platform.getConfigurationLocation().getURL().getPath()).toFile().getAbsolutePath();
componentToProviderMap = new HashMap<IComponent, AbstractComponentsProvider>();
boolean isNeedClean = TalendCacheUtils.cleanComponentCache();
boolean isNeedClean = cleanComponentCache();
isCreated = hasComponentFile(installLocation) && !isNeedClean;
if (isReset) {
isCreated = false;
@@ -347,7 +348,6 @@ public class ComponentsFactory implements IComponentsFactory {
FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(final File file) {
return file.isDirectory() && file.getName().charAt(0) != '.'
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER)
@@ -482,6 +482,11 @@ public class ComponentsFactory implements IComponentsFactory {
return file.exists();
}
private boolean cleanComponentCache() {
return ArrayUtils.contains(Platform.getApplicationArgs(), "--clean_component_cache")
|| ArrayUtils.contains(Platform.getApplicationArgs(), "-clean") || BrandingChecker.isBrandingChanged();
}
private void loadComponentsFromComponentsProviderExtension() {
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
for (AbstractComponentsProvider componentsProvider : componentsProviderManager.getProviders()) {
@@ -512,7 +517,6 @@ public class ComponentsFactory implements IComponentsFactory {
}
}
@Override
public void loadUserComponentsFromComponentsProviderExtension() {
ComponentsProviderManager.getInstance().getProviders();
ComponentsProviderManager componentsProviderManager = ComponentsProviderManager.getInstance();
@@ -583,7 +587,6 @@ public class ComponentsFactory implements IComponentsFactory {
FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(final File file) {
return file.isDirectory() && file.getName().charAt(0) != '.'
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER)
@@ -604,7 +607,6 @@ public class ComponentsFactory implements IComponentsFactory {
FileFilter skeletonFilter = new FileFilter() {
@Override
public boolean accept(final File file) {
String fileName = file.getName();
return file.isFile() && fileName.charAt(0) != '.'
@@ -911,7 +913,6 @@ public class ComponentsFactory implements IComponentsFactory {
component.setImageRegistry(componentsImageRegistry);
}
@Override
public int size() {
if (componentList == null) {
init(false);
@@ -919,7 +920,6 @@ public class ComponentsFactory implements IComponentsFactory {
return componentList.size();
}
@Override
public IComponent get(String name) {
if (componentList == null) {
init(false);
@@ -933,7 +933,6 @@ public class ComponentsFactory implements IComponentsFactory {
return null;
}
@Override
public void initializeComponents(IProgressMonitor monitor) {
this.monitor = monitor;
if (componentList == null) {
@@ -943,7 +942,6 @@ public class ComponentsFactory implements IComponentsFactory {
this.subMonitor = null;
}
@Override
public void initializeComponents(IProgressMonitor monitor, boolean duringLogon) {
this.monitor = monitor;
if (componentList == null) {
@@ -958,7 +956,6 @@ public class ComponentsFactory implements IComponentsFactory {
*
* @see org.talend.core.model.components.IComponentsFactory#getComponents()
*/
@Override
public Set<IComponent> getComponents() {
if (componentList == null) {
init(false);
@@ -966,7 +963,6 @@ public class ComponentsFactory implements IComponentsFactory {
return componentList;
}
@Override
public List<IComponent> getCustomComponents() {
if (customComponentList == null) {
init(false);
@@ -979,7 +975,6 @@ public class ComponentsFactory implements IComponentsFactory {
*
* @see org.talend.core.model.components.IComponentsFactory#getComponentPath()
*/
@Override
public URL getComponentPath() throws IOException {
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(
@@ -997,7 +992,6 @@ public class ComponentsFactory implements IComponentsFactory {
*
* @see org.talend.core.model.components.IComponentsFactory#getSkeletons()
*/
@Override
public List<String> getSkeletons() {
if (skeletonList == null) {
init(false);
@@ -1005,7 +999,6 @@ public class ComponentsFactory implements IComponentsFactory {
return skeletonList;
}
@Override
public void reset() {
componentsImageRegistry.clear();
componentList = null;
@@ -1015,7 +1008,6 @@ public class ComponentsFactory implements IComponentsFactory {
}
@Override
public void resetCache() {
componentsImageRegistry.clear();
componentList = null;
@@ -1034,7 +1026,6 @@ public class ComponentsFactory implements IComponentsFactory {
* @see org.talend.core.model.components.IComponentsFactory#getFamilyTranslation(IComponent component,
* java.lang.String)
*/
@Override
public String getFamilyTranslation(Object component, String text) {
String translated = Messages.getString(text);
@@ -1065,7 +1056,6 @@ public class ComponentsFactory implements IComponentsFactory {
*
* @see org.talend.core.model.components.IComponentsFactory#getAllComponentsCanBeProvided()
*/
@Override
public Map<String, String> getAllComponentsCanBeProvided() {
List source = new ArrayList();
if (allComponents == null) {
@@ -1090,7 +1080,6 @@ public class ComponentsFactory implements IComponentsFactory {
FileFilter fileFilter = new FileFilter() {
@Override
public boolean accept(final File file) {
return file.isDirectory() && file.getName().charAt(0) != '.'
&& !file.getName().equals(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER);
@@ -1149,17 +1138,14 @@ public class ComponentsFactory implements IComponentsFactory {
analyseur = fabrique.newDocumentBuilder();
analyseur.setErrorHandler(new ErrorHandler() {
@Override
public void error(final SAXParseException exception) throws SAXException {
throw exception;
}
@Override
public void fatalError(final SAXParseException exception) throws SAXException {
throw exception;
}
@Override
public void warning(final SAXParseException exception) throws SAXException {
throw exception;
}
@@ -1211,12 +1197,10 @@ public class ComponentsFactory implements IComponentsFactory {
*
* @see org.talend.core.model.components.IComponentsFactory#resetSpecificComponents()
*/
@Override
public void resetSpecificComponents() {
loadComponentsFromExtensions();
}
@Override
public Map<String, File> getComponentsProvidersFolder() {
Map<String, File> list = new HashMap<String, File>();
@@ -1233,7 +1217,6 @@ public class ComponentsFactory implements IComponentsFactory {
return list;
}
@Override
public Map<String, ImageDescriptor> getComponentsImageRegistry() {
return componentsImageRegistry;
}

View File

@@ -80,14 +80,20 @@ public class XsdValidationCacheManager {
public boolean needCheck(java.io.File file, long currentCRC) {
String path = file.getAbsolutePath();
Long lastCheckedCRC = alreadyCheckedXsd.get(path);
if (forceXSDAlreadyChecked) {
alreadyCheckedXsd.put(path, currentCRC);
return false;
} else {
Long lastCheckedCRC = alreadyCheckedXsd.get(path);
if (lastCheckedCRC == null) {
return true;
if (lastCheckedCRC == null) {
return true;
}
boolean isChanged = currentCRC != lastCheckedCRC;
return isChanged;
}
boolean isChanged = currentCRC != lastCheckedCRC;
return isChanged;
}
public void setChecked(File file, long currentCRC) {

View File

@@ -14,7 +14,6 @@ package org.talend.designer.codegen.config;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Method;
@@ -28,6 +27,7 @@ import java.util.StringTokenizer;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
@@ -52,10 +52,12 @@ import org.eclipse.emf.common.util.Monitor;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.talend.commons.debug.TalendDebugHandler;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.core.model.components.ComponentCompilations;
import org.talend.designer.codegen.i18n.Messages;
/**
@@ -298,107 +300,93 @@ public class TalendJetEmitter extends JETEmitter {
progressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETOpeningJavaProject_message", //$NON-NLS-1$
new Object[] { project.getName() }));
// javaProject.open(new SubProgressMonitor(progressMonitor, 1));
IPackageFragmentRoot[] packageFragmentRoots = javaProject.getPackageFragmentRoots();
IPackageFragmentRoot sourcePackageFragmentRoot = null;
for (int j = 0; j < packageFragmentRoots.length; ++j) {
IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[j];
if (packageFragmentRoot.getKind() == IPackageFragmentRoot.K_SOURCE) {
sourcePackageFragmentRoot = packageFragmentRoot;
break;
}
}
String packageName = jetCompiler.getSkeleton().getPackageName();
StringTokenizer stringTokenizer = new StringTokenizer(packageName, "."); //$NON-NLS-1$
IProgressMonitor subProgressMonitor = new SubProgressMonitor(progressMonitor, 1);
subProgressMonitor.beginTask("", stringTokenizer.countTokens() + 4); //$NON-NLS-1$
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_CreateTargetFile_message")); //$NON-NLS-1$
IFolder sourceContainer = project.getFolder("src");
IContainer sourceContainer = (IContainer) sourcePackageFragmentRoot.getCorrespondingResource();
while (stringTokenizer.hasMoreElements()) {
String folderName = stringTokenizer.nextToken();
sourceContainer = sourceContainer.getFolder(new Path(folderName));
if (!sourceContainer.exists()) {
try {
sourceContainer.create(true, true, new SubProgressMonitor(subProgressMonitor, 1));
((IFolder) sourceContainer).create(true, true, new SubProgressMonitor(subProgressMonitor, 1));
} catch (Exception e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
}
boolean needRebuild = true;
IFile targetFile = sourceContainer.getFile(new Path(jetCompiler.getSkeleton().getClassName() + ".java")); //$NON-NLS-1$
if (!targetFile.exists()) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETCreating_message", //$NON-NLS-1$
new Object[] { targetFile.getFullPath() }));
targetFile.create(contents, true, new SubProgressMonitor(subProgressMonitor, 1));
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataInputStream dis = new DataInputStream(targetFile.getContents());
int len = 0;
byte[] buf = new byte[1024];
while (((len = dis.read(buf))) != -1) {
baos.write(buf, 0, len);
}
dis.close();
String currentContent = baos.toString();
String newContent = outputStream.toString();
// since the build is done on linux, if use windows, it will use different rules for \r + \n
// so compare without \r, at least to see if original string is the same
// if yes, consider all is ok, no need to replace the content and recompile
currentContent = currentContent.replace("\r", ""); //$NON-NLS-1$//$NON-NLS-2$
newContent = newContent.replace("\r", ""); //$NON-NLS-1$//$NON-NLS-2$
if (!newContent.equals(currentContent)) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETUpdating_message", //$NON-NLS-1$
new Object[] { targetFile.getFullPath() }));
targetFile.setContents(contents, true, true, new SubProgressMonitor(subProgressMonitor, 1));
} else {
needRebuild = false;
}
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETUpdating_message", //$NON-NLS-1$
new Object[] { targetFile.getFullPath() }));
targetFile.setContents(contents, true, true, new SubProgressMonitor(subProgressMonitor, 1));
}
// if jetEmitter.getMethod() == null, means the class file doesn't exist anymore
// it should be impossible to have only the class file deleted and the .java never modified, but still
// handle this case.
if (needRebuild || jetEmitter.getMethod() == null) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", //$NON-NLS-1$
new Object[] { project.getName() }));
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETBuilding_message", //$NON-NLS-1$
new Object[] { project.getName() }));
if (!ComponentCompilations.getMarkers()) {
project.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(subProgressMonitor, 1));
}
IMarker[] markers = targetFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
boolean errors = false;
for (int i = 0; i < markers.length; ++i) {
IMarker marker = markers[i];
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
errors = true;
subProgressMonitor.subTask(marker.getAttribute(IMarker.MESSAGE) + " : " //$NON-NLS-1$
+ (CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) })));
log.error(jetEmitter.templateURI.substring(jetEmitter.templateURI.lastIndexOf("/") + 1) //$NON-NLS-1$
+ Messages.getString(
"TalendJetEmitter.compileFail", //$NON-NLS-1$
marker.getAttribute(IMarker.MESSAGE),
(CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) }))));
}
IMarker[] markers = targetFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
boolean errors = false;
for (int i = 0; i < markers.length; ++i) {
IMarker marker = markers[i];
if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) == IMarker.SEVERITY_ERROR) {
errors = true;
subProgressMonitor.subTask(marker.getAttribute(IMarker.MESSAGE) + " : " //$NON-NLS-1$
+ (CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) })));
log.error(jetEmitter.templateURI.substring(jetEmitter.templateURI.lastIndexOf("/") + 1) //$NON-NLS-1$
+ Messages.getString(
"TalendJetEmitter.compileFail", //$NON-NLS-1$
marker.getAttribute(IMarker.MESSAGE),
(CodeGenPlugin.getPlugin().getString("jet.mark.file.line", new Object[] { //$NON-NLS-1$
targetFile.getLocation(), marker.getAttribute(IMarker.LINE_NUMBER) }))));
}
}
if (!errors) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", //$NON-NLS-1$
new Object[] { jetCompiler.getSkeleton().getClassName() + ".class" })); //$NON-NLS-1$
if (!errors) {
subProgressMonitor.subTask(CodeGenPlugin.getPlugin().getString("_UI_JETLoadingClass_message", //$NON-NLS-1$
new Object[] { jetCompiler.getSkeleton().getClassName() + ".class" })); //$NON-NLS-1$
// Construct a proper URL for relative lookup.
//
URL url = new File(project.getLocation()
+ "/" + javaProject.getOutputLocation().removeFirstSegments(1) + "/") //$NON-NLS-1$ //$NON-NLS-2$
.toURL();
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") //$NON-NLS-1$ //$NON-NLS-2$
+ jetCompiler.getSkeleton().getClassName());
String methodName = jetCompiler.getSkeleton().getMethodName();
Method[] methods = theClass.getDeclaredMethods();
for (int i = 0; i < methods.length; ++i) {
if (methods[i].getName().equals(methodName)) {
jetEmitter.setMethod(methods[i]);
break;
}
// Construct a proper URL for relative lookup.
//
URL url = new File(project.getLocation() + "/" + javaProject.getOutputLocation().removeFirstSegments(1) + "/") //$NON-NLS-1$ //$NON-NLS-2$
.toURL();
URLClassLoader theClassLoader = new URLClassLoader(new URL[] { url }, jetEmitter.classLoader);
Class theClass = theClassLoader.loadClass((packageName.length() == 0 ? "" : packageName + ".") //$NON-NLS-1$ //$NON-NLS-2$
+ jetCompiler.getSkeleton().getClassName());
String methodName = jetCompiler.getSkeleton().getMethodName();
Method[] methods = theClass.getDeclaredMethods();
for (int i = 0; i < methods.length; ++i) {
if (methods[i].getName().equals(methodName)) {
jetEmitter.setMethod(methods[i]);
break;
}
}
}
subProgressMonitor.done();
} catch (CoreException exception) {
TalendDebugHandler.debug(exception);

View File

@@ -1,7 +1,6 @@
ExchangeView.Exchange=Exchange
AvailableExtensionsComposite.ExtensionName=Nom de l'extension
AvailableExtensionsComposite.Version=Version
AvailableExtensionsComposite.Rating=Note
AvailableExtensionsComposite.Author=Auteur
AvailableExtensionsComposite.ViewDetail.installOperateStatus=Installer
AvailableExtensionsComposite.ViewDetail.WriteReview=Donnez votre avis
@@ -10,7 +9,6 @@ DownloadedExtensionsComposite.DownloadedVersion=Version t
DownloadedExtensionsComposite.DownloadDate=Date de téléchargement
DownloadedExtensionsComposite.installedOperateStatus=Installé
DownloadedExtensionsComposite.updateOperateStatus=Mettre à jour
MyExtensionsComposite.Version=Version
MyExtensionsComposite.UploadDate=Date du chargement
MyExtensionsComposite.AddNewExtensionTitle=Ajouter une nouvelle extension
MyExtensionsComposite.UpLoadNewVersionOperateStatus=Charger une nouvelle version
@@ -21,7 +19,6 @@ MyExtensionsComposite.Form.ExtensionTitle=Titre de l'extension
MyExtensionsComposite.Form.InitialVersion=Version initiale
MyExtensionsComposite.Form.Compatibility=Compatibilité
MyExtensionsComposite.Form.Compatibility.AllVersions=Toutes les versions
MyExtensionsComposite.Form.Compatibility.Version=Version
MyExtensionsComposite.Form.Compatibility.AllVersionsExcept=Toutes les versions sauf :
MyExtensionsComposite.Form.Compatibility.OnlyTheseVersions=Uniquement ces versions :
MyExtensionsComposite.Form.Description=Description

View File

@@ -1,7 +1,4 @@
DownloadedExtensionsComposite.updateOperateStatus=Update
MyExtensionsComposite.UpdateOperateStatus=Update
MyExtensionsComposite.ModifyOperateStatus=Wijzigen
MyExtensionsComposite.DeleteOperateStatus=Verwijderen
MyExtensionsComposite.Form.Upload.Browse=Blader...
RefreshJob.FindExtensions.Title=Beschikbare extensies zoeken
RefreshJob.FindExtensions.Message=Extensies zoeken op Exchange...

View File

@@ -1,4 +1,5 @@
DownloadedExtensionsComposite.updateOperateStatus=UPDATE
MyExtensionsComposite.UpdateOperateStatus=UPDATE
MyExtensionsComposite.DeleteOperateStatus=DELETE
ImportExchangeDialog.TEMPLATES_BUTTON=SQL \u0161abloni
ImportExchangeDialog.REFRESH_BUTTON=Osve\u017Eavanje

View File

@@ -1,55 +1,32 @@
package org.talend.mdm.bulkload.client;
import java.io.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.net.URL;
import java.util.List;
public class BulkloadClient {
private String url;
private String username;
private String password;
private String universe;
private String cluster;
private String concept;
private String dataModel;
private BulkloadOptions options = new BulkloadOptions();
private static final AtomicInteger startedBulkloadCount = new AtomicInteger(0);
public BulkloadClient(String url, String username, String password, String universe, String cluster, String concept, String dataModel) {
String url;
String username;
String password;
String universe;
String cluster;
String concept;
String datamodel;
BulkloadOptions options=new BulkloadOptions();
public BulkloadClient(String url, String username,String password,String universe,String cluster,String concept,String datamodel) {
this.url=url;
this.username=username;
this.password=password;
this.universe=universe;
this.cluster=cluster;
this.concept=concept;
this.dataModel = dataModel;
this.datamodel=datamodel;
}
public void startThreadCount(){
// Kept for compatibility with tMDMBulkload.
}
public void waitForEndOfQueue() {
try {
synchronized (startedBulkloadCount) {
while (startedBulkloadCount.get() > 0) {
System.out.println(startedBulkloadCount.get() + " remaining.");
startedBulkloadCount.wait();
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
public String getUrl() {
return url;
}
@@ -99,11 +76,11 @@ public class BulkloadClient {
}
public String getDatamodel() {
return dataModel;
return datamodel;
}
public void setDatamodel(String dataModel) {
this.dataModel = dataModel;
public void setDatamodel(String datamodel) {
this.datamodel = datamodel;
}
public BulkloadOptions getOptions() {
@@ -113,75 +90,93 @@ public class BulkloadClient {
public void setOptions(BulkloadOptions options) {
this.options = options;
}
/**
* load from a huge xml string
* @param xmlString A full xml document.
* @throws Exception Thrown in case of bulk load error.
*/
public void load(String xmlString) throws Exception {
load(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
public void load(List<String > items) {
doLoad(items);
}
/**
* load from a huge xml string
* @param xmlString
*/
public void load(String xmlString)throws Exception {
List<String > items=BulkloadClientUtil.getItemXmls(xmlString);
doLoad(items);
}
private void doLoad(List<String> items) {
if(items.size()>options.getArraySize()) {
int loop=items.size()/options.getArraySize();
int left=items.size()-options.getArraySize()*loop;
for(int i=0; i<loop; i++) {
List<String> subItems=items.subList(i*options.getArraySize(), (i+1)*options.getArraySize());
try {
BulkloadClientUtil.bulkload(url, cluster, concept, datamodel, options.isValidate(), options.isSmartpk(), subItems, username, password,universe);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
if(left>0) {
List<String> subItems=items.subList(loop*options.getArraySize(), loop*options.getArraySize()+left);
try {
BulkloadClientUtil.bulkload(url, cluster, concept, datamodel, options.isValidate(), options.isSmartpk(), subItems, username, password,universe);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}else {
try {
BulkloadClientUtil.bulkload(url, cluster, concept, datamodel, options.isValidate(), options.isSmartpk(), items, username, password,universe);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* load from File
* @param inputXmlFile
*/
public void load(Reader inputXmlFile) {
BufferedReader reader=null;
try {
reader=new BufferedReader(inputXmlFile);
StringBuffer sb=new StringBuffer();
String line=reader.readLine();
while(line!=null) {
sb=sb.append(line);
line=reader.readLine();
}
List<String > items=BulkloadClientUtil.getItemXmls(sb.toString());
doLoad(items);
}catch(Exception e) {
e.printStackTrace();
}finally {
if(reader!=null)
try {
reader.close();
} catch (IOException e) {
}
}
}
public static void main(String[] args) {
//test
//FileReader reader=new FileReader(file)
URL url=BulkloadClient.class.getResource("test.xml");
try {
BufferedInputStream in=((BufferedInputStream)url.getContent());
byte[] buf=new byte[in.available()];
in.read(buf);
String xml=new String(buf);
BulkloadClient client=new BulkloadClient("http://localhost:8080/datamanager/loadServlet","admin","talend",null,"Order","Country","Order");
client.setOptions(new BulkloadOptions());
client.load(xml);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* <p>
* Loads XML documents in MDM using an InputStream. All documents should follow each other.
* For instance this InputStream can be used with this method.
* </p>
*
* <code>
* InputStream is = new ByteArrayInputStream("<doc></doc><doc></doc><doc></doc>".getBytes());
* </code>
*
* <p>
* This method blocks until all documents in <code>xmlDocuments</code> are read. For non blocking use cases
* see {@link #load()}.
* </p>
*
* @param xmlDocuments A stream that contains several XML documents.
* @throws Exception Thrown in case of bulk load error
*/
public void load(InputStream xmlDocuments) throws Exception {
BulkloadClientUtil.bulkload(url,
cluster,
concept,
dataModel,
options.isValidate(),
options.isSmartpk(),
xmlDocuments,
username,
password,
universe);
}
/**
* <p>
* Loads XML documents in MDM using an InputStream created for the load. This method creates a {@link Thread} that
* wait for {@link InputStreamMerger#push(java.io.InputStream)} to get called.
* </p>
*
* <code>
* BulkloadClient client = ...<br/>
* InputStreamMerger is = client.load();<br/>
* for(...) {<br/>
* is.push(new ByteArrayInputStream("...".getBytes());<br/>
* }
* </code>
*
* @throws Exception Thrown in case of communication error
* @see InputStreamMerger
* @return A {@link InputStreamMerger} that allow asynchronous push to bulkload client.
*/
public InputStreamMerger load() throws Exception {
return BulkloadClientUtil.bulkload(url,
cluster,
concept,
dataModel,
options.isValidate(),
options.isSmartpk(),
username,
password,
universe,
startedBulkloadCount);
}
}

View File

@@ -1,131 +1,189 @@
package org.talend.mdm.bulkload.client;
import java.io.InputStream;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.URI;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.cookie.CookiePolicy;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PutMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpClientParams;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Bulkload amount items client
* @author achen
*
*/
public class BulkloadClientUtil {
public static void bulkload(String url, String cluster, String concept, String datamodel, boolean validate, boolean smartpk, InputStream itemdata,
String username, String password, String universe) throws Exception {
HostConfiguration config = new HostConfiguration();
URI uri = new URI(url, false, "UTF-8"); //$NON-NLS-1$
config.setHost(uri);
/**
* @param args
*/
public static void main(String[] args)throws Exception {
if((!args[0].startsWith("http://") && args.length>0) && (args.length != 9 || args.length!=7 || args.length!=6)) {
usage();
return;
}
String url= args[0];
String username=args[1];
String password=args[2];
String cluster= args[3];
String concept= args[4];
String datamodel= args[5];
boolean validate= false;
boolean smartpk= false;
List<String> itemdata= new ArrayList<String>();
if(args.length==9) {
validate= Boolean.valueOf(args[6]);
smartpk= Boolean.valueOf(args[7]);
itemdata=getItemXmls(args[8]);
}
if(args.length==7) {
itemdata=getItemXmls(args[6]);
}
if(args.length==6) {//get itemdata from System.in
byte[] buf=new byte[System.in.available()];
System.in.read(buf);
itemdata=getItemXmls(new String(buf));
}
try {
bulkload(url,cluster, concept,datamodel, validate, smartpk, itemdata,username,password,null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static List<String> getItemXmls(String itemdata)throws Exception {
Element root=parse(itemdata).getDocumentElement();
List<String> items=new ArrayList<String>();
for(int i=0; i<root.getChildNodes().getLength(); i++) {
Node node=root.getChildNodes().item(i);
if(node.getNodeType() == Node.ELEMENT_NODE) {
items.add(nodeToString(node, true));
}
}
return items;
}
private static String nodeToString(Node n, boolean omitXMLDeclaration) throws TransformerException{
StringWriter sw = new StringWriter();
Transformer transformer = TransformerFactory.newInstance().newTransformer();
if (omitXMLDeclaration)
transformer.setOutputProperty("omit-xml-declaration","yes");
else
transformer.setOutputProperty("omit-xml-declaration","no");
transformer.setOutputProperty("indent","yes");
transformer.transform(
new DOMSource(n),
new StreamResult(sw)
);
if (sw==null) return null;
return sw.toString().replaceAll("\r\n", "\n");
}
private static Document parse(String xmlString) throws ParserConfigurationException,IOException, SAXException{
//parse
Document d=null;
NameValuePair[] parameters = {new NameValuePair("cluster", cluster), //$NON-NLS-1$
new NameValuePair("concept", concept), //$NON-NLS-1$
new NameValuePair("datamodel", datamodel), //$NON-NLS-1$
new NameValuePair("validate", String.valueOf(validate)), //$NON-NLS-1$
new NameValuePair("action", "load"), //$NON-NLS-1$ //$NON-NLS-2$
new NameValuePair("smartpk", String.valueOf(smartpk))}; //$NON-NLS-1$
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
//Schema validation based on schemaURL
factory.setNamespaceAware(true);
factory.setAttribute(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
DocumentBuilder builder;
builder = factory.newDocumentBuilder();
HttpClient client = new HttpClient();
String user = universe == null || universe.trim().length() == 0 ? username : universe + "/" + username; //$NON-NLS-1$
client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(user, password));
HttpClientParams clientParams = client.getParams();
clientParams.setAuthenticationPreemptive(true);
clientParams.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
d = builder.parse(new InputSource(new StringReader(xmlString)));
PutMethod putMethod = new PutMethod();
// This setPath call is *really* important (if not set, request will be sent to the JBoss root '/')
putMethod.setPath(url);
String responseBody;
try {
// Configuration
putMethod.setRequestHeader("Content-Type", "text/xml; charset=utf8"); //$NON-NLS-1$ //$NON-NLS-2$
putMethod.setQueryString(parameters);
putMethod.setContentChunked(true);
// Set the content of the PUT request
putMethod.setRequestEntity(new InputStreamRequestEntity(itemdata));
return d;
}
private static void usage() {
String usage="Usage:\n"+
"\t java -jar bulkloadclient.jar <url> <username> <password> <datacontainer> <concept> <datamodel> [validate] [smartpk] [itemdata] \n"+
"\t example1: java -jar bulkloadclient.jar http://localhost:8080/datamanager/loadServlet admin talend Order Country Order <itemdata><Country><isoCode>zh</isoCode><label>china</label><Continent>Asia</Continent></Country></itemdata>"+
"\t example2(on linux): cat myfile.xml|java -jar bulkloadclient.jar http://localhost:8080/datamanager/loadServlet admin talend Order Country Order";
System.out.println(usage);
}
public static boolean bulkload(String URL, String cluster,String concept,String datamodel, boolean validate, boolean smartpk, List<String> itemdata,
String username, String password,String universe) throws Exception {
HttpClient client = new HttpClient();
HttpClientParams params = new HttpClientParams();
// params.setSoTimeout(1000);
// params.setConnectionManagerTimeout(200);
client.setParams(params);
String user=universe==null||universe.trim().length()==0?username:universe+"/"+username;
client.getState().setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(user, password));
client.executeMethod(config, putMethod);
responseBody = putMethod.getResponseBodyAsString();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
putMethod.releaseConnection();
}
URI uri = new URI(URL, false, "utf-8");
HostConfiguration config = new HostConfiguration();
config.setHost(uri);
int statusCode = putMethod.getStatusCode();
if (statusCode >= 400) {
throw new BulkloadException(responseBody);
}
}
PostMethod postMethod = new PostMethod(URL);
HttpMethodParams reqParams = postMethod.getParams();
reqParams.setContentCharset("UTF-8");
List<NameValuePair> list=new ArrayList<NameValuePair>();
NameValuePair[] data = { new NameValuePair("cluster", cluster),
new NameValuePair("concept", concept),
new NameValuePair("datamodel", datamodel),
new NameValuePair("validate", String.valueOf(validate)),
new NameValuePair("smartpk", String.valueOf(smartpk))};
list.addAll(Arrays.asList(data));
for(int i=0; i<itemdata.size(); i++) {
list.add(new NameValuePair("itemdata"+i, itemdata.get(i)));
}
postMethod.setRequestBody((NameValuePair[])list.toArray(new NameValuePair[list.size()]));
// post method
int statusCode = 0;
try {
statusCode = client.executeMethod(config,postMethod);
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
public static InputStreamMerger bulkload(String url, String cluster, String concept, String dataModel, boolean validate, boolean smartPK, String username, String password, String universe, AtomicInteger startedBulkloadCount) {
InputStreamMerger merger = new InputStreamMerger();
if (statusCode >= 400)
return false;
String str = "";
try {
str = postMethod.getResponseBodyAsString();
} catch (IOException e) {
Runnable loadRunnable = new AsyncLoadRunnable(url, cluster, concept, dataModel, validate, smartPK, merger, username, password, universe, startedBulkloadCount);
Thread loadThread = new Thread(loadRunnable);
loadThread.start();
}
System.out.println(str);
return merger;
}
postMethod.releaseConnection();
return true;
}
private static class AsyncLoadRunnable implements Runnable {
private final String url;
private final String cluster;
private final String concept;
private final String dataModel;
private final boolean validate;
private final boolean smartPK;
private final InputStreamMerger inputStream;
private final String userName;
private final String password;
private final String universe;
private final AtomicInteger startedBulkloadCount;
public AsyncLoadRunnable(String url, String cluster, String concept, String dataModel, boolean validate, boolean smartPK, InputStreamMerger inputStream, String userName, String password, String universe, AtomicInteger startedBulkloadCount) {
this.url = url;
this.cluster = cluster;
this.concept = concept;
this.dataModel = dataModel;
this.validate = validate;
this.smartPK = smartPK;
this.inputStream = inputStream;
this.userName = userName;
this.password = password;
this.universe = universe;
this.startedBulkloadCount = startedBulkloadCount;
}
public void run() {
try {
startedBulkloadCount.incrementAndGet();
bulkload(url, cluster, concept, dataModel, validate, smartPK, inputStream, userName, password, universe);
} catch (Throwable e) {
inputStream.reportFailure(e);
} finally {
startedBulkloadCount.decrementAndGet();
synchronized (startedBulkloadCount) {
startedBulkloadCount.notifyAll();
}
}
}
}
}

View File

@@ -1,52 +0,0 @@
/*
* Copyright (C) 2006-2012 Talend Inc. - www.talend.com
*
* This source code is available under agreement available at
* %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
*
* You should have received a copy of the agreement
* along with this program; if not, write to Talend SA
* 9 rue Pages 92150 Suresnes, France
*/
package org.talend.mdm.bulkload.client;
import java.io.PrintStream;
import java.io.PrintWriter;
/**
*
*/
public class BulkloadException extends RuntimeException {
private static final String SERVER_EXCEPTION_SEPARATOR = "== SERVER EXCEPTION ==";
private static final String LINE_SEPARATOR = System.getProperty("line.separator"); //$NON-NLS-1$
private final String serverException;
public BulkloadException(String serverException) {
super("An exception happened during bulk load on MDM server.");
this.serverException = serverException;
}
public String getServerException() {
return serverException;
}
@Override
public void printStackTrace(PrintStream s) {
super.printStackTrace(s);
s.append(LINE_SEPARATOR);
s.append(SERVER_EXCEPTION_SEPARATOR);
s.append(LINE_SEPARATOR);
s.append(serverException);
}
@Override
public void printStackTrace(PrintWriter s) {
super.printStackTrace(s);
s.println(SERVER_EXCEPTION_SEPARATOR);
s.println(serverException);
}
}

View File

@@ -1,191 +0,0 @@
/*
* Copyright (C) 2006-2012 Talend Inc. - www.talend.com
*
* This source code is available under agreement available at
* %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
*
* You should have received a copy of the agreement
* along with this program; if not, write to Talend SA
* 9 rue Pages 92150 Suresnes, France
*/
package org.talend.mdm.bulkload.client;
import java.io.IOException;
import java.io.InputStream;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
*/
public class InputStreamMerger extends InputStream {
private static final Logger log = Logger.getLogger(InputStreamMerger.class.getName());
private final Queue<InputStream> inputStreamBuffer = new ConcurrentLinkedQueue<InputStream>();
private final Object readLock = new Object();
private final Object exhaustLock = new Object();
private boolean isClosed;
private InputStream currentStream;
private boolean hasFinishedRead;
private Throwable lastFailure;
public void push(InputStream inputStream) throws IOException {
if (inputStream == null) {
throw new IllegalArgumentException("Input stream can not be null.");
}
if (isClosed) {
throw new IOException("Stream is closed");
}
inputStreamBuffer.add(inputStream);
debug("Added a new input stream (buffer now has " + inputStreamBuffer.size() + " streams)");
}
public void reportFailure(Throwable e) {
debug("Exception occurred in consumer thread: " + e.getMessage());
lastFailure = e;
synchronized (exhaustLock) {
exhaustLock.notifyAll();
}
}
@Override
public int available() throws IOException {
return 4096;
}
@Override
public boolean markSupported() {
return false;
}
/**
* <p> Read block the current thread until data is pushed to this stream (using {@link #push(java.io.InputStream)}
* or if {@link #close()} is called. </p>
*
* @return the next byte of data, or <code>-1</code> if the end of the stream is reached <b>or</b> if stream is
* closed.
* @throws IOException
* @see java.io.InputStream#read()
*/
@Override
public int read() throws IOException {
int read = -1;
if (currentStream != null) {
read = currentStream.read();
} else {
moveToNextInputStream();
if (currentStream != null) {
read = currentStream.read();
}
}
if (read < 0) {
moveToNextInputStream();
if (currentStream != null) {
read = currentStream.read();
}
}
if (read < 0) {
synchronized (exhaustLock) {
debug("Notify exhaust lock");
exhaustLock.notifyAll();
}
}
// Throw any exception that might have occurred during last record processing.
throwLastFailure();
return read;
}
private void throwLastFailure() throws IOException {
if (lastFailure != null) {
debug("Report last failure exception to producer.");
throw new IOException("An exception occurred while processing last record.", lastFailure);
}
}
private void moveToNextInputStream() throws IOException {
// Throw any exception that might have occurred during previous records
throwLastFailure();
// Check the isClosed flag in case we've got waken up by a close()
while (inputStreamBuffer.isEmpty() && !isClosed) {
synchronized (readLock) {
try {
debug("Wait for more input...");
readLock.wait();
debug("Wait for more input done.");
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
if (!inputStreamBuffer.isEmpty()) {
if (currentStream != null) {
currentStream.close();
}
currentStream = inputStreamBuffer.poll();
} else {
currentStream = null;
hasFinishedRead = true;
}
debug("Remaining buffers : " + inputStreamBuffer.size());
}
/**
* <p> Close this stream and perform some checks: <ul> <li>Mark this stream as closed (no more calls to {@link
* #push(java.io.InputStream)} are allowed)</li> <li>Closes any remaining stream pushed to this stream</li> </ul>
* </p> <p> Calling this method wakes up any thread blocked on {@link #read()} </p> <p> Wait till all streams pushed
* to this stream (and stored in <code>inputStreamBuffer</code>) are processed by a reader. </p> <p> When this
* method exits, the buffer is empty and the last stream in buffer is fully read (i.e. until read() returns -1).
* </p>
*
* @throws IOException In case at least one stream in buffer hasn't been read.
* @see java.io.InputStream#close()
*/
@Override
public void close() throws IOException {
super.close();
isClosed = true;
synchronized (readLock) {
readLock.notifyAll();
}
debug("Input stream buffer size: " + +inputStreamBuffer.size());
debug("Has finished read: " + hasFinishedRead);
debug("Stop condition: " + (!inputStreamBuffer.isEmpty() && !hasFinishedRead));
while (!inputStreamBuffer.isEmpty() && !hasFinishedRead) {
try {
debug("Waiting for exhaust... (" + inputStreamBuffer.size() + " remaining)");
synchronized (exhaustLock) {
exhaustLock.wait();
}
// In case we got woken up due to a failure
throwLastFailure();
debug("Waiting for exhaust done.");
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
// In case failure happened on very last read.
throwLastFailure();
debug("Close completed.");
}
private static void debug(String message) {
Level debugLevel = Level.FINEST;
if (log.isLoggable(debugLevel)) {
log.log(debugLevel, "[" + Thread.currentThread() + "] " + message);
}
}
public Throwable getLastReportedFailure() {
return lastFailure;
}
}

View File

@@ -15,8 +15,8 @@
<pathelement location="${component.plugin.home}/tFileInputXML/dom4j-1.6.1.jar" />
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/geronimo-stax-api_1.0_spec-1.0.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/log4j-1.2.15.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-3.8-20120913_modified_talend.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-3.8-20121127_modified_talend.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-schemas-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-scratchpad-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/xmlbeans-2.3.0.jar" />

View File

@@ -27,41 +27,30 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
private boolean stop = false;
private int currentColumnIndex = -1;
private int lastColumnIndex = -1;
public DefaultTalendSheetContentsHandler(DataBufferCache cache) {
this.cache = cache;
}
@Override
public void startRow(int rowNum) {
row = new ArrayList<String>();
}
@Override
public void endRow() {
cache.writeData(row);
row = null;
// when each row end ,reset lastColumnIndex
lastColumnIndex = -1;
if (stop) {
throw new EnoughDataException("Get enough data,now stop the xml parse action");
}
}
@Override
public void cell(String cellReference, String formattedValue) {
checkHasNullValue(cellReference);
row.add(formattedValue);
}
@Override
public void headerFooter(String text, boolean isHeader, String tagName) {
}
@Override
public void endSheet() {
}
@@ -70,40 +59,4 @@ public class DefaultTalendSheetContentsHandler implements TalendXSSFSheetXMLHand
this.stop = true;
}
/**
* when currentCellReferecnce is "A1" ,and next currentCellReferecnce is "C1",we need add a null value for "B1"
*/
private void checkHasNullValue(String cellReference) {
currentColumnIndex = getIndexOfColumn(cellReference);
// Might be the empty string.
for (int i = lastColumnIndex; i < currentColumnIndex - 1; i++) {
row.add(null);
}
// Update column
if (currentColumnIndex > -1) {
lastColumnIndex = currentColumnIndex;
}
}
/**
* get index of column,like "AB12" return 27
*/
private int getIndexOfColumn(String cellReference) {
int columnIndex = -1;
// get First Digit index ,like cellReferecnce is "AA13" ,firstDigitIndex return 2
int firstDigitIndex = -1;
for (int c = 0; c < cellReference.length(); ++c) {
if (Character.isDigit(cellReference.charAt(c))) {
firstDigitIndex = c;
break;
}
}
// get String part for cellReference,like "AB2" ,return "AB"
String cellStringPart = cellReference.substring(0, firstDigitIndex);
for (int i = 0; i < cellStringPart.length(); ++i) {
int c = cellStringPart.charAt(i);
columnIndex = (columnIndex + 1) * 26 + c - 'A';
}
return columnIndex;
}
}

View File

@@ -1412,7 +1412,8 @@ public class MktowsApiSoapBindingStub extends org.apache.axis.client.Stub implem
public void addMarketoAuthenticatioNHeader(org.apache.axis.client.Call _call) throws Exception {
// Request timestamp: a timestamp string in W3C WSDL date format
String requestTimestamp = formatAsW3C(Calendar.getInstance().getTime());
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
String requestTimestamp = df.format(Calendar.getInstance().getTime());
// System.out.println(requestTimestamp);
String stringToEncrypt = requestTimestamp + clientAccessID;
@@ -1434,13 +1435,6 @@ public class MktowsApiSoapBindingStub extends org.apache.axis.client.Stub implem
// System.out.println(authenticationHeader.getAsString());
_call.addHeader(authenticationHeader);
}
public String formatAsW3C(java.util.Date dt) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
String text = df.format(dt);
String w3cValue = text.substring(0, 22) + ":" + text.substring(22);
return w3cValue;
}
public com.marketo.www.mktows.SuccessGetLeadActivity getLeadActivity(com.marketo.www.mktows.ParamsGetLeadActivity paramsGetLeadActivity) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {

View File

@@ -16,7 +16,7 @@
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/geronimo-stax-api_1.0_spec-1.0.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/log4j-1.2.15.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-3.8-20120913_modified_talend.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-3.8-20121127_modified_talend.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-ooxml-schemas-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tFileInputExcel/poi-scratchpad-3.8-20120326.jar" />
<pathelement location="${component.plugin.home}/tMicrosoftCrmInput/xmlbeans-2.3.0.jar" />

View File

@@ -3,8 +3,6 @@ package org.talend.designer.components.hashfile.common;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.Iterator;
import org.talend.designer.components.hashfile.memory.AdvancedMemoryHashFile;
public class MapHashFile {
@@ -41,29 +39,4 @@ public class MapHashFile {
public Map<String, String> getKeyMap() {
return keyMap;
}
public void clearCache(String key){
clearChildCache(getRootCache(key));
}
public void clearChildCache(String root){
Set<String> set = keyMap.keySet();
synchronized(keyMap) {
Iterator<String> it = set.iterator();
while(it.hasNext()){
String key = it.next();
if(keyMap.get(key).equals(root)){
this.resourceMap.remove(key);
clearChildCache(key);
}
}
}
this.resourceMap.remove(root);
}
public String getRootCache(String cache){
String root;
while((root = keyMap.get(cache))!=null){
cache=root;
}
return cache;
}
}

View File

@@ -12,7 +12,6 @@
// ============================================================================
package org.talend.designer.components.hashfile.memory;
import java.util.Collections;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -35,9 +34,9 @@ public class AdvancedMemoryHashFile<V> {
public AdvancedMemoryHashFile(MATCHING_MODE matchingMode) {
this.matchingMode = matchingMode;
if (matchingMode == MATCHING_MODE.KEEP_ALL) {
allList = Collections.synchronizedList(new ArrayList<V>());
allList = new ArrayList<V>();
} else if (matchingMode == MATCHING_MODE.KEEP_FIRST) {
firstHash = Collections.synchronizedMap(new HashMap<V, V>());
firstHash = new HashMap<V, V>();
}
}

View File

@@ -63,7 +63,7 @@ bin.excludes = components/tBonitaDeploy/,\
components/tMSSqlInput/jtds-1.2.5.jar,\
components/tMicrosoftMQInput/msmq.jar,\
components/tMysqlInput/mysql-connector-java-3.1.14-bin.jar,\
components/tAmazonMysqlInput/mysql-connector-java-5.1.22-bin.jar,\
components/tAmazonMysqlInput/mysql-connector-java-5.1.0-bin.jar,\
components/tAmazonMysqlInput/mysql-connector-java-5.1.0-bin.jar,\
components/tGreenplumGPLoad/namedpipe_jni.dll,\
components/tNamedPipeOutput/namedpipe_jni.dll,\

View File

@@ -1,4 +1,2 @@
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.V5R2_V5R4=V5R2 to V5R4
DB_VERSION.ITEM.V5R3_V6R1=V5R3 to V6R1

View File

@@ -7,7 +7,9 @@ imports="
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map"
%>

View File

@@ -1,4 +1,2 @@
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.V5R2_V5R4=V5R2 to V5R4
DB_VERSION.ITEM.V5R3_V6R1=V5R3 to V6R1

View File

@@ -1,6 +1,7 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>

View File

@@ -4,6 +4,9 @@ imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
org.talend.core.model.process.IConnection
@@ -11,6 +14,7 @@ imports="
java.util.ArrayList
java.util.Map
java.util.HashMap
java.util.LinkedList
"
skeleton="../templates/db_output_bulk.skeleton"
%>

View File

@@ -4,8 +4,10 @@ imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.IConnection
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
org.talend.core.model.process.IConnectionCategory
@@ -13,6 +15,7 @@ imports="
java.util.ArrayList
java.util.Map
java.util.HashMap
java.util.LinkedList
"
skeleton="../templates/db_output_bulk.skeleton"
%>

View File

@@ -24,7 +24,7 @@ DATA_ACTION.ITEM.INSERT_OR_UPDATE=Insert ou update
DATA_ACTION.ITEM.UPDATE=UPDATE
DATA_ACTION.ITEM.UPDATE_OR_INSERT=Update ou insert
DATA_ACTION.NAME=Action sur les données
DIE_ON_ERROR.NAME=Arrêter en cas d'erreur
DIE_ON_ERROR.NAME=Terminer en cas d'erreur
ENCODING.NAME=Encodage
FIELD_OPTIONS.ITEM.DELETE_KEY=Clé pour suppression
FIELD_OPTIONS.ITEM.INSERTABLE=Insérable

View File

@@ -6,9 +6,5 @@ ADD_COLS.ITEM.OPERATOR.ITEM.IS=IS
ADD_COLS.ITEM.OPERATOR.ITEM.LESS_THAN=Kleiner dan
ADD_COLS.ITEM.OPERATOR.ITEM.NOT_EQUAL=<>
COMMIT_EVERY.NAME=Commit iedere
DATA_ACTION.ITEM.DELETE=Verwijderen
DATA_ACTION.ITEM.UPDATE=Update
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.V5R2_V5R4=V5R2 to V5R4
DB_VERSION.ITEM.V5R3_V6R1=V5R3 to V6R1

View File

@@ -6,5 +6,6 @@ ADD_COLS.ITEM.OPERATOR.ITEM.LESS_THAN=Manje od
ADD_COLS.ITEM.OPERATOR.ITEM.NOT_EQUAL=<>
ADD_COLS.ITEM.REFCOL=Referentna kolona
ADD_COLS.ITEM.SQL=SQL izraz
DATA_ACTION.ITEM.DELETE=DELETE
DATA_ACTION.ITEM.INSERT=INSERT
DATA_ACTION.ITEM.UPDATE=UPDATE

View File

@@ -1,6 +1,6 @@
COMMIT_EVERY.NAME=Commiter toutes les
DBD-DB2.INFO=Requis
DIE_ON_ERROR.NAME=Arrêter en cas d'erreur
DIE_ON_ERROR.NAME=Terminer en cas d'erreur
ENCODING.NAME=Encodage
HELP=org.talend.help.tAS400Row
HOST.NAME=Hôte

View File

@@ -1,5 +1,3 @@
COMMIT_EVERY.NAME=Commit iedere
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.V5R2_V5R4=V5R2 to V5R4
DB_VERSION.ITEM.V5R3_V6R1=V5R3 to V6R1

View File

@@ -4,6 +4,7 @@ imports="
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.MetadataTalendType
org.talend.core.model.metadata.MappingTypeRetriever
java.util.List

View File

@@ -1,4 +1,2 @@
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.Access_2003=Access 2003
DB_VERSION.ITEM.Access_2007=Access 2007

View File

@@ -1,4 +1,2 @@
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.Access_2003=Access 2003
DB_VERSION.ITEM.Access_2007=Access 2007

View File

@@ -7,7 +7,9 @@ imports="
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map
"

View File

@@ -1,3 +1 @@
PASS.NAME=Wachtwoord
DB_VERSION.ITEM.Access_2003=Access 2003
DB_VERSION.ITEM.Access_2007=Access 2007

View File

@@ -3,12 +3,16 @@ imports="org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
java.util.List
java.util.ArrayList
java.util.Map
java.util.HashMap"
java.util.HashMap
java.util.LinkedList"
skeleton="../templates/db_output_bulk.skeleton"
%>

View File

@@ -4,8 +4,10 @@ imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.IConnection
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
org.talend.core.model.process.IConnectionCategory
@@ -13,6 +15,7 @@ imports="
java.util.ArrayList
java.util.Map
java.util.HashMap
java.util.LinkedList
"
skeleton="../templates/db_output_bulk.skeleton"
%>

View File

@@ -15,7 +15,7 @@ DATA_ACTION.ITEM.INSERT_OR_UPDATE=Insert ou update
DATA_ACTION.ITEM.UPDATE=UPDATE
DATA_ACTION.ITEM.UPDATE_OR_INSERT=Update ou insert
DATA_ACTION.NAME=Action sur les données
DIE_ON_ERROR.NAME=Arrêter en cas d'erreur
DIE_ON_ERROR.NAME=Terminer en cas d'erreur
ENCODING.NAME=Encodage
HELP=org.talend.help.tAccessOutput
LONG_NAME=Insère ou met à jour des lignes dans une table Access.

View File

@@ -1,7 +1,5 @@
ADD_COLS.ITEM.NAME=Naam
COMMIT_EVERY.NAME=Commit iedere
DATA_ACTION.ITEM.DELETE=Verwijderen
DATA_ACTION.ITEM.UPDATE=Update
PASS.NAME=Wachtwoord
ADD_COLS.ITEM.OPERATOR.ITEM.NOT_EQUAL=<>
ADD_COLS.ITEM.OPERATOR.ITEM.LESS_THAN=Kleiner dan
@@ -9,5 +7,3 @@ ADD_COLS.ITEM.OPERATOR.ITEM.LESS_EQUAL_THAN=Kleiner dan
ADD_COLS.ITEM.OPERATOR.ITEM.GREAT_THAN=Groter dan of gelijk aan
ADD_COLS.ITEM.OPERATOR.ITEM.GREAT_EQUAL_THAN=Groter dan of gelijk aan
ADD_COLS.ITEM.OPERATOR.ITEM.IS=IS
DB_VERSION.ITEM.Access_2003=Access 2003
DB_VERSION.ITEM.Access_2007=Access 2007

View File

@@ -1,5 +1,6 @@
ADD_COLS.ITEM.REFCOL=Referentna kolona
ADD_COLS.ITEM.SQL=SQL izraz
DATA_ACTION.ITEM.DELETE=DELETE
DATA_ACTION.ITEM.INSERT=INSERT
DATA_ACTION.ITEM.UPDATE=UPDATE
ADD_COLS.ITEM.OPERATOR.ITEM.NOT_EQUAL=<>

View File

@@ -1,6 +1,5 @@
APPEND.NAME=Ecrire après
ENCODING.NAME=Encodage
FILENAME.NAME=Nom de fichier
HELP=org.talend.help.tAccessOutputBulk
INCLUDEHEADER.NAME=Inclure l'en-tête
LONG_NAME=Ecrit un fichier préparé pour chargement de masse Access

View File

@@ -1,7 +1,6 @@
APPEND.NAME=Ecrire après
DBNAME.NAME=Nom de la base de données
DB_SCHEMA.NAME=Schéma
FILENAME.NAME=Nom de fichier
HELP=org.talend.help.tAccessOutputBulkExec
INCLUDEHEADER.NAME=Inclure l'en-tête
LONG_NAME=Construit un fichier de masse au format Access, et demande à la base de données de charger ce fichier
@@ -32,4 +31,3 @@ CREATE.NAME=Cr
PROPERTIES.NAME=Paramètres JDBC supplémentaires
USE_EXISTING_CONNECTION.NAME=Utiliser une connexion existante
USE_FIELDS_ENCLOSURE.NAME=Utiliser l'entourage du texte
FIELDS_ENCLOSURE.NAME=Entourage du champ

View File

@@ -1,5 +1,3 @@
APPEND.NAME=Toevoegen
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.Access_2003=Access 2003
DB_VERSION.ITEM.Access_2007=Access 2007

View File

@@ -1,6 +1,6 @@
COMMIT_EVERY.NAME=Commiter toutes les
TABLE.NAME=Nom de la table
DIE_ON_ERROR.NAME=Arrêter en cas d'erreur
DIE_ON_ERROR.NAME=Terminer en cas d'erreur
ENCODING.NAME=Encodage
HELP=org.talend.help.tAccessRow
LONG_NAME=Exécute une requête SQL à chaque itération de flux Talend

View File

@@ -1,4 +1,2 @@
COMMIT_EVERY.NAME=Commit iedere
PASS.NAME=Wachtwoord
DB_VERSION.ITEM.Access_2003=Access 2003
DB_VERSION.ITEM.Access_2007=Access 2007

View File

@@ -1,7 +1,10 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
"
%>

View File

@@ -1,6 +1,7 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
"
%>

View File

@@ -1,3 +0,0 @@
LOCATION_TYPE_CODE2.NAME=Land code 2 letters
LOCATION_TYPE_CODE3.NAME=Land code 3 letters
LOCATION_TYPE_CODE.NAME=Land code

View File

@@ -1,583 +0,0 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.IMetadataTable
java.util.List
java.util.Map
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
java.util.ArrayList
java.util.LinkedList
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.utils.NodeUtil
"
%>
<%
//XMLTool
class XMLTool{
public boolean advancedSeparator = false;
public String thousandsSeparator = null;
public String decimalSeparator =null;
public String connName = null;
public String cid = null;
public void getValue(XMLNode node){
%>
valueMap_<%=cid%>.get("<%=node.relatedColumn.getLabel()%>")
<%
}
public void getValue(IMetadataColumn column){
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String defaultValue=column.getDefault();
boolean isNotSetDefault = false;
if(defaultValue!=null){
isNotSetDefault = defaultValue.length()==0;
}else{
isNotSetDefault=true;
}
%>
(
<%
if(column.isNullable()){
%>
<%=connName%>.<%=column.getLabel()%> != null?
<%
}
if(advancedSeparator && JavaTypesManager.isNumberType(javaType, column.isNullable())) {
if(javaType == JavaTypesManager.BIGDECIMAL) {
%>
FormatterUtils.format_Number(String.valueOf(<%=column.getPrecision() == null? connName + "." + column.getLabel() : connName + "." + column.getLabel() + ".setScale(" + column.getPrecision() + ", java.math.RoundingMode.HALF_UP)" %>), <%= thousandsSeparator%>,<%=decimalSeparator %>)
<%
} else {
%>
FormatterUtils.format_Number(String.valueOf(<%=connName%>.<%=column.getLabel()%>), <%= thousandsSeparator %>,<%=decimalSeparator %>)
<%
}
} else if(JavaTypesManager.isJavaPrimitiveType( column.getTalendType(), column.isNullable())){
%>
String.valueOf(<%=connName%>.<%=column.getLabel()%>)
<%
}else if(javaType == JavaTypesManager.DATE){
if( column.getPattern() != null && column.getPattern().trim().length() != 0 ){
%>
FormatterUtils.format_Date(<%=connName%>.<%=column.getLabel()%>,<%=column.getPattern()%>)
<%
}else{
%>
<%=connName%>.<%=column.getLabel()%>
<%
}
}else if (javaType == JavaTypesManager.BIGDECIMAL) {
%>
String.valueOf(<%=column.getPrecision() == null? connName + "." + column.getLabel() : connName + "." + column.getLabel() + ".setScale(" + column.getPrecision() + ", java.math.RoundingMode.HALF_UP)" %>)
<%
}else{
%>
<%=connName%>.<%=column.getLabel()%>.toString()
<%
}
if(column.isNullable()){
%>:<%
if(isNotSetDefault == false){
%><%=column.getDefault()%><%
}else{
%>null<%
}
}
%>
)
<%
}
}
// ------------------- *** Dom4j generation mode start *** ------------------- //
class GenerateToolByDom4j{
String cid = null;
boolean allowEmpty = false;
boolean bAddEmptyAttr = false, bAddUnmappedAttr = false;
boolean outputAsXSD = false;
XMLTool tool = null;
boolean isAppend = false;
public void generateCode(XMLNode node, String currEleName, String parentName){
if(("ELEMENT").equals(node.type)){
createElement(currEleName,node,parentName);
setText(currEleName,node);
for(XMLNode ns:node.namespaces){
addNameSpace(currEleName,ns);
}
for(XMLNode attri:node.attributes){
addAttribute(currEleName,attri);
}
if(node.name.indexOf(":")>0){
%>
<%=currEleName%>_<%=cid%>.setName("<%=node.name%>");
<%
}
int index = 0;
for(XMLNode child:node.elements){
if(0==(child.special & 1)){
generateCode(child,currEleName+"_"+index++,currEleName);
}
}
if(node.relatedColumn != null && (node.special & 2)==0 && (node.special & 1)==0){
if(isAppend && !outputAsXSD && !allowEmpty){
%>
if (<%=currEleName%>_<%=cid%>.content().size() == 0
&& <%=currEleName%>_<%=cid%>.attributes().size() == 0
&& <%=currEleName%>_<%=cid%>.declaredNamespaces().size() == 0) {
<%=parentName%>_<%=cid%>.remove(<%=currEleName%>_<%=cid%>);
}
<%
}
}
}
}
private void createElement(String currEleName, XMLNode node, String parentName){
int index = node.name.indexOf(":");
if(5==(node.special & 5)){
int currPos = node.getCurrGroupPos();
if(index>0 && node.parent!=null){
%>
org.dom4j.Element <%=currEleName%>_<%=cid%>;
if (<%=parentName%>_<%=cid%>.getNamespaceForPrefix("<%=node.name.substring(0,index)%>") == null) {
<%=currEleName%>_<%=cid%> = org.dom4j.DocumentHelper.createElement("<%=node.name.substring(index+1)%>");
} else {
<%=currEleName%>_<%=cid%> = org.dom4j.DocumentHelper.createElement("<%=node.name%>");
}
<%
}else{
%>
org.dom4j.Element <%=currEleName%>_<%=cid%> = org.dom4j.DocumentHelper.createElement("<%=node.name%>");
<%
}
if(isAppend){
%>
int app_size_<%=cid %>=<%=parentName%>_<%=cid%>.elements("<%=node.name%>").size();
if(app_size_<%=cid %> > 0){
orders_<%=cid %>[<%=currPos %>] =1+ <%=parentName%>_<%=cid%>.elements().indexOf(<%=parentName%>_<%=cid%>.elements("<%=node.name%>").get(app_size_<%=cid %>-1));
}else{
<%
if(currPos==0){
%>
orders_<%=cid %>[<%=currPos %>] = <%=parentName%>_<%=cid%>.elements().size();
<%
}else{
%>
orders_<%=cid %>[<%=currPos %>] = <%=node.getNodeInsertIndex() %>;
if(orders_<%=cid %>[<%=currPos %>] == 0 && <%=parentName%>_<%=cid%>.elements().size() != 0 && !bl_<%=cid%>) {
orders_<%=cid %>[<%=currPos %>] = <%=parentName%>_<%=cid%>.elements().size();
}
<%
}
%>
}
<%=parentName%>_<%=cid%>.elements().add(orders_<%=cid %>[<%=currPos %>],<%=currEleName%>_<%=cid%>);
<%
}else{
%>
if(orders_<%=cid %>[<%=currPos %>]==0){
orders_<%=cid %>[<%=currPos %>] = <%=node.getNodeInsertIndex() %>;
}
if(<%=currPos +1 %> < orders_<%=cid %>.length){
orders_<%=cid %>[<%=currPos +1 %>] = 0;
}
<%=parentName%>_<%=cid%>.elements().add(orders_<%=cid %>[<%=currPos %>]++,<%=currEleName%>_<%=cid%>);
<%
}
}else{
if(index>0 && node.parent!=null){
%>
org.dom4j.Element <%=currEleName%>_<%=cid%>;
if (<%=parentName%>_<%=cid%>.getNamespaceForPrefix("<%=node.name.substring(0,index)%>") == null) {
<%=currEleName%>_<%=cid%> = <%=parentName%>_<%=cid%>.addElement("<%=node.name.substring(index+1)%>");
} else {
<%=currEleName%>_<%=cid%> = <%=parentName%>_<%=cid%>.addElement("<%=node.name%>");
}
<%
}else{
%>
org.dom4j.Element <%=currEleName%>_<%=cid%> = <%=parentName%>_<%=cid%>.addElement("<%=node.name%>");
<%
}
}
if(0!=(node.special & 2)){
%>
subTreeRootParent_<%=cid%> = <%=currEleName%>_<%=cid%>;
<%
}
}
private void setText(String currEleName, XMLNode node){
if(node.relatedColumn!=null){
JavaType javaType = JavaTypesManager.getJavaTypeFromId(node.relatedColumn.getTalendType());
if(javaType == JavaTypesManager.OBJECT){
%>
if(<%tool.getValue(node); %>!=null){
nestXMLTool_<%=cid%> .parseAndAdd(<%=currEleName%>_<%=cid%>,<%tool.getValue(node);%>);
}
<%
if(outputAsXSD){
%>
else{
nestXMLTool_<%=cid%> .parseAndAdd(<%=currEleName%>_<%=cid%>,"");
<%=currEleName%>_<%=cid%>.addAttribute("xsi:nil","true");
}
<%
}
}else{
if("id_Document".equals(node.relatedColumn.getTalendType())) {
%>
if(<%tool.getValue(node); %>!=null){
nestXMLTool_<%=cid%> .setText(<%=currEleName%>_<%=cid%>, ParserUtils.parseTo_Document(<%tool.getValue(node);%>).getDocument().getRootElement().asXML());
}
<%
} else {
%>
if(<%tool.getValue(node); %>!=null){
nestXMLTool_<%=cid%> .setText(<%=currEleName%>_<%=cid%>,<%tool.getValue(node);%>);
}
<%
}
if(outputAsXSD){
%>
else{
<%=currEleName%>_<%=cid%>.setText("");
<%=currEleName%>_<%=cid%>.addAttribute("xsi:nil","true");
}
<%
}
}
}else if(node.defaultValue != null && !("").equals(node.defaultValue) ){
%>
nestXMLTool_<%=cid %>.parseAndAdd(<%=currEleName %>_<%=cid %>,"<%=node.defaultValue %>");
<%
}
}
private void addAttribute(String currEleName, XMLNode node){
if (node.relatedColumn != null){
%>
if (<%tool.getValue(node);%> != null){
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", <%tool.getValue(node);%>);
} <% if (bAddEmptyAttr) { %> else {
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", "");
}
<%}
} else {
if (node.defaultValue != null && !("").equals(node.defaultValue) ){
%>
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", "<%=node.defaultValue %>");
<%
} else if (bAddUnmappedAttr){
%>
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", "");
<%
}
}
}
private void addNameSpace(String currEleName, XMLNode node){
if(node.relatedColumn!=null){
%>
if(<%tool.getValue(node);%>!=null){
<%=currEleName%>_<%=cid%>.addNamespace("<%=node.path%>",TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>));
<%
if(node.path ==null || node.path.length()==0){
%>
<%=currEleName%>_<%=cid%>.setQName(org.dom4j.DocumentHelper.createQName(<%=currEleName%>_<%=cid%>.getName(),
org.dom4j.DocumentHelper.createNamespace("",TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>))));
<%
}
%>
}
<%
}else if(node.defaultValue != null && !("").equals(node.defaultValue) ){
%>
<%=currEleName %>_<%=cid %>.addNamespace("<%=node.path %>",TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>"));
<%
if(node.path ==null || node.path.length()==0){
%>
<%=currEleName %>_<%=cid %>.setQName(org.dom4j.DocumentHelper.createQName(<%=currEleName %>_<%=cid %>.getName(),
org.dom4j.DocumentHelper.createNamespace("",TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>"))));
<%
}
}
}
}
//----------** add by wliu dom4j to genenrate get function for node **-------//
class GenerateExprCmpByDom4j{
// String cid = null;
XMLTool tool = null;
XMLNode groupNode = null;
boolean needEmptyNode = true;
public void generateCode(XMLNode node, String parentName){
String tmpPath = node.path.replaceFirst(groupNode.path,"");
String[] arrNames = tmpPath.split("/");
if(node==groupNode){
%>true
<%
}
if(node.relatedColumn != null){
%> && (<%
if(!needEmptyNode){
%>(<%tool.getValue(node); %>==null && <%generateCmnExpr(arrNames, parentName); %> == null) || (true &&
<% }%>
<%generateCmnExpr(arrNames, parentName); %>!=null
&& <%generateCmnExpr(arrNames, parentName); %>.getText()!=null
&& <%generateCmnExpr(arrNames, parentName); %>.getText().equals(<%tool.getValue(node); %>)
<%if(!needEmptyNode){%>)<%}%>
)
<%
}
//first generate the attribute comparision
if(node.attributes!=null){
for(XMLNode attri:node.attributes){
if(attri.relatedColumn !=null){
%> && (<%
if(!needEmptyNode){
%>(<%tool.getValue(attri); %>==null && <%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>") == null) || (true &&
<% }%>
<%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>")!=null
&& <%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>").getText()!=null
&& <%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>").getText().equals(<%tool.getValue(attri); %>)
<%
if(!needEmptyNode){%>)<%}
%>)<%
}
}
}
if(node.elements!=null){
for(XMLNode child:node.elements){
if(!child.isMainNode()){
generateCode(child,parentName);
}
}
}
}
private void generateCmnExpr(String[] arrNames, String parentName){
%>
<%=parentName %>
<%
for(int i=1;arrNames != null && i<arrNames.length; i++){
%>.element(<%=parentName%>.getQName("<%=arrNames[i]%>"))
<%
}
}
}
// ------------------- *** Dom4j generation mode end *** ------------------- //
// ------------------- *** Null generation mode start *** ------------------- //
class GenerateToolByNull{
String cid = null;
boolean allowEmpty = false;
boolean bAddEmptyAttr = false, bAddUnmappedAttr = false;
boolean outputAsXSD = false;
XMLTool tool = null;
boolean isCompact = false;
public void generateCode(XMLNode node, String emptySpace){
if(("ELEMENT").equals(node.type)){
startElement(node,emptySpace);
setText(node);
XMLNode mainChild = null;
for(XMLNode child:node.elements){
if(child.isMainNode()){ //loop dosen't have a main child node
mainChild = child;
break;
}
}
for(XMLNode child:node.elements){
if(mainChild!=null && mainChild.order<=child.order){ //loop dosen't have a main child node
if(1==(node.special & 1)){ // group
%>
// buffer the start tabs to group buffer
groupBuffer_<%=cid%>[<%=node.getCurrGroupPos()%>] = buf_<%=cid%>.toString();
buf_<%=cid%> = new StringBuffer();
<%
}else{// root
int num = node.path.split("/").length-2;
if(!outputAsXSD && !allowEmpty){
%>
startTabs_<%=cid%>[<%=num%>] = buf_<%=cid%>.toString();
buf_<%=cid%> = new StringBuffer();
<%
}else{
%>
out_<%=cid%>.write(buf_<%=cid%>.toString());
buf_<%=cid%> = new StringBuffer();
<%
}
}
mainChild = null;
}
if(!child.isMainNode()){ //make the main node output last
if(!outputAsXSD && !allowEmpty
&& (child.relatedColumn != null || child.childrenColumnList.size()>0
|| child.hasDefaultValue == true ) ){
%>
if( false
<%
for(IMetadataColumn column : child.childrenColumnList){
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
if(child.hasDefaultValue == true){%> || true
<%}%>
){
<%
if(isCompact==false)
generateCode(child,emptySpace+" ");
else
generateCode(child,emptySpace);
%>
}
<%
}else{
if(isCompact==false)
generateCode(child,emptySpace+" ");
else
generateCode(child,emptySpace);
}
}
}
if(!node.isMainNode()){ // is not main node
endElement(node,emptySpace);
}
}
}
private void startElement(XMLNode node, String emptySpace){
%>
buf_<%=cid%>.append("<%=isCompact?"":"\\n"%>");
buf_<%=cid%>.append("<%=emptySpace%><<%=node.name%>");
<%
if(outputAsXSD && node.parent==null){
%>
buf_<%=cid%>.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
buf_<%=cid%>.append(" xsi:noNamespaceSchemaLocation= \""+ file_<%=cid%>.substring(file_<%=cid%>.lastIndexOf("/")+1)+".xsd"+"\"");
<%
}
for(XMLNode ns:node.namespaces){
addNameSpace(ns);
}
for(XMLNode attri:node.attributes){
addAttribute(attri);
}
if(outputAsXSD && node.relatedColumn != null){
%>
if(<%tool.getValue(node); %> == null){
buf_<%=cid%>.append(" xsi:nil=\"true\"");
}
<%
}
%>
buf_<%=cid%>.append(">");
<%
}
public void endElement(XMLNode node, String emptySpace){
if(node.elements.size()>0){
%>
buf_<%=cid%>.append("<%=isCompact?"":"\\n"%>");
buf_<%=cid%>.append("<%=emptySpace%></<%=node.name%>>");
<%
}else{
%>
buf_<%=cid%>.append("</<%=node.name%>>");
<%
}
}
private void setText(XMLNode node){
if(node.relatedColumn!=null){
JavaType javaType = JavaTypesManager.getJavaTypeFromId(node.relatedColumn.getTalendType());
if(javaType == JavaTypesManager.OBJECT){
%>
if(<%tool.getValue(node);%>!=null){
if(routines.system.XMLHelper.getInstance().isValid(<%tool.getValue(node);%>)){
buf_<%=cid%>.append(<%tool.getValue(node);%>);
} else {
buf_<%=cid%>.append(TalendString.checkCDATAForXML(<%tool.getValue(node);%>));
}
}
<%
}else{
%>
if(<%tool.getValue(node);%>!=null){
buf_<%=cid%>.append(TalendString.checkCDATAForXML(<%tool.getValue(node);%>));
}
<%
}
}else if(node.defaultValue !=null && !("").equals(node.defaultValue) ){
%>
if(routines.system.XMLHelper.getInstance().isValid("<%=node.defaultValue %>")){
buf_<%=cid %>.append("<%=node.defaultValue %>");
} else {
buf_<%=cid %>.append(TalendString.checkCDATAForXML("<%=node.defaultValue %>"));
}
<%
}
}
private void addAttribute(XMLNode node){
if (node.relatedColumn != null){
%>
if (<%tool.getValue(node); %>!=null){
buf_<%=cid%>.append(" <%=node.path%>=\""+TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>)+"\"");
} <% if (bAddEmptyAttr){%> else{
buf_<%=cid%>.append(" <%=node.path%>=\"\"");
}
<%}
} else {
if (node.defaultValue != null && !("").equals(node.defaultValue)){
%>
buf_<%=cid%>.append(" <%=node.path%>=\""+TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>")+"\"");
<%
} else if (bAddUnmappedAttr){
%>
buf_<%=cid%>.append(" <%=node.path%>=\"\"");
<%
}
}
}
private void addNameSpace(XMLNode node){
if(node.relatedColumn!=null){
%>
if(<%tool.getValue(node);%>!=null){
<%
if(node.path ==null || node.path.length()==0){
%>
buf_<%=cid%>.append(" xmlns=\""+TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>)+"\"");
<%
}else{
%>
buf_<%=cid%>.append(" xmlns:<%=node.path%>=\""+TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>)+"\"");
<%
}
%>
}
<%
}else if(node.defaultValue !=null && !("").equals(node.defaultValue) ){
if(node.path ==null || node.path.length()==0){
%>
buf_<%=cid%>.append(" xmlns=\""+TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>")+"\"");
<%
}else{
%>
buf_<%=cid%>.append(" xmlns:<%=node.path%>=\""+TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>")+"\"");
<%
}
}
}
}
// ------------------- *** Null generation mode end *** ------------------- //
%>

View File

@@ -8,14 +8,7 @@
java.util.Map
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.IMetadataColumn
java.util.ArrayList
java.util.LinkedList
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.utils.NodeUtil
"
skeleton="tAdvancedFileOutputXML_java.skeleton"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
@@ -25,11 +18,6 @@ String cid_original = cid;
cid = cid_original.replace("tAdvancedFileOutputXML","tAFOX");
List< ? extends IConnection> conns = node.getIncomingConnections();
%>
<%@ include file="tAdvancedFileOutputXML_begin.inc.javajet"%>
<%
if (conns == null || conns.isEmpty()) {
return "";
} else {
@@ -72,7 +60,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
%>
int nb_line_<%=cid%> = 0;
<%if (isMerge) {%>
<%if (isMerge == true) {%>
boolean needRoot_<%=cid%> = false;
<%} else {%>
boolean needRoot_<%=cid%> = true;
@@ -97,7 +85,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
}
<%}
if (isMerge) {
if (isMerge==true) {
%>
if (!createFile<%=cid%>.exists() || (createFile<%=cid %>.isFile() && createFile<%=cid %>.length() < 1)) {
needRoot_<%=cid %> = true;
@@ -210,7 +198,7 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
org.dom4j.Element root4Group_<%=cid%> = null;
org.dom4j.Document doc_<%=cid %>=null;
<%if (!useStream && isMerge) {//append mode and the code of file path%>
<%if (!useStream && isMerge == true) {//append mode and the code of file path%>
if (needRoot_<%=cid %> == false) {
try {
org.dom4j.io.SAXReader saxReader_<%=cid %>= new org.dom4j.io.SAXReader();
@@ -332,345 +320,6 @@ if ((metadatas != null) && (metadatas.size() > 0)) {
}
}
}
if(conns!=null && conns.size()>0){
IConnection conn = conns.get(0);
if(conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)){
String allowEmpty = ElementParameterParser.getValue(node, "__CREATE_EMPTY_ELEMENT__");
String advancedSeparatorStr = ElementParameterParser.getValue(node, "__ADVANCED_SEPARATOR__");
boolean advancedSeparator = (advancedSeparatorStr!=null&&!("").equals(advancedSeparatorStr))?("true").equals(advancedSeparatorStr):false;
String thousandsSeparator = ElementParameterParser.getValueWithJavaType(node, "__THOUSANDS_SEPARATOR__", JavaTypesManager.CHARACTER);
String decimalSeparator = ElementParameterParser.getValueWithJavaType(node, "__DECIMAL_SEPARATOR__", JavaTypesManager.CHARACTER);
String outputAsXSD = ElementParameterParser.getValue(node, "__OUTPUT_AS_XSD__");
boolean bAddEmptyAttr = "true".equals(ElementParameterParser.getValue(node, "__ADD_EMPTY_ATTRIBUTE__"));
boolean bAddUnmappedAttr = "true".equals(ElementParameterParser.getValue(node, "__ADD_UNMAPPED_ATTRIBUTE__"));
int schemaOptNum=100;
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
schemaOptNum = Integer.parseInt(schemaOptNumStr);
}
// init tool
XMLTool tool = new XMLTool();
tool.connName = NodeUtil.getPrivateConnClassName(conn);
tool.advancedSeparator=advancedSeparator;
tool.thousandsSeparator=thousandsSeparator;
tool.decimalSeparator=decimalSeparator;
tool.cid=cid;
// change tables to a tree
Object[] treeObjs = getTree(rootTable, groupTable, loopTable, metadata.getListColumns());
if(treeObjs == null || treeObjs.length == 0){
return "";
}
List<XMLNode> mainList = (ArrayList<XMLNode>)treeObjs[0];
List<XMLNode> groupList = (ArrayList<XMLNode>)treeObjs[1];
XMLNode root = mainList.get(0);
XMLNode loop = (XMLNode)treeObjs[2];
if(!("true").equals(allowEmpty)){
removeEmptyElement(root);
}
List<List<XMLNode>> groupbyNodeList = new ArrayList<List<XMLNode>>();
for(XMLNode group:groupList){
groupbyNodeList.add(getGroupByNodeList(group));
}
if(metadata.getListColumns().size()> schemaOptNum){
%>
class AdvancedXMLUtil_<%=cid%>{
<%
int colNum = 0;
for(IMetadataColumn column :metadata.getListColumns()){
if(colNum%schemaOptNum==0){
%>
public void putValue_<%=colNum/schemaOptNum%>(<%=tool.connName%>Struct <%=tool.connName%>,java.util.Map<String,String> valueMap_<%=cid%>){
<%
}
%>
valueMap_<%=cid%>.put("<%=column.getLabel()%>", <% tool.getValue(column); %>);
<%
if((colNum+1)%schemaOptNum==0){
%>
}
<%
}
colNum++;
}
if(colNum>0&&(colNum%schemaOptNum)>0){
%>
}
<%
}
if((groupTable.size()>0 && "Dom4j".equals(mode)&&(useStream || !isMerge))||("Null".equals(mode))){
for(int groupNum=0;groupNum<groupList.size();groupNum++){
XMLNode groupRootNode = groupList.get(groupNum);
int nodeNum=0;
for(int j=0;j<groupbyNodeList.get(groupNum).size();j++){
XMLNode attr = groupbyNodeList.get(groupNum).get(j);
if(attr.relatedColumn!=null){
if(nodeNum%schemaOptNum==0){
%>
public boolean getValue_<%=groupNum%>_<%=nodeNum/schemaOptNum%>(java.util.List<java.util.List<String>> groupbyList_<%=cid%>,java.util.Map<String,String> valueMap_<%=cid%>){
return false
<%
}
%>
|| ( groupbyList_<%=cid%>.get(<%=groupNum%>).get(<%=j%>)!=null
? !groupbyList_<%=cid%>.get(<%=groupNum%>).get(<%=j%>).equals(<%tool.getValue(attr);%>)
: <%tool.getValue(attr);%>!=null )
<%
if((nodeNum+1)%schemaOptNum==0){
%>
;
}
<%
}
nodeNum++;
}
}
if(nodeNum>0&&(nodeNum%schemaOptNum)>0){
%>
;
}
<%
}
for(int j=0;j<groupbyNodeList.get(groupNum).size();j++){
XMLNode attr = groupbyNodeList.get(groupNum).get(j);
if(j%schemaOptNum==0){
%>
public void setValue_<%=groupNum%>_<%=j/schemaOptNum%>(java.util.List<java.util.List<String>> groupbyList_<%=cid%>,java.util.Map<String,String> valueMap_<%=cid%>){
<%
}
%>
groupbyList_<%=cid%>.get(<%=groupNum%>).add(<%tool.getValue(attr);%>);
<%
if((j+1)%schemaOptNum==0){
%>
}
<%
}
}
if(groupbyNodeList.get(groupNum).size()>0&&(groupbyNodeList.get(groupNum).size()%schemaOptNum)>0){
%>
}
<%
}
}
}
if(("Dom4j").equals(mode)){
//init the generate tool.
GenerateToolByDom4j generateToolByDom4j = new GenerateToolByDom4j();
if(!useStream && ("true").equals(outputAsXSD)){ // add a new prerequisite:useStream to ignore generating the xsd file
generateToolByDom4j.outputAsXSD = true;
}
if(("true").equals(allowEmpty)){
generateToolByDom4j.allowEmpty = true;
}
generateToolByDom4j.bAddEmptyAttr = bAddEmptyAttr;
generateToolByDom4j.bAddUnmappedAttr = bAddUnmappedAttr;
generateToolByDom4j.cid = cid;
generateToolByDom4j.tool = tool;
if( groupTable.size()>0){
if((!useStream && isMerge)){
generateToolByDom4j.isAppend= true;
for( int i=0; i<groupList.size();i++){
XMLNode groupNode= groupList.get(i);
GenerateExprCmpByDom4j generateExprCmpByDom4j = new GenerateExprCmpByDom4j();
generateExprCmpByDom4j.tool = tool;
generateExprCmpByDom4j.groupNode = groupNode;
generateExprCmpByDom4j.needEmptyNode = ("true").equals(allowEmpty);
%>
public boolean generateCodeDom4j_FindInsertNode<%=i%>(org.dom4j.Element tempElem,java.util.Map<String,String> valueMap_<%=cid%>){
return <%generateExprCmpByDom4j.generateCode(groupNode, "tempElem"); %>;
}
public org.dom4j.Element generateCodeDom4j_UnFindInsertNode<%=i%>(NestXMLTool_<%=cid%> nestXMLTool_<%=cid%>,java.util.Map<String,String> valueMap_<%=cid%>,org.dom4j.Element subTreeRootParent_<%=cid%>,int[] orders_<%=cid %>,boolean bl_<%=cid %>){
<%
generateToolByDom4j.generateCode(groupList.get(i),"group"+i+"_","subTreeRootParent");
%>
return group<%=i%>__<%=cid%>;
}
<%
}
}else{
for(int i=0;i<groupList.size();i++){
XMLNode groupRootNode = groupList.get(i);
%>
public org.dom4j.Element generateCodeDom4j_group<%=i%>(NestXMLTool_<%=cid%> nestXMLTool_<%=cid%>,java.util.Map<String,String> valueMap_<%=cid%>,org.dom4j.Element subTreeRootParent_<%=cid%>,int[] orders_<%=cid %>){
<%
generateToolByDom4j.generateCode(groupList.get(i),"group"+i+"_","subTreeRootParent");
%>
return group<%=i%>__<%=cid%>;
}
<%
}
}
}
if(loopTable!=null && loopTable.size()>0){
%>
public org.dom4j.Element generateCodeDom4j_Loop(NestXMLTool_<%=cid%> nestXMLTool_<%=cid%>,java.util.Map<String,String> valueMap_<%=cid%>,org.dom4j.Element subTreeRootParent_<%=cid%>,int[] orders_<%=cid %><%if(!useStream && isMerge && groupTable.size()>0){%>,boolean bl_<%=cid %><%}%>){
<%
generateToolByDom4j.generateCode(loop,"loop","subTreeRootParent");
%>
return loop_<%=cid%>;
}
<%
}
}
if("Null".equals(mode)){
GenerateToolByNull generateToolByNull = new GenerateToolByNull();
if(!useStream && ("true").equals(outputAsXSD)){ // add a new prerequisite:useStream to ignore generating the xsd file
generateToolByNull.outputAsXSD = true;
}
if(("true").equals(allowEmpty)){
generateToolByNull.allowEmpty = true;
}
generateToolByNull.bAddEmptyAttr = bAddEmptyAttr;
generateToolByNull.bAddUnmappedAttr = bAddUnmappedAttr;
generateToolByNull.cid = cid;
generateToolByNull.tool = tool;
generateToolByNull.isCompact = isCompact;
String rootEmptySpace = "";
for(int i=0;i < mainList.size();i++){
%>
public StringBuffer generateCodeNull_rootEmptySpace<%=i%>(StringBuffer buf_<%=cid%>,java.io.BufferedWriter out_<%=cid%>,String[] startTabs_<%=cid%>,String[] endTabs_<%=cid%>,java.util.Map<String, String> valueMap_<%=cid%>)throws IOException{
<%
generateToolByNull.generateCode(mainList.get(i),rootEmptySpace);
%>
return buf_<%=cid%>;
}
<%
if(isCompact==false){//generate pretty file
rootEmptySpace+=" ";
}
if(!generateToolByNull.outputAsXSD && !generateToolByNull.allowEmpty){
if(mainList.get(i).relatedColumn != null || mainList.get(i).childrenColumnList.size()>0){
int columnNum=0;
for(IMetadataColumn column : mainList.get(i).childrenColumnList){
if(columnNum%schemaOptNum==0){
%>
public boolean generateCodeNull_conditMain<%=i%>_<%=columnNum/schemaOptNum%>(java.util.Map<String,String> valueMap_<%=cid%>){
return false
<%
}
%>
|| valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null
<%
if((columnNum+1)%schemaOptNum==0){
%>
;}
<%
}
columnNum++;
}
if(columnNum>0&&(columnNum%schemaOptNum)>0){
%>
;}
<%
}
}
}
}
for(int i=0;i<groupList.size();i++){
String emptySpace = "";
if(isCompact==false){//generate pretty file
for(int len = groupList.get(i).path.split("/").length-1;len>1;len--){
emptySpace +=" ";
}
}
%>
public StringBuffer generateCodeNull_emptySpace<%=i%>(StringBuffer buf_<%=cid%>,java.util.Map<String, String> valueMap_<%=cid%>,String[] groupBuffer_<%=cid%>){
<%
generateToolByNull.generateCode(groupList.get(i),emptySpace);
%>
return buf_<%=cid%>;
}
<%
if(!("true").equals(outputAsXSD) && !("true").equals(allowEmpty)){
if((groupList.get(i).relatedColumn != null || groupList.get(i).childrenColumnList.size()>0)){
int columnNum=0;
for(IMetadataColumn column : groupList.get(i).childrenColumnList){
if(columnNum%schemaOptNum==0){
%>
public boolean generateCodeNull_conditGroup<%=i%>_<%=columnNum/schemaOptNum%>(java.util.Map<String,String> valueMap_<%=cid%>){
return false
<%
}
%>
|| valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null
<%
if((columnNum+1)%schemaOptNum==0){
%>
;}
<%
}
columnNum++;
}
if(columnNum>0&&(columnNum%schemaOptNum)>0){
%>
;}
<%
}
}
}
}
if(!("true").equals(outputAsXSD) && !("true").equals(allowEmpty)){
int columnNum=0;
for(IMetadataColumn column : loop.childrenColumnList){
if(columnNum%schemaOptNum==0){
%>
public boolean generateCodeNull_conditLoop_<%=columnNum/schemaOptNum%>(java.util.Map<String,String> valueMap_<%=cid%>){
return false
<%
}
%>
|| valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null
<%
if((columnNum+1)%schemaOptNum==0){
%>
;}
<%
}
columnNum++;
}
if(columnNum>0&&(columnNum%schemaOptNum)>0){
%>
;}
<%
}
}
String emptySpace = "";
if(isCompact==false){//generate pretty file
for(int len =loop.path.split("/").length-1;len>1;len--){
emptySpace +=" ";
}
}
%>
public void generateCodeNull_loopEmptySpace(StringBuffer buf_<%=cid%>,java.io.BufferedWriter out_<%=cid%>,String[] endTabs_<%=cid%>,java.util.Map<String, String> valueMap_<%=cid%>){
<%
generateToolByNull.generateCode(loop,emptySpace);
generateToolByNull.endElement(loop,emptySpace);
%>
}
<%
}
%>
}
AdvancedXMLUtil_<%=cid%> advancedXMLUtil_<%=cid%>=new AdvancedXMLUtil_<%=cid%>();
<%
}
}
}
}
}
%>

View File

@@ -192,11 +192,6 @@
<PARAMETER NAME="DELETE_EMPTYFILE" FIELD="CHECK" REQUIRED="true" NUM_ROW="70" NOT_SHOW_IF="USESTREAM=='true'">
<DEFAULT>false</DEFAULT>
</PARAMETER>
<PARAMETER NAME="SCHEMA_OPT_NUM" FIELD="TEXT" NUM_ROW="90"
REQUIRED="true" SHOW="false">
<DEFAULT>100</DEFAULT>
</PARAMETER>
</ADVANCED_PARAMETERS>
<CODEGENERATION>

View File

@@ -13,14 +13,574 @@ imports="
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.utils.NodeUtil
"
skeleton="tAdvancedFileOutputXML_java.skeleton"
%>
<%
//XMLTool
class XMLTool{
public boolean advancedSeparator = false;
public String thousandsSeparator = null;
public String decimalSeparator =null;
public String connName = null;
public String cid = null;
public void getValue(XMLNode node){
%>
valueMap_<%=cid%>.get("<%=node.relatedColumn.getLabel()%>")
<%
}
<%@ include file="tAdvancedFileOutputXML_begin.inc.javajet"%>
public void getValue(IMetadataColumn column){
JavaType javaType = JavaTypesManager.getJavaTypeFromId(column.getTalendType());
String defaultValue=column.getDefault();
boolean isNotSetDefault = false;
if(defaultValue!=null){
isNotSetDefault = defaultValue.length()==0;
}else{
isNotSetDefault=true;
}
%>
(
<%
if(column.isNullable()){
%>
<%=connName%>.<%=column.getLabel()%> != null?
<%
}
if(advancedSeparator && JavaTypesManager.isNumberType(javaType, column.isNullable())) {
if(javaType == JavaTypesManager.BIGDECIMAL) {
%>
FormatterUtils.format_Number(String.valueOf(<%=column.getPrecision() == null? connName + "." + column.getLabel() : connName + "." + column.getLabel() + ".setScale(" + column.getPrecision() + ", java.math.RoundingMode.HALF_UP)" %>), <%= thousandsSeparator%>,<%=decimalSeparator %>)
<%
} else {
%>
FormatterUtils.format_Number(String.valueOf(<%=connName%>.<%=column.getLabel()%>), <%= thousandsSeparator %>,<%=decimalSeparator %>)
<%
}
} else if(JavaTypesManager.isJavaPrimitiveType( column.getTalendType(), column.isNullable())){
%>
String.valueOf(<%=connName%>.<%=column.getLabel()%>)
<%
}else if(javaType == JavaTypesManager.DATE){
if( column.getPattern() != null && column.getPattern().trim().length() != 0 ){
%>
FormatterUtils.format_Date(<%=connName%>.<%=column.getLabel()%>,<%=column.getPattern()%>)
<%
}else{
%>
<%=connName%>.<%=column.getLabel()%>
<%
}
}else if (javaType == JavaTypesManager.BIGDECIMAL) {
%>
String.valueOf(<%=column.getPrecision() == null? connName + "." + column.getLabel() : connName + "." + column.getLabel() + ".setScale(" + column.getPrecision() + ", java.math.RoundingMode.HALF_UP)" %>)
<%
}else{
%>
<%=connName%>.<%=column.getLabel()%>.toString()
<%
}
if(column.isNullable()){
%>:<%
if(isNotSetDefault == false){
%><%=column.getDefault()%><%
}else{
%>null<%
}
}
%>
)
<%
}
}
// ------------------- *** Dom4j generation mode start *** ------------------- //
class GenerateToolByDom4j{
String cid = null;
boolean allowEmpty = false;
boolean bAddEmptyAttr = false, bAddUnmappedAttr = false;
boolean outputAsXSD = false;
XMLTool tool = null;
boolean isAppend = false;
public void generateCode(XMLNode node, String currEleName, String parentName){
if(("ELEMENT").equals(node.type)){
createElement(currEleName,node,parentName);
setText(currEleName,node);
for(XMLNode ns:node.namespaces){
addNameSpace(currEleName,ns);
}
for(XMLNode attri:node.attributes){
addAttribute(currEleName,attri);
}
if(node.name.indexOf(":")>0){
%>
<%=currEleName%>_<%=cid%>.setName("<%=node.name%>");
<%
}
int index = 0;
for(XMLNode child:node.elements){
if(0==(child.special & 1)){
generateCode(child,currEleName+"_"+index++,currEleName);
}
}
if(node.relatedColumn != null && (node.special & 2)==0 && (node.special & 1)==0){
if(isAppend && !outputAsXSD && !allowEmpty){
%>
if (<%=currEleName%>_<%=cid%>.content().size() == 0
&& <%=currEleName%>_<%=cid%>.attributes().size() == 0
&& <%=currEleName%>_<%=cid%>.declaredNamespaces().size() == 0) {
<%=parentName%>_<%=cid%>.remove(<%=currEleName%>_<%=cid%>);
}
<%
}
}
}
}
private void createElement(String currEleName, XMLNode node, String parentName){
int index = node.name.indexOf(":");
if(5==(node.special & 5)){
int currPos = node.getCurrGroupPos();
if(index>0 && node.parent!=null){
%>
org.dom4j.Element <%=currEleName%>_<%=cid%>;
if (<%=parentName%>_<%=cid%>.getNamespaceForPrefix("<%=node.name.substring(0,index)%>") == null) {
<%=currEleName%>_<%=cid%> = org.dom4j.DocumentHelper.createElement("<%=node.name.substring(index+1)%>");
} else {
<%=currEleName%>_<%=cid%> = org.dom4j.DocumentHelper.createElement("<%=node.name%>");
}
<%
}else{
%>
org.dom4j.Element <%=currEleName%>_<%=cid%> = org.dom4j.DocumentHelper.createElement("<%=node.name%>");
<%
}
if(isAppend){
%>
int app_size_<%=cid %>=<%=parentName%>_<%=cid%>.elements("<%=node.name%>").size();
if(app_size_<%=cid %> > 0){
orders_<%=cid %>[<%=currPos %>] =1+ <%=parentName%>_<%=cid%>.elements().indexOf(<%=parentName%>_<%=cid%>.elements("<%=node.name%>").get(app_size_<%=cid %>-1));
}else{
<%
if(currPos==0){
%>
orders_<%=cid %>[<%=currPos %>] = <%=parentName%>_<%=cid%>.elements().size();
<%
}else{
%>
orders_<%=cid %>[<%=currPos %>] = <%=node.getNodeInsertIndex() %>;
if(orders_<%=cid %>[<%=currPos %>] == 0 && <%=parentName%>_<%=cid%>.elements().size() != 0 && !bl_<%=cid%>) {
orders_<%=cid %>[<%=currPos %>] = <%=parentName%>_<%=cid%>.elements().size();
}
<%
}
%>
}
<%=parentName%>_<%=cid%>.elements().add(orders_<%=cid %>[<%=currPos %>],<%=currEleName%>_<%=cid%>);
<%
}else{
%>
if(orders_<%=cid %>[<%=currPos %>]==0){
orders_<%=cid %>[<%=currPos %>] = <%=node.getNodeInsertIndex() %>;
}
if(<%=currPos +1 %> < orders_<%=cid %>.length){
orders_<%=cid %>[<%=currPos +1 %>] = 0;
}
<%=parentName%>_<%=cid%>.elements().add(orders_<%=cid %>[<%=currPos %>]++,<%=currEleName%>_<%=cid%>);
<%
}
}else{
if(index>0 && node.parent!=null){
%>
org.dom4j.Element <%=currEleName%>_<%=cid%>;
if (<%=parentName%>_<%=cid%>.getNamespaceForPrefix("<%=node.name.substring(0,index)%>") == null) {
<%=currEleName%>_<%=cid%> = <%=parentName%>_<%=cid%>.addElement("<%=node.name.substring(index+1)%>");
} else {
<%=currEleName%>_<%=cid%> = <%=parentName%>_<%=cid%>.addElement("<%=node.name%>");
}
<%
}else{
%>
org.dom4j.Element <%=currEleName%>_<%=cid%> = <%=parentName%>_<%=cid%>.addElement("<%=node.name%>");
<%
}
}
if(0!=(node.special & 2)){
%>
subTreeRootParent_<%=cid%> = <%=currEleName%>_<%=cid%>;
<%
}
}
private void setText(String currEleName, XMLNode node){
if(node.relatedColumn!=null){
JavaType javaType = JavaTypesManager.getJavaTypeFromId(node.relatedColumn.getTalendType());
if(javaType == JavaTypesManager.OBJECT){
%>
if(<%tool.getValue(node); %>!=null){
nestXMLTool_<%=cid%> .parseAndAdd(<%=currEleName%>_<%=cid%>,<%tool.getValue(node);%>);
}
<%
if(outputAsXSD){
%>
else{
nestXMLTool_<%=cid%> .parseAndAdd(<%=currEleName%>_<%=cid%>,"");
<%=currEleName%>_<%=cid%>.addAttribute("xsi:nil","true");
}
<%
}
}else{
if("id_Document".equals(node.relatedColumn.getTalendType())) {
%>
if(<%tool.getValue(node); %>!=null){
nestXMLTool_<%=cid%> .setText(<%=currEleName%>_<%=cid%>, ParserUtils.parseTo_Document(<%tool.getValue(node);%>).getDocument().getRootElement().asXML());
}
<%
} else {
%>
if(<%tool.getValue(node); %>!=null){
nestXMLTool_<%=cid%> .setText(<%=currEleName%>_<%=cid%>,<%tool.getValue(node);%>);
}
<%
}
if(outputAsXSD){
%>
else{
<%=currEleName%>_<%=cid%>.setText("");
<%=currEleName%>_<%=cid%>.addAttribute("xsi:nil","true");
}
<%
}
}
}else if(node.defaultValue != null && !("").equals(node.defaultValue) ){
%>
nestXMLTool_<%=cid %>.parseAndAdd(<%=currEleName %>_<%=cid %>,"<%=node.defaultValue %>");
<%
}
}
private void addAttribute(String currEleName, XMLNode node){
if (node.relatedColumn != null){
%>
if (<%tool.getValue(node);%> != null){
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", <%tool.getValue(node);%>);
} <% if (bAddEmptyAttr) { %> else {
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", "");
}
<%}
} else {
if (node.defaultValue != null && !("").equals(node.defaultValue) ){
%>
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", "<%=node.defaultValue %>");
<%
} else if (bAddUnmappedAttr){
%>
<%=currEleName%>_<%=cid%>.addAttribute("<%=node.path%>", "");
<%
}
}
}
private void addNameSpace(String currEleName, XMLNode node){
if(node.relatedColumn!=null){
%>
if(<%tool.getValue(node);%>!=null){
<%=currEleName%>_<%=cid%>.addNamespace("<%=node.path%>",TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>));
<%
if(node.path ==null || node.path.length()==0){
%>
<%=currEleName%>_<%=cid%>.setQName(org.dom4j.DocumentHelper.createQName(<%=currEleName%>_<%=cid%>.getName(),
org.dom4j.DocumentHelper.createNamespace("",TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>))));
<%
}
%>
}
<%
}else if(node.defaultValue != null && !("").equals(node.defaultValue) ){
%>
<%=currEleName %>_<%=cid %>.addNamespace("<%=node.path %>",TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>"));
<%
if(node.path ==null || node.path.length()==0){
%>
<%=currEleName %>_<%=cid %>.setQName(org.dom4j.DocumentHelper.createQName(<%=currEleName %>_<%=cid %>.getName(),
org.dom4j.DocumentHelper.createNamespace("",TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>"))));
<%
}
}
}
}
//----------** add by wliu dom4j to genenrate get function for node **-------//
class GenerateExprCmpByDom4j{
// String cid = null;
XMLTool tool = null;
XMLNode groupNode = null;
boolean needEmptyNode = true;
public void generateCode(XMLNode node, String parentName){
String tmpPath = node.path.replaceFirst(groupNode.path,"");
String[] arrNames = tmpPath.split("/");
if(node==groupNode){
%>true
<%
}
if(node.relatedColumn != null){
%> && (<%
if(!needEmptyNode){
%>(<%tool.getValue(node); %>==null && <%generateCmnExpr(arrNames, parentName); %> == null) || (true &&
<% }%>
<%generateCmnExpr(arrNames, parentName); %>!=null
&& <%generateCmnExpr(arrNames, parentName); %>.getText()!=null
&& <%generateCmnExpr(arrNames, parentName); %>.getText().equals(<%tool.getValue(node); %>)
<%if(!needEmptyNode){%>)<%}%>
)
<%
}
//first generate the attribute comparision
if(node.attributes!=null){
for(XMLNode attri:node.attributes){
if(attri.relatedColumn !=null){
%> && (<%
if(!needEmptyNode){
%>(<%tool.getValue(attri); %>==null && <%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>") == null) || (true &&
<% }%>
<%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>")!=null
&& <%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>").getText()!=null
&& <%generateCmnExpr(arrNames, parentName); %>.attribute("<%=attri.name %>").getText().equals(<%tool.getValue(attri); %>)
<%
if(!needEmptyNode){%>)<%}
%>)<%
}
}
}
if(node.elements!=null){
for(XMLNode child:node.elements){
if(!child.isMainNode()){
generateCode(child,parentName);
}
}
}
}
private void generateCmnExpr(String[] arrNames, String parentName){
%>
<%=parentName %>
<%
for(int i=1;arrNames != null && i<arrNames.length; i++){
%>.element(<%=parentName%>.getQName("<%=arrNames[i]%>"))
<%
}
}
}
// ------------------- *** Dom4j generation mode end *** ------------------- //
// ------------------- *** Null generation mode start *** ------------------- //
class GenerateToolByNull{
String cid = null;
boolean allowEmpty = false;
boolean bAddEmptyAttr = false, bAddUnmappedAttr = false;
boolean outputAsXSD = false;
XMLTool tool = null;
boolean isCompact = false;
public void generateCode(XMLNode node, String emptySpace){
if(("ELEMENT").equals(node.type)){
startElement(node,emptySpace);
setText(node);
XMLNode mainChild = null;
for(XMLNode child:node.elements){
if(child.isMainNode()){ //loop dosen't have a main child node
mainChild = child;
break;
}
}
for(XMLNode child:node.elements){
if(mainChild!=null && mainChild.order<=child.order){ //loop dosen't have a main child node
if(1==(node.special & 1)){ // group
%>
// buffer the start tabs to group buffer
groupBuffer_<%=cid%>[<%=node.getCurrGroupPos()%>] = buf_<%=cid%>.toString();
buf_<%=cid%> = new StringBuffer();
<%
}else{// root
int num = node.path.split("/").length-2;
if(!outputAsXSD && !allowEmpty){
%>
startTabs_<%=cid%>[<%=num%>] = buf_<%=cid%>.toString();
buf_<%=cid%> = new StringBuffer();
<%
}else{
%>
out_<%=cid%>.write(buf_<%=cid%>.toString());
buf_<%=cid%> = new StringBuffer();
<%
}
}
mainChild = null;
}
if(!child.isMainNode()){ //make the main node output last
if(!outputAsXSD && !allowEmpty
&& (child.relatedColumn != null || child.childrenColumnList.size()>0
|| child.hasDefaultValue == true ) ){
%>
if( false
<%
for(IMetadataColumn column : child.childrenColumnList){
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
if(child.hasDefaultValue == true){%> || true
<%}%>
){
<%
if(isCompact==false)
generateCode(child,emptySpace+" ");
else
generateCode(child,emptySpace);
%>
}
<%
}else{
if(isCompact==false)
generateCode(child,emptySpace+" ");
else
generateCode(child,emptySpace);
}
}
}
if(!node.isMainNode()){ // is not main node
endElement(node,emptySpace);
}
}
}
private void startElement(XMLNode node, String emptySpace){
%>
buf_<%=cid%>.append("<%=isCompact?"":"\\n"%>");
buf_<%=cid%>.append("<%=emptySpace%><<%=node.name%>");
<%
if(outputAsXSD && node.parent==null){
%>
buf_<%=cid%>.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
buf_<%=cid%>.append(" xsi:noNamespaceSchemaLocation= \""+ file_<%=cid%>.substring(file_<%=cid%>.lastIndexOf("/")+1)+".xsd"+"\"");
<%
}
for(XMLNode ns:node.namespaces){
addNameSpace(ns);
}
for(XMLNode attri:node.attributes){
addAttribute(attri);
}
if(outputAsXSD && node.relatedColumn != null){
%>
if(<%tool.getValue(node); %> == null){
buf_<%=cid%>.append(" xsi:nil=\"true\"");
}
<%
}
%>
buf_<%=cid%>.append(">");
<%
}
public void endElement(XMLNode node, String emptySpace){
if(node.elements.size()>0){
%>
buf_<%=cid%>.append("<%=isCompact?"":"\\n"%>");
buf_<%=cid%>.append("<%=emptySpace%></<%=node.name%>>");
<%
}else{
%>
buf_<%=cid%>.append("</<%=node.name%>>");
<%
}
}
private void setText(XMLNode node){
if(node.relatedColumn!=null){
JavaType javaType = JavaTypesManager.getJavaTypeFromId(node.relatedColumn.getTalendType());
if(javaType == JavaTypesManager.OBJECT){
%>
if(<%tool.getValue(node);%>!=null){
if(routines.system.XMLHelper.getInstance().isValid(<%tool.getValue(node);%>)){
buf_<%=cid%>.append(<%tool.getValue(node);%>);
} else {
buf_<%=cid%>.append(TalendString.checkCDATAForXML(<%tool.getValue(node);%>));
}
}
<%
}else{
%>
if(<%tool.getValue(node);%>!=null){
buf_<%=cid%>.append(TalendString.checkCDATAForXML(<%tool.getValue(node);%>));
}
<%
}
}else if(node.defaultValue !=null && !("").equals(node.defaultValue) ){
%>
if(routines.system.XMLHelper.getInstance().isValid("<%=node.defaultValue %>")){
buf_<%=cid %>.append("<%=node.defaultValue %>");
} else {
buf_<%=cid %>.append(TalendString.checkCDATAForXML("<%=node.defaultValue %>"));
}
<%
}
}
private void addAttribute(XMLNode node){
if (node.relatedColumn != null){
%>
if (<%tool.getValue(node); %>!=null){
buf_<%=cid%>.append(" <%=node.path%>=\""+TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>)+"\"");
} <% if (bAddEmptyAttr){%> else{
buf_<%=cid%>.append(" <%=node.path%>=\"\"");
}
<%}
} else {
if (node.defaultValue != null && !("").equals(node.defaultValue)){
%>
buf_<%=cid%>.append(" <%=node.path%>=\""+TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>")+"\"");
<%
} else if (bAddUnmappedAttr){
%>
buf_<%=cid%>.append(" <%=node.path%>=\"\"");
<%
}
}
}
private void addNameSpace(XMLNode node){
if(node.relatedColumn!=null){
%>
if(<%tool.getValue(node);%>!=null){
<%
if(node.path ==null || node.path.length()==0){
%>
buf_<%=cid%>.append(" xmlns=\""+TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>)+"\"");
<%
}else{
%>
buf_<%=cid%>.append(" xmlns:<%=node.path%>=\""+TalendString.replaceSpecialCharForXML(<%tool.getValue(node);%>)+"\"");
<%
}
%>
}
<%
}else if(node.defaultValue !=null && !("").equals(node.defaultValue) ){
if(node.path ==null || node.path.length()==0){
%>
buf_<%=cid%>.append(" xmlns=\""+TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>")+"\"");
<%
}else{
%>
buf_<%=cid%>.append(" xmlns:<%=node.path%>=\""+TalendString.replaceSpecialCharForXML("<%=node.defaultValue %>")+"\"");
<%
}
}
}
}
// ------------------- *** Null generation mode end *** ------------------- //
// ------------------- *** Common code start *** ------------------- //
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
@@ -68,30 +628,10 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
boolean useStream = ("true").equals(ElementParameterParser.getValue(node,"__USESTREAM__"));
String outStream = ElementParameterParser.getValue(node,"__STREAMNAME__");
//*******************add for feature:8873 end ****************
boolean needFileValid = ("true").equals(ElementParameterParser.getValue(node, "__FILE_VALID__"));
boolean needDTDValid = ("true").equals(ElementParameterParser.getValue(node, "__DTD_VALID__"));
String dtdRootName = ElementParameterParser.getValue(node, "__DTD_NAME__");
String dtdFileName = ElementParameterParser.getValue(node, "__DTD_SYSTEMID__");
boolean needXSLValid = ("true").equals(ElementParameterParser.getValue(node, "__XSL_VALID__"));
String xslType = ElementParameterParser.getValue(node, "__XSL_TYPE__");
String xslHref = ElementParameterParser.getValue(node, "__XSL_HREF__");
int schemaOptNum=100;
boolean isOptimizeCode=false;
String schemaOptNumStr=ElementParameterParser.getValue(node, "__SCHEMA_OPT_NUM__");
if(schemaOptNumStr!=null && !"".equals(schemaOptNumStr) && !"\"\"".equals(schemaOptNumStr)){
schemaOptNum = Integer.parseInt(schemaOptNumStr);
}
if(metadata.getListColumns().size()> schemaOptNum){
isOptimizeCode=true;
}
// init tool
XMLTool tool = new XMLTool();
tool.connName = NodeUtil.getPrivateConnClassName(conn);
tool.connName = conn.getName();
tool.advancedSeparator=advancedSeparator;
tool.thousandsSeparator=thousandsSeparator;
tool.decimalSeparator=decimalSeparator;
@@ -121,20 +661,10 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
nb_line_<%=cid%>++;
valueMap_<%=cid%>.clear();
<%
int colNum=0;
for(IMetadataColumn column :metadata.getListColumns()){
if(isOptimizeCode){
if(colNum%schemaOptNum==0){
%>
advancedXMLUtil_<%=cid%>.putValue_<%=colNum/schemaOptNum%>(<%=tool.connName%>,valueMap_<%=cid%>);
<%
}
}else{
%>
valueMap_<%=cid%>.put("<%=column.getLabel()%>", <% tool.getValue(column); %>);
<%
}
colNum++;
}
// ------------------- *** Common code end *** ------------------- //
@@ -166,7 +696,7 @@ if(("Dom4j").equals(mode)){
}
<%
generateToolByDom4j.generateCode(root,"root","doc");
if(!isMerge || useStream){ // add a prerequisite useStream to ignore the append mode
if(isMerge==false || useStream){ // add a prerequisite useStream to ignore the append mode
%>
root4Group_<%=cid%> = subTreeRootParent_<%=cid%>;
}else{
@@ -181,7 +711,7 @@ if(("Dom4j").equals(mode)){
}
if(groupTable.size()>0){ //init the generate tool.
if(!useStream && isMerge){//merge into the file and add a prerequisite:useStream to ignore the append mode
if(!useStream && isMerge==true){//merge into the file and add a prerequisite:useStream to ignore the append mode
generateToolByDom4j.isAppend= true;
String firstGroupPath = groupList.get(0).path;
%>
@@ -219,17 +749,7 @@ if(groupTable.size()>0){ //init the generate tool.
for(j=0;j<listNodes.size();j++){
org.dom4j.Element tempElem =listNodes.get(j);
if(("<%=groupNode.path%>").equals(tempElem.getPath()!=null ? tempElem.getPath().replace("*[name()='","").replace("']", "") : "")){
<%
if(isOptimizeCode){
%>
if(advancedXMLUtil_<%=cid%>.generateCodeDom4j_FindInsertNode<%=i%>(tempElem,valueMap_<%=cid%>)){
<%
}else{
%>
if(<%generateExprCmpByDom4j.generateCode(groupNode, "tempElem"); %>){
<%
}
%>
subTreeRootParent_<%=cid %> = tempElem;
break;
}
@@ -243,19 +763,8 @@ if(groupTable.size()>0){ //init the generate tool.
}
}
if(bl_<%=cid %>==true){
<%
if(isOptimizeCode){
%>
org.dom4j.Element group<%=i%>__<%=cid%> = advancedXMLUtil_<%=cid%>.generateCodeDom4j_UnFindInsertNode<%=i%>(nestXMLTool_<%=cid%>,valueMap_<%=cid%>,subTreeRootParent_<%=cid%>,orders_<%=cid %>,bl_<%=cid %>);
<%
if(("ELEMENT").equals(groupList.get(i).type) && (0!=(groupList.get(i).special & 2))){
%>
subTreeRootParent_<%=cid%>=group<%=i%>__<%=cid%>;
<%
}
}else{
generateToolByDom4j.generateCode(groupList.get(i),"group"+i+"_","subTreeRootParent");
}
<%
generateToolByDom4j.generateCode(groupList.get(i),"group"+i+"_","subTreeRootParent");
%>
}
<%
@@ -266,44 +775,23 @@ if(groupTable.size()>0){ //init the generate tool.
<%
for(int i=0;i<groupList.size();i++){
XMLNode groupRootNode = groupList.get(i);
int nodeNum=0;
%>
if(isNewElememt_<%=cid %> || groupbyList_<%=cid%>.size()<=<%=i%> || groupbyList_<%=cid%>.get(<%=i%>)==null
<%
for(int j=0;j<groupbyNodeList.get(i).size();j++){
XMLNode attr = groupbyNodeList.get(i).get(j);
if(attr.relatedColumn!=null){
if(isOptimizeCode){
if(nodeNum%schemaOptNum==0){
%>
|| advancedXMLUtil_<%=cid%>.getValue_<%=i%>_<%=nodeNum/schemaOptNum%>(groupbyList_<%=cid%>,valueMap_<%=cid%>)
<%
}
nodeNum++;
}else{
%>
|| ( groupbyList_<%=cid%>.get(<%=i%>).get(<%=j%>)!=null
? !groupbyList_<%=cid%>.get(<%=i%>).get(<%=j%>).equals(<%tool.getValue(attr);%>)
: <%tool.getValue(attr);%>!=null )
<%
}
}
}
%>
){
<%
if(isOptimizeCode){
%>
org.dom4j.Element group<%=i%>__<%=cid%>=advancedXMLUtil_<%=cid%>.generateCodeDom4j_group<%=i%>(nestXMLTool_<%=cid%>,valueMap_<%=cid%>,subTreeRootParent_<%=cid%>,orders_<%=cid%>);
<%
if(("ELEMENT").equals(groupRootNode.type) && (0!=(groupRootNode.special & 2))){
%>
subTreeRootParent_<%=cid%>=group<%=i%>__<%=cid%>;
<%
}
}else{
generateToolByDom4j.generateCode(groupList.get(i),"group"+i+"_","subTreeRootParent");
}
generateToolByDom4j.generateCode(groupList.get(i),"group"+i+"_","subTreeRootParent");
%>
if(groupbyList_<%=cid%>.size()<=<%=i%>){
groupbyList_<%=cid%>.add(new java.util.ArrayList<String>());
@@ -313,17 +801,9 @@ if(groupTable.size()>0){ //init the generate tool.
<%
for(int j=0;j<groupbyNodeList.get(i).size();j++){
XMLNode attr = groupbyNodeList.get(i).get(j);
if(isOptimizeCode){
if(j%schemaOptNum==0){
%>
advancedXMLUtil_<%=cid%>.setValue_<%=i%>_<%=j/schemaOptNum%>(groupbyList_<%=cid%>,valueMap_<%=cid%>);
<%
}
}else{
%>
groupbyList_<%=cid%>.get(<%=i%>).add(<%tool.getValue(attr);%>);
<%
}
}
%>
isNewElememt_<%=cid %>=true;
@@ -346,18 +826,7 @@ if(groupTable.size()>0){ //init the generate tool.
// build loop xml tree
<%
if(loopTable!=null && loopTable.size()>0){
if(isOptimizeCode){
%>
org.dom4j.Element loop_<%=cid%>=advancedXMLUtil_<%=cid%>.generateCodeDom4j_Loop(nestXMLTool_<%=cid%>,valueMap_<%=cid%>,subTreeRootParent_<%=cid%>,orders_<%=cid%><%if(!useStream && isMerge && groupTable.size()>0){%>, bl_<%=cid %><%}%>);
<%
if(("ELEMENT").equals(loop.type) && (0!=(loop.special & 2))){
%>
subTreeRootParent_<%=cid%>=loop_<%=cid%>;
<%
}
}else{
generateToolByDom4j.generateCode(loop,"loop","subTreeRootParent");
}
generateToolByDom4j.generateCode(loop,"loop","subTreeRootParent");
}
//file split
if(!useStream && ("true").equals(split)){ //add a prerequisite:useStream to ignore the append mode
@@ -391,19 +860,6 @@ if(groupTable.size()>0){ //init the generate tool.
output_<%=cid%>.write(doc_<%=cid%>);
output_<%=cid%>.close();
doc_<%=cid%> = org.dom4j.DocumentHelper.createDocument();
<%
if (!isMerge && needFileValid) {
if(needDTDValid) {
%>
doc_<%=cid %>.addDocType(<%=dtdRootName %>, null, <%=dtdFileName %>);
<%
} else if(needXSLValid) {
%>
doc_<%=cid %>.addProcessingInstruction("xml-stylesheet", inMap_<%=cid %>);
<%
}
}
%>
groupElementList_<%=cid%>.clear();
}
<%
@@ -438,13 +894,7 @@ else if(("Null").equals(mode)){
<%
String rootEmptySpace = "";
for(int i=0;i < mainList.size();i++){
if(isOptimizeCode){
%>
buf_<%=cid%>=advancedXMLUtil_<%=cid%>.generateCodeNull_rootEmptySpace<%=i%>(buf_<%=cid%>,out_<%=cid%>,startTabs_<%=cid%>,endTabs_<%=cid%>,valueMap_<%=cid%>);
<%
}else{
generateToolByNull.generateCode(mainList.get(i),rootEmptySpace);
}
generateToolByNull.generateCode(mainList.get(i),rootEmptySpace);
if(isCompact==false){//generate pretty file
rootEmptySpace+=" ";
}
@@ -454,18 +904,8 @@ else if(("Null").equals(mode)){
%>
if( false
<%
int columnNum=0;
for(IMetadataColumn column : mainList.get(i).childrenColumnList){
if(isOptimizeCode){
if(columnNum%schemaOptNum==0){
%>
|| advancedXMLUtil_<%=cid%>.generateCodeNull_conditMain<%=i%>_<%=columnNum/schemaOptNum%>(valueMap_<%=cid%>)
<%
}
columnNum++;
}else{
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
}
%>
){
@@ -496,7 +936,6 @@ else if(("Null").equals(mode)){
}
for(int i=0;i<groupList.size();i++){
XMLNode groupRootNode = groupList.get(i);
int nodeNum=0;
%>
// need a new group element <%=groupRootNode.name%> or not
@@ -505,20 +944,11 @@ else if(("Null").equals(mode)){
for(int j=0;j<groupbyNodeList.get(i).size();j++){
XMLNode attr = groupbyNodeList.get(i).get(j);
if(attr.relatedColumn!=null){
if(isOptimizeCode){
if(nodeNum%schemaOptNum==0){
%>
|| advancedXMLUtil_<%=cid%>.getValue_<%=i%>_<%=nodeNum/schemaOptNum%>(groupbyList_<%=cid%>,valueMap_<%=cid%>)
<%
}
nodeNum++;
}else{
%>
|| ( groupbyList_<%=cid%>.get(<%=i%>).get(<%=j%>)!=null
? !groupbyList_<%=cid%>.get(<%=i%>).get(<%=j%>).equals(<%tool.getValue(attr);%>)
: <%tool.getValue(attr);%>!=null )
<%
}
}
}
%>
@@ -537,17 +967,9 @@ else if(("Null").equals(mode)){
<%
for(int j=0;j<groupbyNodeList.get(i).size();j++){
XMLNode attr = groupbyNodeList.get(i).get(j);
if(isOptimizeCode){
if(j%schemaOptNum==0){
%>
advancedXMLUtil_<%=cid%>.setValue_<%=i%>_<%=j/schemaOptNum%>(groupbyList_<%=cid%>,valueMap_<%=cid%>);
<%
}
}else{
%>
groupbyList_<%=cid%>.get(<%=i%>).add(<%tool.getValue(attr);%>);
<%
}
}
%>
isNewElememt_<%=cid %>=true;
@@ -562,30 +984,16 @@ else if(("Null").equals(mode)){
emptySpace +=" ";
}
}
if(isOptimizeCode){
%>
buf_<%=cid%>=advancedXMLUtil_<%=cid%>.generateCodeNull_emptySpace<%=i%>(buf_<%=cid%>,valueMap_<%=cid%>,groupBuffer_<%=cid%>);
<%
}else{
generateToolByNull.generateCode(groupList.get(i),emptySpace);
}
generateToolByNull.generateCode(groupList.get(i),emptySpace);
if(!("true").equals(outputAsXSD) && !("true").equals(allowEmpty)){
if((groupList.get(i).relatedColumn != null || groupList.get(i).childrenColumnList.size()>0)){
%>
if( false
<%
int columnNum=0;
for(IMetadataColumn column : groupList.get(i).childrenColumnList){
if(isOptimizeCode){
if(columnNum%schemaOptNum==0){
%>
|| advancedXMLUtil_<%=cid%>.generateCodeNull_conditGroup<%=i%>_<%=columnNum/schemaOptNum%>(valueMap_<%=cid%>)
<%
}
columnNum++;
}else{
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
%>
){
@@ -704,32 +1112,16 @@ else if(("Null").equals(mode)){
%>
if( false
<%
int columnNum=0;
for(IMetadataColumn column : loop.childrenColumnList){
if(isOptimizeCode){
if(columnNum%schemaOptNum==0){
%>
|| advancedXMLUtil_<%=cid%>.generateCodeNull_conditLoop_<%=columnNum/schemaOptNum%>(valueMap_<%=cid%>)
<%
}
columnNum++;
}else{
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
%> || valueMap_<%=cid%>.get("<%=column.getLabel()%>") != null<%
}
if(loop.hasDefaultValue == true){%> || true
<%}%>
){
<%
}
if(isOptimizeCode){
%>
advancedXMLUtil_<%=cid%>.generateCodeNull_loopEmptySpace(buf_<%=cid%>,out_<%=cid%>,endTabs_<%=cid%>,valueMap_<%=cid%>);
<%
}else{
generateToolByNull.generateCode(loop,emptySpace);
generateToolByNull.endElement(loop,emptySpace);
}
generateToolByNull.generateCode(loop,emptySpace);
generateToolByNull.endElement(loop,emptySpace);
%>
// output all buffer
for (int i_<%=cid%> = 0; i_<%=cid%> < startTabs_<%=cid%>.length; i_<%=cid%>++) {
@@ -811,22 +1203,6 @@ else if(("Null").equals(mode)){
out_<%=cid%> = new java.io.BufferedWriter(new java.io.OutputStreamWriter(new java.io.FileOutputStream(file_<%=cid%> + currentFileCount_<%=cid %> + suffix_<%=cid %>), <%=encoding%>));
out_<%=cid%>.write("<?xml version=\"1.0\" encoding=\""+<%=encoding%>+"\"?>");
out_<%=cid%>.newLine();
<%
if (needFileValid) {
if (needDTDValid) {
%>
out_<%=cid%>.write("<!DOCTYPE "+<%=dtdRootName %>+" SYSTEM \"" + <%=dtdFileName %> + "\">");
out_<%=cid%>.newLine();
<%
} else if (needXSLValid) {
%>
out_<%=cid%>.write("<?xml-stylesheet type=\""+<%=xslType %>+"\" href=\""+<%=xslHref%>+"\">");
out_<%=cid%>.newLine();
<%
}
}
%>
}
<%
}

View File

@@ -32,7 +32,6 @@ MAPPING.NAME=
MERGE.NAME=Append the source xml file
NB_LINE.NAME=Number of line
NOT_TRIM_TEXT.NAME=
SCHEMA_OPT_NUM.NAME=Min column number of optimize code
OUTPUT_AS_XSD.NAME=Create associated XSD file
PRETTY_COMPACT.NAME=Generate compact file
ROOT.ITEM.ATTRIBUTE=Attribute

View File

@@ -5,7 +5,6 @@ DECIMAL_SEPARATOR.NAME=S
DELETE_EMPTYFILE.NAME=Ne pas générer de fichier vide
ENCODING.NAME=Encodage
FIELD_TAG.NAME=Étiquette du champ
FILENAME.NAME=Nom de fichier
GENERATION_MODE.ITEM.DOM4J=Lent et consommateur de mémoire (Dom4J)
GENERATION_MODE.ITEM.NULL=Rapide avec peu de consommation de mémoire
GENERATION_MODE.NAME=Mode de génération
@@ -41,7 +40,7 @@ VALIDATORMODE.NAME=Mode de validation
FILE_VALID.NAME=Inclure les DTD ou XSL
DTD_VALID.NAME=DTD
DTD_NAME.NAME=Elément racine
DTD_SYSTEMID.NAME=Nom de fichier
DTD_SYSTEMID.NAME=Nom du fichier
XSL_VALID.NAME=XSL
XSL_TYPE.NAME=Type
XSL_HREF.NAME=Href

View File

@@ -6,10 +6,15 @@
org.talend.core.model.process.ElementParameterParser
java.util.List
java.util.ArrayList
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IHashableInputConnections
org.talend.core.model.process.IHashConfiguration
org.talend.core.model.process.IHashableColumn
org.talend.core.model.process.IMatchingMode
java.util.HashSet
java.util.Set
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.IDataConnection
"
%>
@@ -17,7 +22,6 @@
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
List<IConnection> connections = (List<IConnection>) node.getIncomingConnections();
@@ -76,23 +80,11 @@
}
boolean isAllRows = "ALL_ROWS".equals(matchingModeStr);
boolean includeParallelComps = false;
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
if (listPartitions!=null && listPartitions.size() > 0 ) {
includeParallelComps = true;
}
%>
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE matchingModeEnum_<%=connectionName%> =
org.talend.designer.components.lookup.common.ICommonLookup.MATCHING_MODE.<%= matchingModeStr %>;
<%if (includeParallelComps && !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk)) {%>
synchronized(this) {
try {
if (globalMap.get("tHash_Lookup_<%=connectionName%>") == null) {
<%
}
if (hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk) {
%>
org.talend.designer.components.lookup.persistent.Persistent<%= isAllRows ? "" : "Sorted" %>LookupManager<<%=connectionName%>Struct> tHash_Lookup_<%=connectionName%> =
@@ -110,23 +102,13 @@
tHash_Lookup_<%=connectionName%>.initPut();
globalMap.put("tHash_Lookup_<%=connectionName%>", tHash_Lookup_<%=connectionName%>);
<%
} else {
if (includeParallelComps) {
%>
org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<<%=connectionName%>Struct> tHash_Lookup_<%=connectionName%> =
org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup.
<<%=connectionName%>Struct>getLookup(matchingModeEnum_<%=connectionName%>);
<%
} else {
%>
org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<<%=connectionName%>Struct> tHash_Lookup_<%=connectionName%> =org.talend.designer.components.lookup.memory.AdvancedMemoryLookup.
org.talend.designer.components.lookup.memory.AdvancedMemoryLookup<<%=connectionName%>Struct> tHash_Lookup_<%=connectionName%> =
org.talend.designer.components.lookup.memory.AdvancedMemoryLookup.
<<%=connectionName%>Struct>getLookup(matchingModeEnum_<%=connectionName%>);
<%
}
%>
globalMap.put("tHash_Lookup_<%=connectionName%>", tHash_Lookup_<%=connectionName%>);
<%
@@ -142,4 +124,4 @@
}
%>

View File

@@ -3,86 +3,29 @@
org.talend.core.model.process.INode
org.talend.core.model.process.IConnection
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
java.util.List
org.talend.core.model.process.IHashableInputConnections
org.talend.core.model.process.IHashConfiguration
org.talend.core.model.process.IDataConnection
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
List<IConnection> connections = (List<IConnection>) node.getIncomingConnections();
List<IConnection> connections = (List<IConnection>) node.getIncomingConnections();
if (connections != null && connections.size() > 0) {
for (IConnection connection : connections) {
String connectionName = connection.getName();
INode validTarget = ((IDataConnection) connection).getLinkNodeForHash();
boolean memoryStorage = true;
if(validTarget != null) {
IHashConfiguration hashConfiguration = null;
boolean bSortOnDisk = "true".equals(ElementParameterParser.getValue(node, "__SORT_ON_DISK__"));
if (validTarget instanceof IHashableInputConnections){
IHashableInputConnections target = (IHashableInputConnections) validTarget;
hashConfiguration = target.getHashConfiguration(connection.getName());
}
memoryStorage = !(hashConfiguration != null && hashConfiguration.isPersistent() || bSortOnDisk);
}
IMetadataTable metadataTable = connection.getMetadataTable();
boolean includeParallelComps = false;
List<? extends INode> listPartitions= node.getProcess().getNodesOfType("tPartitioner");
if (listPartitions!=null && listPartitions.size() > 0 ) {
includeParallelComps = true;
}
%>
tHash_Lookup_<%=connectionName%>.endPut();
<%
if (includeParallelComps && memoryStorage) {
%>
java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>> mapsList_<%=cid%> =
(java.util.List<java.util.concurrent.ConcurrentHashMap<String,Object>>)globalMap.get("THREAD_MAPS_"+jobName);
if (mapsList_<%=cid%> != null) {
for (java.util.concurrent.ConcurrentHashMap<String,Object> map : mapsList_<%=cid%>) {
org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
<<%=connectionName%>Struct> tmp = (org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
<<%=connectionName%>Struct>)tHash_Lookup_<%=connectionName%>;
if (globalMap != map) {
//map.put("MAP_POPULATED_<%=connectionName%>",Boolean.TRUE);
map.put("tHash_Lookup_<%=connectionName%>",new org.talend.designer.components.lookup.memory.ConcurrentAdvancedMemoryLookup
<<%=connectionName%>Struct>(tmp));
while (map.get("tHash_Lookup_<%=connectionName%>") == null) {
Thread.sleep(1);
}
}
}
}
}
} catch (Exception ex) {
globalMap.put("THREADS_HAVE_ERROR",ex);
throw ex;
} catch (Error er) {
globalMap.put("THREADS_HAVE_ERROR",er);
throw er;
}
}//end synchronized
<%
}
}
}
%>

View File

@@ -12,6 +12,9 @@
org.talend.core.model.process.IHashConfiguration
org.talend.core.model.process.IHashableColumn
org.talend.core.model.process.IMatchingMode
java.util.HashSet
java.util.Set
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.IDataConnection
"
%>

View File

@@ -14,10 +14,13 @@
org.talend.core.model.process.IMatchingMode
java.util.List
java.util.ArrayList
java.util.HashSet
java.util.Set
java.util.Map
java.util.HashMap
java.util.Comparator
java.util.Collections
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.IDataConnection
org.talend.designer.xmlmap.XmlMapComponent
org.eclipse.emf.common.util.EList

View File

@@ -5,6 +5,8 @@
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
"
%>

View File

@@ -12,10 +12,13 @@
org.talend.core.model.process.IMatchingMode
java.util.List
java.util.ArrayList
java.util.HashSet
java.util.Set
java.util.Map
java.util.HashMap
java.util.Comparator
java.util.Collections
org.talend.core.model.process.EConnectionType
org.talend.core.model.process.IDataConnection
org.talend.designer.xmlmap.XmlMapComponent
org.eclipse.emf.common.util.EList

View File

@@ -2,4 +2,3 @@ LONG_NAME=Remplit une m
HELP=org.talend.help.tAdvancedHash
RUN_IF.MENU=Run if
RUN_IF.LINK=If
NB_LINE.NAME=Nombre de lignes

View File

@@ -1,8 +1,17 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map
java.util.HashMap
"
%>

View File

@@ -1,4 +1,24 @@
<%@ jet
imports=""
imports="
org.talend.core.model.process.INode
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
java.util.Map
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
"
%>
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
%>
} // G_AggR_600

View File

@@ -11,6 +11,7 @@ imports="
java.util.Map
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.process.INode
"
%>

View File

@@ -4,6 +4,7 @@ imports="
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.metadata.types.JavaTypesManager
@@ -11,6 +12,7 @@ imports="
java.util.List
java.util.ArrayList
java.util.Map
java.util.HashMap
"
%>

View File

@@ -1,9 +1,16 @@
<%@ jet
imports="
org.talend.core.model.process.INode
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.process.ElementParameterParser
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.List
java.util.Map
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
"
%>

View File

@@ -2,8 +2,15 @@
imports="
org.talend.core.model.process.INode
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.designer.codegen.config.CodeGeneratorArgument
java.util.ArrayList
java.util.HashMap
java.util.LinkedList
java.util.List
java.util.Map
"

View File

@@ -4,7 +4,14 @@ imports="
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
java.util.List
java.util.ArrayList
java.util.LinkedList
java.util.Map
java.util.HashMap
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
"
%>

View File

@@ -6,8 +6,14 @@ imports="
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.ElementParameterParser
java.util.List
java.util.ArrayList
java.util.LinkedList
java.util.Map
java.util.HashMap
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
"
%>

View File

@@ -22,6 +22,7 @@ ENCODING.NAME=Encodage
HELP=org.talend.help.tAmazonMysqlCommit
HOST.NAME=Hôte
LONG_NAME=Commite toutes les transactions n'ayant pas encore été commitées dans une connexion MySQL Amazon RDS sélectionnée
NB_LINE.NAME=Nombre de lignes
NULL_CHAR.NAME=Caractère Null
PASS.NAME=Mot de passe
PORT.NAME=Port

View File

@@ -1,6 +1,4 @@
ADD_COLS.ITEM.NAME=Naam
COMMIT_EVERY.NAME=Commit iedere
DATA_ACTION.ITEM.DELETE=Verwijderen
DATA_ACTION.ITEM.UPDATE=Update
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam

View File

@@ -1,5 +1,6 @@
ADD_COLS.ITEM.REFCOL=Referentna kolona
ADD_COLS.ITEM.SQL=SQL izraz
DATA_ACTION.ITEM.DELETE=DELETE
DATA_ACTION.ITEM.INSERT=INSERT
DATA_ACTION.ITEM.UPDATE=UPDATE
SQL_SYNTAX.NAME=SQL sintaksa

View File

@@ -49,7 +49,7 @@
REPOSITORY_VALUE="DB_VERSION"
READONLY="true">
<ITEMS DEFAULT="MYSQL_5">
<ITEM NAME="MYSQL_5" VALUE="MYSQL_5" />
<ITEM NAME="MYSQL_5" VALUE="mysql-connector-java-5.1.0-bin.jar" />
</ITEMS>
</PARAMETER>
@@ -160,7 +160,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-MysqlConnector" MODULE="mysql-connector-java-5.1.22-bin.jar" REQUIRED_IF="DB_VERSION == 'MYSQL_5'" />
<IMPORT NAME="Driver-MysqlConnector" MODULE="mysql-connector-java-5.1.0-bin.jar" REQUIRED="false" />
</IMPORTS>
</CODEGENERATION>
<RETURNS/>

View File

@@ -6,6 +6,7 @@ ENCODING.NAME=Encodage
HELP=org.talend.help.tAmazonMysqlConnection
HOST.NAME=Hôte
LONG_NAME=Crée une connexion à une base de données MySQL Amazon RDS
NB_LINE.NAME=Nombre de lignes
NULL_CHAR.NAME=Caractère Null
PASS.NAME=Mot de passe
PORT.NAME=Port

View File

@@ -1,3 +1,2 @@
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.MYSQL_5=Mysql 5

View File

@@ -7,7 +7,9 @@ imports="
org.talend.designer.codegen.config.CodeGeneratorArgument
org.talend.core.model.process.IConnection
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.builder.database.ExtractMetaDataUtils
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
java.util.List
java.util.Map
"

View File

@@ -15,7 +15,6 @@
</HEADER>
<FAMILIES>
<FAMILY>Databases/AmazonRDS/MySQL</FAMILY>
<FAMILY>Cloud/AmazonRDS/MySQL</FAMILY>
</FAMILIES>
@@ -51,7 +50,7 @@
READONLY="true"
SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
<ITEMS DEFAULT="MYSQL_5">
<ITEM NAME="MYSQL_5" VALUE="MYSQL_5" />
<ITEM NAME="MYSQL_5" VALUE="mysql-connector-java-5.1.0-bin.jar" />
</ITEMS>
</PARAMETER>
@@ -238,7 +237,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-Mysql5" MODULE="mysql-connector-java-5.1.22-bin.jar" REQUIRED_IF="(DB_VERSION == 'MYSQL_5') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="Driver-Mysql5" MODULE="mysql-connector-java-5.1.0-bin.jar" REQUIRED="false" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -7,6 +7,7 @@ ENCODING.NAME=Encodage
HELP=org.talend.help.tAmazonMysqlInput
HOST.NAME=Hôte
LONG_NAME=Lit une table MySQL Amazon RDS et extrait des champs à partir d'une requête SQL
NB_LINE.NAME=Nombre de lignes
NULL_CHAR.NAME=Caractère Null
PASS.NAME=Mot de passe
PORT.NAME=Port

View File

@@ -1,3 +1,2 @@
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.MYSQL_5=Mysql 5

View File

@@ -4,7 +4,9 @@ imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
org.talend.core.model.process.IProcess
@@ -13,6 +15,7 @@ imports="
java.util.ArrayList
java.util.Map
java.util.HashMap
java.util.LinkedList
"
skeleton="../templates/db_output_bulk.skeleton"
%>
@@ -205,7 +208,7 @@ if(!useExistingConnection) {
}
%>
<%
if (useBatchSize && "MYSQL_5".equals(dbVersion) && !extendedInsert) {
if (useBatchSize && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion) && !extendedInsert) {
if(!("").equals(batchSize)&&!("0").equals(batchSize)) {
%>
int batchSize_<%=cid%> = <%=batchSize%>;
@@ -329,7 +332,7 @@ if(columnList != null && columnList.size() > 0) {
<%
} else {//extended-insert mode(begin)
if ("MYSQL_4".equals(dbVersion)) {
if ("mysql-connector-java-3.1.14-bin.jar".equals(dbVersion)) {
%>
class BufferLine_<%=cid%> {
<%
@@ -400,7 +403,7 @@ if(columnList != null && columnList.size() > 0) {
String insertColValue<%=cid%> = "<%=insertValueStmt.toString()%>";
int rowCount<%=cid%> = 0;
<%
} else if ("MYSQL_5".equals(dbVersion)) {
} else if ("mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) {
%>
String insert_<%=cid%> = "INSERT INTO `" + <%=table%> + "` (<%=insertColName.toString()%>) VALUES (<%=insertValueStmt.toString()%>)";
<%
@@ -475,7 +478,7 @@ if(columnList != null && columnList.size() > 0) {
}
}
if(isDynamic) {
if ("MYSQL_4".equals(dbVersion) && extendedInsert) {
if ("mysql-connector-java-3.1.14-bin.jar".equals(dbVersion) && extendedInsert) {
%>
class BufferLine_<%=cid%> {

View File

@@ -4,8 +4,11 @@ imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.IConnection
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
org.talend.core.model.process.IProcess
@@ -101,7 +104,7 @@ skeleton="../templates/db_output_bulk.skeleton"
if(extendedInsert){
if ("MYSQL_4".equals(dbVersion)) {
if ("mysql-connector-java-3.1.14-bin.jar".equals(dbVersion)) {
class ExtendInsertOperation{
public String generateType(String typeToGenerate){
if(("byte[]").equals(typeToGenerate)){
@@ -337,7 +340,7 @@ skeleton="../templates/db_output_bulk.skeleton"
insertedCount_<%=cid%> = insertedCount_<%=cid%> + pstmt_<%=cid %>.executeUpdate();
}
<%
} else if ("MYSQL_5".equals(dbVersion)) {
} else if ("mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) {
//////////batch execute by batch size///////
if(!("").equals(numPerInsert ) && !("0").equals(numPerInsert )) {
%>
@@ -420,7 +423,7 @@ skeleton="../templates/db_output_bulk.skeleton"
<%
} else {
%>
<%if ((rejectConnName==null && "MYSQL_5".equals(dbVersion) && useBatchSize) && ( ("INSERT").equals(dataAction) ||("UPDATE").equals(dataAction) || ("DELETE").equals(dataAction))) {
<%if ((rejectConnName==null && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion) && useBatchSize) && ( ("INSERT").equals(dataAction) ||("UPDATE").equals(dataAction) || ("DELETE").equals(dataAction))) {
%>
try {
int countSum_<%=cid%> = 0;

View File

@@ -17,7 +17,6 @@
</HEADER>
<FAMILIES>
<FAMILY>Databases/AmazonRDS/MySQL</FAMILY>
<FAMILY>Cloud/AmazonRDS/MySQL</FAMILY>
</FAMILIES>
@@ -55,7 +54,7 @@
READONLY="true"
SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
<ITEMS DEFAULT="MYSQL_5">
<ITEM NAME="MYSQL_5" VALUE="MYSQL_5" />
<ITEM NAME="MYSQL_5" VALUE="mysql-connector-java-5.1.0-bin.jar" />
</ITEMS>
</PARAMETER>
@@ -420,7 +419,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-Mysql5" MODULE="mysql-connector-java-5.1.22-bin.jar" REQUIRED_IF="(DB_VERSION == 'MYSQL_5') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="Driver-Mysql5" MODULE="mysql-connector-java-5.1.0-bin.jar" REQUIRED="false" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -4,8 +4,10 @@ imports="
org.talend.core.model.process.INode
org.talend.core.model.process.ElementParameterParser
org.talend.core.model.process.IConnection
org.talend.core.model.metadata.IMetadataColumn
org.talend.core.model.metadata.IMetadataTable
org.talend.core.model.metadata.types.JavaTypesManager
org.talend.core.model.metadata.types.JavaType
org.talend.core.model.process.IConnectionCategory
org.talend.core.model.metadata.MappingTypeRetriever
org.talend.core.model.metadata.MetadataTalendType
@@ -14,6 +16,7 @@ imports="
java.util.ArrayList
java.util.Map
java.util.HashMap
java.util.LinkedList
"
skeleton="../templates/db_output_bulk.skeleton"
%>
@@ -230,7 +233,7 @@ if(columnList != null && columnList.size() > 0) {
<%
} else {//extended-insert mode(begin)
if ("MYSQL_4".equals(dbVersion)) {
if ("mysql-connector-java-3.1.14-bin.jar".equals(dbVersion)) {
%>
////////////////////////////////////////////////////////////////////////////////////////////
@@ -297,7 +300,7 @@ if(columnList != null && columnList.size() > 0) {
int rowCount<%=cid%> = 0;
<%
}
} else if ("MYSQL_5".equals(dbVersion)) {
} else if ("mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) {
List< ? extends IConnection> conns_dynamic = node.getIncomingConnections();
if(conns_dynamic!=null && conns_dynamic.size()>0){
IConnection conn = conns_dynamic.get(0);
@@ -623,7 +626,7 @@ if(columnList != null && columnList.size() > 0) {
<%
}
}
if ("MYSQL_5".equals(dbVersion)) {
if ("mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) {
if (extendedInsert || useBatchSize) {
if((!("").equals(numPerInsert)&&!("0").equals(numPerInsert))
||(!("").equals(batchSize)&&!("0").equals(batchSize))) {
@@ -644,7 +647,7 @@ if(columnList != null && columnList.size() > 0) {
<%
if(("INSERT").equals(dataAction)) {
if(extendedInsert) {//extended-insert mode(begin)
if ("MYSQL_4".equals(dbVersion)) {
if ("mysql-connector-java-3.1.14-bin.jar".equals(dbVersion)) {
ExtendInsertOperation eiOperation = new ExtendInsertOperation();
int insertableCount = 0;
for(Column column : colStruct) {
@@ -723,7 +726,7 @@ if(columnList != null && columnList.size() > 0) {
counter<%=cid%>=1;
}
<%
} else if ("MYSQL_5".equals(dbVersion)) {
} else if ("mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) {
int counter = 1;
for(Column column : colStruct) {
if(column.isInsertable()) {
@@ -933,7 +936,7 @@ if(columnList != null && columnList.size() > 0) {
}
%>
<%if (rejectConnName == null && useBatchSize && "MYSQL_5".equals(dbVersion)) { // whether use batch
<%if (rejectConnName == null && useBatchSize && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) { // whether use batch
%>
pstmt_<%=cid %>.addBatch();
nb_line_<%=cid%>++;
@@ -1371,7 +1374,7 @@ if(columnList != null && columnList.size() > 0) {
<%
}
%>
<%if (rejectConnName == null && useBatchSize && "MYSQL_5".equals(dbVersion)) { // whether use batch
<%if (rejectConnName == null && useBatchSize && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) { // whether use batch
%>
pstmt_<%=cid %>.addBatch();
nb_line_<%=cid%>++;
@@ -1641,7 +1644,7 @@ if(columnList != null && columnList.size() > 0) {
<%
}
//////////batch execute by batch size///////
if (extendedInsert && "MYSQL_5".equals(dbVersion) && ("INSERT").equals(dataAction)) {
if (extendedInsert && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion) && ("INSERT").equals(dataAction)) {
if(!("").equals(numPerInsert ) && !("0").equals(numPerInsert )) {
%>
if ( batchSize_<%=cid%> <= batchSizeCounter_<%=cid%>) {
@@ -1688,7 +1691,7 @@ if(columnList != null && columnList.size() > 0) {
}
}
if (useBatchSize && "MYSQL_5".equals(dbVersion) &&(rejectConnName==null)) {
if (useBatchSize && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion) &&(rejectConnName==null)) {
if(!("").equals(batchSize) && !("0").equals(batchSize)) {
%>
if ( batchSize_<%=cid%> <= batchSizeCounter_<%=cid%>) {
@@ -1748,7 +1751,7 @@ if(columnList != null && columnList.size() > 0) {
if(commitEvery_<%=cid%> <= commitCounter_<%=cid%>) {
<%if ((rejectConnName==null && useBatchSize && "MYSQL_5".equals(dbVersion)) && (("INSERT").equals(dataAction) || ("UPDATE").equals(dataAction) || ("DELETE").equals(dataAction)) ) {
<%if ((rejectConnName==null && useBatchSize && "mysql-connector-java-5.1.0-bin.jar".equals(dbVersion)) && (("INSERT").equals(dataAction) || ("UPDATE").equals(dataAction) || ("DELETE").equals(dataAction)) ) {
%>
try {
int countSum_<%=cid%> = 0;

View File

@@ -35,12 +35,13 @@ DBD-ODBC.INFO=Requis pour les connexions de type ODBC
DBD-Oracle.INFO=Requis pour Oracle
DBD-Pg.INFO=Requis pour PostgreSQL
DBD-mysql.INFO=Requis pour MySQL
DIE_ON_ERROR.NAME=Arrêter en cas d'erreur
DIE_ON_ERROR.NAME=Terminer en cas d'erreur
ENCODING.NAME=Encodage
EXTENDINSERT.NAME=Insertions étendues
HELP=org.talend.help.tAmazonMysqlOutput
HOST.NAME=Hôte
LONG_NAME=Insère ou met à jour des lignes dans une table MySQL Amazon RDS
NB_LINE.NAME=Nombre de lignes
NULL_CHAR.NAME=Caractère Null
PASS.NAME=Mot de passe
PORT.NAME=Port

View File

@@ -2,11 +2,5 @@ ADD_COLS.ITEM.NAME=Naam
ADD_COLS.ITEM.OPERATOR.ITEM.NOT_EQUAL=<>
ADD_COLS.ITEM.OPERATOR.ITEM.IS=IS
COMMIT_EVERY.NAME=Commit iedere
DATA_ACTION.ITEM.DELETE=Verwijderen
DATA_ACTION.ITEM.UPDATE=Update
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
HINT_OPTIONS.ITEM.SQL_STMT.ITEM.UPDATE=Update
HINT_OPTIONS.ITEM.SQL_STMT.ITEM.DELETE=Verwijderen
DB_VERSION.ITEM.MYSQL_4=Mysql 4
DB_VERSION.ITEM.MYSQL_5=Mysql 5

View File

@@ -5,6 +5,7 @@ ADD_COLS.ITEM.OPERATOR.ITEM.NOT_EQUAL=<>
ADD_COLS.ITEM.OPERATOR.ITEM.LESS_THAN=<
ADD_COLS.ITEM.OPERATOR.ITEM.GREAT_THAN=>
ADD_COLS.ITEM.OPERATOR.ITEM.GREAT_EQUAL_THAN=>=
DATA_ACTION.ITEM.DELETE=DELETE
DATA_ACTION.ITEM.INSERT=INSERT
DATA_ACTION.ITEM.UPDATE=UPDATE
SQL_SYNTAX.NAME=SQL sintaksa
@@ -14,5 +15,6 @@ TYPE.ITEM.PGSQL=Postgre SQL
HINT_OPTIONS.ITEM.SQL_STMT=SQL STMT*
HINT_OPTIONS.ITEM.SQL_STMT.ITEM.INSERT=INSERT
HINT_OPTIONS.ITEM.SQL_STMT.ITEM.UPDATE=UPDATE
HINT_OPTIONS.ITEM.SQL_STMT.ITEM.DELETE=DELETE
DB_VERSION.ITEM.MYSQL_4=Mysql 4
DB_VERSION.ITEM.MYSQL_5=Mysql 5

View File

@@ -22,6 +22,7 @@ ENCODING.NAME=Encodage
HELP=org.talend.help.tAmazonMysqlRollback
HOST.NAME=Hôte
LONG_NAME=Annule toutes les transactions n'ayant pas encore été commitées dans une connexion MySQL Amazon RDS sélectionnée
NB_LINE.NAME=Nombre de lignes
NULL_CHAR.NAME=Caractère Null
PASS.NAME=Mot de passe
PORT.NAME=Port

View File

@@ -1,6 +1,4 @@
ADD_COLS.ITEM.NAME=Naam
COMMIT_EVERY.NAME=Commit iedere
DATA_ACTION.ITEM.DELETE=Verwijderen
DATA_ACTION.ITEM.UPDATE=Update
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam

View File

@@ -1,5 +1,6 @@
ADD_COLS.ITEM.REFCOL=Referentna kolona
ADD_COLS.ITEM.SQL=SQL izraz
DATA_ACTION.ITEM.DELETE=DELETE
DATA_ACTION.ITEM.INSERT=INSERT
DATA_ACTION.ITEM.UPDATE=UPDATE
SQL_SYNTAX.NAME=SQL sintaksa

View File

@@ -51,7 +51,7 @@
READONLY="true"
SHOW_IF="USE_EXISTING_CONNECTION == 'false'">
<ITEMS DEFAULT="MYSQL_5">
<ITEM NAME="MYSQL_5" VALUE="MYSQL_5" />
<ITEM NAME="MYSQL_5" VALUE="mysql-connector-java-5.1.0-bin.jar" />
</ITEMS>
</PARAMETER>
@@ -276,7 +276,7 @@
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="Driver-Mysql5" MODULE="mysql-connector-java-5.1.22-bin.jar" REQUIRED_IF="(DB_VERSION == 'MYSQL_5') AND (USE_EXISTING_CONNECTION == 'false')" />
<IMPORT NAME="Driver-Mysql5" MODULE="mysql-connector-java-5.1.0-bin.jar" REQUIRED="false" />
</IMPORTS>
</CODEGENERATION>

View File

@@ -4,11 +4,12 @@ DBD-Oracle.INFO=Requis pour Oracle
DBD-Pg.INFO=Requis pour PostgreSQL
DBD-mysql.INFO=Requis pour MySQL
DBTABLE.NAME=Nom de la table
DIE_ON_ERROR.NAME=Arrêter en cas d'erreur
DIE_ON_ERROR.NAME=Terminer en cas d'erreur
ENCODING.NAME=Encodage
HELP=org.talend.help.tAmazonMysqlRow
HOST.NAME=Hôte
LONG_NAME=Exécute une requête SQL à chaque itération de flux Talend
NB_LINE.NAME=Nombre de lignes
PASS.NAME=Mot de passe
PORT.NAME=Port
PREPARED_STATEMENT.NAME=Instruction préparée
@@ -44,7 +45,7 @@ SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_INDEX=Index des param
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE=Type de paramètre
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.BigDecimal=BigDecimal
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.Blob=Blob
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.Boolean=Boolean
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.Boolean=Booléen
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.Byte=Byte
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.Bytes=Bytes
SET_PREPAREDSTATEMENT_PARAMETERS.ITEM.PARAMETER_TYPE.ITEM.Clob=Clob

View File

@@ -1,5 +1,3 @@
COMMIT_EVERY.NAME=Commit iedere
PASS.NAME=Wachtwoord
USER.NAME=Gebruikersnaam
DB_VERSION.ITEM.MYSQL_4=Mysql 4
DB_VERSION.ITEM.MYSQL_5=Mysql 5

Some files were not shown because too many files have changed in this diff Show More