001 /*
002 * Copyright 2005-2007 The Kuali Foundation
003 *
004 *
005 * Licensed under the Educational Community License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.opensource.org/licenses/ecl2.php
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.kuali.rice.kew.notes;
018
019 import org.kuali.rice.kew.dto.RouteHeaderDTO;
020 import org.kuali.rice.kew.web.session.UserSession;
021
022
023 /**
024 * Default implementation of the {@link CustomNoteAttribute}.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028 public class CustomNoteAttributeImpl implements CustomNoteAttribute {
029
030 private RouteHeaderDTO routeHeaderVO;
031 private UserSession userSession;
032
033 public CustomNoteAttributeImpl() {}
034
035 public boolean isAuthorizedToAddNotes() throws Exception {
036 return true;
037 }
038
039 /**
040 * By default the individual who authored the note is the only one allowed to edit it.
041 */
042 public boolean isAuthorizedToEditNote(Note note) throws Exception {
043 return note.getNoteAuthorWorkflowId().equalsIgnoreCase(userSession.getPrincipalId());
044 }
045
046 public RouteHeaderDTO getRouteHeaderVO() {
047 return routeHeaderVO;
048 }
049
050 public void setRouteHeaderVO(RouteHeaderDTO routeHeaderVO) {
051 this.routeHeaderVO = routeHeaderVO;
052 }
053
054 public UserSession getUserSession() {
055 return userSession;
056 }
057
058 public void setUserSession(UserSession userSession) {
059 this.userSession = userSession;
060 }
061
062
063 }