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.data;
17
18 import java.io.Serializable;
19
20 import org.apache.commons.lang.StringUtils;
21
22 /**
23 * PersistenceOption is used when saving through the data object service to configure how the data will be stored.
24 *
25 * @author Kuali Rice Team (rice.collab@kuali.org)
26 */
27 public class PersistenceOption implements Serializable {
28 private static final long serialVersionUID = 1L;
29
30 /**
31 * Used to link references and synchronize foreign keys in the data object.
32 */
33 public static PersistenceOption LINK_KEYS = new PersistenceOption("org.kuali.rice.krad.data.LINK_KEYS");
34
35 /**
36 * Used to synchronize the data object with the database.
37 */
38 public static PersistenceOption FLUSH = new PersistenceOption("org.kuali.rice.krad.data.FLUSH");
39
40 private final String optionId;
41
42 /**
43 * Sets the option Id
44 *
45 * @param optionId cannot be null or blank.
46 */
47 public PersistenceOption(String optionId) {
48 if (StringUtils.isBlank(optionId)) {
49 throw new IllegalArgumentException("optionId must not be a null or blank value");
50 }
51 this.optionId = optionId;
52 }
53
54 /**
55 * Gets the option id.
56 *
57 * @return not null or blank.
58 */
59 public String getOptionId() {
60 return this.optionId;
61 }
62
63 }