01: /*
02: * Created by IntelliJ IDEA.
03: * User: sg426575
04: * Date: May 8, 2006
05: * Time: 4:16:57 AM
06: */
07: package com.technoetic.xplanner.upgrade;
08:
09: import java.util.Properties;
10: import java.sql.Statement;
11: import java.sql.SQLException;
12:
13: import net.sf.hibernate.type.Type;
14: import net.sf.hibernate.type.LongType;
15: import org.apache.axis.types.Id;
16: import org.springframework.jdbc.core.StatementCallback;
17: import org.springframework.dao.DataAccessException;
18: import com.tacitknowledge.util.migration.MigrationException;
19:
20: import com.technoetic.xplanner.upgrade.schema.DBSchemaMigrater;
21: import com.technoetic.xplanner.db.hibernate.GlobalSessionFactory;
22: import com.technoetic.xplanner.db.hibernate.HibernateIdentityGenerator;
23: import com.technoetic.xplanner.db.hibernate.HibernateHelper;
24: import com.technoetic.xplanner.db.hibernate.IdGenerator;
25: import com.technoetic.xplanner.soap.XPlanner;
26:
27: public class RemoveIterationDeletionRightsFromEditor extends
28: JdbcMigrationTaskSupport {
29:
30: public RemoveIterationDeletionRightsFromEditor() {
31: super ("Remove iteration deletion rights from editor", 14);
32: }
33:
34: protected void migrate() throws Exception {
35: final int nextId = IdGenerator.getNextPersistentId();
36: IdGenerator.setNextPersistentId(nextId + 1);
37: template.execute(new StatementCallback() {
38: public Object doInStatement(Statement stmt)
39: throws SQLException, DataAccessException {
40: stmt
41: .execute("INSERT INTO permission VALUES("
42: + nextId
43: + ",3,'delete','system.project.iteration',0, 0)");
44:
45: return null;
46: }
47: });
48: }
49:
50: public static void main(String[] args) throws Exception {
51: new RemoveIterationDeletionRightsFromEditor().run();
52: }
53: }
|