commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Goodwin <mgood...@metalexis.com>
Subject Re: [betwixt] Collection property question
Date Fri, 14 Jan 2005 15:13:21 GMT
Thanks.  It's really weird because the RSS example in the sample code 
works fine and my code is almost identical. 

Matt


Jason Wood wrote:

>I'm afraid I miss understood your original question and am not sure what the
>best approach is.
>
>Sorry
>J
>
>-----Original Message-----
>From: Matt Goodwin [mailto:mgoodwin@metalexis.com]
>Sent: Thursday, January 13, 2005 5:12 PM
>To: Jakarta Commons Users List
>Subject: Re: [betwixt] Collection property question
>
>
>public void testReadBean() {
>        try {
>            File file = new File(FILE1);
>            BeanReader beanReader = new BeanReader();
>            beanReader.registerBeanClass(AgentStatement.class);
>            AgentStatement statement = 
>(AgentStatement)beanReader.parse(file);
>        } catch(Exception e) {
>            fail(e.getMessage());
>        }   
>    }
>
>xml file:
><AgentStatementVO>
>  <StatementDate>2004/10/08</StatementDate>
>  <AgentInfoVO>
>    <FirstName/>
>    <Name>xxxx</Name>
>    <AgentId>xxxx</AgentId>
>    <Address1>xxxx</Address1>
>    <Address2>xxxx</Address2>
>    <City>xxxx</City>
>    <State>xx</State>
>    <Zip>xxxxx</Zip>
>    <AgentType>xxxx</AgentType>
>    <DisbursementSource>xxxx</DisbursementSource>
>  </AgentInfoVO>
>  <AgentStatementLineVO>
>    <AgentNumber>xxxx</AgentNumber>
>    <ProductType>xxxx</ProductType>
>    <FirstName>xxxx</FirstName>
>    <Name>xxxx</Name>
>    <EffectiveDate>2004/10/04</EffectiveDate>
>    <ProcessDate>2004/10/05</ProcessDate>
>    <OwnerName>xxxx</OwnerName>
>    <PolicyNumber>0</PolicyNumber>
>    <InitialPremium>0</InitialPremium>
>    <CommissionRate>0.0</CommissionRate>
>    <CommissionPremium>0</CommissionPremium>
>    <Type>xxxx</Type>
>    <AmountDue>0</AmountDue>
>  </AgentStatementLineVO>
>  <AgentStatementLineVO>
>    <AgentNumber>xxxx</AgentNumber>
>    <ProductType>xxxx</ProductType>
>    <FirstName>xxxx</FirstName>
>    <Name>xxxx</Name>
>    <EffectiveDate>2004/10/04</EffectiveDate>
>    <ProcessDate>2004/10/05</ProcessDate>
>    <OwnerName>xxxx</OwnerName>
>    <PolicyNumber>0</PolicyNumber>
>    <InitialPremium>0</InitialPremium>
>    <CommissionRate>0.0</CommissionRate>
>    <CommissionPremium>0</CommissionPremium>
>    <Type>xxxx</Type>
>    <AmountDue>0</AmountDue>
>  </AgentStatementLineVO>
>  <AgentEarningsVO>
>      <TaxableIncome>0.0</TaxableIncome>
>      <TaxableIncomeYTD>0.0</TaxableIncomeYTD>
>      <PositivePolicyEarnings>0</PositivePolicyEarnings>
>      <NegativePolicyEarnings>0</NegativePolicyEarnings>
>      <NetPolicyEarnings>0</NetPolicyEarnings>
>  </AgentEarningsVO>
></AgentStatementVO>
>
>reads all non-plural elements fine.  when i change AgentStatementLineVO 
>to non-plural (regular getter/setter for the object) it works fine as well.
>
>Thanks,
>
>Matt
>Tim O'Brien wrote:
>
>  
>
>>Could you send the complete code you are using to read with?
>>
>>Tim 
>>
>>
>>-----Original Message-----
>>From: Matt Goodwin [mailto:mgoodwin@metalexis.com]
>>Sent: Thu 1/13/2005 2:58 PM
>>To: Jakarta Commons Users List
>>Subject: Re: [betwixt] Collection property question
>>
>>I have that set.  It appears that my class is not being recognized in 
>>the parse process.  My add method on my class is never called.
>>
>>Matt
>>
>>
>>Jason Wood wrote:
>>
>> 
>>
>>    
>>
>>>I think you want this ...
>>>
>>> IntrospectionConfiguration.setWrapCollectionsInElement(false)
>>>
>>>Jason
>>>
>>>-----Original Message-----
>>>From: Matt Goodwin [mailto:mgoodwin@metalexis.com]
>>>Sent: Thursday, January 13, 2005 11:02 AM
>>>To: Jakarta Commons Users List
>>>Subject: [betwixt] Collection property question
>>>
>>>
>>>I have xml I need to map to my bean.  It is very similar to the 
>>>CustomerBean example, except I am using Collection instead of and array 
>>>of objects (i.e. Order[]).  Here is a sample of the xml, followed by my 
>>>class, followed by my .betwixt file.  The problem I am having is the 
>>>List is always null.  How do you map objects in the .betwixt file if the 
>>>collection has no surrounding element tag (i.e. 
>>><orders></order></order></orders>)?
>>>
>>>Example xml:
>>><AgentStatementVO>
>>><StatementDate>2004/10/08</StatementDate>
>>><AgentInfoVO>...</AgentInfoVO>
>>><AgentStatementLineVO>...</AgentStatementLineVO>
>>><AgentStatementLineVO>...</AgentStatementLineVO>
>>><AgentEarningsVO>...</AgentEarningsVO>
>>></AgentStatementVO>
>>>
>>>Class:
>>>public class AgentStatement implements java.io.Serializable {
>>>  private Date statementDate;
>>>  private AgentInfo agentInfo;
>>>  private Collection agentStatementDetails = new java.util.ArrayList();
>>>  private AgentEarning agentEarning;
>>>  /* .. snip non-relevant getters/setters */
>>>  public Collection getAgentStatementDetails() {
>>>      return agentStatementDetails;
>>>  }
>>>  public void setAgentStatementDetails(Collection agentStatementDetails)
>>>      
>>>
>{
>  
>
>>>      this.agentStatementDetails = agentStatementDetails;
>>>  }
>>>  public void addAgentStatementDetail(AgentStatementDetail 
>>>agentStatementDetail) {
>>>      this.agentStatementDetails.add(agentStatementDetail);
>>>  }
>>>}
>>>
>>>Betwixt file:
>>><?xml version='1.0' ?>
>>><info>
>>><element name='AgentStatementVO'>
>>>    <element name='StatementDate' property='statementDate'/>
>>>    <element name='AgentInfoVO' property='agentInfo'/>
>>>    <element name='AgentStatementLineVO' 
>>>property='agentStatementDetails' 
>>>class='com.equitrust.commissionloader.beans.AgentStatementDetail'/>
>>>    <element name='AgentEarningsVO' property='agentEarning'/>
>>></element>
>>></info>
>>>
>>>Everything except the agentStatementDetails are populated correctly.
>>>
>>>Thanks,
>>>
>>>Matt
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>> 
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>    
>>
>
>  
>

-- 
Matt Goodwin
mgoodwin@metalexis.com
(515)708-0114
Metalexis
"Transcending the Ordinary"


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message