Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/clra/xml/MemberSoapBindingImpl.java


1   /*
2    * Copyright (c) Carnegie Lake Rowing Association 2002. All rights reserved.
3    * Distributed under the GPL license. See doc/COPYING.
4    * $RCSfile: MemberSoapBindingImpl.java,v $
5    * $Date: 2003/03/01 00:48:54 $
6    * $Revision: 1.3 $
7    */
8   
9   package com.clra.xml;
10  
11  import com.clra.member.Address;
12  import com.clra.member.Email;
13  import com.clra.member.MemberDBRead;
14  import com.clra.member.MemberName;
15  import com.clra.member.MemberRole;
16  import com.clra.member.MemberSnapshot;
17  import com.clra.member.Telephone;
18  import com.clra.xml.beans.AddressBean;
19  import com.clra.xml.beans.MemberBean;
20  import com.clra.xml.beans.MemberNameBean;
21  import com.clra.xml.beans.MemberRoleBean;
22  import java.util.Collection;
23  import java.util.Calendar;
24  import java.util.Date;
25  import java.util.Map;
26  import org.apache.log4j.Category;
27  
28  /**
29   * This file was auto-generated from WSDL by the Apache Axis WSDL2Java emitter,
30   * and then modified by hand.
31   * @version $Revision: 1.3 $  ($Date: 2003/03/01 00:48:54 $)
32   * @author <a href="mailto:rphall@pluto.njcc.com">Rick Hall</a>
33   */
34  public class MemberSoapBindingImpl implements com.clra.xml.IMemberXmlRpc{
35  
36      private final static String base = MemberSoapBindingImpl.class.getName();
37      private final static Category theLog = Category.getInstance( base );
38  
39      public com.clra.xml.beans.MemberBean[] findAllMembers()
40        throws java.rmi.RemoteException {
41  
42          MemberSnapshot[] memberSnapshots = new MemberSnapshot[0];
43          try {
44            Collection c = MemberDBRead.findAllMembersByLastName();
45            memberSnapshots =
46                (MemberSnapshot[]) c.toArray( new MemberSnapshot[0] );
47          }
48          catch( Exception x ) {
49            // This is ugly. Should generate a wsdl:fault instead.
50            theLog.error( x );
51          }
52  
53          final int MAX = memberSnapshots.length;
54          MemberBean[] retVal = new MemberBean[ MAX ];
55          for ( int i=0; i<MAX; i++ ) {
56  
57            MemberSnapshot ms = memberSnapshots[i];
58  
59            retVal[i] = new MemberBean();
60  
61            retVal[i].setId( ms.getId() );
62            retVal[i].setAccountName( ms.getAccountName() );
63            retVal[i].setAccountType( ms.getAccountType().toString() );
64  
65            Calendar accountDate = Calendar.getInstance();
66            accountDate.setTime( ms.getAccountDate() );
67            retVal[i].setAccountDate( accountDate );
68  
69            MemberName memberName = ms.getMemberName();
70            MemberNameBean memberNameBean = new MemberNameBean();
71            memberNameBean.setFirstName( memberName.getFirstName() );
72            memberNameBean.setLastName( memberName.getLastName() );
73            memberNameBean.setMiddleName( memberName.getMiddleName() );
74            memberNameBean.setSuffix( memberName.getSuffix() );
75            retVal[i].setMemberNameBean( memberNameBean );
76  
77            Address address = ms.getAddress();
78            AddressBean addressBean = new AddressBean();
79            addressBean.setStreet1( address.getStreet1() );
80            addressBean.setStreet2( address.getStreet2() );
81            addressBean.setCity( address.getCity() );
82            addressBean.setState( address.getState() );
83            addressBean.setZip( address.getZip() );
84            retVal[i].setAddressBean( addressBean );
85  
86            Map phoneNumbers = ms.getTelephoneNumbers();
87            Telephone phone = (Telephone) phoneNumbers.get( Telephone.EVENING );
88            retVal[i].setEveningTelephone( phone.toString() );
89  
90            phone = (Telephone) phoneNumbers.get( Telephone.DAY );
91            if ( phone != null ) {
92              retVal[i].setDayTelephone( phone.toString() );
93            }
94  
95            phone = (Telephone) phoneNumbers.get( Telephone.OTHER );
96            if ( phone != null ) {
97              retVal[i].setOtherTelephone( phone.toString() );
98            }
99  
100           Email email = ms.getEmail();
101           if ( email != null ) {
102             retVal[i].setEmail( email.toString() );
103           }
104 
105           MemberRole[] roles = ms.getMemberRoles();
106           MemberRoleBean[] roleBeans = new MemberRoleBean[ roles.length ];
107           for ( int j=0; j<roleBeans.length; j++ ) {
108             roleBeans[j] = new MemberRoleBean();
109             roleBeans[j].setRole( roles[j].getRole() );
110             roleBeans[j].setRoleGroup( roles[j].getRoleGroup() );
111           }
112           retVal[i].setMemberRoleBeans( roleBeans );
113 
114           Calendar birthDate = Calendar.getInstance();
115           Date d = ms.getBirthDate();
116           if ( d != null ) {
117             birthDate.setTime( ms.getBirthDate() );
118             retVal[i].setBirthDate( birthDate );
119           }
120 
121         } // for
122 
123         return retVal;
124     } // findAllMembers()
125 
126 } // MemberSoapBindingImpl
127 
128 /*
129  * $Log: MemberSoapBindingImpl.java,v $
130  * Revision 1.3  2003/03/01 00:48:54  rphall
131  * Removed import of TelephoneBean
132  *
133  * Revision 1.2  2003/02/28 20:28:45  rphall
134  * XML-related file that is not auto-generated
135  *
136  * Revision 1.1  2003/02/26 20:17:57  rphall
137  * XML-RPC functionality
138  *
139  */
140