| 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 | 0 | |
| 23 | import javax.print.attribute.standard.MediaSize.ISO; | |
| 24 | ||
| 25 | 15 | public class Birthdate extends Property { |
| 26 | ||
| 27 | private int yyyy; | |
| 28 | private int mm; | |
| 29 | private int dd; | |
| 30 | ||
| 31 | private static final String BIRTHDATE_FIELD_DELIMITER = "-"; | |
| 32 | ||
| 33 | /** | |
| 34 | * Sets the birthdate of the contact. | |
| 35 | * @param yyyy 4 digit year | |
| 36 | * @param mm 2 digit month | |
| 37 | * @param dd 2 digit day | |
| 38 | 0 | * @see ISO 8601 date encoding standard |
| 39 | 0 | */ |
| 40 | 0 | public void setBirthdate(int yyyy, int mm, int dd) { |
| 41 | 12 | this.yyyy = yyyy; |
| 42 | 12 | this.mm = mm; |
| 43 | 12 | this.dd = dd; |
| 44 | 12 | } |
| 45 | 0 | |
| 46 | 0 | @Override |
| 47 | protected void setPropertyName() { | |
| 48 | 15 | super.PROPERTY_NAME = "BDAY:"; |
| 49 | 15 | } |
| 50 | 0 | |
| 51 | @Override | |
| 52 | public void doValidate() throws JCardException { | |
| 53 | 9 | if(dd < 1 || dd > 31 || |
| 54 | 3 | mm < 1 || mm > 12 || |
| 55 | 3 | yyyy < 1900) // may need to change year validation |
| 56 | 6 | throw new JCardException("Validation error: Valid date not entered"); |
| 57 | 3 | } |
| 58 | 0 | |
| 59 | 0 | @Override |
| 60 | 0 | public String toString() { |
| 61 | 12 | StringBuffer birthdate = new StringBuffer(21); |
| 62 | 12 | birthdate.append(Integer.toString(yyyy)); |
| 63 | 12 | birthdate.append(BIRTHDATE_FIELD_DELIMITER); |
| 64 | 12 | birthdate.append(Integer.toString(mm)); |
| 65 | 12 | birthdate.append(BIRTHDATE_FIELD_DELIMITER); |
| 66 | 12 | birthdate.append(Integer.toString(dd)); |
| 67 | 12 | return birthdate.toString(); |
| 68 | } | |
| 69 | ||
| 70 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |