From: Roland Haeder Date: Sat, 10 Oct 2015 20:05:59 +0000 (+0200) Subject: initial import X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d7058d8843b2ec586c7f5a8de727929ad70035c3;p=jcountry-core.git initial import --- d7058d8843b2ec586c7f5a8de727929ad70035c3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0383bcc --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/nbproject/private/ +/nbproject/*~ +/manifest.mf +/build/ +/dist/ +/data/* +/*.properties diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..a30d1f2 --- /dev/null +++ b/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project jcountry-core. + + + diff --git a/dist.sh b/dist.sh new file mode 100755 index 0000000..f48251e --- /dev/null +++ b/dist.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +NAME="${PWD##*/}" +DIST="dist/${NAME}.jar" +LIST=`find ../*/lib/${NAME}.jar` +LIST="${LIST} `find ../*/*-ejb/lib/${NAME}.jar`" +LIST="${LIST} ${HOME}/gf_domains/domain1/lib/" + +for target in ${LIST}; +do + if [ ! -f "${DIST}" ] + then + echo "$0: '${DIST}' not found." + elif [ -d "${target}" ] + then + cp -v "${DIST}" "${target}" + elif [ -f "${target}" ] + then + cp -v "${DIST}" "${target}" + else + echo "$0: Target '${target}' not found." + fi +done diff --git a/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar new file mode 100644 index 0000000..2cc00f0 Binary files /dev/null and b/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar differ diff --git a/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip b/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip new file mode 100644 index 0000000..fd55e6e Binary files /dev/null and b/lib/jpa20-persistence/javax.persistence-2.1.0-doc.zip differ diff --git a/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar b/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar new file mode 100644 index 0000000..a4dd386 Binary files /dev/null and b/lib/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar differ diff --git a/lib/nblibraries.properties b/lib/nblibraries.properties new file mode 100644 index 0000000..7ee5412 --- /dev/null +++ b/lib/nblibraries.properties @@ -0,0 +1,10 @@ +libs.CopyLibs.classpath=\ + ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar +libs.CopyLibs.displayName=CopyLibs Task +libs.CopyLibs.prop-version=2.0 +libs.jpa20-persistence.classpath=\ + ${base}/jpa20-persistence/javax.persistence_2.1.0.v201304241213.jar +libs.jpa20-persistence.displayName=Persistence (JPA 2.1) +libs.jpa20-persistence.javadoc=\ + ${base}/jpa20-persistence/javax.persistence-2.1.0-doc.zip +libs.jpa20-persistence.prop-maven-dependencies=org.eclipse.persistence:javax.persistence:2.1.0:jar diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 0000000..b30056c --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 0000000..e5fc70b --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=efbfbc75 +build.xml.script.CRC32=82df3835 +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=efbfbc75 +nbproject/build-impl.xml.script.CRC32=d4b03963 +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..9e18b6f --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,76 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +application.title=jcountry-core +application.vendor=Roland Haeder +auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/jcountry-core.jar +dist.javadoc.dir=${dist.dir}/javadoc +endorsed.classpath= +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.jpa20-persistence.classpath} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked -Xlint:deprecation +javac.deprecation=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=true +javadoc.splitindex=true +javadoc.use=true +javadoc.version=true +javadoc.windowtitle=Country Data Library +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=true +platform.active=default_platform +project.license=gpl30 +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..c209fd4 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,18 @@ + + + org.netbeans.modules.java.j2seproject + + + jcountry-core + + + + + + + + + ./lib/nblibraries.properties + + + diff --git a/src/org/mxchange/jcountry/data/Country.java b/src/org/mxchange/jcountry/data/Country.java new file mode 100644 index 0000000..2578a2c --- /dev/null +++ b/src/org/mxchange/jcountry/data/Country.java @@ -0,0 +1,126 @@ +/* + * 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 . + */ +package org.mxchange.jcountry.data; + +import java.io.Serializable; + +/** + * A POJI for country data such as dial prefixes + *

+ * @author Roland Haeder + */ +public interface Country extends Serializable { + + /** + * Getter for country code (example: 49 for Germany, 63 for Philippines) + *

+ * @return Dial number without prefix + */ + public Short getCountryPhoneCode (); + + /** + * Setter for country code (example: 49 for Germany, 63 for Philippines) + *

+ * @param phoneCountryCode Country code + */ + public void setCountryPhoneCode (final Short phoneCountryCode); + + /** + * Getter for id number + *

+ * @return Id number + */ + public Long getCountryId (); + + /** + * Setter for id number + *

+ * @param countryId Id number + */ + public void setCountryId (final Long countryId); + + /** + * Getter for 2-characters country code + *

+ * @return Country code + */ + public String getCountryCode (); + + /** + * Setter for 2-characters country code + *

+ * @param countryCode Country code + */ + public void setCountryCode (final String countryCode); + + /** + * Getter for local dial prefix + *

+ * @return Local dial prefix + */ + public String getCountryLocalDialPrefix (); + + /** + * Setter for local dial prefix + *

+ * @param countryLocalDialPrefix Local dial prefix + */ + public void setCountryLocalDialPrefix (final String countryLocalDialPrefix); + + /** + * Getter for abroad dial prefix + *

+ * @return Abroad dial prefix + */ + public String getCountryAbroadDialPrefix (); + + /** + * Setter for abroad dial prefix + *

+ * @param countryAbroadDialPrefix Abroad dial prefix + */ + public void setCountryAbroadDialPrefix (final String countryAbroadDialPrefix); + + /** + * Getter for i18n key for country name + *

+ * @return i18n key for country name + */ + public String getCountryI18nkey (); + + /** + * Setter for i18n key for country name + *

+ * @param countryI18nkey i18n key for country name + */ + public void setCountryI18nkey (final String countryI18nkey); + + /** + * Getter for whether the local dial prefix is required for local calls + *

+ * @return Whether the local dial prefix is required + */ + public Boolean getCountryIsLocalPrefixRequired (); + + /** + * Setter for whether the local dial prefix is required for local calls + *

+ * @param countryIsLocalPrefixRequired Whether the local dial prefix is + * required + */ + public void setCountryIsLocalPrefixRequired (final Boolean countryIsLocalPrefixRequired); +} diff --git a/src/org/mxchange/jcountry/data/CountryData.java b/src/org/mxchange/jcountry/data/CountryData.java new file mode 100644 index 0000000..5f4d0fa --- /dev/null +++ b/src/org/mxchange/jcountry/data/CountryData.java @@ -0,0 +1,169 @@ +/* + * 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 . + */ +package org.mxchange.jcountry.data; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * A POJO for country data + *

+ * @author Roland Haeder + */ +@Entity (name = "country_data") +@Table (name = "country_data") +public class CountryData implements Country, Comparable { + + /** + * Serial number + */ + private static final long serialVersionUID = 14_853_982_718_509L; + + /** + * Id number + */ + @Id + @GeneratedValue + @Column (name = "country_id", length = 20, nullable = false, updatable = false) + private Long countryId; + + /** + * 2-characters country code, all upper-case (example: DE for Germany, PH + * for Philippines) + */ + @Basic (optional = false) + @Column (name = "country_code", length = 2, nullable = false, unique = true) + private String countryCode; + + /** + * Dial prefix to be dialed before the area/city number is dialed locally. + * In Germany, this is 0. + */ + @Basic (optional = false) + @Column (name = "country_local_dial_prefix", length = 10) + private String countryLocalDialPrefix; + + /** + * Dial prefix to be dialed before an abroad number is being dialed. In + * Germany this is "+" or 00. + */ + @Basic (optional = false) + @Column (name = "country_abroad_dial_prefix", length = 10) + private String countryAbroadDialPrefix; + + /** + * Key to i18n key (to have translated country names) + */ + @Basic (optional = false) + @Column (name = "country_i18n_key", length = 100, nullable = false) + private String countryI18nkey; + + /** + * 2-digit country's phone code (example: 49 for Germany, 63 for + * Philippines) + */ + @Basic (optional = false) + @Column (name = "country_phone_code", length = 2, nullable = false, updatable = false) + private Short countryPhoneCode; + + /** + * Is the local dialing prefix required or optional for calling numbers in + * same area? + */ + @Basic (optional = false) + @Column (name = "country_is_local_prefix_required", nullable = false) + private Boolean countryIsLocalPrefixRequired; + + @Override + public Short getCountryPhoneCode () { + return this.countryPhoneCode; + } + + @Override + public void setCountryPhoneCode (final Short countryPhoneCode) { + this.countryPhoneCode = countryPhoneCode; + } + + @Override + public int compareTo (final Country country) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public Long getCountryId () { + return this.countryId; + } + + @Override + public void setCountryId (final Long countryId) { + this.countryId = countryId; + } + + @Override + public String getCountryCode () { + return this.countryCode; + } + + @Override + public void setCountryCode (final String countryCode) { + this.countryCode = countryCode; + } + + @Override + public String getCountryLocalDialPrefix () { + return this.countryLocalDialPrefix; + } + + @Override + public void setCountryLocalDialPrefix (final String countryLocalDialPrefix) { + this.countryLocalDialPrefix = countryLocalDialPrefix; + } + + @Override + public String getCountryAbroadDialPrefix () { + return this.countryAbroadDialPrefix; + } + + @Override + public void setCountryAbroadDialPrefix (final String countryAbroadDialPrefix) { + this.countryAbroadDialPrefix = countryAbroadDialPrefix; + } + + @Override + public String getCountryI18nkey () { + return this.countryI18nkey; + } + + @Override + public void setCountryI18nkey (final String countryI18nkey) { + this.countryI18nkey = countryI18nkey; + } + + @Override + public Boolean getCountryIsLocalPrefixRequired () { + return this.countryIsLocalPrefixRequired; + } + + @Override + public void setCountryIsLocalPrefixRequired (final Boolean countryIsLocalPrefixRequired) { + this.countryIsLocalPrefixRequired = countryIsLocalPrefixRequired; + } +}