${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.CopyLibs.displayName=CopyLibs Task
libs.CopyLibs.prop-version=2.0
+libs.javaee-api-7.0.classpath=\
+ ${base}/javaee-api-7.0/javaee-api-7.0.jar
+libs.javaee-api-7.0.displayName=Java EE 7 API Library
+libs.javaee-api-7.0.javadoc=\
+ ${base}/javaee-api-7.0/javaee-doc-api.jar
+libs.javaee-api-7.0.prop-maven-dependencies=javax:javaee-api:7.0:jar
libs.jpa20-persistence.classpath=\
${base}/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar
libs.jpa20-persistence.displayName=Persistence (JPA 2.1)
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
+file.reference.jcoreee.jar=lib/jcoreee.jar
file.reference.jcountry-core.jar=lib/jcountry-core.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
+ ${file.reference.jcoreee.jar}:\
${file.reference.jcountry-core.jar}:\
- ${libs.jpa20-persistence.classpath}
+ ${libs.jpa20-persistence.classpath}:\
+ ${libs.javaee-api-7.0.classpath}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.deprecation=true
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
+source.reference.jcoreee.jar=../jcoreee/src/
source.reference.jcountry-core.jar=../jcountry-core/src/
src.dir=src
test.src.dir=test
* <p>
* @return Country instance
*/
- public Country getCountry ();
+ public Country getPhoneCountry ();
/**
* Setter for country instance ('s dial data)
* <p>
* @param country Country instance
*/
- public void setCountry (final Country country);
+ public void setPhoneCountry (final Country country);
/**
* Getter for id number
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.data.CountryData;
import org.mxchange.jphone.phonenumbers.smsprovider.CellphoneProvider;
import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
private Long phoneNumber;
/**
- * Country instance ('s dial data)
+ * Contructor with cellphone carrier and number
+ * <p>
+ * @param cellphoneCarrier Cellphone carrier instance
+ * @param cellphoneNumber Cellphone number
*/
- @JoinColumn (name = "cellphone_country_id", nullable = false)
- @OneToOne (targetEntity = CountryData.class, optional = false, cascade = CascadeType.ALL)
- private Country country;
+ public CellphoneNumber (final SmsProvider cellphoneCarrier, final Long cellphoneNumber) {
+ this.cellphoneProvider = cellphoneCarrier;
+ this.phoneNumber = cellphoneNumber;
+ }
+
+ /**
+ * Protected constructor
+ */
+ protected CellphoneNumber () {
+ }
+
+ @Override
+ @Deprecated
+ public Country getPhoneCountry () {
+ throw new UnsupportedOperationException("The country code is provided by SmsProvider."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ @Deprecated
+ public void setPhoneCountry (final Country country) {
+ throw new UnsupportedOperationException("The country code is provided by SmsProvider."); //To change body of generated methods, choose Tools | Templates.
+ }
@Override
public Long getPhoneId () {
}
@Override
+ @Deprecated
public Integer getPhoneAreaCode () {
throw new UnsupportedOperationException("Cellphone numbers don't have area codes. Please fix your code."); //NOI18N
}
@Override
+ @Deprecated
public void setPhoneAreaCode (final Integer phoneAreaCode) {
throw new UnsupportedOperationException("Cellphone numbers don't have area codes. Please fix your code."); //NOI18N
}
public int compareTo (final DialableCellphoneNumber dialableCellphoneNumber) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
-
- @Override
- public Country getCountry () {
- return this.country;
- }
-
- @Override
- public void setCountry (final Country country) {
- this.country = country;
- }
}
*/
@Basic (optional = false)
@Column (name = "fax_area_code", length = 10, nullable = false)
- private Integer phoneAreaCode;
+ private Integer faxAreaCode;
/**
* Country instance ('s dial data)
*/
@JoinColumn (name = "fax_country_id", nullable = false)
@OneToOne (targetEntity = CountryData.class, optional = false, cascade = CascadeType.ALL)
- private Country country;
+ private Country faxCountry;
+
+ /**
+ * Contructor with country, area code and number
+ * <p>
+ * @param faxCountry Country instance
+ * @param faxAreaCode Area code (without leading zeros)
+ * @param faxNumber Fax number (without area code and leading zero)
+ */
+ public FaxNumber (final Country faxCountry, final Integer faxAreaCode, final Long faxNumber) {
+ this.faxCountry = faxCountry;
+ this.faxAreaCode = faxAreaCode;
+ this.phoneNumber = faxNumber;
+ }
+
+ /**
+ * Protected constructor
+ */
+ protected FaxNumber () {
+ }
@Override
public Long getPhoneId () {
@Override
public Integer getPhoneAreaCode () {
- return this.phoneAreaCode;
+ return this.faxAreaCode;
}
@Override
- public void setPhoneAreaCode (final Integer phoneAreaCode) {
- this.phoneAreaCode = phoneAreaCode;
+ public void setPhoneAreaCode (final Integer faxAreaCode) {
+ this.faxAreaCode = faxAreaCode;
}
@Override
- public Country getCountry () {
- return this.country;
+ public Country getPhoneCountry () {
+ return this.faxCountry;
}
@Override
- public void setCountry (final Country country) {
- this.country = country;
+ public void setPhoneCountry (final Country faxCountry) {
+ this.faxCountry = faxCountry;
}
}
*/
@JoinColumn (name = "phone_country_id", nullable = false, updatable = false)
@OneToOne (targetEntity = CountryData.class, cascade = CascadeType.ALL, optional = false)
- private Country country;
+ private Country phoneCountry;
+
+ /**
+ * Counstructor with country instance, area code and number
+ * <p>
+ * @param phoneCountry Country instance
+ * @param phoneAreaCode Phone area code
+ * @param phoneNumber Phone number
+ */
+ public LandLineNumber (final Country phoneCountry, final Integer phoneAreaCode, final Long phoneNumber) {
+ this.phoneCountry = phoneCountry;
+ this.phoneAreaCode = phoneAreaCode;
+ this.phoneNumber = phoneNumber;
+ }
+
+ /**
+ * Protected constructor
+ */
+ protected LandLineNumber () {
+ }
@Override
public Long getPhoneId () {
}
@Override
- public Country getCountry () {
- return this.country;
+ public Country getPhoneCountry () {
+ return this.phoneCountry;
}
@Override
- public void setCountry (final Country country) {
- this.country = country;
+ public void setPhoneCountry (final Country phoneCountry) {
+ this.phoneCountry = phoneCountry;
}
}
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.mxchange.jcountry.data.Country;
*/
@Entity (name = "cellphone_provider")
@Table (name = "cellphone_provider")
+@NamedQueries (
+ @NamedQuery (name = "AllSmsProvider", query = "SELECT p FROM cellphone_provider AS p ORDER BY p.providerId ASC")
+)
public class CellphoneProvider implements SmsProvider {
/**
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jphone.validators;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import org.mxchange.jcoreee.validator.number.BaseLongValidator;
+
+/**
+ * A validator for phone, fax and mobile numbers
+ * <p>
+ * @author Roland Haeder
+ */
+public class PhoneNumberValidator extends BaseLongValidator implements Validator {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 186_897_817_692_786_900L;
+
+ @Override
+ public void validate (final FacesContext context, final UIComponent component, final Object value) {
+ // Trace message
+ //this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
+
+ // The required field
+ String[] requiredFileds = {"phoneAreaCode", "phoneNumber", "faxAreaCode", "faxNumber", "cellphoneNumber"}; //NOI18N
+
+ // Pre-validation (example: not null, not a string, empty string ...)
+ super.preValidate(context, component, value, requiredFileds, true);
+
+ // Trace message
+ //this.getLogger().logTrace("validate: EXIT!"); //NOI18N
+ }
+}