001/**
002 * Copyright 2005-2016 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 */
016package org.kuali.rice.krad.data;
017
018import org.apache.commons.lang.StringUtils;
019
020import java.io.Serializable;
021
022
023/**
024 * PersistenceOption is used when saving through the data object service to configure how the data will be stored.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public class PersistenceOption implements Serializable {
029        private static final long serialVersionUID = 1L;
030
031    /**
032     * Used to link references and synchronize foreign keys in the data object.
033     */
034    public static PersistenceOption LINK_KEYS = new PersistenceOption("org.kuali.rice.krad.data.LINK_KEYS");
035
036    /**
037     * Used to synchronize the data object with the database.
038     */
039    public static PersistenceOption FLUSH = new PersistenceOption("org.kuali.rice.krad.data.FLUSH");
040
041    private final String optionId;
042
043    /**
044    * Sets the option Id
045    *
046    * @param optionId cannot be null or blank.
047    */
048    public PersistenceOption(String optionId) {
049        if (StringUtils.isBlank(optionId)) {
050            throw new IllegalArgumentException("optionId must not be a null or blank value");
051        }
052        this.optionId = optionId;
053    }
054
055    /**
056    * Gets the option id.
057    *
058    * @return not null or blank.
059    */
060    public String getOptionId() {
061        return this.optionId;
062    }
063
064}