KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > engines > JahiaEngineTools


1 /*
2  * ____.
3  * __/\ ______| |__/\. _______
4  * __ .____| | \ | +----+ \
5  * _______| /--| | | - \ _ | : - \_________
6  * \\______: :---| : : | : | \________>
7  * |__\---\_____________:______: :____|____:_____\
8  * /_____|
9  *
10  * . . . i n j a h i a w e t r u s t . . .
11  *
12  *
13  *
14  * ----- BEGIN LICENSE BLOCK -----
15  * Version: JCSL 1.0
16  *
17  * The contents of this file are subject to the Jahia Community Source License
18  * 1.0 or later (the "License"); you may not use this file except in
19  * compliance with the License. You may obtain a copy of the License at
20  * http://www.jahia.org/license
21  *
22  * Software distributed under the License is distributed on an "AS IS" basis,
23  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
24  * for the rights, obligations and limitations governing use of the contents
25  * of the file. The Original and Upgraded Code is the Jahia CMS and Portal
26  * Server. The developer of the Original and Upgraded Code is JAHIA Ltd. JAHIA
27  * Ltd. owns the copyrights in the portions it created. All Rights Reserved.
28  *
29  * The Shared Modifications are Jahia View Helper.
30  *
31  * The Developer of the Shared Modifications is Jahia Solution S�rl.
32  * Portions created by the Initial Developer are Copyright (C) 2002 by the
33  * Initial Developer. All Rights Reserved.
34  *
35  * Contributor(s):
36  * 13-Aug-2003, Jahia Solutions Sarl: Fulco Houkes
37  *
38  * ----- END LICENSE BLOCK -----
39  */

40
41
42 package org.jahia.engines;
43
44 import java.util.HashMap JavaDoc;
45
46 import org.jahia.exceptions.JahiaException;
47 import org.jahia.services.acl.ACLNotFoundException;
48 import org.jahia.services.acl.JahiaBaseACL;
49
50
51 /**
52  * @author Khue Nguyen
53  */

54
55 public class JahiaEngineTools {
56
57     /** logging */
58     private static final org.apache.log4j.Logger logger =
59             org.apache.log4j.Logger.getLogger (JahiaEngineTools.class);
60
61
62     //--------------------------------------------------------------------------
63
// @author Khue Nguyen
64
/**
65      * Return the container list field Acl object for a given field
66      *
67      * @param aclsMap the key is the fieldID and the value is the aclID
68      * @param fieldID the field identification number
69      *
70      * @return the acl reference, or <code>null</code> if not found
71      */

72     public static JahiaBaseACL getCtnListFieldACL (HashMap JavaDoc aclsMap, int fieldID) {
73         if (aclsMap == null)
74             return null;
75         Integer JavaDoc I = (Integer JavaDoc) aclsMap.get (new Integer JavaDoc (fieldID));
76         if (I != null) {
77             try {
78                 int aclID = I.intValue ();
79                 logger.debug ("Looking for acl [" + aclID + "]");
80                 JahiaBaseACL theACL = null;
81                 try {
82                     theACL = new JahiaBaseACL (aclID);
83
84                 } catch (ACLNotFoundException ex) {
85                     logger.warn (ex);
86
87                 } catch (JahiaException ex) {
88                     logger.warn (ex);
89                 }
90                 return theACL;
91             } catch (Throwable JavaDoc t) {
92                 t.printStackTrace ();
93             }
94         }
95         return null;
96     }
97
98 }
99
100
Popular Tags