<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2004-2014 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/ecl2.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.

-->
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

	<bean id="LeavePayout" parent="LeavePayout-parentBean" />

	<bean id="LeavePayout-parentBean" abstract="true" parent="KPMEHrBusinessObjectParent">
		<property name="businessObjectClass"
			value="org.kuali.kpme.tklm.leave.payout.LeavePayout" />
 		<property name="inquiryDefinition">
			<ref bean="LeavePayout-inquiryDefinition" />
		</property>
		<property name="objectLabel" value="LeavePayout" />
		<property name="lookupDefinition">
			<ref bean="LeavePayout-lookupDefinition" />
		</property>
		<property name="attributes">
			<list merge="true">
				<ref bean="LeavePayout-lmLeavePayoutId" />
				<ref bean="LeavePayout-principalId" />
                <ref bean="LeavePayout-earnCode" />
                <ref bean="LeavePayout-fromAccrualCategory" />
				<ref bean="LeavePayout-payoutAmount"/>
				<ref bean="LeavePayout-forfeitedAmount"/>
				<ref bean="LeavePayout-leaveCalendarDocumentId"/>
				<ref bean="LeavePayout-accrualCategoryRule"/>
			</list>
		</property>
		<property name="relationships">
			<list>
				<bean parent="RelationshipDefinition">
					<property name="objectAttributeName" value="principal" />
					<property name="primitiveAttributes">
						<list>
							<bean parent="PrimitiveAttributeDefinition" p:sourceName="principalId"
								p:targetName="principalId" />
						</list>
					</property>
				</bean>	
				<bean parent="RelationshipDefinition">
					<property name="objectAttributeName" value="earnCodeObj" />
					<property name="primitiveAttributes">
						<list>
							<bean parent="PrimitiveAttributeDefinition" p:sourceName="earnCode"
								p:targetName="earnCode" />
						</list>
					</property>
                    <property name="supportAttributes">
                        <list>
                            <bean parent="SupportAttributeDefinition" p:sourceName="relativeEffectiveDate"
                                  p:targetName="effectiveDate" />
                        </list>
                    </property>
				</bean>
				<bean parent="RelationshipDefinition">
					<property name="objectAttributeName" value="fromAccrualCategoryObj" />
					<property name="primitiveAttributes">
						<list>
							<bean parent="PrimitiveAttributeDefinition" p:sourceName="fromAccrualCategory"
								p:targetName="accrualCategory" />
						</list>
					</property>
                    <property name="supportAttributes">
                        <list>
                            <bean parent="SupportAttributeDefinition" p:sourceName="relativeEffectiveDate"
                                  p:targetName="effectiveDate" />
                        </list>
                    </property>
				</bean>
			</list>
		</property>
	</bean>

	<!-- Attribute Definitions -->
	
	<!--  lmLeavePayoutId -->
	<bean id="LeavePayout-lmLeavePayoutId" parent="LeavePayout-lmLeavePayoutId-parentBean" />
	<bean id="LeavePayout-lmLeavePayoutId-parentBean" abstract="true"
		parent="AttributeDefinition">
		<property name="shortLabel" value="Payout Id"/>
		<property name="maxLength" value="20"/>
		<property name="name" value="lmLeavePayoutId" />
		<property name="control">
			<bean parent="HiddenControlDefinition" />
		</property>
		<property name="label" value="Payout Id" />
	</bean>
	
	<!-- principalId -->
	<bean id="LeavePayout-principalId" parent="LeavePayout-principalId-parentBean" />
	<bean id="LeavePayout-principalId-parentBean" abstract="true" parent="KpmeAttributeReference-principalId" />

    <!-- EarnCode -->
    <bean id="LeavePayout-earnCode" parent="LeavePayout-earnCode-parentBean" />
    <bean id="LeavePayout-earnCode-parentBean" abstract="true" parent="KpmeAttributeReference-earnCode"/>

    <!-- fromAccrualCategory -->
    <bean id="LeavePayout-fromAccrualCategory" parent="LeavePayout-fromAccrualCategory-parentBean" />
    <bean id="LeavePayout-fromAccrualCategory-parentBean" abstract="true"
          parent="AttributeDefinition">
        <property name="shortLabel" value="From Accrual Category" />
        <property name="maxLength" value="15" />
        <property name="validationPattern">
            <bean parent="AnyCharacterValidationPattern">
                <property name="allowWhitespace" value="false" />
            </bean>
        </property>
        <property name="control">
            <bean parent="TextControlDefinition" p:size="10" />
        </property>
        <property name="required" value="true"/>
        <property name="name" value="fromAccrualCategory" />
        <property name="label" value="Payout From Accrual Category" />
    </bean>

    <!-- payoutAmount -->
	<bean id="LeavePayout-payoutAmount" parent="LeavePayout-payoutAmount-parentBean" />
	<bean id="LeavePayout-payoutAmount-parentBean" abstract="true"
		parent="AttributeDefinition">
		<property name="shortLabel" value="Payout Amount" />
		<property name="maxLength" value="20" />
		<property name="validationPattern">
			<bean parent="RegexValidationPattern">
 		   		<property name="pattern" value="((\+|-)?([0-9]{1,9}(\.[0-9]{1,2})?))()"></property>
 		   		<property name="validationErrorMessageKey" value="error.bigDecimal"></property>
 			</bean>
		</property>
		<property name="control">
			<bean parent="TextControlDefinition" p:size="10" />
		</property>
		<property name="required" value="true"/>
		<property name="name" value="payoutAmount" />
		<property name="label" value="Payout Amount" />
	</bean>

	<!-- forfeitedAmount -->
	<bean id="LeavePayout-forfeitedAmount" parent="LeavePayout-forfeitedAmount-parentBean" />
	<bean id="LeavePayout-forfeitedAmount-parentBean" abstract="true"
		parent="AttributeDefinition">
		<property name="shortLabel" value="Forfeited Amount" />
		<property name="maxLength" value="10" />
		<property name="validationPattern">
			<bean parent="FloatingPointValidationPattern" />
		</property>
		<property name="control">
			<bean parent="TextControlDefinition" p:size="10" />
		</property>
		<property name="name" value="forfeitedAmount"/>
		<property name="label" value="Forfeited Amount" />
	</bean>
	
	<!-- accrualCategoryRule -->
	<bean id="LeavePayout-accrualCategoryRule" parent="LeavePayout-accrualCategoryRule-parentBean" />
	<bean id="LeavePayout-accrualCategoryRule-parentBean" abstract="true"
		parent="AttributeDefinition">
		<property name="name" value="accrualCategoryRule" />
		<property name="maxLength" value="10" />
		<property name="control">
			<bean parent="HiddenControlDefinition" />
		</property>
		<property name="label" value="Accrual Category Rule" />
	</bean>
	
	<!-- leaveCalendarDocumentId -->
	<bean id="LeavePayout-leaveCalendarDocumentId" parent="LeavePayout-leaveCalendarDocumentId-parentBean" />
	<bean id="LeavePayout-leaveCalendarDocumentId-parentBean" abstract="true"
		parent="AttributeDefinition">
		<property name="name" value="leaveCalendarDocumentId" />
		<property name="maxLength" value="10" />
		<property name="control">
			<bean parent="HiddenControlDefinition" />
		</property>
		<property name="label" value="Leave Calendar ID" />
	</bean>

	<!--  Inquiry Definitions  -->

	<bean id="LeavePayout-inquiryDefinition" parent="LeavePayout-inquiryDefinition-parentBean" />

	<bean id="LeavePayout-inquiryDefinition-parentBean" abstract="true"
		parent="InquiryDefinition" p:inquirableClass="org.kuali.kpme.tklm.leave.payout.LeavePayoutInquirableImpl">
		<property name="inquirySections">
			<list>
				<bean parent="InquirySectionDefinition">
					<property name="numberOfColumns" value="1" />
					<property name="inquiryFields">
						<list>
                            <bean parent="FieldDefinition" p:attributeName="lmLeavePayoutId"/>
                            <bean parent="FieldDefinition" p:attributeName="principalId"/>
                            <bean parent="FieldDefinition" p:attributeName="earnCode"/>
							<bean parent="FieldDefinition" p:attributeName="effectiveDate" p:noInquiry="true" p:noLookup="true"/>
                            <bean parent="FieldDefinition" p:attributeName="relativeEffectiveDate"
                                  p:noInquiry="true" p:noLookup="true" p:hidden="true" p:defaultValue=" "/>
							<bean parent="FieldDefinition" p:attributeName="fromAccrualCategory"/>
                            <bean parent="FieldDefinition" p:attributeName="userPrincipalId" />
						</list>
					</property>
					<property name="title" value="LeavePayout" />
				</bean>
			</list>
		</property>
		<property name="translateCodes" value="false"/>
		<property name="title" value="Leave Payout Inquiry" />
	</bean>

	<!--  Look up Definitions  -->

	<bean id="LeavePayout-lookupDefinition" parent="LeavePayout-lookupDefinition-parentBean" />
	<bean id="LeavePayout-lookupDefinition-parentBean" abstract="true"
		parent="LookupDefinition">
		<property name="lookupableID" value="leavePayoutLookupable"></property>
		<property name="lookupFields">
			<list>
				<bean parent="FieldDefinition" p:attributeName="principalId" />
				<bean parent="FieldDefinition" p:attributeName="fromAccrualCategory" />
				<bean parent="FieldDefinition" p:attributeName="payoutAmount" />
				<bean parent="FieldDefinition" p:attributeName="earnCode" />
				<bean parent="FieldDefinition" p:attributeName="forfeitedAmount" />
                <bean parent="FieldDefinition" p:attributeName="effectiveDate" p:noInquiry="true" p:noLookup="true"/>
                <bean parent="FieldDefinition" p:attributeName="relativeEffectiveDate"
                      p:noInquiry="true" p:noLookup="true" p:hidden="true" p:defaultValue=" "/>
			</list>

		</property>
		<property name="resultFields">
			<list>
				<bean parent="FieldDefinition" p:attributeName="principalId" />
				<bean parent="FieldDefinition" p:attributeName="earnCode" />
                <bean parent="FieldDefinition" p:attributeName="effectiveDate" p:noInquiry="true" p:noLookup="true"/>
                <bean parent="FieldDefinition" p:attributeName="fromAccrualCategory" />
				<bean parent="FieldDefinition" p:attributeName="payoutAmount"/>
				<bean parent="FieldDefinition" p:attributeName="forfeitedAmount" />
			</list>
		</property>
		<property name="title" value="Leave Payout Lookup" />
	</bean>

</beans>
