- moved PizzaProduct to own package and created BaseProduct from it. This class and interface Product are possible candidates for jcore
- Added Apache commons jar (for new jcore changes for having a non-proprietary implementation of BASE64 encoding and decoding
- Added newly thrown exception CorruptedDatabaseFileException
- Ignored some strings for internationalization
- Id needs to be initialized with zero, not null
- Method toStoreable() has been fully rewritten to a more flexible solution
- Removed some deprecated/unused methods
Signed-off-by:Roland Häder <roland@mxchange.org>
--- /dev/null
+\r
+ Apache License\r
+ Version 2.0, January 2004\r
+ http://www.apache.org/licenses/\r
+\r
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+ 1. Definitions.\r
+\r
+ "License" shall mean the terms and conditions for use, reproduction,\r
+ and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+ "Licensor" shall mean the copyright owner or entity authorized by\r
+ the copyright owner that is granting the License.\r
+\r
+ "Legal Entity" shall mean the union of the acting entity and all\r
+ other entities that control, are controlled by, or are under common\r
+ control with that entity. For the purposes of this definition,\r
+ "control" means (i) the power, direct or indirect, to cause the\r
+ direction or management of such entity, whether by contract or\r
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+ outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+ "You" (or "Your") shall mean an individual or Legal Entity\r
+ exercising permissions granted by this License.\r
+\r
+ "Source" form shall mean the preferred form for making modifications,\r
+ including but not limited to software source code, documentation\r
+ source, and configuration files.\r
+\r
+ "Object" form shall mean any form resulting from mechanical\r
+ transformation or translation of a Source form, including but\r
+ not limited to compiled object code, generated documentation,\r
+ and conversions to other media types.\r
+\r
+ "Work" shall mean the work of authorship, whether in Source or\r
+ Object form, made available under the License, as indicated by a\r
+ copyright notice that is included in or attached to the work\r
+ (an example is provided in the Appendix below).\r
+\r
+ "Derivative Works" shall mean any work, whether in Source or Object\r
+ form, that is based on (or derived from) the Work and for which the\r
+ editorial revisions, annotations, elaborations, or other modifications\r
+ represent, as a whole, an original work of authorship. For the purposes\r
+ of this License, Derivative Works shall not include works that remain\r
+ separable from, or merely link (or bind by name) to the interfaces of,\r
+ the Work and Derivative Works thereof.\r
+\r
+ "Contribution" shall mean any work of authorship, including\r
+ the original version of the Work and any modifications or additions\r
+ to that Work or Derivative Works thereof, that is intentionally\r
+ submitted to Licensor for inclusion in the Work by the copyright owner\r
+ or by an individual or Legal Entity authorized to submit on behalf of\r
+ the copyright owner. For the purposes of this definition, "submitted"\r
+ means any form of electronic, verbal, or written communication sent\r
+ to the Licensor or its representatives, including but not limited to\r
+ communication on electronic mailing lists, source code control systems,\r
+ and issue tracking systems that are managed by, or on behalf of, the\r
+ Licensor for the purpose of discussing and improving the Work, but\r
+ excluding communication that is conspicuously marked or otherwise\r
+ designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+ "Contributor" shall mean Licensor and any individual or Legal Entity\r
+ on behalf of whom a Contribution has been received by Licensor and\r
+ subsequently incorporated within the Work.\r
+\r
+ 2. Grant of Copyright License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ copyright license to reproduce, prepare Derivative Works of,\r
+ publicly display, publicly perform, sublicense, and distribute the\r
+ Work and such Derivative Works in Source or Object form.\r
+\r
+ 3. Grant of Patent License. Subject to the terms and conditions of\r
+ this License, each Contributor hereby grants to You a perpetual,\r
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+ (except as stated in this section) patent license to make, have made,\r
+ use, offer to sell, sell, import, and otherwise transfer the Work,\r
+ where such license applies only to those patent claims licensable\r
+ by such Contributor that are necessarily infringed by their\r
+ Contribution(s) alone or by combination of their Contribution(s)\r
+ with the Work to which such Contribution(s) was submitted. If You\r
+ institute patent litigation against any entity (including a\r
+ cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+ or a Contribution incorporated within the Work constitutes direct\r
+ or contributory patent infringement, then any patent licenses\r
+ granted to You under this License for that Work shall terminate\r
+ as of the date such litigation is filed.\r
+\r
+ 4. Redistribution. You may reproduce and distribute copies of the\r
+ Work or Derivative Works thereof in any medium, with or without\r
+ modifications, and in Source or Object form, provided that You\r
+ meet the following conditions:\r
+\r
+ (a) You must give any other recipients of the Work or\r
+ Derivative Works a copy of this License; and\r
+\r
+ (b) You must cause any modified files to carry prominent notices\r
+ stating that You changed the files; and\r
+\r
+ (c) You must retain, in the Source form of any Derivative Works\r
+ that You distribute, all copyright, patent, trademark, and\r
+ attribution notices from the Source form of the Work,\r
+ excluding those notices that do not pertain to any part of\r
+ the Derivative Works; and\r
+\r
+ (d) If the Work includes a "NOTICE" text file as part of its\r
+ distribution, then any Derivative Works that You distribute must\r
+ include a readable copy of the attribution notices contained\r
+ within such NOTICE file, excluding those notices that do not\r
+ pertain to any part of the Derivative Works, in at least one\r
+ of the following places: within a NOTICE text file distributed\r
+ as part of the Derivative Works; within the Source form or\r
+ documentation, if provided along with the Derivative Works; or,\r
+ within a display generated by the Derivative Works, if and\r
+ wherever such third-party notices normally appear. The contents\r
+ of the NOTICE file are for informational purposes only and\r
+ do not modify the License. You may add Your own attribution\r
+ notices within Derivative Works that You distribute, alongside\r
+ or as an addendum to the NOTICE text from the Work, provided\r
+ that such additional attribution notices cannot be construed\r
+ as modifying the License.\r
+\r
+ You may add Your own copyright statement to Your modifications and\r
+ may provide additional or different license terms and conditions\r
+ for use, reproduction, or distribution of Your modifications, or\r
+ for any such Derivative Works as a whole, provided Your use,\r
+ reproduction, and distribution of the Work otherwise complies with\r
+ the conditions stated in this License.\r
+\r
+ 5. Submission of Contributions. Unless You explicitly state otherwise,\r
+ any Contribution intentionally submitted for inclusion in the Work\r
+ by You to the Licensor shall be under the terms and conditions of\r
+ this License, without any additional terms or conditions.\r
+ Notwithstanding the above, nothing herein shall supersede or modify\r
+ the terms of any separate license agreement you may have executed\r
+ with Licensor regarding such Contributions.\r
+\r
+ 6. Trademarks. This License does not grant permission to use the trade\r
+ names, trademarks, service marks, or product names of the Licensor,\r
+ except as required for reasonable and customary use in describing the\r
+ origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+ 7. Disclaimer of Warranty. Unless required by applicable law or\r
+ agreed to in writing, Licensor provides the Work (and each\r
+ Contributor provides its Contributions) on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+ implied, including, without limitation, any warranties or conditions\r
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+ PARTICULAR PURPOSE. You are solely responsible for determining the\r
+ appropriateness of using or redistributing the Work and assume any\r
+ risks associated with Your exercise of permissions under this License.\r
+\r
+ 8. Limitation of Liability. In no event and under no legal theory,\r
+ whether in tort (including negligence), contract, or otherwise,\r
+ unless required by applicable law (such as deliberate and grossly\r
+ negligent acts) or agreed to in writing, shall any Contributor be\r
+ liable to You for damages, including any direct, indirect, special,\r
+ incidental, or consequential damages of any character arising as a\r
+ result of this License or out of the use or inability to use the\r
+ Work (including but not limited to damages for loss of goodwill,\r
+ work stoppage, computer failure or malfunction, or any and all\r
+ other commercial damages or losses), even if such Contributor\r
+ has been advised of the possibility of such damages.\r
+\r
+ 9. Accepting Warranty or Additional Liability. While redistributing\r
+ the Work or Derivative Works thereof, You may choose to offer,\r
+ and charge a fee for, acceptance of support, warranty, indemnity,\r
+ or other liability obligations and/or rights consistent with this\r
+ License. However, in accepting such obligations, You may act only\r
+ on Your own behalf and on Your sole responsibility, not on behalf\r
+ of any other Contributor, and only if You agree to indemnify,\r
+ defend, and hold each Contributor harmless for any liability\r
+ incurred by, or claims asserted against, such Contributor by reason\r
+ of your accepting any such warranty or additional liability.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ APPENDIX: How to apply the Apache License to your work.\r
+\r
+ To apply the Apache License to your work, attach the following\r
+ boilerplate notice, with the fields enclosed by brackets "[]"\r
+ replaced with your own identifying information. (Don't include\r
+ the brackets!) The text should be enclosed in the appropriate\r
+ comment syntax for the file format. We also recommend that a\r
+ file or class name and description of purpose be included on the\r
+ same "printed page" as the copyright notice for easier\r
+ identification within third-party archives.\r
+\r
+ Copyright [yyyy] [name of copyright owner]\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 1999-2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
<copyfiles files="${reference.jcore.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.log4j-api-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.log4j-core-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.commons-codec-1.10.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<copyfiles files="${reference.jcore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.log4j-api-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.log4j-core-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.commons-codec-1.10.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
-build.xml.data.CRC32=40f8a45c
+build.xml.data.CRC32=ec514056
build.xml.script.CRC32=a6f5a733
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
# 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=40f8a45c
-nbproject/build-impl.xml.script.CRC32=63e11c78
+nbproject/build-impl.xml.data.CRC32=ec514056
+nbproject/build-impl.xml.script.CRC32=ea019def
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
dist.war=${dist.dir}/${war.name}
endorsed.classpath=
excludes=
+file.reference.commons-codec-1.10.jar=lib/commons-codec-1.10.jar
file.reference.log4j-api-2.3.jar=lib\\log4j-api-2.3.jar
file.reference.log4j-core-2.3.jar=lib\\log4j-core-2.3.jar
includes=**
javac.classpath=\
${reference.jcore.jar}:\
${file.reference.log4j-api-2.3.jar}:\
- ${file.reference.log4j-core-2.3.jar}
+ ${file.reference.log4j-core-2.3.jar}:\
+ ${file.reference.commons-codec-1.10.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked
javac.debug=true
javadoc.notree=false
javadoc.preview=true
javadoc.private=false
+javadoc.reference.commons-codec-1.10.jar=/home/quix0r/public_html/JARs/commons-codec-1.10-javadoc.jar
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
runmain.jvmargs=
source.encoding=UTF-8
+source.reference.commons-codec-1.10.jar=/home/quix0r/public_html/JARs/commons-codec-1.10-sources.jar
source.root=src
src.dir=${source.root}/java
test.src.dir=test
<file>${file.reference.log4j-core-2.3.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
+ <library dirs="200">
+ <file>${file.reference.commons-codec-1.10.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
import javax.servlet.http.HttpSession;
import org.mxchange.jcore.contact.Gender;
import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
import org.mxchange.pizzaapplication.category.Category;
@Override
public String getPrintableProduktAvailability (final Product product) {
// Trace message
- this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product));
+ this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product)); //NOI18N
// Is it null?
if (product == null) {
// Should not be null
- throw new NullPointerException("product is null");
+ throw new NullPointerException("product is null"); //NOI18N
}
// Get availability
try {
// Ask frontend for a list of products
return this.productFrontend.getAvailableProducts();
- } catch (final IOException | BadTokenException | SQLException ex) {
+ } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException ex) {
throw new ServletException(ex);
}
}
try {
// Ask frontend for a list of products
return this.productFrontend.getAllProducts();
- } catch (final IOException | BadTokenException | SQLException ex) {
+ } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException ex) {
throw new ServletException(ex);
}
}
try {
// Ask frontend for a list of categories
return this.categoryFrontend.getCategories();
- } catch (final IOException | BadTokenException | SQLException ex) {
+ } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException ex) {
throw new ServletException(ex);
}
}
* @param title Title of category to check
* @return Whether it has been found
*/
- private boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException {
+ private boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException {
// Delegate to frontend
return this.categoryFrontend.isCategoryTitleUsed(title);
}
* @param title Product title to check
* @return Whether the product title has already been used
*/
- private boolean isProductTitleUsed (final String title) throws IOException, SQLException, BadTokenException {
+ private boolean isProductTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException {
// Delegate to frontend
return this.productFrontend.isProductTitleUsed(title);
}
// request must not be null
if (request == null) {
// Is null
- throw new NullPointerException("request is null");
+ throw new NullPointerException("request is null"); //NOI18N
}
// Get all fields
String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
String parent = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_PARENT);
- Integer id = null;
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("title={0},parent={1}", title, parent)); //NOI18N
+
+ // Init variables for casting
+ Integer id = 0;
// Check all fields
if (title == null) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
} else if ((parent != null) && (!parent.isEmpty())) {
// "parent" is set, so check it
try {
throw new IllegalArgumentException(e);
}
}
+
try {
// Try to check if title is used already
if (this.isCategoryTitleUsed(title)) {
// Title already used
throw new CategoryTitleAlreadyUsedException(request);
}
- } catch (final IOException | SQLException | BadTokenException ex) {
+ } catch (final IOException | SQLException | BadTokenException | CorruptedDatabaseFileException ex) {
throw new ServletException(ex);
}
try {
// The category is not found, so add it to database
this.categoryFrontend.addCategory(title, id);
- } catch (final SQLException ex) {
+ } catch (final SQLException | IOException ex) {
// Continue to throw it
throw new ServletException(ex);
}
// request must not be null
if (request == null) {
// Is null
- throw new NullPointerException("request is null");
+ throw new NullPointerException("request is null"); //NOI18N
}
// Get title, price and category id
String category = request.getParameter(PizzaProductDatabaseConstants.COLUMN_CATEGORY);
String available = request.getParameter(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("title={0},price={1},category={2},available={3}", title, price, category, available));
+
+ // Variables for converting
Long id = null;
Float p = null;
- Boolean a = null;
// Check all fields
if (title == null) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
} else if (price == null) {
// "price" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_PRICE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N
} else if (price.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_PRICE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N
} else if (category == null) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_CATEGORY));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N
} else if (category.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_CATEGORY));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N
} else if (available == null) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N
} else if (available.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE));
- } else if ((!"true".equals(available)) && (!"false".equals(available))) {
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N
+ } else if ((!"true".equals(available)) && (!"false".equals(available))) { //NOI18N
// Invalid value
- throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available));
+ throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available)); //NOI18N
}
// Parse numbers
}
// Parse boolean
- a = Boolean.parseBoolean(available);
+ Boolean a = Boolean.parseBoolean(available);
// Test on product title
try {
// Title already used
throw new ProductTitleAlreadyUsedException(request);
}
- } catch (final IOException | SQLException | BadTokenException ex) {
+ } catch (final IOException | SQLException | BadTokenException | CorruptedDatabaseFileException ex) {
throw new ServletException(ex);
}
try {
// The product is not found, so add it to database
this.productFrontend.addProduct(title, p, id, a);
- } catch (final SQLException ex) {
+ } catch (final SQLException | IOException ex) {
// Continue to throw it
throw new ServletException(ex);
}
@Override
public String generateLinkForParent (final Category category) {
// Trace message
- this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category));
+ this.getLogger().trace(MessageFormat.format("category={0} - CALLED!", category)); //NOI18N
// category must not be null
if (category == null) {
// Is null
- throw new NullPointerException("category is null");
+ throw new NullPointerException("category is null"); //NOI18N
}
// Get parent id
// Is the id set?
if (parent > 0) {
// Product HTML code for link
- throw new UnsupportedOperationException(MessageFormat.format("parent={0} - Unfinished!", parent));
+ throw new UnsupportedOperationException(MessageFormat.format("parent={0} - Unfinished!", parent)); //NOI18N
}
// No parent set
package org.mxchange.pizzaapplication.category;
import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.Objects;
import org.mxchange.jcore.BaseFrameworkSystem;
this.setParent(parent);
}
+ /**
+ * Default constructor
+ */
+ protected BaseCategory () {
+ }
+
/**
* Compares two categories with each other
*
public final void setTitle (final String title) {
this.title = title;
}
+
+ @Override
+ public void setValueFromColumn (final String columnName, final String value) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
}
/**
* Compare method
* @param category Category to compare to
+ * @return Comparison value
*/
@Override
public int compareTo (final Category category);
// Call parent constructor
super(id, title, parent);
}
+
+ /**
+ * Default constructor
+ */
+ public ProductCategory () {
+ }
}
public void show (final Client client) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
+
+ @Override
+ public Object getValueFromColumn (String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Deligate to "hidden" object
+ return this.getContact().getValueFromColumn(columnName);
+ }
+
+ @Override
+ public void setValueFromColumn (String columnName, String value) {
+ // Deligate to "hidden" object
+ this.getContact().setValueFromColumn(columnName, value);
+ }
}
import java.util.Iterator;
import org.mxchange.jcore.database.frontend.DatabaseFrontend;
import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.pizzaapplication.category.Category;
/**
* @param title Title of category
* @param parent Parent id or null if not selected
* @throws java.sql.SQLException If any SQL error occurs
+ * @throws java.io.IOException If an IO error occurs
*/
- public void addCategory (final String title, final Integer parent) throws SQLException;
+ public void addCategory (final String title, final Integer parent) throws SQLException, IOException;
/**
* An iterator on all categories
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.sql.SQLException If any SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Iterator<Category> getCategories () throws IOException, BadTokenException, SQLException;
+ public Iterator<Category> getCategories () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException;
/**
* Checks if given category title is already used
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.sql.SQLException If any SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException;
+ public boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException;
}
*/
package org.mxchange.pizzaapplication.database.frontend.category;
-import org.mxchange.pizzaapplication.category.product.ProductCategory;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Iterator;
+import java.util.Map;
import org.mxchange.jcore.criteria.searchable.SearchCriteria;
import org.mxchange.jcore.criteria.searchable.SearchableCritera;
import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
import org.mxchange.jcore.database.result.Result;
import org.mxchange.jcore.database.storage.Storeable;
import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.category.Category;
+import org.mxchange.pizzaapplication.category.product.ProductCategory;
import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
/**
* @param parent Parent id or null if not selected
*/
@Override
- public void addCategory (final String title, final Integer parent) throws SQLException {
+ public void addCategory (final String title, final Integer parent) throws SQLException, IOException {
// Trace message
this.getLogger().trace(MessageFormat.format("title={0},parent={1} - CALLED!", title, parent));
@Override
@SuppressWarnings ("unchecked")
- public Iterator<Category> getCategories () throws IOException, BadTokenException, SQLException {
+ public Iterator<Category> getCategories () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
* @return Whether the title has been used
*/
@Override
- public boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException {
+ public boolean isCategoryTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException {
// Trace message
this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title));
}
/**
- * Parses given line from database backend into a Storeable instance. Please
- * note that not all backends need this.
+ * Converts the given map into a Storeable instance, depending on which class implements it. All
+ * keys are being interpreted as class fields/attributes and their respective setters are being searched for. As
+ * this method may fail to find one or access it, this method throws some exception.
*
- * @param line Line from database backend
- * @return A Storeable instance
+ * @param map Map instance to convert to Storeable
+ * @return An instance of a Storeable implementation
*/
@Override
- public Storeable parseLineToStoreable (final String line) throws BadTokenException {
+ public Storeable toStoreable (final Map<String, String> map) {
// Trace message
- this.getLogger().trace(MessageFormat.format("line={0} - CALLED!", line)); //NOI18N
-
- // Call inner method
- Category category = this.parseLine(line);
+ this.getLogger().trace("map=" + map + " - CALLED!");
+
+ // Is map null?
+ if (map == null) {
+ // Is null
+ throw new NullPointerException("map is null");
+ } else if (map.isEmpty()) {
+ // Map is empty
+ throw new IllegalArgumentException("map is empty.");
+ }
// Debug message
- this.getLogger().trace(MessageFormat.format("category={0} - EXIT!", category)); //NOI18N
+ this.getLogger().debug("Has to handle " + map.size() + " entries");
- // Return it
- return category;
- }
+ // Get iterator on all entries
+ Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
- /**
- * Parses given line to a Category instance
- *
- * @param line Raw, decoded line from a file-based backend
- * @return A Category instance from given line
- */
- private Category parseLine (final String line) {
- throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: line={0}", line)); //NOI18N
+ // Init object instance
+ Storeable instance = new ProductCategory();
+
+ // Iterate over all
+ while (iterator.hasNext()) {
+ // Get next entry
+ Map.Entry<String, String> entry = iterator.next();
+
+ // Debug message
+ this.getLogger().debug("entry:" + entry.getKey() + "=" + entry.getValue());
+
+ // Try to set value
+ instance.setValueFromColumn(entry.getKey(), entry.getValue());
+ }
+
+ throw new UnsupportedOperationException("Not supported yet: map=" + map);
}
}
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Iterator;
+import java.util.Map;
import org.mxchange.jcore.criteria.searchable.SearchCriteria;
import org.mxchange.jcore.criteria.searchable.SearchableCritera;
import org.mxchange.jcore.database.frontend.BaseDatabaseFrontend;
import org.mxchange.jcore.database.result.Result;
import org.mxchange.jcore.database.storage.Storeable;
import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
-import org.mxchange.pizzaapplication.product.PizzaProduct;
+import org.mxchange.pizzaapplication.product.pizza.PizzaProduct;
import org.mxchange.pizzaapplication.product.Product;
/**
@Override
@SuppressWarnings ("unchecked")
- public Iterator<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException {
+ public Iterator<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
*/
@Override
@SuppressWarnings ("unchecked")
- public Iterator<Product> getAllProducts () throws IOException, BadTokenException, SQLException {
+ public Iterator<Product> getAllProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
* @throws java.sql.SQLException If any SQL errors occur
*/
@Override
- public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException {
+ public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException {
// Trace message
this.getLogger().trace(MessageFormat.format("title={0} - CALLED!", title));
return isFound;
}
- /**
- * Parses given line from database backend into a Storeable instance. Please
- * note that not all backends need this.
- *
- * @param line Line from database backend
- * @return A Storeable instance
- */
- @Override
- public Storeable parseLineToStoreable (final String line) throws BadTokenException {
- // Trace message
- this.getLogger().trace(MessageFormat.format("line={0} - CALLED!", line)); //NOI18N
-
- // Call inner method
- Product product = this.parseLine(line);
-
- // Debug message
- this.getLogger().trace(MessageFormat.format("product={0} - EXIT!", product)); //NOI18N
-
- // Return it
- return product;
- }
-
- /**
- * Parses given line to a Product instance
- *
- * @param line
- * @return A Product instance from given line
- */
- private Product parseLine (final String line) {
- throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: line={0}", line)); //NOI18N
- }
-
/**
* Adds product to database by given title, price and category id
* @param title Product title
* @throws java.sql.SQLException If any SQL errors occur
*/
@Override
- public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException {
+ public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException, IOException {
// Trace message
this.getLogger().trace(MessageFormat.format("title={0},price={1},category={2} - CALLED!", title, price, category));
// Trace message
this.getLogger().trace("EXIT!");
}
+
+ /**
+ * Converts the given map into a Storeable instance, depending on which class implements it. All
+ * keys are being interpreted as class fields/attributes and their respective setters are being searched for. As
+ * this method may fail to find one or access it, this method throws some exception.
+ *
+ * @param map Map instance to convert to Storeable
+ * @return An instance of a Storeable implementation
+ */
+ @Override
+ public Storeable toStoreable (final Map<String, String> map) {
+ throw new UnsupportedOperationException("Not supported yet: map=" + map);
+ }
}
import java.util.Iterator;
import org.mxchange.jcore.database.frontend.DatabaseFrontend;
import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.pizzaapplication.product.Product;
/**
* @param category Product category id
* @param available Availability of product (selectable by customer)
* @throws java.sql.SQLException If any SQL errors occur
+ * @throws java.io.IOException If an IO error occurs
*/
- public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException;
+ public void addProduct (final String title, final Float price, final Long category, final Boolean available) throws SQLException, IOException;
/**
* An iterator on all products
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.sql.SQLException If any SQL errors occur
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Iterator<Product> getAllProducts () throws IOException, BadTokenException, SQLException;
+ public Iterator<Product> getAllProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException;
/**
* An iterator on all products
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.sql.SQLException If any SQL errors occur
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public Iterator<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException;
+ public Iterator<Product> getAvailableProducts () throws IOException, BadTokenException, SQLException, CorruptedDatabaseFileException;
/**
* Checks wether the given product title is already used.
* @throws java.io.IOException If any IO error occurs
* @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found in a file-based database backend's file ... ;-)
* @throws java.sql.SQLException If any SQL errors occur
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If the database file is damaged
*/
- public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException;
+ public boolean isProductTitleUsed (String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException;
}
--- /dev/null
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.mxchange.pizzaapplication.product;
+
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.Objects;
+import org.mxchange.jcore.BaseFrameworkSystem;
+
+/**
+ *
+ * @author quix0r
+ */
+public class BaseProduct extends BaseFrameworkSystem implements Product {
+ /**
+ * Availability of product
+ */
+ private Boolean available;
+
+ /**
+ * Product category
+ */
+ private Long category;
+
+ /**
+ * Id number of product
+ */
+ private Long id;
+
+ /**
+ * Price of product
+ */
+ private float price;
+
+ /**
+ * Title of product
+ */
+ private String title;
+
+ /**
+ * Getter for product availability
+ *
+ * @return Product availability
+ */
+ @Override
+ public final Boolean getAvailable () {
+ return this.available;
+ }
+
+ /**
+ * Setter for product availability
+ *
+ * @param available Product availability
+ */
+ @Override
+ public final void setAvailable (final Boolean available) {
+ this.available = available;
+ }
+
+ /**
+ * Getter for product category
+ *
+ * @return Product category
+ */
+ @Override
+ public final Long getCategory () {
+ return this.category;
+ }
+
+ /**
+ * Setter for product category
+ *
+ * @param category Product category
+ */
+ @Override
+ public final void setCategory (final Long category) {
+ this.category = category;
+ }
+
+ /**
+ * Name of product
+ * @return the name
+ */
+ @Override
+ public final Long getId () {
+ return this.id;
+ }
+
+ /**
+ * Id number of product
+ * @param id the id number to set
+ */
+ @Override
+ public final void setId (final Long id) {
+ this.id = id;
+ }
+
+ /**
+ * Price of product
+ * @return the price
+ */
+ @Override
+ public final float getPrice () {
+ return this.price;
+ }
+
+ /**
+ * Price of product
+ * @param price the price to set
+ */
+ @Override
+ public final void setPrice (final float price) {
+ this.price = price;
+ }
+
+ /**
+ * Title of product
+ * @return the title
+ */
+ @Override
+ public final String getTitle () {
+ return this.title;
+ }
+
+ /**
+ * Title of product
+ * @param title the title to set
+ */
+ @Override
+ public final void setTitle (final String title) {
+ this.title = title;
+ }
+
+ /**
+ * Compares two categories with each other
+ *
+ * @param product Product comparator
+ * @return Comparison value
+ */
+ @Override
+ public int compareTo (final Product product) {
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product));
+
+ // category should not be null
+ if (product == null) {
+ throw new NullPointerException("product is null");
+ }
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("this.id={0},product.id={1}", this.getId(), product.getId()));
+
+ // Is the id the same?
+ if (Objects.equals(this.getId(), product.getId())) {
+ // Same id, means same category
+ return 0;
+ } else if (this.getId() > product.getId()) {
+ // This id is larger than compared to
+ return -1;
+ }
+
+ // The other id is larger
+ return 1;
+ }
+
+ @Override
+ public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ throw new UnsupportedOperationException("Not supported yet:columnName=" + columnName);
+ }
+
+ @Override
+ public void setValueFromColumn (final String columnName, final String value) {
+ throw new UnsupportedOperationException("Not supported yet: columnName=" + columnName + ",value=" + value);
+ }
+}
+++ /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.pizzaapplication.product;
-
-import java.text.MessageFormat;
-import java.util.Objects;
-import org.mxchange.jcore.BaseFrameworkSystem;
-
-/**
- * Product class for pizza application
- *
- * @author Roland Haeder
- */
-public class PizzaProduct extends BaseFrameworkSystem implements Product {
- /**
- * Availability of product
- */
- private Boolean available;
-
- /**
- * Product category
- */
- private Long category;
-
- /**
- * Id number of product
- */
- private Long id;
-
- /**
- * Price of product
- */
- private float price;
-
- /**
- * Title of product
- */
- private String title;
-
-
- /**
- * Constructor for products with a name and a price.
- *
- * @param id Id number of product
- * @param title Name of product
- * @param price Price
- * @deprecated Please use constructor with category and available
- */
- @Deprecated
- public PizzaProduct (final Long id, final String title, final float price) {
- this.setId(id);
- this.setTitle(title);
- this.setPrice(price);
- }
-
- /**
- * Constructor will all required data
- *
- * @param id Id number of product
- * @param title Name of product
- * @param price Price
- * @param category Category id
- * @param available Availability (selectable by customer)
- */
- public PizzaProduct (final Long id, final String title, final Float price, final Long category, final Boolean available) {
- // Set all here
- this.setId(id);
- this.setTitle(title);
- this.setPrice(price);
- this.setCategory(category);
- this.setAvailable(available);
- }
-
- /**
- * Getter for product availability
- *
- * @return Product availability
- */
- @Override
- public final Boolean getAvailable () {
- return this.available;
- }
-
- /**
- * Setter for product availability
- *
- * @param available Product availability
- */
- @Override
- public final void setAvailable (final Boolean available) {
- this.available = available;
- }
-
- /**
- * Getter for product category
- *
- * @return Product category
- */
- @Override
- public final Long getCategory () {
- return this.category;
- }
-
- /**
- * Setter for product category
- *
- * @param category Product category
- */
- @Override
- public final void setCategory (final Long category) {
- this.category = category;
- }
-
- /**
- * Name of product
- * @return the name
- */
- @Override
- public final Long getId () {
- return this.id;
- }
-
- /**
- * Id number of product
- * @param id the id number to set
- */
- @Override
- public final void setId (final Long id) {
- this.id = id;
- }
-
- /**
- * Price of product
- * @return the price
- */
- @Override
- public final float getPrice () {
- return this.price;
- }
-
- /**
- * Price of product
- * @param price the price to set
- */
- @Override
- public final void setPrice (final float price) {
- this.price = price;
- }
-
- /**
- * Title of product
- * @return the title
- */
- @Override
- public final String getTitle () {
- return this.title;
- }
-
- /**
- * Title of product
- * @param title the title to set
- */
- @Override
- public final void setTitle (final String title) {
- this.title = title;
- }
-
- /**
- * Compares two categories with each other
- *
- * @param product Product comparator
- * @return Comparison value
- */
- @Override
- public int compareTo (final Product product) {
- // Trace message
- this.getLogger().trace(MessageFormat.format("product={0} - CALLED!", product));
-
- // category should not be null
- if (product == null) {
- throw new NullPointerException("product is null");
- }
-
- // Debug message
- this.getLogger().debug(MessageFormat.format("this.id={0},product.id={1}", this.getId(), product.getId()));
-
- // Is the id the same?
- if (Objects.equals(this.getId(), product.getId())) {
- // Same id, means same category
- return 0;
- } else if (this.getId() > product.getId()) {
- // This id is larger than compared to
- return -1;
- }
-
- // The other id is larger
- return 1;
- }
-}
/**
* Compare method
* @param category Category to compare to
+ * @return Comparison value
*/
@Override
public int compareTo (final Product category);
--- /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.pizzaapplication.product.pizza;
+
+import org.mxchange.pizzaapplication.product.BaseProduct;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ * Product class for pizza application
+ *
+ * @author Roland Haeder
+ */
+public class PizzaProduct extends BaseProduct implements Product {
+
+ /**
+ * Constructor for products with a name and a price.
+ *
+ * @param id Id number of product
+ * @param title Name of product
+ * @param price Price
+ * @deprecated Please use constructor with category and available
+ */
+ @Deprecated
+ public PizzaProduct (final Long id, final String title, final Float price) {
+ // Trace message
+ this.getLogger().trace("id=" + id + ",title=" + title + ",price=" + price + " - CALLED!");
+
+ // Set all
+ this.setId(id);
+ this.setTitle(title);
+ this.setPrice(price);
+ }
+
+ /**
+ * Constructor will all required data
+ *
+ * @param id Id number of product
+ * @param title Name of product
+ * @param price Price
+ * @param category Category id
+ * @param available Availability (selectable by customer)
+ */
+ public PizzaProduct (final Long id, final String title, final Float price, final Long category, final Boolean available) {
+ // Trace message
+ this.getLogger().trace("id=" + id + ",title=" + title + ",price=" + price + ",category=" + category + ",available=" + available + " - CALLED!");
+
+ // Set all here
+ this.setId(id);
+ this.setTitle(title);
+ this.setPrice(price);
+ this.setCategory(category);
+ this.setAvailable(available);
+ }
+}