JiveJdon Community Forums
在线205人 Home | 论坛 | 培训咨询 | 精华 | 查搜 | 注册 | 登陆 |
首页 » 论坛 » J2EE/JavaEE/JEE/EJB/JSF等技术讨论
???en_US.forumThreadPrev.name??? 上一主题
Go back to the topic listing   返回主题列表
???en_US.forumThreadNext.name??? 下一主题
这个主题共有 15 回复 / 2 页 [ 1 2 下一页 ]  发表新帖子  回复该主题贴
nmg

发表文章: 56
注册时间: 2002年12月02日 09:45
给他发消息
banq,你做的软件做的怎末样了 发表: 2002年12月03日 14:15 回复
banq,你做的网站引擎软件做的怎末样了,想好怎末卖了吗?
做市场是非常主要的!你打算如何去做市场?
nmg

发表文章: 56
注册时间: 2002年12月02日 09:45
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2002年12月03日 15:56 回复
banq?做的怎末样了
nmg

发表文章: 56
注册时间: 2002年12月02日 09:45
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月09日 20:06 回复
时光匆匆
banq

发表文章: 9095
注册时间: 2002年08月03日 17:08
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月10日 12:58 回复
多谢,现在主要做JdonSD框架了
banq

发表文章: 9095
注册时间: 2002年08月03日 17:08
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月10日 13:31 回复
哪里有无你的系统介绍,非常大,我下载了,在欣赏中,原来多日不见,闭门修炼去了,佩服。
jody

发表文章: 26
注册时间: 2004年04月07日 14:32
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月10日 15:25 回复
我靠。。。本来想学习学习这个代码生成的软件。。

10多MB。。。吓人。。在这个 Ant 和velocity盛行的年代。。。居然能做出那么大的一个软件。。。真是佩服啊。。。

小弟我用 ant + velocity 也做了代码生成工具。。
生成form 用的是公用form Strutsconf ,strutsaction .HibernateBMP,Hibernate javacode ,以及Struts 的前台表现层velocity ,一次生成,对表生成操作为 浏览,添加.删除.修改,查寻,翻页,打印。,,,,感觉还是不复杂的
sunw

发表文章: 21
注册时间: 2004年04月19日 13:43
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月10日 16:47 回复
banq 现在不做软件了 ,做教育 做框架了 , 是吧
haibo

发表文章: 4
注册时间: 2004年08月09日 14:14
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月10日 16:48 回复
我不太懂你所说的“代码生成工具”是什么。但从你说的生成表操作添加.删除.修改,查寻,翻页,打印等等,如果这样的代码需要"批量生成”
的话,设计肯定没有做好,否则不会出现冗余
banq

发表文章: 9095
注册时间: 2002年08月03日 17:08
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月11日 11:36 回复
to jody
你的生成器是否有介绍和演示?想看看。。。


jody

发表文章: 26
注册时间: 2004年04月07日 14:32
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月13日 12:45 回复
生成代码的样子。
IE下浏览

Mozilla下浏览
jody

发表文章: 26
注册时间: 2004年04月07日 14:32
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月13日 12:46 回复
代码:


package com.coolwen.ant;

import javax.sql.DataSource;

import org.apache.commons.dbcp.BasicDataSource;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;


/**
* TODO
*
* @author <a href="mailto:jody@cpgroup.cn>QiaoLu</a>
* @Date:2004-7-23
*/

public abstract class AbstractTask extends Task{

protected String datasourceDriver;
protected String datasourceUrl;
protected String datasourceUsername;
protected String datasourcePassword;

protected Project project;

/**
* @return Returns the datasourceDriver.
*/

public String getDatasourceDriver() {
return datasourceDriver;
}
/**
* @param datasourceDriver The datasourceDriver to set.
*/

public void setDatasourceDriver(String datasourceDriver) {
this.datasourceDriver = datasourceDriver;
}
/**
* @return Returns the datasourcePassword.
*/

public String getDatasourcePassword() {
return datasourcePassword;
}
/**
* @param datasourcePassword The datasourcePassword to set.
*/

public void setDatasourcePassword(String datasourcePassword) {
this.datasourcePassword = datasourcePassword;
}
/**
* @return Returns the datasourceUrl.
*/

public String getDatasourceUrl() {
return datasourceUrl;
}
/**
* @param datasourceUrl The datasourceUrl to set.
*/

public void setDatasourceUrl(String datasourceUrl) {
this.datasourceUrl = datasourceUrl;
}
/**
* @return Returns the datasourceUsername.
*/

public String getDatasourceUsername() {
return datasourceUsername;
}
/**
* @param datasourceUsername The datasourceUsername to set.
*/

public void setDatasourceUsername(String datasourceUsername) {
this.datasourceUsername = datasourceUsername;
}
protected DataSource getDataSource(){
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName(this.getDatasourceDriver());
ds.setUsername(this.getDatasourceUsername());
ds.setPassword(this.getDatasourcePassword());
ds.setUrl(this.getDatasourceUrl());
return ds;
}
public abstract void execute () throws BuildException;


/**
* @return Returns the project.
*/

public Project getProject() {
return project;
}
/**
* @param project The project to set.
*/

public void setProject(Project project) {
this.project = project;
}
}
jody

发表文章: 26
注册时间: 2004年04月07日 14:32
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月13日 12:47 回复
代码 生成 HBM 和JAVA



package com.coolwen.ant.hibernate;

import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;

import net.sf.hibernate.tool.ddl2hbm.MapGenerator;

import org.apache.tools.ant.BuildException;

import com.coolwen.ant.AbstractTask;

/**
* TODO
*
* @author <a href="mailto:jody@cpgroup.cn>QiaoLu</a>
* @Date:2004-7-23
*/

public class HibernateTask extends AbstractTask {

protected String coolwen_hibernate_package;

protected String coolwen_hibernate_schem;

protected String[] coolwen_hibernate_tables;

protected String coolwen_hibernate_catalog;

protected String coolwen_hibernate_idname;

protected String coolwen_hibernate_idtype;

protected File coolwen_hibernate_outDir;

protected String coolwen_hibernate_generator;

protected boolean coolwen_hibernate_Java;

protected boolean coolwen_hibernate_Hbm;

protected boolean coolwen_hibernate_singlemap;

protected String coolwen_hibernate_singlemapname;




/* (non-Javadoc)
* @see com.coolwen.ant.AbstractTask#execute()
*/

public void execute() throws BuildException {
// TODO Auto-generated method stub
MapGenerator mg = new MapGenerator();
mg.setCatalog(this.getCoolwen_hibernate_catalog());
mg.setSchemaPattern(this.getCoolwen_hibernate_schem());
mg.setIdName(this.getCoolwen_hibernate_idname());
mg.setIdType(this.getCoolwen_hibernate_idtype());
mg.setTableNames(this.getCoolwen_hibernate_tables());
mg.setPackageName(this.getCoolwen_hibernate_package());
mg.setHibernateTypes(true);
mg.setGenerator(this.getCoolwen_hibernate_generator());
mg.setOutputDirectory(this.getCoolwen_hibernate_outDir());
mg.setSingleMapFile(this.isCoolwen_hibernate_singlemap());
mg.setMappingFile(this.getCoolwen_hibernate_singlemapname());
mg.setJava(this.isCoolwen_hibernate_Java());
mg.setHbm(this.isCoolwen_hibernate_Hbm());
try {
mg.generate(this.getDataSource().getConnection());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

/**
* @return Returns the coolwen_hibernate_package.
*/

public String getCoolwen_hibernate_package() {
return coolwen_hibernate_package;
}
/**
* @param coolwen_hibernate_package The coolwen_hibernate_package to set.
*/

public void setCoolwen_hibernate_package(String coolwen_hibernate_package) {
this.coolwen_hibernate_package = coolwen_hibernate_package;
}


/**
* @return Returns the coolwen_hibernate_schem.
*/

public String getCoolwen_hibernate_schem() {
return coolwen_hibernate_schem;
}
/**
* @param coolwen_hibernate_schem The coolwen_hibernate_schem to set.
*/

public void setCoolwen_hibernate_schem(String coolwen_hibernate_schem) {
this.coolwen_hibernate_schem = coolwen_hibernate_schem;
}

/**
* @return Returns the coolwen_hibernate_tables.
*/

public String[] getCoolwen_hibernate_tables() {
return coolwen_hibernate_tables;
}
/**
* @param coolwen_hibernate_tables The coolwen_hibernate_tables to set.
*/

public void setCoolwen_hibernate_tables(String coolwen_hibernate_tables) {
String[] result = null;
if(coolwen_hibernate_tables.toUpperCase().equals(
"*")){
Connection conn = null;

try {
conn = this.getDataSource().getConnection();
DatabaseMetaData dmd =conn.getMetaData();
ResultSet rs = null;
rs = dmd.getTables(this.getCoolwen_hibernate_catalog(), this.coolwen_hibernate_schem,
"%", new String[] {"TABLE", "VIEW", "SYNONYM", "ALIAS"} );
List l = new LinkedList();
while (rs.next()) {
l.add(rs.getString(3));
}
result = new String[l.size()];
for(int i = 0 ; i< l.size(); i++){
result[i] = (String)l.get(i);
}
rs.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally {
if(conn != null)
try {
conn.close();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}else{
StringTokenizer fqcnTokenizer = new StringTokenizer(coolwen_hibernate_tables,
";", false);

result = new String[fqcnTokenizer.countTokens()];
while (fqcnTokenizer.hasMoreTokens()) {
result[fqcnTokenizer.countTokens()-1] = fqcnTokenizer.nextToken().trim().toUpperCase();
}
}
this.coolwen_hibernate_tables = result;
}

/**
* @return Returns the coolwen_hibernate_catalog.
*/

public String getCoolwen_hibernate_catalog() {
return coolwen_hibernate_catalog;
}
/**
* @param coolwen_hibernate_catalog The coolwen_hibernate_catalog to set.
*/

public void setCoolwen_hibernate_catalog(String coolwen_hibernate_catalog) {
this.coolwen_hibernate_catalog = coolwen_hibernate_catalog;
}
/**
* @return Returns the coolwen_hibernate_idname.
*/

public String getCoolwen_hibernate_idname() {
return coolwen_hibernate_idname;
}
/**
* @param coolwen_hibernate_idname The coolwen_hibernate_idname to set.
*/

public void setCoolwen_hibernate_idname(String coolwen_hibernate_idname) {
this.coolwen_hibernate_idname = coolwen_hibernate_idname;
}
/**
* @return Returns the coolwen_hibernate_idtype.
*/

public String getCoolwen_hibernate_idtype() {
return coolwen_hibernate_idtype;
}
/**
* @param coolwen_hibernate_idtype The coolwen_hibernate_idtype to set.
*/

public void setCoolwen_hibernate_idtype(String coolwen_hibernate_idtype) {
this.coolwen_hibernate_idtype = coolwen_hibernate_idtype;
}

/**
* @return Returns the coolwen_hibernate_outDir.
*/

public File getCoolwen_hibernate_outDir() {
return coolwen_hibernate_outDir;
}
/**
* @param coolwen_hibernate_outDir The coolwen_hibernate_outDir to set.
*/

public void setCoolwen_hibernate_outDir(File coolwen_hibernate_outDir) {
this.coolwen_hibernate_outDir = coolwen_hibernate_outDir;
}

/**
* @return Returns the coolwen_hibernate_generator.
*/

public String getCoolwen_hibernate_generator() {
return coolwen_hibernate_generator;
}
/**
* @param coolwen_hibernate_generator The coolwen_hibernate_generator to set.
*/

public void setCoolwen_hibernate_generator(
String coolwen_hibernate_generator) {
this.coolwen_hibernate_generator = coolwen_hibernate_generator;
}

/**
* @return Returns the coolwen_hibernate_singlemap.
*/

public boolean isCoolwen_hibernate_singlemap() {
return coolwen_hibernate_singlemap;
}
/**
* @param coolwen_hibernate_singlemap The coolwen_hibernate_singlemap to set.
*/

public void setCoolwen_hibernate_singlemap(
boolean coolwen_hibernate_singlemap) {
this.coolwen_hibernate_singlemap = coolwen_hibernate_singlemap;
}


/**
* @return Returns the coolwen_hibernate_singlemapname.
*/

public String getCoolwen_hibernate_singlemapname() {
return coolwen_hibernate_singlemapname;
}
/**
* @param coolwen_hibernate_singlemapname The coolwen_hibernate_singlemapname to set.
*/

public void setCoolwen_hibernate_singlemapname(
String coolwen_hibernate_singlemapname) {
this.coolwen_hibernate_singlemapname = coolwen_hibernate_singlemapname;
}

/**
* @return Returns the coolwen_hibernate_Hbm.
*/

public boolean isCoolwen_hibernate_Hbm() {
return coolwen_hibernate_Hbm;
}
/**
* @param coolwen_hibernate_Hbm The coolwen_hibernate_Hbm to set.
*/

public void setCoolwen_hibernate_Hbm(boolean coolwen_hibernate_Hbm) {
this.coolwen_hibernate_Hbm = coolwen_hibernate_Hbm;
}
/**
* @return Returns the coolwen_hibernate_Java.
*/

public boolean isCoolwen_hibernate_Java() {
return coolwen_hibernate_Java;
}
/**
* @param coolwen_hibernate_Java The coolwen_hibernate_Java to set.
*/

public void setCoolwen_hibernate_Java(boolean coolwen_hibernate_Java) {
this.coolwen_hibernate_Java = coolwen_hibernate_Java;
}
}
jody

发表文章: 26
注册时间: 2004年04月07日 14:32
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月13日 12:48 回复
生成根据模板生成action ....文件


package com.coolwen.ant.struts;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;

import net.sf.hibernate.tool.ddl2hbm.JDBCUtil;
import net.sf.hibernate.util.StringHelper;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.tools.ant.BuildException;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.context.Context;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.texen.Generator;

import com.coolwen.ant.hibernate.HibernateTask;

/**
* TODO
*
* @author <a href="mailto:jody@cpgroup.cn>QiaoLu</a>
* @Date:2004-7-29
*/

public class ActionTask extends HibernateTask {

protected static Map template = new HashMap();

protected File coolwen_struts_outpath;

protected String coolwen_struts_schem;

protected String coolwen_struts_templatepath;

protected File coolwen_struts_documentpath;

protected String coolwen_struts_package;
public List getColumns(List value){
List result = new ArrayList();
for (Iterator iter = value.iterator(); iter.hasNext(); ){
JDBCUtil.Column column = (JDBCUtil.Column)iter.next();
Column newColumn = new Column();
newColumn.setHibernateType(column.hibernateType);
newColumn.setJavaType(column.javaType);
newColumn.setName(column.name.toLowerCase());
newColumn.setSqlColumnLength(column.sqlColumnLength);
newColumn.setSqlDecimalLength(column.sqlDecimalLength);
newColumn.setSqlNotNull(column.sqlNotNull);
newColumn.setSqlReadOnly(column.sqlReadOnly);
newColumn.setSqlType(column.sqlType);
result.add(newColumn);
}
return result;
}
/* (non-Javadoc)
* @see org.apache.tools.ant.Task#execute()
*/

public void execute () throws BuildException {
List content = new ArrayList();
for(int i = 0 ; i < this.getCoolwen_hibernate_tables().length ; i++){
try {
List pkColumns = JDBCUtil.getPrimaryK**Columns(this.getDataSource().getConnection(), this.getCoolwen_hibernate_catalog(), this.getCoolwen_hibernate_schem(), this.getCoolwen_hibernate_tables()[i]);
Set fkColumns = JDBCUtil.getForeignK**Columns(this.getDataSource().getConnection(), this.getCoolwen_hibernate_catalog(), this.getCoolwen_hibernate_schem(), this.getCoolwen_hibernate_tables()[i]);
List columns = JDBCUtil.getTableColumns(this.getDataSource().getConnection(), this.getCoolwen_hibernate_catalog(), this.getCoolwen_hibernate_schem(), this.getCoolwen_hibernate_tables()[i]);

ActionTemplateData actiontemplat = new ActionTemplateData ();
actiontemplat.setClassname(this.getCoolwen_hibernate_tables()[i]);
actiontemplat.setPackagename(this.getCoolwen_hibernate_package());
actiontemplat.setColumns(this.getColumns(columns));
actiontemplat.setFkColumns(fkColumns);
actiontemplat.setPkColumns(this.getColumns(pkColumns));
content.add(actiontemplat);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
VelocityEngine ve = new VelocityEngine();
ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, this.getCoolwen_struts_templatepath());
ve.init();
Generator generator = Generator.getInstance();
generator.setVelocityEngine(ve);
generator.setOutputPath(this.getCoolwen_struts_templatepath());
Template template = null;
Writer writer = null;
// TODO start Struts config generat
Context Struts = new VelocityContext();
Struts.put(
"contents",content);
Struts.put(
"schem",this.getCoolwen_struts_schem());
Struts.put(
"package",this.getCoolwen_struts_package());
//template = generator.getTemplate("strutsTemplate.vm","GBK");
template = this.getTemplate(generator,
"strutsTemplate.vm");
File StrutsFile = this.getCoolwen_struts_documentpath();
StrutsFile = new File(strutsFile,
"WEB-INF");
StrutsFile = new File(strutsFile,
"struts-config-"+this.getCoolwen_struts_schem()+".xml");
writer = this.getWriter(strutsFile,null);
template.merge(struts,writer);
writer.flush();
writer.close();
String rootid = this.create(
"Tree",true,"-1","");
String schemid = this.create(this.getCoolwen_struts_schem().toLowerCase(),true,rootid,
"");
for (Iterator iter = content.iterator(); iter.hasNext(); ){
Context c = new VelocityContext();
c.put(
"now", new Date().toString());
ActionTemplateData tempdata = (ActionTemplateData)iter.next();
System.out.println(schemid);
this.create(tempdata.classname.toLowerCase(),false,schemid,this.getCoolwen_struts_schem().toLowerCase()+
"/"+tempdata.classname.toLowerCase());
c.put(
"content",tempdata);
c.put(
"schem",this.getCoolwen_struts_schem());
c.put(
"package",this.getCoolwen_struts_package()+"."+this.getCoolwen_struts_schem());
//# TODO Struts Action generat
File tempf = this.getCoolwen_struts_outpath();
tempf = new File(tempf,this.getCoolwen_struts_schem());
if(!tempf.exists())
tempf.mkdirs();
tempf = new File(tempf,tempdata.classname+
"Actions.java");
writer = this.getWriter(tempf,null);
template = this.getTemplate(generator,
"actionTemplate.vm");
template.merge(c,writer);
writer.flush();
writer.close();
//c = null;
//# TODO Struts confit generat

//# Velocity generat
Map templateMap = new HashMap();
templateMap.put(
"add","addTemplate.vm");
templateMap.put(
"detail","detailTemplate.vm");
templateMap.put(
"list","listTemplate.vm");
templateMap.put(
"print","printTemplate.vm");
templateMap.put(
"update","updateTemplate.vm");
templateMap.put(
"index","indexTemplate.vm");
templateMap.put(
"frameMaster","frameMasterTemplate.vm");
File velocity = this.getCoolwen_struts_documentpath();
velocity = new File(velocity,this.getCoolwen_struts_schem().toLowerCase()+File.separator+tempdata.getClassname().toLowerCase());
if(!velocity.exists())
velocity.mkdirs();
for(Iterator tmap = templateMap.k**Set().iterator(); tmap.hasNext();){
template = null;
String k** = (String)tmap.next();
String value = (String)templateMap.get(k**);
writer = null;
File veloctiytemp = new File(velocity,k**+
".vm");
writer = this.getWriter(veloctiytemp,null);
template = this.getTemplate(generator,value);
//generator.getTemplate(value,"GBK");
template.merge(c,writer);
writer.flush();
writer.close();
}
}

} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}
protected String makeEntityName(String name) {
String tmp = makeMemberName(name);
tmp = tmp.substring(0,1).toUpperCase() + tmp.substring(1);
return tmp;
}

protected String makeMemberName(String name) {
String memberName = name.toLowerCase();
int i;
while ( (i = memberName.indexOf(StringHelper.UNDERSCORE) ) != -1 ) {
java.lang.String tmp1 = memberName.substring(0, i);
if (i+1 < memberName.length()) {
tmp1 += memberName.substring(i+1, i+2).toUpperCase();
}
if (i+2 < memberName.length()) {
tmp1 += memberName.substring(i+2);
}
memberName = tmp1;
}
return memberName;
}


/**
* @return Returns the coolwen_struts_outpath.
*/

public File getCoolwen_struts_outpath() {
return coolwen_struts_outpath;
}
/**
* @param coolwen_struts_outpath The coolwen_struts_outpath to set.
*/

public void setCoolwen_struts_outpath(File coolwen_struts_outpath) {
this.coolwen_struts_outpath = coolwen_struts_outpath;
}
/**
* @return Returns the coolwen_struts_schem.
*/

public String getCoolwen_struts_schem() {
return coolwen_struts_schem;
}
/**
* @param coolwen_struts_schem The coolwen_struts_schem to set.
*/

public void setCoolwen_struts_schem(String coolwen_struts_schem) {
this.coolwen_struts_schem = coolwen_struts_schem;
}
/**
* @return Returns the coolwen_struts_templatepath.
*/

public String getCoolwen_struts_templatepath() {
return coolwen_struts_templatepath;
}
/**
* @param coolwen_struts_templatepath The coolwen_struts_templatepath to set.
*/

public void setCoolwen_struts_templatepath(
String coolwen_struts_templatepath) {
this.coolwen_struts_templatepath = coolwen_struts_templatepath;
}

/**
* @return Returns the coolwen_struts_documentpath.
*/

public File getCoolwen_struts_documentpath() {
return coolwen_struts_documentpath;
}
/**
* @param coolwen_struts_documentpath The coolwen_struts_documentpath to set.
*/

public void setCoolwen_struts_documentpath(
File coolwen_struts_documentpath) {
this.coolwen_struts_documentpath = coolwen_struts_documentpath;
}

/**
* @return Returns the coolwen_struts_package.
*/

public String getCoolwen_struts_package() {
return coolwen_struts_package;
}
/**
* @param coolwen_struts_package The coolwen_struts_package to set.
*/

public void setCoolwen_struts_package(String coolwen_struts_package) {
this.coolwen_struts_package = coolwen_struts_package;
}

/**
* Returns a writer, based on encoding and path.
*
* @param path path to the output file
* @param encoding output encoding
*/

public Writer getWriter(File path, String encoding) throws Exception {
Writer writer;
if (encoding == null || encoding.length() == 0 || encoding.equals(
"8859-1") || encoding.equals("8859_1")) {
writer = new FileWriter(path);
}
else {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(path), encoding));
}
return writer;
}

public Template getTemplate(Generator generator,String template) throws Exception{
Template temp = null;
synchronized(ActionTask.template){
temp = (Template)ActionTask.template.get(template);
if(temp == null){
temp = generator.getTemplate(template,
"GB2312");
ActionTask.template.put(template,temp);
}
}
return temp;
}
protected String create(String name,boolean isfloder,String parentid,String link){
QueryRunner queryRunner = new QueryRunner(this.getDataSource());
String id =
"";
IsExist isExist = new IsExist();
String sql =
"";
if(this.getCoolwen_hibernate_schem()!=null && this.getCoolwen_hibernate_schem().length()>0){
sql =
"select * from "+this.getCoolwen_hibernate_schem()+".GEN_MENU where NODENAME = '"+name+"' and ISNODE ='"+isfloder+"'" ;
}else{
sql =
"select * from GEN_MENU where NODENAME = '"+name+"' and ISNODE ='"+isfloder+"'" ;
}
String isexist;
try {
isexist = queryRunner.query(sql, isExist).toString();

} catch (SQLException e) {
e.printStackTrace();
return
"0";
}
if(isexist.equals(
"0")){
if(this.getCoolwen_hibernate_schem()!=null && this.getCoolwen_hibernate_schem().length()>0){
sql =
"insert into "+this.getCoolwen_hibernate_schem()+".GEN_MENU(NODEID,NODENAME,ISNODE,PARENTID,LINK,STATE)values(?,?,?,?,?,?)" ;
}else{
sql =
"insert into GEN_MENU(NODEID,NODENAME,ISNODE,PARENTID,LINK,STATE)values(?,?,?,?,?,?)" ;
}
Vector parm = new Vector();
id = new Date().getTime()+
""+(int)(Math.random()*99999);
parm.add(id);
parm.add(name);
parm.add(new Boolean(isfloder));
parm.add(parentid);
parm.add(link);
parm.add(new Boolean(true));
try {
queryRunner.update( sql, parm.toArray());
}catch(SQLException e){
e.printStackTrace();
}
}else
id = isexist;
return id;
}
public class IsExist implements ResultSetHandler {
public Object handle(ResultSet rs) throws SQLException {
if(rs.next())
return rs.getObject(
"NODEID");
else
return
"0";
}
}
}
jody

发表文章: 26
注册时间: 2004年04月07日 14:32
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月13日 12:53 回复
to banq

这只是个demo
最初只是方便我使用。牵扯的地方很多。。我没有整理过。。。
其中用到的是 Struts(Velocity DynamicForm action)-spring-hibernate

如果大家觉得这东西有用。。。等我整理过后。。。可以共享给大家使用
banq

发表文章: 9095
注册时间: 2002年08月03日 17:08
给他发消息
Re: banq,你做的软件做的怎末样了 发表: 2004年08月13日 19:28 回复
不错,支持的部件比较多。我在仔细研究中....

建议压缩成rar,用File上传即可。
这个主题有 15 回复 / 2 页 [ 1 2 下一页 ]
???en_US.forumThreadPrev.name??? 上一主题
Go back to the topic listing   返回主题列表    返回页首  返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG: AOP cache DDD EJB 集群 设计模式 Hibernate IOC JiveJdon OO RBAC Spring Struts
查询本论坛内 回复超过的热门帖子
快速发表回复
标题
 
粗体 斜体 下划线 插入图片 插入代码 插入url链接 插入附件
内容
 

解惑之道在J道 ,打造中国最具影响力的的企业软件社区
OpenSource JIVEJDON v3.0 Powered by JdonFramework Code © 2002-08 jdon.com

anti spam