001 /** 002 * Copyright 2005-2012 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.krad.service; 017 018 import org.kuali.rice.krad.bo.Note; 019 import org.kuali.rice.krad.bo.PersistableBusinessObject; 020 021 import java.util.List; 022 023 /** 024 * This service provides various operations related to {@link Note} objects. 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 */ 028 public interface NoteService { 029 030 /** 031 * Retrieves a list of notes that are associated with the given object id. 032 * This object id will generally be the object id of the {@link org.kuali.rice.krad.bo.PersistableBusinessObject} 033 * that the note was attached to when it was created. 034 * 035 * @param remoteObjectId the object id that the notes being searched for are associated with 036 * @return the list of notes which are associated with the given object id. If no such notes are found, an empty list will be returned. 037 */ 038 public List<Note> getByRemoteObjectId(String remoteObjectId); 039 040 /** 041 * Retrieves the note with the given id. 042 * 043 * @param noteId the note id to search by 044 * @return the note with the given note id, or null if no note is found 045 * @throws IllegalArgumentException if the specified id is null 046 */ 047 public Note getNoteByNoteId(Long noteId); 048 049 /** 050 * Saves the given lists of notes. If the given list is null or empty, 051 * this method will do nothing. 052 * 053 * @param notes the list of notes to save 054 * @throws IllegalStateException if any of the notes in the list have an invalid remoteObjectId 055 */ 056 public void saveNoteList(List<Note> notes); 057 058 /** 059 * Saves the specified note. This method returns a reference to the note that was 060 * saved. Callers of this method should reassign their reference to the note 061 * passed in with the one that is returned. 062 * 063 * @param note the note to save 064 * @return the saved note 065 * @throws IllegalArgumentException if the specified note is null 066 * @throws IllegalStateException if the given note's remoteObjectId is not valid 067 */ 068 public Note save(Note note); 069 070 /** 071 * Deletes the specified note. 072 * 073 * @param note the note to delete 074 * @throws IllegalArgumentException if the given note is null 075 */ 076 public void deleteNote(Note note); 077 078 /** 079 * Creates a new note which is a copy of the given note and is associated with 080 * the specified PersistableBusinessObject and Person. 081 * 082 * @param noteToCopy the note to copy 083 * @param bo the business object to associate the Note with 084 * @return a copy of the given note which 085 */ 086 public Note createNote(Note noteToCopy, PersistableBusinessObject bo, String authorPrincipalId); 087 088 }