| Line | Hits | Source |
|---|---|---|
| 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 | ||
| 21 | package base.user.jcard; | |
| 22 | ||
| 23 | 24 | public class Name extends Property { |
| 24 | ||
| 25 | private static final String FIELD_NAME_DELIMITER=";"; | |
| 26 | ||
| 27 | 12 | private String familyName = ""; // init all to empty string, so as to not print null. |
| 28 | 12 | private String givenName = ""; |
| 29 | 12 | private String additionalName = ""; |
| 30 | 12 | private String prefix = ""; |
| 31 | 12 | private String suffix = ""; |
| 32 | ||
| 33 | // Setters | |
| 34 | ||
| 35 | /** | |
| 36 | * @param additionalName The additionalName to set. | |
| 37 | */ | |
| 38 | public void setAdditionalName(String additionalName) { | |
| 39 | 3 | this.additionalName = additionalName; |
| 40 | 3 | } |
| 41 | ||
| 42 | /** | |
| 43 | * @param familyName The familyName to set. | |
| 44 | */ | |
| 45 | public void setFamilyName(String familyName) { | |
| 46 | 3 | this.familyName = familyName; |
| 47 | 3 | } |
| 48 | ||
| 49 | /** | |
| 50 | * @param givenName The givenName to set. | |
| 51 | */ | |
| 52 | public void setGivenName(String givenName) { | |
| 53 | 6 | this.givenName = givenName; |
| 54 | 6 | } |
| 55 | ||
| 56 | /** | |
| 57 | * @param prefix The prefix to set. | |
| 58 | */ | |
| 59 | public void setPrefix(String prefix) { | |
| 60 | 3 | this.prefix = prefix; |
| 61 | 3 | } |
| 62 | ||
| 63 | /** | |
| 64 | * @param suffix The suffix to set. | |
| 65 | */ | |
| 66 | public void setSuffix(String suffix) { | |
| 67 | 3 | this.suffix = suffix; |
| 68 | 3 | } |
| 69 | ||
| 70 | // Inherited abstract methods | |
| 71 | ||
| 72 | public void setPropertyName() { | |
| 73 | 12 | super.PROPERTY_NAME = "N:"; |
| 74 | 12 | } |
| 75 | ||
| 76 | public void doValidate() throws JCardException { | |
| 77 | // At least first name must be given. | |
| 78 | 6 | if(givenName == null || givenName == "") { |
| 79 | 3 | throw new JCardException("Validation error: At least given name must be populated"); |
| 80 | } | |
| 81 | 3 | } |
| 82 | ||
| 83 | // It is NOT responsibility of each toJCardString method to append a CRLF at the end of its write. | |
| 84 | public String toString() { | |
| 85 | 6 | StringBuffer name = new StringBuffer(30); |
| 86 | 6 | name.append(familyName); |
| 87 | 6 | name.append(FIELD_NAME_DELIMITER); |
| 88 | 6 | name.append(givenName); |
| 89 | 6 | name.append(FIELD_NAME_DELIMITER); |
| 90 | 6 | name.append(additionalName); |
| 91 | 6 | name.append(FIELD_NAME_DELIMITER); |
| 92 | 6 | name.append(prefix); |
| 93 | 6 | name.append(FIELD_NAME_DELIMITER); |
| 94 | 6 | name.append(suffix); |
| 95 | 6 | return name.toString(); |
| 96 | } | |
| 97 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |