Coverage details for base.user.User

LineHitsSource
1 /*******************************************************************************
2  * InternetCafe is a software solution that helps the management of Cybercafes
3  * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005.
4  * Copyright (C) 2006 Guido Angelo Ingenito
5  
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *******************************************************************************/
20 package base.user;
21  
22 import java.io.UnsupportedEncodingException;
23 import java.security.MessageDigest;
24 import java.security.NoSuchAlgorithmException;
25 import java.util.Date;
26 import java.util.HashSet;
27 import java.util.Iterator;
28 import java.util.Observable;
29  
30 import org.apache.log4j.Logger;
31 import org.w3c.dom.Document;
32 import org.w3c.dom.Element;
33 import org.w3c.dom.Node;
34  
35 import base.ICXmlTags;
36 import base.IXMLLoadable;
37 import base.IXMLSaveable;
38  
390public class User extends Observable implements IXMLSaveable, IXMLLoadable {
40  
410    private static final transient Logger logger = Logger.getLogger(User.class
420            .getName());
43  
44     private int id;
45  
460    private String name = "";
47  
480    private String surname = "";
49  
500    private base.user.Document document = new base.user.Document();;
51  
520    private String imagePath = null;
53  
540    private String credential = UserCredential.USER_CREDENTIAL[0];
55  
560    private String nickname = "";
57  
580    private String password = "";
59  
600    private Date birthday = new Date();
61  
620    public Date creationDate = new Date();
63  
640    private String gender = UserGender.USER_GENDER[0];
65  
660    private HashSet<NAddress> nAddress = new HashSet<NAddress>();
67  
680    private HashSet<EAddress> eAddress = new HashSet<EAddress>();
69  
700    private HashSet<PhoneNumber> phoneNumber = new HashSet<PhoneNumber>();
71  
720    private int currentNAddressId = 0;
73  
740    private int currentEAddressId = 0;
75  
760    private int currentPhoneNumberId = 0;
77  
78     /**
79      * @param id
80      * The user's id.
81      * @param name
82      * The user's name.
83      * @param surname
84      * The user's surname.
85      * @param gender
86      * The user's gender.
87      * @param birthday
88      * The user's birthday.
89      * @param nickname
90      * The user's nickname.
91      * @param password
92      * The user's password.
93      * @param credential
94      * The user's id.
95      * @param document
96      * The user's document.
97      */
980    protected User(final int id, String name, String surname, String gender,
99             Date birthday, String nickname, String password, String credential,
1000            base.user.Document document) {
1010        this.id = id;
1020        this.name = name;
1030        this.surname = surname;
1040        this.gender = gender;
1050        this.birthday = birthday;
1060        this.nickname = nickname;
1070        this.password = password;
1080        this.credential = credential;
1090        this.document = document;
1100        this.currentNAddressId = retrieveMaxNAddressId();
1110        this.currentEAddressId = retrieveMaxEAddressId();
1120        this.currentPhoneNumberId = retrieveMaxPhoneNumberId();
1130    }
114  
1150    protected User(int id) {
1160        this.id = id;
117         // TODO Auto-generated constructor stub
1180    }
119  
120     /**
121      * @return Returns the imagePath.
122      */
123     public String getImagePath() {
1240        return imagePath;
125     }
126  
127     /**
128      * @param imagePath
129      * The imagePath to set.
130      */
131     public void setImagePath(String imagePath) {
1320        this.imagePath = imagePath;
1330    }
134  
135     /**
136      * @return Returns the password.
137      */
138     public String getPassword() {
1390        return password;
140     }
141  
142     /**
143      * @param password
144      * The password to set.
145      */
146     public void setPassword(String password) {
1470        if (!this.getPassword().equals(password)) {
148             // Assuming that password is modified, we must rebuild it.
1490            this.password = buildUserPassword(password);
1500        } else
1510            this.password = password;
1520    }
153  
154     /**
155      * @param birthday
156      * The birthday to set.
157      */
158     public void setBirthday(Date birthday) {
1590        this.birthday = birthday;
1600    }
161  
162     /**
163      * @param credential
164      * The credential to set.
165      */
166     public void setCredential(String credential) {
1670        this.credential = credential;
1680    }
169  
170     /**
171      * @param document
172      * The document to set.
173      */
174     public void setDocument(base.user.Document document) {
1750        this.document = document;
1760    }
177  
178     /**
179      * @param name
180      * The name to set.
181      */
182     public void setName(String name) {
1830        this.name = name;
1840    }
185  
186     /**
187      * @param nickname
188      * The nickname to set.
189      */
190     public void setNickname(String nickname) {
1910        this.nickname = nickname;
1920    }
193  
194     /**
195      * @param surname
196      * The surname to set.
197      */
198     public void setSurname(String surname) {
1990        this.surname = surname;
2000    }
201  
202     /**
203      * @return Returns the document.
204      */
205     public base.user.Document getDocument() {
2060        return document;
207     }
208  
209     /**
210      * @return Returns the name.
211      */
212     public String getName() {
2130        return name;
214     }
215  
216     /**
217      * @return Returns the nickname.
218      */
219     public String getNickname() {
2200        return nickname;
221     }
222  
223     /**
224      * @return Returns the surname.
225      */
226     public String getSurname() {
2270        return surname;
228     }
229  
230     /**
231      * @return Returns the credential.
232      */
233     public String getCredential() {
2340        return credential;
235     }
236  
237     /*
238      * (non-Javadoc)
239      *
240      * @see java.lang.Object#toString()
241      */
242     @Override
243     public String toString() {
2440        StringBuffer sb = new StringBuffer();
2450        sb.append("USER");
2460        sb.append("\n");
2470        sb.append("id: " + id);
2480        sb.append("\n");
2490        sb.append("name: " + name);
2500        sb.append("\n");
2510        sb.append("surname: " + surname);
2520        sb.append("\n");
2530        sb.append("gender: " + gender);
2540        sb.append("\n");
2550        sb.append("birthday: " + birthday);
2560        sb.append("\n");
2570        sb.append("document: \n" + document);
2580        sb.append("\n");
2590        sb.append("nAddress: \n");
260  
2610        Iterator iterator = nAddress.iterator();
2620        while (iterator.hasNext())
2630            sb.append(iterator.next() + "\n");
2640        sb.append("eAddress: \n");
265  
2660        iterator = eAddress.iterator();
2670        while (iterator.hasNext())
2680            sb.append(iterator.next() + "\n");
2690        sb.append("phoneNumber: \n");
270  
2710        iterator = phoneNumber.iterator();
2720        while (iterator.hasNext())
2730            sb.append(iterator.next() + "\n");
274  
2750        sb.append("image: " + imagePath);
2760        sb.append("\n");
2770        sb.append("credential: " + credential);
2780        sb.append("\n");
2790        sb.append("nickname: " + nickname);
2800        sb.append("\n");
2810        sb.append("password: " + password);
2820        return sb.toString();
283     }
284  
285     /**
286      * @return Returns the birthday.
287      */
288     public Date getBirthday() {
2890        return birthday;
290     }
291  
292     /**
293      * @return Returns the id.
294      */
295     public int getId() {
2960        return id;
297     }
298  
299     /**
300      * @return Returns the gender.
301      */
302     public String getGender() {
3030        return gender;
304     }
305  
306     /**
307      * @param gender
308      * The gender to set.
309      */
310     public void setGender(String gender) {
3110        this.gender = gender;
3120    }
313  
314     /**
315      * @return Returns the creationDate.
316      */
317     public Date getCreationDate() {
3180        return creationDate;
319     }
320  
321     /**
322      * @param password
323      * The User's password.
324      * @return Returns an MD5 digest of the user's password.
325      */
326     public static String buildUserPassword(String password) {
3270        String result = "";
328         MessageDigest md;
329         try {
3300            md = MessageDigest.getInstance("MD5");
3310            md.update(password.getBytes("UTF8"));
3320            byte[] hash = md.digest();
3330            for (int i = 0; i < hash.length; i++) {
3340                int hexValue = hash[i] & 0xFF;
3350                if (hexValue < 16) {
3360                    result = result + "0";
337                 }
3380                result = result + Integer.toString(hexValue, 16);
339             }
3400            logger.debug("Users'password MD5 Digest: " + result);
3410        } catch (NoSuchAlgorithmException ex) {
342             // TODO Auto-generated catch block
3430            logger.error(ex.getMessage());
3440            ex.printStackTrace();
3450        } catch (UnsupportedEncodingException ex) {
3460            logger.error(ex.getMessage());
3470            ex.printStackTrace();
3480        }
3490        return result;
350     }
351  
352     /**
353      * @return Returns the eAddress.
354      */
355     public EAddress[] getEAddress() {
3560        if (eAddress == null) {
3570            eAddress = new HashSet<EAddress>();
358         }
3590        return eAddress.toArray(new EAddress[0]);
360     }
361  
362     /**
363      * @return Returns the nAddress.
364      */
365     public NAddress[] getNAddress() {
3660        if (nAddress == null) {
3670            nAddress = new HashSet<NAddress>();
368         }
3690        return nAddress.toArray(new NAddress[0]);
370     }
371  
372     /**
373      * @return Returns the phoneNumber.
374      */
375     public PhoneNumber[] getPhoneNumber() {
3760        if (phoneNumber == null) {
3770            phoneNumber = new HashSet<PhoneNumber>();
378         }
3790        return phoneNumber.toArray(new PhoneNumber[0]);
380     }
381  
382     public void addEAddress(EAddress eAddress) {
3830        eAddress.setId(getNextEAddressId());
3840        this.eAddress.add(eAddress);
3850    }
386  
387     public void addNAddress(NAddress nAddress) {
3880        nAddress.setId(getNextNAddressId());
3890        this.nAddress.add(nAddress);
3900    }
391  
392     public void addPhoneNumber(PhoneNumber phoneNumber) {
3930        phoneNumber.setId(getNextPhoneNumberId());
3940        this.phoneNumber.add(phoneNumber);
3950    }
396  
397     private int getNextNAddressId() {
3980        return ++currentNAddressId;
399     }
400  
401     private int getNextEAddressId() {
4020        return ++currentEAddressId;
403     }
404  
405     private int getNextPhoneNumberId() {
4060        return ++currentPhoneNumberId;
407     }
408  
409     private int retrieveMaxNAddressId() {
4100        int max = -1; // This is an invalid value...
4110        NAddress[] address = getNAddress();
4120        for (int i = 0; i < address.length; i++)
4130            if (address[i].getId() > max)
4140                max = address[i].getId();
4150        return max;
416     }
417  
418     private int retrieveMaxEAddressId() {
4190        int max = -1; // This is an invalid value...
4200        EAddress[] address = getEAddress();
4210        for (int i = 0; i < address.length; i++)
4220            if (address[i].getId() > max)
4230                max = address[i].getId();
4240        return max;
425     }
426  
427     private int retrieveMaxPhoneNumberId() {
4280        int max = -1; // This is an invalid value...
4290        PhoneNumber[] phoneNumber = getPhoneNumber();
4300        for (int i = 0; i < phoneNumber.length; i++)
4310            if (phoneNumber[i].getId() > max)
4320                max = phoneNumber[i].getId();
4330        return max;
434     }
435  
436     public NAddress newNAddress(String city, String nation, String street,
437             String region, String postalCode, String description) {
4380        return new NAddress(0, city, nation, street, region, postalCode,
4390                description);
440     }
441  
442     public EAddress newEAddress(String eAddress) {
4430        return new EAddress(0, eAddress);
444     }
445  
446     public PhoneNumber newPhoneNumber(String areaCode, String exchange,
447             String number, String description) {
4480        return new PhoneNumber(0, areaCode, exchange, number, description);
449     }
450  
451     /**
452      * @param addressId
453      * The id associated to the NAddress
454      * @return The NAddress whose id is addressId, null if such nAddressId is
455      * not contained in the user's nAddress set.
456      *
457      */
458     public NAddress getNAddressById(int addressId) {
4590        NAddress[] address = getNAddress();
4600        for (int i = 0; i < address.length; i++)
4610            if (address[i].getId() == addressId)
4620                return address[i];
4630        return null;
464     }
465  
466     /**
467      * @param addressId
468      * The id associated to an EAddress.
469      * @return The EAddress whose id is addressId, null if such eAddressId is
470      * not contained in the user's eAddress set.
471      */
472     public EAddress getEAddressById(int addressId) {
4730        EAddress[] address = getEAddress();
4740        for (int i = 0; i < address.length; i++)
4750            if (address[i].getId() == addressId)
4760                return address[i];
4770        return null;
478     }
479  
480     /**
481      * @param phoneNumberId
482      * The id associated to a PhoneNumber.
483      * @return The PhoneNumber whose id is phoneNumberId, null if such
484      * phoneNumberId is not contained in the user's phoneNumber set.
485      */
486     public PhoneNumber getPhoneNumberById(int phoneNumberId) {
4870        PhoneNumber[] phoneNumber = getPhoneNumber();
4880        for (int i = 0; i < phoneNumber.length; i++)
4890            if (phoneNumber[i].getId() == phoneNumberId)
4900                return phoneNumber[i];
4910        return null;
492     }
493  
494     /**
495      * @param nAddress
496      * Deletes the nAddress form the user's nAddress set.
497      */
498     public void deleteNAddress(NAddress nAddress) {
4990        this.nAddress.remove(nAddress);
5000    }
501  
502     /**
503      * @param eAddress
504      * Deletes the eAddress from the user's eAddress set.
505      */
506     public void deleteEAddress(EAddress eAddress) {
5070        this.eAddress.remove(eAddress);
508  
5090    }
510  
511     /**
512      * @param phoneNumber
513      * Deletes the phoneNumber from the user's phoneNumber set.
514      */
515     public void deletePhoneNumber(PhoneNumber phoneNumber) {
5160        this.phoneNumber.remove(phoneNumber);
517  
5180    }
519  
520     public Node toXml(Document document) {
5210        Element userElement = document.createElement(ICXmlTags.IC_USER_TAG);
5220        userElement.setAttribute(ICXmlTags.IC_USER_ID_ATTRIBUTE, "" + this.id);
5230        userElement.setAttribute(
5240                ICXmlTags.IC_USER_CURRENT_NADDRESS_ID_ATTRIBUTE, ""
5250                        + this.currentNAddressId);
5260        userElement.setAttribute(
5270                ICXmlTags.IC_USER_CURRENT_EADDRESS_ID_ATTRIBUTE, ""
5280                        + this.currentEAddressId);
5290        userElement.setAttribute(
5300                ICXmlTags.IC_USER_CURRENT_PHONE_NUMBER_ID_ATTRIBUTE, ""
5310                        + this.currentPhoneNumberId);
532  
5330        Element nameElement = document
5340                .createElement(ICXmlTags.IC_USER_NAME_TAG);
5350        nameElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE, this.name);
5360        userElement.appendChild(nameElement);
537  
5380        Element surnameElement = document
5390                .createElement(ICXmlTags.IC_USER_SURNAME_TAG);
5400        surnameElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE, this.surname);
5410        userElement.appendChild(surnameElement);
542  
5430        Element genderElement = document
5440                .createElement(ICXmlTags.IC_USER_GENDER_TAG);
5450        genderElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE, this.gender);
5460        userElement.appendChild(genderElement);
547  
5480        Element credentialElement = document
5490                .createElement(ICXmlTags.IC_USER_CREDENTIAL_TAG);
5500        credentialElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE,
5510                this.credential);
5520        userElement.appendChild(credentialElement);
553  
5540        Element nicknameElement = document
5550                .createElement(ICXmlTags.IC_USER_NICKNAME_TAG);
5560        nicknameElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE,
5570                this.nickname);
5580        userElement.appendChild(nicknameElement);
559  
5600        Element passwordElement = document
5610                .createElement(ICXmlTags.IC_USER_PASSWORD_TAG);
5620        passwordElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE,
5630                this.password);
5640        userElement.appendChild(passwordElement);
5650 
5660        Element imagePathElement = document
5670                .createElement(ICXmlTags.IC_USER_IMAGE_PATH_TAG);
5680        imagePathElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE,
5690                this.imagePath);
5700        userElement.appendChild(imagePathElement);
5710 
5720        Element birthdayElement = document
5730                .createElement(ICXmlTags.IC_USER_BIRTHDAY_TAG);
5740        birthdayElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE,
5750                this.birthday.toString());
5760        birthdayElement.setAttribute(ICXmlTags.IC_LONG_VALUE_ATTRIBUTE, ""
5770                + this.birthday.getTime());
5780        userElement.appendChild(birthdayElement);
5790 
5800        Element creationDateElement = document
5810                .createElement(ICXmlTags.IC_USER_CREATION_DATE_TAG);
5820        creationDateElement.setAttribute(ICXmlTags.IC_VALUE_ATTRIBUTE,
5830                this.creationDate.toString());
5840        creationDateElement.setAttribute(ICXmlTags.IC_LONG_VALUE_ATTRIBUTE, ""
5850                + this.creationDate.getTime());
586  
5870        userElement.appendChild(creationDateElement);
5880 
5890        userElement.appendChild(this.document.toXml(document));
5900 
5910        Element nAddressElement = document
5920                .createElement(ICXmlTags.IC_USER_NADDRESS_LIST_TAG);
5930        Iterator iterator = this.nAddress.iterator();
5940        while (iterator.hasNext())
5950            nAddressElement.appendChild(((IXMLSaveable) iterator.next())
5960                    .toXml(document));
5970        userElement.appendChild(nAddressElement);
5980 
5990        Element eAddressElement = document
6000                .createElement(ICXmlTags.IC_USER_EADDRESS_LIST_TAG);
6010        iterator = this.eAddress.iterator();
6020        while (iterator.hasNext())
6030            eAddressElement.appendChild(((IXMLSaveable) iterator.next())
6040                    .toXml(document));
6050        userElement.appendChild(eAddressElement);
6060 
6070        Element phoneNumberElement = document
6080                .createElement(ICXmlTags.IC_USER_PHONE_NUMBER_LIST_TAG);
6090        iterator = this.phoneNumber.iterator();
6100        while (iterator.hasNext())
6110            phoneNumberElement.appendChild(((IXMLSaveable) iterator.next())
6120                    .toXml(document));
6130        userElement.appendChild(phoneNumberElement);
614  
6150        return userElement;
6160    }
617  
6180    public Object fromXml(Document document) {
6190 
6200        Node userNode = document.getElementsByTagName(ICXmlTags.IC_USER_TAG)
6210                .item(0);
622  
6230        int id = Integer.parseInt(userNode.getAttributes().getNamedItem(
6240                ICXmlTags.IC_USER_ID_ATTRIBUTE).getNodeValue());
6250        int currentNAddressId = Integer.parseInt(userNode.getAttributes()
6260                .getNamedItem(ICXmlTags.IC_USER_CURRENT_NADDRESS_ID_ATTRIBUTE)
6270                .getNodeValue());
6280        int currentEAddressId = Integer.parseInt(userNode.getAttributes()
6290                .getNamedItem(ICXmlTags.IC_USER_CURRENT_EADDRESS_ID_ATTRIBUTE)
6300                .getNodeValue());
6310        int currentPhoneNumberId = Integer.parseInt(userNode.getAttributes()
6320                .getNamedItem(
6330                        ICXmlTags.IC_USER_CURRENT_PHONE_NUMBER_ID_ATTRIBUTE)
6340                .getNodeValue());
6350 
6360        String name = "";
6370        String surname = "";
6380        String gender = "";
6390        String credential = "";
6400        Date birthday = null;
6410        Date creationDate = null;
6420        String nickname = "";
6430        String password = "";
6440        base.user.Document userDocument = null;
6450        String imagePath = "";
6460        NAddress[] nAddress = null;
6470        EAddress[] eAddress = null;
6480        PhoneNumber[] phoneNumber = null;
6490 
6500        for (int i = 0; i < userNode.getChildNodes().getLength(); i++) {
6510            if (userNode.getChildNodes().item(i).getNodeName()
6520                    .equalsIgnoreCase(ICXmlTags.IC_USER_NAME_TAG))
6530                name = userNode.getChildNodes().item(i).getAttributes()
6540                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6550                        .getNodeValue();
6560            if (userNode.getChildNodes().item(i).getNodeName()
6570                    .equalsIgnoreCase(ICXmlTags.IC_USER_SURNAME_TAG))
6580                surname = userNode.getChildNodes().item(i).getAttributes()
6590                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6600                        .getNodeValue();
6610            if (userNode.getChildNodes().item(i).getNodeName()
6620                    .equalsIgnoreCase(ICXmlTags.IC_USER_GENDER_TAG))
6630                gender = userNode.getChildNodes().item(i).getAttributes()
6640                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6650                        .getNodeValue();
6660            if (userNode.getChildNodes().item(i).getNodeName()
6670                    .equalsIgnoreCase(ICXmlTags.IC_USER_CREDENTIAL_TAG))
6680                credential = userNode.getChildNodes().item(i).getAttributes()
6690                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6700                        .getNodeValue();
6710            if (userNode.getChildNodes().item(i).getNodeName()
6720                    .equalsIgnoreCase(ICXmlTags.IC_USER_NICKNAME_TAG))
6730                nickname = userNode.getChildNodes().item(i).getAttributes()
6740                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6750                        .getNodeValue();
6760            if (userNode.getChildNodes().item(i).getNodeName()
6770                    .equalsIgnoreCase(ICXmlTags.IC_USER_PASSWORD_TAG))
6780                password = userNode.getChildNodes().item(i).getAttributes()
6790                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6800                        .getNodeValue();
6810            if (userNode.getChildNodes().item(i).getNodeName()
6820                    .equalsIgnoreCase(ICXmlTags.IC_USER_IMAGE_PATH_TAG))
6830                imagePath = userNode.getChildNodes().item(i).getAttributes()
6840                        .getNamedItem(ICXmlTags.IC_VALUE_ATTRIBUTE)
6850                        .getNodeValue();
6860            if (userNode.getChildNodes().item(i).getNodeName()
6870                    .equalsIgnoreCase(ICXmlTags.IC_USER_BIRTHDAY_TAG))
6880                birthday = new Date(Long.parseLong(userNode.getChildNodes()
6890                        .item(i).getAttributes().getNamedItem(
6900                                ICXmlTags.IC_LONG_VALUE_ATTRIBUTE)
6910                        .getNodeValue()));
6920            if (userNode.getChildNodes().item(i).getNodeName()
6930                    .equalsIgnoreCase(ICXmlTags.IC_USER_CREATION_DATE_TAG))
6940                creationDate = new Date(Long.parseLong(userNode.getChildNodes()
6950                        .item(i).getAttributes().getNamedItem(
6960                                ICXmlTags.IC_LONG_VALUE_ATTRIBUTE)
6970                        .getNodeValue()));
6980            if (userNode.getChildNodes().item(i).getNodeName()
6990                    .equalsIgnoreCase(ICXmlTags.IC_USER_NADDRESS_LIST_TAG)) {
7000                nAddress = new NAddress[userNode.getChildNodes().item(i)
7010                        .getChildNodes().getLength()];
7020                for (int k = 0; k < userNode.getChildNodes().item(i)
7030                        .getChildNodes().getLength(); k++) {
7040                    nAddress[k] = new NAddress().fromXml(userNode
7050                            .getChildNodes().item(i).getChildNodes().item(i));
706                 }
707             }
7080            if (userNode.getChildNodes().item(i).getNodeName()
7090                    .equalsIgnoreCase(ICXmlTags.IC_USER_EADDRESS_LIST_TAG)) {
7100                eAddress = new EAddress[userNode.getChildNodes().item(i)
7110                        .getChildNodes().getLength()];
7120                for (int k = 0; k < userNode.getChildNodes().item(i)
7130                        .getChildNodes().getLength(); k++) {
7140                    eAddress[k] = new EAddress().fromXml(userNode
7150                            .getChildNodes().item(i).getChildNodes().item(i));
716                 }
717             }
7180            if (userNode.getChildNodes().item(i).getNodeName()
7190                    .equalsIgnoreCase(ICXmlTags.IC_USER_PHONE_NUMBER_LIST_TAG)) {
7200                phoneNumber = new PhoneNumber[userNode.getChildNodes().item(i)
7210                        .getChildNodes().getLength()];
7220                for (int k = 0; k < userNode.getChildNodes().item(i)
7230                        .getChildNodes().getLength(); k++) {
7240                    phoneNumber[k] = new PhoneNumber().fromXml(userNode
7250                            .getChildNodes().item(i).getChildNodes().item(i));
726                 }
727             }
7280            if (userNode.getChildNodes().item(i).getNodeName()
7290                    .equalsIgnoreCase(ICXmlTags.IC_DOCUMENT_TAG)) {
7300                userDocument = new base.user.Document().fromXml(userNode
7310                        .getChildNodes().item(i));
732             }
733         }
734  
7350        User result = new User(id);
7360        result.currentEAddressId = currentEAddressId;
7370        result.currentNAddressId = currentNAddressId;
7380        result.currentPhoneNumberId = currentPhoneNumberId;
7390        result.creationDate = creationDate;
7400        result.name = name;
7410        result.surname = surname;
7420        result.gender = gender;
7430        result.birthday = birthday;
7440        result.nickname = nickname;
7450        result.password = password;
7460        result.credential = credential;
7470        result.document = userDocument;
7480        result.imagePath = imagePath;
749  
7500        return result;
751     }
752  
753     /**
754      * @param id
755      * The id to set.
756      */
757     protected void setId(int id) {
7580        this.id = id;
7590    }
760 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.