1 /** 2 * Copyright 2005-2014 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krad.service; 17 18 import org.kuali.rice.krad.bo.Note; 19 import org.kuali.rice.krad.bo.PersistableBusinessObject; 20 21 import java.util.List; 22 23 /** 24 * This service provides various operations related to {@link Note} objects. 25 * 26 * @author Kuali Rice Team (rice.collab@kuali.org) 27 */ 28 public interface NoteService { 29 30 /** 31 * Retrieves a list of notes that are associated with the given object id. 32 * This object id will generally be the object id of the {@link org.kuali.rice.krad.bo.PersistableBusinessObject} 33 * that the note was attached to when it was created. 34 * 35 * @param remoteObjectId the object id that the notes being searched for are associated with 36 * @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. 37 */ 38 public List<Note> getByRemoteObjectId(String remoteObjectId); 39 40 /** 41 * Retrieves the note with the given id. 42 * 43 * @param noteId the note id to search by 44 * @return the note with the given note id, or null if no note is found 45 * @throws IllegalArgumentException if the specified id is null 46 */ 47 public Note getNoteByNoteId(Long noteId); 48 49 /** 50 * Saves the given lists of notes. If the given list is null or empty, 51 * this method will do nothing. 52 * 53 * @param notes the list of notes to save 54 * @throws IllegalStateException if any of the notes in the list have an invalid remoteObjectId 55 */ 56 public void saveNoteList(List<Note> notes); 57 58 /** 59 * Saves the specified note. This method returns a reference to the note that was 60 * saved. Callers of this method should reassign their reference to the note 61 * passed in with the one that is returned. 62 * 63 * @param note the note to save 64 * @return the saved note 65 * @throws IllegalArgumentException if the specified note is null 66 * @throws IllegalStateException if the given note's remoteObjectId is not valid 67 */ 68 public Note save(Note note); 69 70 /** 71 * Deletes the specified note. 72 * 73 * @param note the note to delete 74 * @throws IllegalArgumentException if the given note is null 75 */ 76 public void deleteNote(Note note); 77 78 /** 79 * Creates a new note which is a copy of the given note and is associated with 80 * the specified PersistableBusinessObject and Person. 81 * 82 * @param noteToCopy the note to copy 83 * @param bo the business object to associate the Note with 84 * @return a copy of the given note which 85 */ 86 public Note createNote(Note noteToCopy, PersistableBusinessObject bo, String authorPrincipalId); 87 88 }