001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/sam/trunk/component/src/java/org/sakaiproject/tool/assessment/facade/authz/FunctionFacade.java $
003: * $Id: FunctionFacade.java 9273 2006-05-10 22:34:28Z daisyf@stanford.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.tool.assessment.facade.authz;
021:
022: import org.osid.shared.Id;
023: import org.osid.shared.Type;
024: import org.sakaiproject.tool.assessment.data.dao.authz.FunctionData;
025: import org.sakaiproject.tool.assessment.data.ifc.authz.FunctionIfc;
026: import org.sakaiproject.tool.assessment.facade.TypeFacadeQueriesAPI;
027: import org.sakaiproject.tool.assessment.services.PersistenceService;
028:
029: public class FunctionFacade implements FunctionIfc {
030: /**
031: *
032: */
033: private static final long serialVersionUID = 2610431044785097038L;
034: private Id id;
035: private String referenceName;
036: private String description;
037: private Type functionType;
038: private FunctionIfc data;
039: // private String functionId;
040: private long functionId;
041: private String functionTypeId;
042: private String displayName;
043:
044: public FunctionFacade() {
045: this .data = new FunctionData(); //should do a create method later
046: }
047:
048: public FunctionFacade(String referenceName, String displayName,
049: String description, String functionTypeId) {
050: this .data = new FunctionData(); //should do a create method later
051: setReferenceName(referenceName);
052: setDisplayName(displayName);
053: setDescription(description);
054: setFunctionTypeId(functionTypeId);
055: }
056:
057: public FunctionFacade(FunctionIfc data) {
058: this .data = data;
059: this .id = getId();
060: this .referenceName = data.getDisplayName();
061: this .description = data.getDescription();
062: this .functionTypeId = data.getFunctionTypeId();
063: this .functionType = getFunctionType();
064: this .displayName = data.getDisplayName();
065: }
066:
067: public Id getId() {
068: return id;
069: }
070:
071: public String getReferenceName() {
072: return getDisplayName();
073: }
074:
075: public void setReferenceName(String referenceName) {
076: this .referenceName = referenceName;
077: setDisplayName(referenceName);
078: }
079:
080: public Type getFunctionType() {
081: TypeFacadeQueriesAPI typeFacadeQueries = PersistenceService
082: .getInstance().getTypeFacadeQueries();
083: return typeFacadeQueries.getTypeById(new Long(this .data
084: .getFunctionTypeId()));
085: }
086:
087: public String getDescription() {
088: return data.getDescription();
089: }
090:
091: public void updateDescription(String description) {
092: setDescription(description);
093: }
094:
095: public void setDescription(String description) {
096: this .description = description;
097: data.setDescription(description);
098: }
099:
100: public FunctionIfc getData() {
101: return this .data;
102: }
103:
104: // public String getFunctionId()
105: public long getFunctionId() {
106: return data.getFunctionId();
107: }
108:
109: // public void setFunctionId(String id)
110: public void setFunctionId(long id) {
111: this .functionId = id;
112: data.setFunctionId(id);
113: }
114:
115: public String getDisplayName() {
116: return data.getDisplayName();
117: }
118:
119: public void setDisplayName(String displayName) {
120: this .displayName = displayName;
121: data.setDisplayName(displayName);
122: }
123:
124: public String getFunctionTypeId() {
125: return data.getFunctionTypeId();
126: }
127:
128: public void setFunctionTypeId(String id) {
129: this.functionTypeId = id;
130: data.setFunctionTypeId(id);
131: }
132:
133: }
|