1 /** 2 * Copyright 2005-2013 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.maintenance.MaintenanceDocument; 19 import org.kuali.rice.krad.maintenance.MaintenanceLock; 20 import org.kuali.rice.krad.maintenance.Maintainable; 21 22 import java.util.List; 23 import java.util.Map; 24 25 /** 26 * Provides methods for working with <code>MaintenanceDocument</code>(s) 27 * 28 * @author Kuali Rice Team (rice.collab@kuali.org) 29 */ 30 public interface MaintenanceDocumentService { 31 32 /** 33 * Prepares the <code>MaintenanceDocument</code> on initial request 34 * 35 * <p> 36 * This includes retrieving the data object for edit or copy, clearing 37 * fields 38 * </p> 39 * 40 * @param objectClassName 41 * - class name for the object being maintained 42 * @param docTypeName 43 * - workflow doc type for the maintenance document requested 44 * @param maintenanceAction 45 * - indicates whether this is a new, copy, or edit maintenance 46 * action 47 * @return MaintenanceDocument prepared document instance 48 */ 49 public MaintenanceDocument setupNewMaintenanceDocument( 50 String objectClassName, String docTypeName, String maintenanceAction); 51 52 /** 53 * Called to setup the object being maintained 54 * 55 * <p> 56 * For edit and copy actions, the old record is retrieved and prepared for 57 * editing (in the case of a copy some fields are cleared). In addition some 58 * authorization checks are performed and hooks for custom 59 * <code>Maintainble</code> implementations are invoked. 60 * </p> 61 * 62 * @param document - document instance for the maintenance object 63 * @param maintenanceAction - the requested maintenance action (new, new with existing, 64 * copy, edit) 65 * @param requestParameters - Map of parameters from the request 66 */ 67 public void setupMaintenanceObject(MaintenanceDocument document, String maintenanceAction, 68 Map<String, String[]> requestParameters); 69 70 /** 71 * Attempts to find any other active documents that are pending on the same 72 * maintenance record. 73 * 74 * If any are pending and locked, thereby blocking this document, then the 75 * docHeaderId/documentNumber of the blocking locked document is returned. 76 * 77 * Otherwise, if nothing is blocking, then null is returned. 78 * 79 * @param document 80 * - document to test 81 * @return A String representing the docHeaderId of any blocking document, 82 * or null if none are blocking 83 * 84 */ 85 public String getLockingDocumentId(MaintenanceDocument document); 86 87 /** 88 * Attempts to find any other active documents that are pending on the same 89 * maintenance record. 90 * 91 * If any are pending and locked, thereby blocking this document, then the 92 * docHeaderId/documentNumber of the blocking locked document is returned. 93 * 94 * Otherwise, if nothing is blocking, then null is returned. 95 * 96 * @param maintainable 97 * - maintainable representing the document to test 98 * @param documentNumber 99 * - the documentNumber/docHeaderId of the document to test 100 * @return A String representing the docHeaderId of any blocking document, 101 * or null if none are blocking 102 */ 103 public String getLockingDocumentId(Maintainable maintainable, 104 String documentNumber); 105 106 /** 107 * Call the same-named method in the Dao, since the service has access to 108 * the Dao, but the caller doesn't. 109 * 110 * This method deletes the locks for the given document number. It is called 111 * when the document is final, thus it can be unlocked, or when the locks 112 * need to be regenerated (thus they get cleared first). 113 * 114 * @param documentNumber 115 * - document number whose locks should be deleted 116 */ 117 public void deleteLocks(String documentNumber); 118 119 /** 120 * Call the same-named method in the Dao, since the service has access to 121 * the Dao, but the caller doesn't. 122 * 123 * This method stores the given list of maintenance locks. Typically these 124 * will all be for the same document. 125 * 126 * @param maintenanceLocks 127 * - the list of maintenance locks to be stored 128 */ 129 public void storeLocks(List<MaintenanceLock> maintenanceLocks); 130 131 }