1   /*
2    * Copyright 2003 - 2013 The eFaps Team
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   * Revision:        $Rev$
17   * Last Changed:    $Date$
18   * Last Changed By: $Author$
19   */
20  
21  package org.efaps.admin.ui;
22  
23  import java.util.UUID;
24  
25  import org.efaps.ci.CIAdminUserInterface;
26  import org.efaps.util.cache.CacheReloadException;
27  import org.slf4j.Logger;
28  import org.slf4j.LoggerFactory;
29  
30  /**
31   * @author The eFaps Team
32   * @version $Id$ TODO:
33   *          description
34   */
35  public class Table
36      extends AbstractCollection
37      implements Cloneable
38  {
39  
40      /**
41       * Logging instance used in this class.
42       */
43      protected static final Logger LOG = LoggerFactory.getLogger(Table.class);
44  
45      /**
46       * Needed for serialization.
47       */
48      private static final long serialVersionUID = 1L;
49  
50      /**
51       * This is the constructor to set the id and the name.
52       *
53       * @param _id id of the new table
54       * @param _uuid UUID of the new table
55       * @param _name name of the new table
56       */
57      public Table(final Long _id,
58                   final String _uuid,
59                   final String _name)
60      {
61          super(_id, _uuid, _name);
62      }
63  
64      /**
65       * Creates and returns a copy of this table object.
66       *
67       * @return cloned table
68       */
69      public Table cloneTable()
70      {
71          Table ret = null;
72          try {
73              ret = (Table) super.clone();
74          } catch (final CloneNotSupportedException e) {
75              e.printStackTrace();
76          }
77          return ret;
78      }
79  
80      /**
81       * Returns for given parameter <i>_id</i> the instance of class
82       * {@link Table}.
83       *
84       * @param _id id to search in the cache
85       * @return instance of class {@link Table}
86       * @throws CacheReloadException on error
87       */
88      public static Table get(final long _id)
89          throws CacheReloadException
90      {
91          return AbstractUserInterfaceObject.<Table>get(_id, Table.class, CIAdminUserInterface.Table.getType());
92      }
93  
94      /**
95       * Returns for given parameter <i>_name</i> the instance of class
96       * {@link Table}.
97       *
98       * @param _name name to search in the cache
99       * @return instance of class {@link Table}
100      * @throws CacheReloadException on error
101      */
102     public static Table get(final String _name)
103         throws CacheReloadException
104     {
105         return AbstractUserInterfaceObject.<Table>get(_name, Table.class, CIAdminUserInterface.Table.getType());
106     }
107 
108     /**
109      * Returns for given parameter <i>UUID</i> the instance of class
110      * {@link Table}.
111      *
112      * @param _uuid UUID to search in the cache
113      * @return instance of class {@link Table}
114      * @throws CacheReloadException on error
115      */
116     public static Table get(final UUID _uuid)
117         throws CacheReloadException
118     {
119         return AbstractUserInterfaceObject.<Table>get(_uuid, Table.class, CIAdminUserInterface.Table.getType());
120     }
121 }