View Javadoc

1   package olr.om;
2   
3   import java.util.List;
4   
5   import org.apache.log4j.Logger;
6   import org.apache.torque.util.Criteria;
7   
8   /***
9    * The skeleton for this class was autogenerated by Torque on:
10   *
11   * [Wed Jun 16 21:12:50 CEST 2004]
12   *
13   *  You should add additional methods to this class to meet the
14   *  application requirements.  This class will only be generated as
15   *  long as it does not already exist in the output directory.
16   */
17  public class RdfToolbarPeer
18      extends olr.om.BaseRdfToolbarPeer
19  {
20  
21      public static List getAllToolbars(RdfUser user)
22          throws Exception
23      {       
24          try 
25          {   
26              final Criteria criteria = new Criteria();
27              criteria.add(RdfToolbarPeer.USR, user.getId());
28              return RdfToolbarPeer.doSelect(criteria);            
29          }
30          catch(Exception e) 
31          {
32              Logger.getLogger(RdfToolbarPeer.class).error(e);
33              throw e;
34          }
35      }
36  
37      public static void addSchema(RdfUser user, String uri, String title)
38          throws Exception
39      {
40          insert(user, uri, title, true);
41      }
42  
43      private static void insert(RdfUser user, String uri, String title, boolean isSchema)
44          throws Exception
45      {
46          final RdfToolbar toolbar = new RdfToolbar();
47          toolbar.setTitle(title);
48          toolbar.setUri(uri);
49          toolbar.setRdfUser(user);
50          toolbar.setIsSchema(isSchema); 
51          toolbar.save();
52      }
53  
54      public static void addInstanceFile(RdfUser user, String uri, String title)
55          throws Exception
56      {
57          insert(user, uri, title, false);
58      }
59  
60      public static void delete(RdfUser user, String uri)
61          throws Exception
62      {
63          final Criteria criteria = new Criteria();
64          criteria.add(USR, user.getId());
65          criteria.add(URI, uri);
66          doDelete(criteria);
67          /*Connection dbConn = null;
68          try
69          {
70              dbConn = BasicFactory.getConnection();
71              String sql = String.valueOf(String.valueOf((new StringBuffer("DELETE FROM rdf_toolbar WHERE uri='")).append(uri).append("'").append(" AND usr=").append(user.getId())));
72              dbConn.createStatement().executeUpdate(sql);
73          }
74          catch(Exception e)
75          {
76              e.printStackTrace();
77          }
78          BasicFactory.releaseConnection(dbConn);*/
79      }
80  }