1 /**
2 * Copyright 2005-2015 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.BusinessObject;
19 import org.kuali.rice.krad.datadictionary.InactivationBlockingMetadata;
20
21 import java.util.Collection;
22
23 /**
24 * This service detects whether there are any records that block the inactivation of a particular record
25 *
26 * @author Kuali Rice Team (rice.collab@kuali.org)
27 */
28 public interface InactivationBlockingDetectionService {
29
30 /**
31 * Determines whether there is ANY record in the relationship defined by the inactivationBlockingMetadata that prevents inactivation of blockedBo
32 *
33 * @param blockedBo a BO that is potentially inactivation blocked
34 * @param inactivationBlockingMetadata
35 * @return true iff there was a record that blocks the blockedBo using the metadata in inactivationBlockingMetadata
36 *
37 * @deprecated use {@link #detectBlockingRecord(Object, org.kuali.rice.krad.datadictionary.InactivationBlockingMetadata)}
38 */
39 @Deprecated
40 boolean hasABlockingRecord(BusinessObject blockedBo, InactivationBlockingMetadata inactivationBlockingMetadata);
41
42 /**
43 * Detects if there is ANY record in the relationship defined in the given metadata that prevents inactivation of
44 * the given data object.
45 *
46 * @param dataObject data object to check for inactivation blocking
47 * @param inactivationBlockingMetadata metadata to use for the inactivation blocking check
48 * @return true if there is any record which would block inactivation of the given data object, false otherwise
49 *
50 * @throws IllegalArgumentException if either dataObject or inactivationBlockingMetadata is null
51 */
52 boolean detectBlockingRecord(Object dataObject, InactivationBlockingMetadata inactivationBlockingMetadata);
53
54 /**
55 * Lists all records in the relationship defined by the inactivationBlockingMetadata that prevents inactivation of blockedBo
56 *
57 * @param blockedBo a BO that is potentially inactivation blocked
58 * @param inactivationBlockingMetadata
59 * @return true iff there was a record that blocks the blockedBo using the metadata in inactivationBlockingMetadata
60 *
61 * @deprecated use {@link #detectAllBlockingRecords(Object, org.kuali.rice.krad.datadictionary.InactivationBlockingMetadata)}
62 */
63 @Deprecated
64 Collection<BusinessObject> listAllBlockerRecords(BusinessObject blockedBo, InactivationBlockingMetadata inactivationBlockingMetadata);
65
66 /**
67 * Detects all records in the relationship defined in the given metadata that prevents inactivation of the given
68 * data object.
69 *
70 * @param dataObject data object to check for inactivation blocking
71 * @param inactivationBlockingMetadata metadata to use for the inactivation blocking check
72 * @return an immutable list of records which are blocking inactivation of the given data object
73 *
74 * @throws IllegalArgumentException if either dataObject or inactivationBlockingMetadata is null
75 */
76 Collection<?> detectAllBlockingRecords(Object dataObject, InactivationBlockingMetadata inactivationBlockingMetadata);
77 }