KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > webapps > fichotheque > AccessRight


1 package org.jahia.webapps.fichotheque;
2
3 import java.util.*;
4 import java.sql.*;
5
6 import org.jahia.tools.*;
7 import org.jahia.tools.db.*;
8
9
10 /**
11  * Represents a card given its id, the specific table name, a vector with the fields values and a vector with the fields names
12  *
13  * @author Yann Gentil <a HREF="mailto:gentil@xo3.com">gentil@xo3.com</a>
14  * @version %I%, %G%
15  */

16
17 public class AccessRight
18 {
19
20   /** The id of right **/
21   private int rightId;
22   /** The name of the card library **/
23   private String JavaDoc cardLibraryName;
24
25   /** The names of the card's fields **/
26
27   private String JavaDoc right = null;
28   private String JavaDoc firstName = null;
29   int userId;
30 // private String user = null;
31
// private String absenceType = null;
32
// private String status = null;
33

34   /**
35    * Create new rights
36    */

37   public AccessRight() {
38   }
39
40   /**
41    * Create new rights with id and fields
42    *
43    * @param id the id of the right
44    * @param fields a vector that contains the values of the fields
45    * @param fieldsName a vector that contains the names of the fields
46    */

47   public AccessRight(int id, String JavaDoc right, int userId, String JavaDoc cardlib) {
48     this.rightId = id;
49     this.right = right;
50     this.cardLibraryName = cardlib;
51     this.userId = userId;
52   }
53
54   /**
55    * Method filter
56    * Filter special caracters
57    *
58    * @param input String to filter
59    * @return a filtered string
60    */

61   public static String JavaDoc filter(String JavaDoc input) {
62     StringBuffer JavaDoc filtered = new StringBuffer JavaDoc(input.length());
63     char c;
64
65     for (int i = 0; i < input.length(); i++) {
66       c = input.charAt(i);
67       if (c == '\'') {
68         filtered.append("&#39;");
69       }
70       else if (c == '"') {
71         filtered.append("&#34;");
72       }
73       else {
74         filtered.append(c);
75       }
76     }
77     return (filtered.toString());
78   }
79   public String JavaDoc getCardLibraryName() {
80     return cardLibraryName;
81   }
82   public void setCardLibraryName(String JavaDoc cardLibraryName) {
83     this.cardLibraryName = cardLibraryName;
84   }
85   public String JavaDoc getRight() {
86     return right;
87   }
88   public void setRight(String JavaDoc right) {
89     this.right = right;
90   }
91   public int getRightId() {
92     return rightId;
93   }
94   public void setRightId(int rightId) {
95     this.rightId = rightId;
96   }
97   public int getUserId() {
98     return userId;
99   }
100   public void setUserId(int userId) {
101     this.userId = userId;
102   }
103 }
104
105
106
107
108
Popular Tags