ORCentral
|
00001 package eu.coform.database.command; 00002 00003 import eu.coform.Filestatus; 00004 import eu.coform.database.DBException; 00005 import eu.coform.database.Database; 00006 import eu.coform.database.Query; 00007 00011 public class InsertFileStatusCommand implements ResultDatabaseCommand { 00012 00013 Filestatus status = null; 00014 Integer m_result = null; 00015 00016 public InsertFileStatusCommand(Filestatus status){ 00017 this.status = status; 00018 } 00024 @Override 00025 public void exec() throws DBException { 00026 NextIdCommand c = new NextIdCommand("ID", "filestatus"); 00027 c.exec(); 00028 status.setFilestatusID(c.getResult().intValue()); 00029 00030 Query query = Database.getInstance().getNewQuery(); 00031 query.setQuery("INSERT INTO filestatus(ID,Name,URI,Description)VALUES(" + 00032 "'" + status.getFilestatusID() + "', " + 00033 "'" + status.getName() +"',"+ 00034 "'" + status.getUri() +"',"+ 00035 "'" + status.getDescription() +"')"); 00036 Database.getInstance().insert(query); 00037 } 00038 00039 @Override 00040 public Integer getResult() { 00041 return m_result; 00042 } 00043 00044 }