001/**
002 * Copyright 2005-2018 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.uif.view;
017
018import org.kuali.rice.krad.datadictionary.parse.BeanTag;
019import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
020import org.kuali.rice.krad.inquiry.InquirableImpl;
021import org.kuali.rice.krad.uif.UifConstants.ViewType;
022
023/**
024 * Type of <code>View</code> that provides a read-only display of a record of
025 * data (object instance)
026 *
027 * <p>
028 * The <code>InquiryView</code> provides the interface for the Inquiry
029 * framework. It works with the <code>Inquirable</code> service and inquiry
030 * controller. The view does render a form to support the configuration of
031 * actions to perform operations on the data.
032 * </p>
033 *
034 * <p>
035 * Inquiry views are primarily configured by the object class they are
036 * associated with. This provides the default dictionary information for the
037 * fields. If more than one inquiry view is needed for the same object class,
038 * the view name can be used to further identify an unique view
039 * </p>
040 *
041 * @author Kuali Rice Team (rice.collab@kuali.org)
042 */
043@BeanTag(name = "inquiryView", parent = "Uif-InquiryView")
044public class InquiryView extends FormView {
045    private static final long serialVersionUID = 716926008488403616L;
046
047    private Class<?> dataObjectClassName;
048
049    public InquiryView() {
050        super();
051
052        setViewTypeName(ViewType.INQUIRY);
053        setApplyDirtyCheck(false);
054        setTranslateCodesOnReadOnlyDisplay(true);
055    }
056
057    /**
058     * The following initialization is performed:
059     *
060     * <ul>
061     * <li>Set the abstractTypeClasses map for the inquiry object path</li>
062     * </ul>
063     *
064     * {@inheritDoc}
065     */
066    @Override
067    public void performInitialization(Object model) {
068        super.performInitialization(model);
069
070        getObjectPathToConcreteClassMapping().put(getDefaultBindingObjectPath(), getDataObjectClassName());
071    }
072
073    /**
074     * Class name for the object the inquiry applies to
075     *
076     * <p>
077     * The object class name is used to pick up a dictionary entry which will
078     * feed the attribute field definitions and other configuration. In addition
079     * it is used to configure the <code>Inquirable</code> which will carry out
080     * the inquiry action
081     * </p>
082     *
083     * @return inquiry object class
084     */
085    @BeanTagAttribute
086    public Class<?> getDataObjectClassName() {
087        return this.dataObjectClassName;
088    }
089
090    /**
091     * Setter for the object class name
092     *
093     * @param dataObjectClassName
094     */
095    public void setDataObjectClassName(Class<?> dataObjectClassName) {
096        this.dataObjectClassName = dataObjectClassName;
097    }
098
099}