001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-api/api/src/java/org/sakaiproject/metaobj/security/Authorization.java $
003: * $Id: Authorization.java 8052 2006-04-20 18:16:21Z ggolden@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.metaobj.security;
021:
022: import org.sakaiproject.metaobj.shared.model.Agent;
023: import org.sakaiproject.metaobj.shared.model.Id;
024:
025: /**
026: * Created by IntelliJ IDEA.
027: * User: jbush
028: * Date: Apr 29, 2004
029: * Time: 4:58:21 PM
030: * To change this template use File | Settings | File Templates.
031: */
032: public class Authorization {
033: private Id id;
034: private Agent agent;
035: private String function;
036: private Id qualifier;
037:
038: public Authorization() {
039: }
040:
041: public Authorization(Agent agent, String function, Id qualifier) {
042: this .agent = agent;
043: this .function = function;
044: this .qualifier = qualifier;
045: }
046:
047: public Id getId() {
048: return id;
049: }
050:
051: public void setId(Id id) {
052: this .id = id;
053: }
054:
055: public Agent getAgent() {
056: return agent;
057: }
058:
059: public String getFunction() {
060: return function;
061: }
062:
063: public Id getQualifier() {
064: return qualifier;
065: }
066:
067: public void setAgent(Agent agent) {
068: this .agent = agent;
069: }
070:
071: public void setFunction(String function) {
072: this .function = function;
073: }
074:
075: public void setQualifier(Id qualifier) {
076: this .qualifier = qualifier;
077: }
078:
079: public boolean equals(Object o) {
080: if (this == o) {
081: return true;
082: }
083: if (!(o instanceof Authorization)) {
084: return false;
085: }
086:
087: final Authorization authorization = (Authorization) o;
088:
089: if (!agent.equals(authorization.agent)) {
090: return false;
091: }
092: if (!function.equals(authorization.function)) {
093: return false;
094: }
095: if (!qualifier.equals(authorization.qualifier)) {
096: return false;
097: }
098:
099: return true;
100: }
101:
102: public int hashCode() {
103: int result;
104: result = agent.hashCode();
105: result = 29 * result + function.hashCode();
106: result = 29 * result + qualifier.hashCode();
107: return result;
108: }
109:
110: }
|