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.keyvalues; 017 018import org.kuali.rice.core.api.util.ConcreteKeyValue; 019import org.kuali.rice.core.api.util.KeyValue; 020import org.kuali.rice.kew.api.KewApiConstants; 021import org.kuali.rice.krad.document.Document; 022import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase; 023import org.kuali.rice.krad.uif.view.ViewModel; 024import org.kuali.rice.krad.web.form.DocumentFormBase; 025 026import java.util.ArrayList; 027import java.util.List; 028 029public class AdHocActionRequestCodesValuesFinder extends UifKeyValuesFinderBase { 030 private static final long serialVersionUID = 8457876358655872234L; 031 032 /** 033 * @see org.kuali.rice.krad.uif.control.UifKeyValuesFinder#getKeyValues(org.kuali.rice.krad.uif.view.ViewModel) 034 */ 035 @Override 036 public List<KeyValue> getKeyValues(ViewModel model) { 037 DocumentFormBase documentFormBase = (DocumentFormBase) model; 038 Document document = documentFormBase.getDocument(); 039 List<KeyValue> keyValues = new ArrayList<KeyValue>(); 040 keyValues.add(new ConcreteKeyValue(KewApiConstants.ACTION_REQUEST_FYI_REQ, KewApiConstants.ACTION_REQUEST_FYI_REQ_LABEL)); 041 keyValues.add(new ConcreteKeyValue(KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KewApiConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ_LABEL)); 042 keyValues.add(new ConcreteKeyValue(KewApiConstants.ACTION_REQUEST_APPROVE_REQ, KewApiConstants.ACTION_REQUEST_APPROVE_REQ_LABEL)); 043 044 if ((document.getDocumentHeader().getWorkflowDocument().isInitiated() || document.getDocumentHeader().getWorkflowDocument().isSaved())) { 045 keyValues.add(new ConcreteKeyValue(KewApiConstants.ACTION_REQUEST_COMPLETE_REQ, KewApiConstants.ACTION_REQUEST_COMPLETE_REQ_LABEL)); 046 } 047 return keyValues; 048 } 049}