/*
 * Copyright 2005-2010 The Kuali Foundation
 * 
 * Licensed under the Educational Community License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.opensource.org/licenses/ecl1.php
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kuali.kra.institutionalproposal.proposallog;

import org.kuali.kra.infrastructure.Constants;
import org.kuali.kra.infrastructure.KraServiceLocator;
import org.kuali.kra.institutionalproposal.InstitutionalProposalConstants;
import org.kuali.rice.kns.service.ParameterService;

/**
 * This class is a set of common convenience methods used by Proposal Log related classes.
 */
public final class ProposalLogUtils {
    
    private ProposalLogUtils() {
        
    }
    
    public static String getProposalLogPendingStatusCode() {
        return getCodeValue("PROPOSAL_LOG_PENDING_STATUS_CODE");
    }
    
    public static String getProposalLogMergedStatusCode() {
        return getCodeValue("PROPOSAL_LOG_MERGED_STATUS_CODE");
    }
    
    public static String getProposalLogSubmittedStatusCode() {
        return "PROPOSAL_LOG_SUBMITTED_STATUS_CODE";
    }
    
    public static String getProposalLogVoidStatusCode() {
        return "PROPOSAL_LOG_VOID_STATUS_CODE";
    }
    
    public static String getProposalLogTemporaryStatusCode() {
        return "PROPOSAL_LOG_TEMPORARY_STATUS_CODE";
    }
    
    public static String getProposalLogPermanentTypeCode() {
        return "PROPOSAL_LOG_PERMANENT_TYPE_CODE";
    }
    
    public static String getProposalLogTemporaryTypeCode() {
        return "PROPOSAL_LOG_TEMPORARY_TYPE_CODE";
    }
    
    private static String getCodeValue(String paramName) {
        return KraServiceLocator.getService(ParameterService.class).getParameterValue(
                InstitutionalProposalConstants.INSTITUTIONAL_PROPOSAL_NAMESPACE, Constants.PARAMETER_COMPONENT_DOCUMENT, paramName);
    }

}

@@ -1482,32 +1482,45 @@
 %0A        return 
+getCodeValue(
 %22PROPOSAL_LOG_SU
@@ -1531,32 +1531,33 @@
 TED_STATUS_CODE%22
+)
 ;%0D%0A    %7D%0D%0A    %0D%0A
@@ -1622,32 +1622,45 @@
 %0A        return 
+getCodeValue(
 %22PROPOSAL_LOG_VO
@@ -1666,32 +1666,33 @@
 OID_STATUS_CODE%22
+)
 ;%0D%0A    %7D%0D%0A    %0D%0A
@@ -1762,32 +1762,45 @@
 %0A        return 
+getCodeValue(
 %22PROPOSAL_LOG_TE
@@ -1815,24 +1815,25 @@
 STATUS_CODE%22
+)
 ;%0D%0A    %7D%0D%0A  
@@ -1905,32 +1905,45 @@
 %0A        return 
+getCodeValue(
 %22PROPOSAL_LOG_PE
@@ -1952,32 +1952,33 @@
 ANENT_TYPE_CODE%22
+)
 ;%0D%0A    %7D%0D%0A    %0D%0A
@@ -2054,16 +2054,29 @@
  return 
+getCodeValue(
 %22PROPOSA
@@ -2101,16 +2101,17 @@
 PE_CODE%22
+)
 ;%0D%0A    %7D

Migrate hardcoded proposal log codes to system params