001: /*
002: * Copyright (c) JForum Team
003: * All rights reserved.
004: *
005: * Redistribution and use in source and binary forms,
006: * with or without modification, are permitted provided
007: * that the following conditions are met:
008: *
009: * 1) Redistributions of source code must retain the above
010: * copyright notice, this list of conditions and the
011: * following disclaimer.
012: * 2) Redistributions in binary form must reproduce the
013: * above copyright notice, this list of conditions and
014: * the following disclaimer in the documentation and/or
015: * other materials provided with the distribution.
016: * 3) Neither the name of "Rafael Steil" nor
017: * the names of its contributors may be used to endorse
018: * or promote products derived from this software without
019: * specific prior written permission.
020: *
021: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
022: * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
023: * EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
024: * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
025: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR
026: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
027: * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
028: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
029: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES
030: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
031: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
032: * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
033: * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
034: * IN CONTRACT, STRICT LIABILITY, OR TORT
035: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
036: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
037: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
038: *
039: * This file creation date: 21/09/2003 / 16:39:49
040: * The JForum Project
041: * http://www.jforum.net
042: */
043: package net.jforum.security;
044:
045: import java.util.List;
046:
047: /**
048: * Guarda os itens e os dados de um determinado campo de permissao.
049: * No formulario de edicao das permissoes de acesso de algum grupo ou usuario,
050: * esta classe encapsula o nome, id e os itens do campo de permissao.
051: *
052: * @author Rafael Steil
053: * @version $Id: PermissionItem.java,v 1.7 2006/08/20 22:47:34 rafaelsteil Exp $
054: */
055: public class PermissionItem {
056: /**
057: * Nome da permissao
058: * */
059: private String name;
060:
061: /**
062: * ID da permissao
063: * */
064: private String id;
065:
066: /**
067: * Tipo ( Campo se multipla escolha ou unica )
068: * */
069: private String type;
070:
071: /**
072: * Itens do campo ( id=valor)
073: * */
074: private List data;
075:
076: public static final int SINGLE = 1;
077: public static final int MULTIPLE = 2;
078:
079: /**
080: * Cria um novo objeto.
081: *
082: * @param name Nome da permissao
083: * @param id ID da permissao
084: * @param type Tipo da permissao. <code>SINGLE</code> ou <code>MULTIPLE</code>
085: * @param data ArrayList com itens do campo ( contendo objetos do tipo <code>FormSelectedData</code>
086: * */
087: public PermissionItem(String name, String id, String type, List data) {
088: this .name = name;
089: this .id = id;
090: this .type = type;
091: this .data = data;
092: }
093:
094: /**
095: * Pega o nome da permissao.
096: *
097: * @reutrn String contendo o nome da permissao
098: * */
099: public String getName() {
100: return this .name;
101: }
102:
103: /**
104: * Pega o ID da permisao.
105: *
106: * @return String contendo o ID da permissao
107: * */
108: public String getId() {
109: return this .id;
110: }
111:
112: /**
113: * Pega o tipo de permissao.
114: *
115: * @return int contendo o tipo. Para campo de unica escolha,
116: * retorna o valor de <code>SINGLE</code>, e <code>MULTIPLE</code>
117: * se o campo for de multipla escolha
118: * */
119: public String getType() {
120: return this .type;
121: }
122:
123: /**
124: * Pega os itens do campo.
125: *
126: * @param ArrayList contendo os itens da permissao. Cada posicao
127: * do ArrayList eh um objeto do tipo <code>FormSelectedData</code>
128: * */
129: public List getData() {
130: return this.data;
131: }
132: }
|