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.admin.datamodel.Type;
26 import org.efaps.ci.CIAdminUserInterface;
27 import org.efaps.util.EFapsException;
28 import org.efaps.util.cache.CacheReloadException;
29 import org.slf4j.Logger;
30 import org.slf4j.LoggerFactory;
31
32 /**
33 * @author The eFaps TEam
34 * @version $Id$ TODO:
35 * description
36 */
37 public class Form
38 extends AbstractCollection
39 {
40 /**
41 * Logging instance used in this class.
42 */
43 protected static final Logger LOG = LoggerFactory.getLogger(Form.class);
44
45 /**
46 * Needed for serialization.
47 */
48 private static final long serialVersionUID = 1L;
49
50 /**
51 * @param _id id
52 * @param _uuid UUID
53 * @param _name name
54 */
55 public Form(final Long _id,
56 final String _uuid,
57 final String _name)
58 {
59 super(_id, _uuid, _name);
60 }
61
62 /**
63 * Returns for given parameter <i>_id</i> the instance of class {@link Form}
64 * .
65 *
66 * @param _id id to search in the cache
67 * @return instance of class {@link Form}
68 * @throws CacheReloadException on error
69 */
70 public static Form get(final long _id)
71 throws CacheReloadException
72 {
73 return AbstractUserInterfaceObject.<Form>get(_id, Form.class, CIAdminUserInterface.Form.getType());
74 }
75
76 /**
77 * Returns for given parameter <i>_name</i> the instance of class
78 * {@link Form}.
79 *
80 * @param _name name to search in the cache
81 * @return instance of class {@link Form}
82 * @throws CacheReloadException on error
83 */
84 public static Form get(final String _name)
85 throws CacheReloadException
86 {
87 return AbstractUserInterfaceObject.<Form>get(_name, Form.class, CIAdminUserInterface.Form.getType());
88 }
89
90 /**
91 * Returns for given parameter <i>_uuid</i> the instance of class
92 * {@link Form}.
93 *
94 * @param _uuid UUID to search in the cache
95 * @return instance of class {@link Form}
96 * @throws CacheReloadException on error
97 */
98 public static Form get(final UUID _uuid)
99 throws CacheReloadException
100 {
101 return AbstractUserInterfaceObject.<Form>get(_uuid, Form.class, CIAdminUserInterface.Form.getType());
102 }
103
104 /**
105 * Returns for given type the type form. If no type form is defined for the
106 * type, it is searched if for parent type a menu is defined.
107 *
108 * @param _type type for which the type form is searched
109 * @return type form for given type if found; otherwise <code>null</code>.
110 * @throws EFapsException on error
111 */
112 public static Form getTypeForm(final Type _type)
113 throws EFapsException
114 {
115 return _type.getTypeForm();
116 }
117 }