use of org.mybatis.generator.api.dom.xml.Attribute in project generator by mybatis.
the class UpdateByExampleWithBLOBsElementGenerator method addElements.
@Override
public void addElements(XmlElement parentElement) {
//$NON-NLS-1$
XmlElement answer = new XmlElement("update");
answer.addAttribute(new //$NON-NLS-1$
Attribute(//$NON-NLS-1$
"id", introspectedTable.getUpdateByExampleWithBLOBsStatementId()));
//$NON-NLS-1$ //$NON-NLS-2$
answer.addAttribute(new Attribute("parameterType", "map"));
context.getCommentGenerator().addComment(answer);
StringBuilder sb = new StringBuilder();
//$NON-NLS-1$
sb.append("update ");
sb.append(introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime());
answer.addElement(new TextElement(sb.toString()));
// set up for first column
sb.setLength(0);
//$NON-NLS-1$
sb.append("set ");
Iterator<IntrospectedColumn> iter = ListUtilities.removeGeneratedAlwaysColumns(introspectedTable.getAllColumns()).iterator();
while (iter.hasNext()) {
IntrospectedColumn introspectedColumn = iter.next();
sb.append(MyBatis3FormattingUtilities.getAliasedEscapedColumnName(introspectedColumn));
//$NON-NLS-1$
sb.append(" = ");
sb.append(MyBatis3FormattingUtilities.getParameterClause(introspectedColumn, //$NON-NLS-1$
"record."));
if (iter.hasNext()) {
sb.append(',');
}
answer.addElement(new TextElement(sb.toString()));
// set up for the next column
if (iter.hasNext()) {
sb.setLength(0);
OutputUtilities.xmlIndent(sb, 1);
}
}
answer.addElement(getUpdateByExampleIncludeElement());
if (context.getPlugins().sqlMapUpdateByExampleWithBLOBsElementGenerated(answer, introspectedTable)) {
parentElement.addElement(answer);
}
}
use of org.mybatis.generator.api.dom.xml.Attribute in project generator by mybatis.
the class AntFileGenerator method getTargetElement.
private XmlElement getTargetElement() {
//$NON-NLS-1$
XmlElement targetElement = new XmlElement("target");
//$NON-NLS-1$ //$NON-NLS-2$
targetElement.addAttribute(new Attribute("name", "generate"));
addSqlTaskIfNecessary(targetElement);
targetElement.addElement(getGenerateTask());
return targetElement;
}
use of org.mybatis.generator.api.dom.xml.Attribute in project generator by mybatis.
the class AntFileGenerator method getProjectElement.
private XmlElement getProjectElement() {
//$NON-NLS-1$
XmlElement projectElement = new XmlElement("project");
//$NON-NLS-1$ //$NON-NLS-2$
projectElement.addAttribute(new Attribute("default", "generate"));
projectElement.addElement(getTargetElement());
return projectElement;
}
use of org.mybatis.generator.api.dom.xml.Attribute in project generator by mybatis.
the class AntFileGenerator method getGenerateTask.
private XmlElement getGenerateTask() {
//$NON-NLS-1$
XmlElement generateTask = new XmlElement("mybatis.generate");
//$NON-NLS-1$
generateTask.addAttribute(new Attribute("configfile", getConfigFile()));
return generateTask;
}
use of org.mybatis.generator.api.dom.xml.Attribute in project generator by mybatis.
the class NewConfigFileWizard method openContentStream.
/**
* We will initialize file contents with a sample text.
*/
private InputStream openContentStream() {
Document document = new Document(XmlConstants.MYBATIS_GENERATOR_CONFIG_PUBLIC_ID, XmlConstants.MYBATIS_GENERATOR_CONFIG_SYSTEM_ID);
//$NON-NLS-1$
XmlElement generatorConfiguration = new XmlElement("generatorConfiguration");
document.setRootElement(generatorConfiguration);
//$NON-NLS-1$
XmlElement context = new XmlElement("context");
//$NON-NLS-1$ //$NON-NLS-2$
context.addAttribute(new Attribute("id", "context1"));
generatorConfiguration.addElement(context);
//$NON-NLS-1$
XmlElement jdbcConnection = new XmlElement("jdbcConnection");
//$NON-NLS-1$ //$NON-NLS-2$
jdbcConnection.addAttribute(new Attribute("driverClass", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
jdbcConnection.addAttribute(new Attribute("connectionURL", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
jdbcConnection.addAttribute(new Attribute("userId", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
jdbcConnection.addAttribute(new Attribute("password", "???"));
context.addElement(jdbcConnection);
//$NON-NLS-1$
XmlElement javaModelGenerator = new XmlElement("javaModelGenerator");
//$NON-NLS-1$ //$NON-NLS-2$
javaModelGenerator.addAttribute(new Attribute("targetPackage", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
javaModelGenerator.addAttribute(new Attribute("targetProject", "???"));
context.addElement(javaModelGenerator);
//$NON-NLS-1$
XmlElement sqlMapGenerator = new XmlElement("sqlMapGenerator");
//$NON-NLS-1$ //$NON-NLS-2$
sqlMapGenerator.addAttribute(new Attribute("targetPackage", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
sqlMapGenerator.addAttribute(new Attribute("targetProject", "???"));
context.addElement(sqlMapGenerator);
//$NON-NLS-1$
XmlElement javaClientGenerator = new XmlElement("javaClientGenerator");
//$NON-NLS-1$ //$NON-NLS-2$
javaClientGenerator.addAttribute(new Attribute("targetPackage", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
javaClientGenerator.addAttribute(new Attribute("targetProject", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
javaClientGenerator.addAttribute(new Attribute("type", "XMLMAPPER"));
context.addElement(javaClientGenerator);
//$NON-NLS-1$
XmlElement table = new XmlElement("table");
//$NON-NLS-1$ //$NON-NLS-2$
table.addAttribute(new Attribute("schema", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
table.addAttribute(new Attribute("tableName", "???"));
//$NON-NLS-1$
XmlElement columnOverride = new XmlElement("columnOverride");
//$NON-NLS-1$ //$NON-NLS-2$
columnOverride.addAttribute(new Attribute("column", "???"));
//$NON-NLS-1$ //$NON-NLS-2$
columnOverride.addAttribute(new Attribute("property", "???"));
table.addElement(columnOverride);
context.addElement(table);
return new ByteArrayInputStream(document.getFormattedContent().getBytes());
}
Aggregations