diff --git a/.ucdetector_reports/.icons/FewReference.gif b/.ucdetector_reports/.icons/FewReference.gif new file mode 100644 index 0000000..13e8b78 Binary files /dev/null and b/.ucdetector_reports/.icons/FewReference.gif differ diff --git a/.ucdetector_reports/.icons/Final.gif b/.ucdetector_reports/.icons/Final.gif new file mode 100644 index 0000000..a63b65a Binary files /dev/null and b/.ucdetector_reports/.icons/Final.gif differ diff --git a/.ucdetector_reports/.icons/Other.gif b/.ucdetector_reports/.icons/Other.gif new file mode 100644 index 0000000..f0f5d83 Binary files /dev/null and b/.ucdetector_reports/.icons/Other.gif differ diff --git a/.ucdetector_reports/.icons/Reference.gif b/.ucdetector_reports/.icons/Reference.gif new file mode 100644 index 0000000..0910ed6 Binary files /dev/null and b/.ucdetector_reports/.icons/Reference.gif differ diff --git a/.ucdetector_reports/.icons/TestOnly.gif b/.ucdetector_reports/.icons/TestOnly.gif new file mode 100644 index 0000000..f30d23a Binary files /dev/null and b/.ucdetector_reports/.icons/TestOnly.gif differ diff --git a/.ucdetector_reports/.icons/VisibilityDefault.gif b/.ucdetector_reports/.icons/VisibilityDefault.gif new file mode 100644 index 0000000..c71e22a Binary files /dev/null and b/.ucdetector_reports/.icons/VisibilityDefault.gif differ diff --git a/.ucdetector_reports/.icons/VisibilityPrivate.gif b/.ucdetector_reports/.icons/VisibilityPrivate.gif new file mode 100644 index 0000000..f35be0c Binary files /dev/null and b/.ucdetector_reports/.icons/VisibilityPrivate.gif differ diff --git a/.ucdetector_reports/.icons/VisibilityProtected.gif b/.ucdetector_reports/.icons/VisibilityProtected.gif new file mode 100644 index 0000000..8f1b320 Binary files /dev/null and b/.ucdetector_reports/.icons/VisibilityProtected.gif differ diff --git a/.ucdetector_reports/.icons/html.xslt b/.ucdetector_reports/.icons/html.xslt new file mode 100644 index 0000000..027c4a3 --- /dev/null +++ b/.ucdetector_reports/.icons/html.xslt @@ -0,0 +1,274 @@ + + + + + + + + Copyright (c) 2016 Joerg Spieler All rights reserved. This program and the + accompanying materials are made available under the terms of the Eclipse + Public License v1.0 which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + + +To create custom reports change: +ECLIPSE_HOME/dropins/org.ucdetector_*.jar/org/ucdetector/report/html.xslt + + + + + UCDetector Report + + + +

+ + UCDetector homepage + + UCDetector Report +

+ + + + + + + + + +
+

About search

+ + + + + + + + + #E6E6FA + #FFFACD + + + + + + + +
PropertyValue
+ + + +
+
+

Preferences

+ + + + + + + + + #E6E6FA + #FFFACD + + + + + + + +
PreferenceValue
+ + + +
+ preferences above are different from default prefences. +
+ +

Searched in

+ + + + + + + + + #E6E6FA + #FFFACD + + + + + + + +
ElementType
+ + + +
+ Searched: +
+ + +

Warnings

+ + + + + + + + + + + + + + + + + + #E6E6FA + #FFFACD + + + + + + + + + + + + + + + + + + + + + + + +
NrJavaMarkerDescriptionReferences**AuthorLocation*Java typeMarker type
+ + + + {javaType/@long} + + + {@markerType} + + + + + + + + + + +   + + + + + + + + + + + declaration + + + + + + + + + + + + + + + + + + +
+ + +

+* To get links to the source locations, copy and paste first column (or table) to Eclipse 'Java Stack Trace Console'

+** Set 'Detect code with max number of references' > 0

+

+ + + +

+ + Exceptions found during detection +

+
    + +
  • + + + +
    +									
    +										
    +									
    +								
    +
  • +
    +
+
+
+ +
+ Created with + UCDetector + + +
+
+ + +
+
+ diff --git a/.ucdetector_reports/.icons/j_annotation_obj.gif b/.ucdetector_reports/.icons/j_annotation_obj.gif new file mode 100644 index 0000000..435d62e Binary files /dev/null and b/.ucdetector_reports/.icons/j_annotation_obj.gif differ diff --git a/.ucdetector_reports/.icons/j_class_obj.gif b/.ucdetector_reports/.icons/j_class_obj.gif new file mode 100644 index 0000000..e4c2a83 Binary files /dev/null and b/.ucdetector_reports/.icons/j_class_obj.gif differ diff --git a/.ucdetector_reports/.icons/j_enum_obj.gif b/.ucdetector_reports/.icons/j_enum_obj.gif new file mode 100644 index 0000000..15535f5 Binary files /dev/null and b/.ucdetector_reports/.icons/j_enum_obj.gif differ diff --git a/.ucdetector_reports/.icons/j_field_public_obj.gif b/.ucdetector_reports/.icons/j_field_public_obj.gif new file mode 100644 index 0000000..d4cb425 Binary files /dev/null and b/.ucdetector_reports/.icons/j_field_public_obj.gif differ diff --git a/.ucdetector_reports/.icons/j_innerclass_public_obj.gif b/.ucdetector_reports/.icons/j_innerclass_public_obj.gif new file mode 100644 index 0000000..e4c2a83 Binary files /dev/null and b/.ucdetector_reports/.icons/j_innerclass_public_obj.gif differ diff --git a/.ucdetector_reports/.icons/j_int_obj.gif b/.ucdetector_reports/.icons/j_int_obj.gif new file mode 100644 index 0000000..2ebc46e Binary files /dev/null and b/.ucdetector_reports/.icons/j_int_obj.gif differ diff --git a/.ucdetector_reports/.icons/j_methpub_obj.gif b/.ucdetector_reports/.icons/j_methpub_obj.gif new file mode 100644 index 0000000..7d24707 Binary files /dev/null and b/.ucdetector_reports/.icons/j_methpub_obj.gif differ diff --git a/.ucdetector_reports/.icons/ucd.gif b/.ucdetector_reports/.icons/ucd.gif new file mode 100644 index 0000000..2243d81 Binary files /dev/null and b/.ucdetector_reports/.icons/ucd.gif differ diff --git a/.ucdetector_reports/.icons/ucdetector.dtd b/.ucdetector_reports/.icons/ucdetector.dtd new file mode 100644 index 0000000..bbcff40 --- /dev/null +++ b/.ucdetector_reports/.icons/ucdetector.dtd @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.ucdetector_reports/.icons/ucdetector32.png b/.ucdetector_reports/.icons/ucdetector32.png new file mode 100644 index 0000000..1b0dd47 Binary files /dev/null and b/.ucdetector_reports/.icons/ucdetector32.png differ diff --git a/.ucdetector_reports/UCDetectorReport_001.html b/.ucdetector_reports/UCDetectorReport_001.html new file mode 100644 index 0000000..50f03a0 --- /dev/null +++ b/.ucdetector_reports/UCDetectorReport_001.html @@ -0,0 +1,101 @@ + + + + + UCDetector Report + + + +

+ UCDetector homepageUCDetector Report +

+ + + + +
+

About search

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyValue
Operating systemWindows 10 - 10.0
Java14.0.2+12-46
Eclipse4.17.0.v20200902-1800
Eclipse productSpring Tool Suite 4, Version: 4.8.0.RELEASE, Build Id: 202009151856
UCDetector2.0.0
ModeDefault [built-in]
Created report2020-10-29 15:48:10
Search duration232 millis
Warnings1
+
+

Preferences

+ + + + +
PreferenceValue
+ 0 preferences above are different from default prefences. +
+

Searched in

+ + + + + + + +
ElementType
GolfScoreSourceType
+ Searched: 1
+

Warnings

+ + + + + + + + + +
NrJavaMarkerDescriptionReferences**AuthorLocation*Java typeMarker type
1ClassReferenceClass "GolfScore" has 0 references0 GolfScore.declaration(GolfScore.java:9)ClassReference
+

+ * To get links to the source locations, copy and paste first column (or table) to Eclipse 'Java Stack Trace Console' +
+ ** Set 'Detect code with max number of references' > 0 +
+

+
+ +
+ Created with UCDetector + 2.0.0
+
+ + diff --git a/.ucdetector_reports/UCDetectorReport_001.txt b/.ucdetector_reports/UCDetectorReport_001.txt new file mode 100644 index 0000000..d091d25 --- /dev/null +++ b/.ucdetector_reports/UCDetectorReport_001.txt @@ -0,0 +1,3 @@ +Created with UCDetector 2.0.0 2020-10-29 15:48:09 http://www.ucdetector.org/ Created by class: org.ucdetector.report.TextReport +Location Description Java Marker Author +GolfScore.(GolfScore.java:9) Class "GolfScore" has 0 references GolfScore org.ucdetector.analyzeMarkerReference diff --git a/screwdriver-3.5.6/.classpath b/screwdriver-3.5.6/.classpath new file mode 100644 index 0000000..03ac35c --- /dev/null +++ b/screwdriver-3.5.6/.classpath @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/.project b/screwdriver-3.5.6/.project new file mode 100644 index 0000000..14ac40b --- /dev/null +++ b/screwdriver-3.5.6/.project @@ -0,0 +1,23 @@ + + + screwdriver-3.5.6 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + diff --git a/screwdriver-3.5.6/.screwMaven/.classpath b/screwdriver-3.5.6/.screwMaven/.classpath new file mode 100644 index 0000000..c51eb12 --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.classpath @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/.screwMaven/.project b/screwdriver-3.5.6/.screwMaven/.project new file mode 100644 index 0000000..f9e9335 --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.project @@ -0,0 +1,37 @@ + + + XappnameX + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jem.workbench.JavaEMFNature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.jsdt.core.jsNature + + diff --git a/screwdriver-3.5.6/.screwMaven/.settings/.jsdtscope b/screwdriver-3.5.6/.screwMaven/.settings/.jsdtscope new file mode 100644 index 0000000..2418123 --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/.jsdtscope @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.core.resources.prefs b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..7280518 --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF8 +encoding//src/main/resources=UTF8 +encoding//src/test/java=UTF8 +encoding//src/test/resources=UTF8 +encoding/=UTF8 diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.jdt.core.prefs b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..4e4a3ad --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.m2e.core.prefs b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.component b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.component new file mode 100644 index 0000000..2f9092c --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.component @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..6d59853 --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.project.facet.core.xml b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..7e607f0 --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.jsdt.ui.superType.container b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.jsdt.ui.superType.container new file mode 100644 index 0000000..3bd5d0a --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.jsdt.ui.superType.container @@ -0,0 +1 @@ +org.eclipse.wst.jsdt.launching.baseBrowserLibrary \ No newline at end of file diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.jsdt.ui.superType.name b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.jsdt.ui.superType.name new file mode 100644 index 0000000..05bd71b --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.jsdt.ui.superType.name @@ -0,0 +1 @@ +Window \ No newline at end of file diff --git a/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.validation.prefs b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.validation.prefs new file mode 100644 index 0000000..04cad8c --- /dev/null +++ b/screwdriver-3.5.6/.screwMaven/.settings/org.eclipse.wst.validation.prefs @@ -0,0 +1,2 @@ +disabled=06target +eclipse.preferences.version=1 diff --git a/screwdriver-3.5.6/.settings/org.eclipse.core.resources.prefs b/screwdriver-3.5.6/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..f9fe345 --- /dev/null +++ b/screwdriver-3.5.6/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/screwdriver-3.5.6/.settings/org.eclipse.jdt.core.prefs b/screwdriver-3.5.6/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..71ac301 --- /dev/null +++ b/screwdriver-3.5.6/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/screwdriver-3.5.6/.settings/org.eclipse.m2e.core.prefs b/screwdriver-3.5.6/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/screwdriver-3.5.6/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/screwdriver-3.5.6/Eclipse Public License - Version 1.0.html b/screwdriver-3.5.6/Eclipse Public License - Version 1.0.html new file mode 100644 index 0000000..e484bef --- /dev/null +++ b/screwdriver-3.5.6/Eclipse Public License - Version 1.0.html @@ -0,0 +1,260 @@ + + + + + +Eclipse Public License - Version 1.0 + + + + + + +

Eclipse Public License - v 1.0

+ +

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR +DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS +AGREEMENT.

+ +

1. DEFINITIONS

+ +

"Contribution" means:

+ +

a) in the case of the initial Contributor, the initial +code and documentation distributed under this Agreement, and

+

b) in the case of each subsequent Contributor:

+

i) changes to the Program, and

+

ii) additions to the Program;

+

where such changes and/or additions to the Program +originate from and are distributed by that particular Contributor. A +Contribution 'originates' from a Contributor if it was added to the +Program by such Contributor itself or anyone acting on such +Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) +are not derivative works of the Program.

+ +

"Contributor" means any person or entity that distributes +the Program.

+ +

"Licensed Patents" mean patent claims licensable by a +Contributor which are necessarily infringed by the use or sale of its +Contribution alone or when combined with the Program.

+ +

"Program" means the Contributions distributed in accordance +with this Agreement.

+ +

"Recipient" means anyone who receives the Program under +this Agreement, including all Contributors.

+ +

2. GRANT OF RIGHTS

+ +

a) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free copyright license to reproduce, prepare derivative works +of, publicly display, publicly perform, distribute and sublicense the +Contribution of such Contributor, if any, and such derivative works, in +source code and object code form.

+ +

b) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free patent license under Licensed Patents to make, use, sell, +offer to sell, import and otherwise transfer the Contribution of such +Contributor, if any, in source code and object code form. This patent +license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, +such addition of the Contribution causes such combination to be covered +by the Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder.

+ +

c) Recipient understands that although each Contributor +grants the licenses to its Contributions set forth herein, no assurances +are provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility to +secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow Recipient +to distribute the Program, it is Recipient's responsibility to acquire +that license before distributing the Program.

+ +

d) Each Contributor represents that to its knowledge it +has sufficient copyright rights in its Contribution, if any, to grant +the copyright license set forth in this Agreement.

+ +

3. REQUIREMENTS

+ +

A Contributor may choose to distribute the Program in object code +form under its own license agreement, provided that:

+ +

a) it complies with the terms and conditions of this +Agreement; and

+ +

b) its license agreement:

+ +

i) effectively disclaims on behalf of all Contributors +all warranties and conditions, express and implied, including warranties +or conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose;

+ +

ii) effectively excludes on behalf of all Contributors +all liability for damages, including direct, indirect, special, +incidental and consequential damages, such as lost profits;

+ +

iii) states that any provisions which differ from this +Agreement are offered by that Contributor alone and not by any other +party; and

+ +

iv) states that source code for the Program is available +from such Contributor, and informs licensees how to obtain it in a +reasonable manner on or through a medium customarily used for software +exchange.

+ +

When the Program is made available in source code form:

+ +

a) it must be made available under this Agreement; and

+ +

b) a copy of this Agreement must be included with each +copy of the Program.

+ +

Contributors may not remove or alter any copyright notices contained +within the Program.

+ +

Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution.

+ +

4. COMMERCIAL DISTRIBUTION

+ +

Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use of +the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create +potential liability for other Contributors. Therefore, if a Contributor +includes the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and +indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") +arising from claims, lawsuits and other legal actions brought by a third +party against the Indemnified Contributor to the extent caused by the +acts or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In +order to qualify, an Indemnified Contributor must: a) promptly notify +the Commercial Contributor in writing of such claim, and b) allow the +Commercial Contributor to control, and cooperate with the Commercial +Contributor in, the defense and any related settlement negotiations. The +Indemnified Contributor may participate in any such claim at its own +expense.

+ +

For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages.

+ +

5. NO WARRANTY

+ +

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable laws, +damage to or loss of data, programs or equipment, and unavailability or +interruption of operations.

+ +

6. DISCLAIMER OF LIABILITY

+ +

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT +NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

+ +

7. GENERAL

+ +

If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable.

+ +

If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the +date such litigation is filed.

+ +

All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of time +after becoming aware of such noncompliance. If all Recipient's rights +under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

+ +

Everyone is permitted to copy and distribute copies of this +Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The +Agreement Steward reserves the right to publish new versions (including +revisions) of this Agreement from time to time. No one other than the +Agreement Steward has the right to modify this Agreement. The Eclipse +Foundation is the initial Agreement Steward. The Eclipse Foundation may +assign the responsibility to serve as the Agreement Steward to a +suitable separate entity. Each new version of the Agreement will be +given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version +of the Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives no +rights or licenses to the intellectual property of any Contributor under +this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved.

+ +

This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No party +to this Agreement will bring a legal action under this Agreement more +than one year after the cause of action arose. Each party waives its +rights to a jury trial in any resulting litigation.

+ + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/Leoncavallo.xml b/screwdriver-3.5.6/Leoncavallo.xml new file mode 100644 index 0000000..15653fc --- /dev/null +++ b/screwdriver-3.5.6/Leoncavallo.xml @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/MarkupsList-3.3.1.html b/screwdriver-3.5.6/MarkupsList-3.3.1.html new file mode 100644 index 0000000..700b92b --- /dev/null +++ b/screwdriver-3.5.6/MarkupsList-3.3.1.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/ReferenceManual-3.3.1.html b/screwdriver-3.5.6/ReferenceManual-3.3.1.html new file mode 100644 index 0000000..0ad81d3 --- /dev/null +++ b/screwdriver-3.5.6/ReferenceManual-3.3.1.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/TermsOfUse.txt b/screwdriver-3.5.6/TermsOfUse.txt new file mode 100644 index 0000000..b7348af --- /dev/null +++ b/screwdriver-3.5.6/TermsOfUse.txt @@ -0,0 +1,53 @@ +Definitions +Software: Any software that is made available to you +by plug-in "Drill", by the application "Screwdriver" +and all software associated to it. Your use of the +Software is governed by the terms of the end user +license agreement EPL which accompanies or is +included with the Software ("License Agreement"). + +DISCLAIMER +THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY +OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO +EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY +GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE +USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER +DEALINGS IN THIS SOFTWARE. BEING A CODE GENERATOR, +THIS DECLARATION REFERS NOT ONLY TO THE SOFTWARE +PROVIDED, BUT ALSO TO ALL THE APPLICATIONS THAT WILL +BE GENERATED BY IT. +THE FINAL USER OF "SCREWDRIVER" OWNS THE INTELLECTUAL +PROPERTIES OF THE SOFTWARE HE HAS GENERATED. + +Definizioni +Software: qualsiasi software reso disponibile dal +plug-in "Drill", dall'applicazione "Screwdriver" e da +tutto il software ad esso associato. L'utilizzo del +software è regolato dai termini del contratto di +licenza per l'utente finale LGPL che accompagna o è +incluso nel software ("Contratto di licenza"). + +DECLINAZIONE DI RESPONSABILITA' +QUESTO SOFTWARE È FORNITO "COSÌ COM'È", SENZA ALCUN +TIPO DI GARANZIA, ESPRESSA O IMPLICITA, SENZA ALCUNA +GARANZIA DI COMMERCIABILITÀ, IDONEITÀ A UN +PARTICOLARE SCOPO E SENZA DIRITTO DI COPYRIGHT, +BREVETTO, MARCHIO O ALTRO DIRITTO. IN NESSUN CASO IL +TITOLARE DEL COPYRIGHT SARÀ RESPONSABILE DI QUALSIASI +RECLAMO, DANNO O ALTRA RESPONSABILITÀ, COMPRESO +QUALSIASI DANNO GENERALE, SPECIALE, INDIRETTO, +INCIDENTALE O CONSEQUENZIALE, SIA NELL'AMBITO DI UN +CONTRATTO, SIA DI UNA CONTROVERSIA O ALTRO, DERIVANTE +DALL'UTILIZZO O DALL'IMPOSSIBILITÀ DI UTILIZZARE +QUESTO SOFTWARE. TRATTANDOSI DI UN GENERATORE DI +CODICE, QUESTA DICHIARAZIONE SI RIFERISCE NON SOLO AL +SOFTWARE FORNITO, MA ANCHE A TUTTE LE APPLICAZIONI +CHE SARANNO DA ESSO GENERATE. +L'UTENTE FINALE DI "SCREWDRIVER" DETIENE LA PROPRIETÀ +INTELLETTUALE DEL SOFTWARE CHE HA GENERATO. \ No newline at end of file diff --git a/screwdriver-3.5.6/UserGuide-3.5.1.html b/screwdriver-3.5.6/UserGuide-3.5.1.html new file mode 100644 index 0000000..bb4130d --- /dev/null +++ b/screwdriver-3.5.6/UserGuide-3.5.1.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/Versions_History.html b/screwdriver-3.5.6/Versions_History.html new file mode 100644 index 0000000..91f082a --- /dev/null +++ b/screwdriver-3.5.6/Versions_History.html @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 5.2.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 5.2.eli new file mode 100644 index 0000000..98b39f6 --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 5.2.eli @@ -0,0 +1,10 @@ +appse+JBoss EAP 5.2 +sv+3.2.13.RELEASE +mavmo+4.0.0 +mavgr+it.ramecera.ict +mv+0.0.1-SNAPSHOT +depen+2 +pompr+0 +mavco+1.7 +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 5.2.uv.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 5.2.uv.eli new file mode 100644 index 0000000..113f8dd --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 5.2.uv.eli @@ -0,0 +1,13 @@ +appse+JBoss EAP 5.2 +sv+3.2.13.RELEASE +uv+3.1.4.RELEASE +hv+3.4 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mv+0.0.1-SNAPSHOT +depen+2 +pompr+0 +mavco+1.7 +hvalid+4.2.0.Final +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4.eli new file mode 100644 index 0000000..a493ea5 --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4.eli @@ -0,0 +1,14 @@ +appse+JBoss EAP 6.4 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.7 +jeev+6.0 +hv+3.5+hjpav+1 +hvalid+4.2.0.Final +log4j+2.5 +sv+3.2.13.RELEASE +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4.uv.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4.uv.eli new file mode 100644 index 0000000..f4fc197 --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4.uv.eli @@ -0,0 +1,18 @@ +appse+JBoss EAP 6.4 +sv+3.2.13.RELEASE +uv+3.1.4.RELEASE +hv+3.5+hjpav+2 +mavmo+4.0.0 +mavbu+ +mavcp+2.3.2 +mavwa+2.1.1 +mavcl+2.3 +mavgr+it.ramecera.ict +mv+0.0.1-SNAPSHOT +depen+2 +pompr+0 +mavco+1.7 +log4j+2.5 +hvalid+4.2.0.Final +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4_s3_h3_jpa1.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4_s3_h3_jpa1.eli new file mode 100644 index 0000000..07803ea --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 6.4_s3_h3_jpa1.eli @@ -0,0 +1,18 @@ +appse+JBoss EAP 6.4 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mavbu+ +mavcp+2.3.2 +mavwa+2.1.1 +mavcl+2.3 +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.7 +jeev+6.0 +hv+3.5+hjpav+1 +hvalid+4.2.0.Final +log4j+2.5 +sv+3.2.13.RELEASE +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1.eli new file mode 100644 index 0000000..7e610aa --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1.eli @@ -0,0 +1,12 @@ +appse+JBoss EAP 7.1 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.8 +jeev+6.0 +sv+4.3.12.RELEASE +log4j+2.5 +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s3_h3_jpa1.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s3_h3_jpa1.eli new file mode 100644 index 0000000..fc293c0 --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s3_h3_jpa1.eli @@ -0,0 +1,17 @@ +appse+JBoss EAP 7.1 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mavbu+ +mavcp+2.3.2 +mavwa+2.1.1 +mavcl+2.3 +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.7 +jeev+6.0 +hv+3.5+hjpav+1 +log4j+2.5 +sv+3.2.13.RELEASE +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s4.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s4.eli new file mode 100644 index 0000000..5a54008 --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s4.eli @@ -0,0 +1,16 @@ +appse+JBoss EAP 7.1 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mavbu+ +mavcp+2.3.2 +mavwa+2.1.1 +mavcl+2.3 +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.8 +jeev+6.0 +sv+4.3.12.RELEASE +log4j+2.5 +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s4_h5_jpa2.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s4_h5_jpa2.eli new file mode 100644 index 0000000..d162c5e --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_s4_h5_jpa2.eli @@ -0,0 +1,17 @@ +appse+JBoss EAP 7.1 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mavbu+ +mavcp+2.3.2 +mavwa+2.1.1 +mavcl+2.3 +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.8 +jeev+6.0 +sv+4.3.12.RELEASE +log4j+2.5 +hv+5.1.0.Final+hjpav+2 +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_uv_s4.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_uv_s4.eli new file mode 100644 index 0000000..2eed1b8 --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_uv_s4.eli @@ -0,0 +1,11 @@ +appse+JBoss EAP 7.1 +mavgr+it.ramecera.ict +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.8 +jeev+6.0 +sv+4.3.12.RELEASE +uv+3.1.4.RELEASE +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_uv_s4_h5_jpa2.eli b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_uv_s4_h5_jpa2.eli new file mode 100644 index 0000000..83af47a --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_JBoss EAP 7.1_uv_s4_h5_jpa2.eli @@ -0,0 +1,19 @@ +appse+JBoss EAP 7.1 +mavmo+4.0.0 +mavgr+it.ramecera.ict +mavbu+ +mavcp+2.3.2 +mavwa+2.1.1 +mavcl+2.3 +mv+0.0.1-SNAPSHOT +depen+4 +pompr+0 +mavco+1.8 +jeev+6.0 +sv+4.3.12.RELEASE +log4j+2.5 +hv+5.1.0.Final+hjpav+2 +uv+3.1.4.RELEASE +sreso+ +defaulan+en +charset+UTF-8 diff --git a/screwdriver-3.5.6/box/include/primary_Tomcat 7.0.eli b/screwdriver-3.5.6/box/include/primary_Tomcat 7.0.eli new file mode 100644 index 0000000..f54ecdc --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_Tomcat 7.0.eli @@ -0,0 +1,8 @@ +appse+Tomcat 7.0 +sv+3.1.0.RELEASE +mavmo+4.0.0 +mavgr+it.ipzs +mv+0.0.1-SNAPSHOT +mavco+1.7 +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/primary_Tomcat 7.0.uv.eli b/screwdriver-3.5.6/box/include/primary_Tomcat 7.0.uv.eli new file mode 100644 index 0000000..92b262c --- /dev/null +++ b/screwdriver-3.5.6/box/include/primary_Tomcat 7.0.uv.eli @@ -0,0 +1,12 @@ +appse+Tomcat 7.0 +sv+3.1.0.RELEASE +uv+3.1.4.RELEASE +mavmo+4.0.0 +mavgr+it.ipzs +mv+0.0.1-SNAPSHOT +mavco+1.7 +htv+3.4 +depen+2 +hvalid+4.2.0.Final +sreso+ +defaulan+en \ No newline at end of file diff --git a/screwdriver-3.5.6/box/include/userpass_domain.eli b/screwdriver-3.5.6/box/include/userpass_domain.eli new file mode 100644 index 0000000..e21d116 --- /dev/null +++ b/screwdriver-3.5.6/box/include/userpass_domain.eli @@ -0,0 +1 @@ +colorform+rgb(254, 231, 234) diff --git a/screwdriver-3.5.6/box/include/userpass_simple.eli b/screwdriver-3.5.6/box/include/userpass_simple.eli new file mode 100644 index 0000000..e21d116 --- /dev/null +++ b/screwdriver-3.5.6/box/include/userpass_simple.eli @@ -0,0 +1 @@ +colorform+rgb(254, 231, 234) diff --git a/screwdriver-3.5.6/box/include/userpass_trivial.eli b/screwdriver-3.5.6/box/include/userpass_trivial.eli new file mode 100644 index 0000000..e21d116 --- /dev/null +++ b/screwdriver-3.5.6/box/include/userpass_trivial.eli @@ -0,0 +1 @@ +colorform+rgb(254, 231, 234) diff --git a/screwdriver-3.5.6/box/snippets/ViewResolver.txt b/screwdriver-3.5.6/box/snippets/ViewResolver.txt new file mode 100644 index 0000000..158b5d0 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/ViewResolver.txt @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/antisamyDepen.txt b/screwdriver-3.5.6/box/snippets/antisamyDepen.txt new file mode 100644 index 0000000..960881d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/antisamyDepen.txt @@ -0,0 +1,16 @@ + + + org.owasp.antisamy + antisamy + 1.5.3 + + + xml-apis-ext + xml-apis + + + xml-apis + xml-apis + + + diff --git a/screwdriver-3.5.6/box/snippets/cancella_extpr.txt b/screwdriver-3.5.6/box/snippets/cancella_extpr.txt new file mode 100644 index 0000000..216c287 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/cancella_extpr.txt @@ -0,0 +1,12 @@ + + + + screw_list_A + + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/cancella_hv_3.txt b/screwdriver-3.5.6/box/snippets/cancella_hv_3.txt new file mode 100644 index 0000000..7594cd8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/cancella_hv_3.txt @@ -0,0 +1,33 @@ + + + + + org.hibernate + hibernate-core + 3.3.2.GA + compile + + + org.hibernate + hibernate-annotations + 3.4.0.GA + compile + + + org.hibernate + hibernate-commons-annotations + 3.1.0.GA + compile + + + org.hibernate + hibernate-validator + 3.1.0.GA + compile + + + org.hibernate + hibernate-tools + 3.2.3.GA + compile + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/corpoDispatcherTiles_2.txt b/screwdriver-3.5.6/box/snippets/corpoDispatcherTiles_2.txt new file mode 100644 index 0000000..dbccd38 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/corpoDispatcherTiles_2.txt @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/corpoDispatcherTiles_3.txt b/screwdriver-3.5.6/box/snippets/corpoDispatcherTiles_3.txt new file mode 100644 index 0000000..9a6b951 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/corpoDispatcherTiles_3.txt @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/css/bootstrap.css b/screwdriver-3.5.6/box/snippets/css/bootstrap.css new file mode 100644 index 0000000..c70f1c8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/css/bootstrap.css @@ -0,0 +1,3277 @@ +/*! + * Bootstrap v2.0.1 + * + * Copyright 2012 Twitter, Inc + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world @twitter by @mdo and @fat. + */ +.clearfix { + *zoom: 1; +} + +.clearfix:before, .clearfix:after { + display: table; + content: ""; +} + +.clearfix:after { + clear: both; +} + +article, aside, details, figcaption, figure, footer, header, hgroup, nav, + section { + display: block; +} + +audio, canvas, video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +audio:not ([controls] ) { + display: none; +} + +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} + +a:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +a:hover, a:active { + outline: 0; +} + +sub, sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +img { + max-width: 100%; + height: auto; + border: 0; + -ms-interpolation-mode: bicubic; +} + +button, input, select, textarea { + margin: 0; + font-size: 100%; + vertical-align: middle; +} + +button, input { + *overflow: visible; + line-height: normal; +} + +button::-moz-focus-inner, input::-moz-focus-inner { + padding: 0; + border: 0; +} + +button, input[type="button"], input[type="reset"], input[type="submit"] + { + cursor: pointer; + -webkit-appearance: button; +} + +input[type="search"] { + -webkit-appearance: textfield; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button + { + -webkit-appearance: none; +} + +textarea { + overflow: auto; + vertical-align: top; +} + +body { + margin: 0; + font-family: "Verdana"; + font-size: 18px; + line-height: 32px; + color: #333333; + background-color: #ffffff; +} + +a { + color: yellow; + text-decoration: none; +} + +a:hover { + color: red; + text-decoration: underline; +} + +.row { + margin-left: -20px; + *zoom: 1; +} + +.row:before, .row:after { + display: table; + content: ""; +} + +.row:after { + clear: both; +} + +[class*="span"] { + float: left; + margin-left: 20px; +} + +.span1 { + width: 60px; +} + +.span2 { + width: 140px; +} + +.span3 { + width: 220px; +} + +.span4 { + width: 300px; +} + +.span5 { + width: 380px; +} + +.span6 { + width: 460px; +} + +.span7 { + width: 540px; +} + +.span8 { + width: 620px; +} + +.span9 { + width: 700px; +} + +.span10 { + width: 780px; +} + +.span11 { + width: 860px; +} + +.span12, .container { + width: 940px; +} + +.offset1 { + margin-left: 100px; +} + +.offset2 { + margin-left: 180px; +} + +.offset3 { + margin-left: 260px; +} + +.offset4 { + margin-left: 340px; +} + +.offset5 { + margin-left: 420px; +} + +.offset6 { + margin-left: 500px; +} + +.offset7 { + margin-left: 580px; +} + +.offset8 { + margin-left: 660px; +} + +.offset9 { + margin-left: 740px; +} + +.offset10 { + margin-left: 820px; +} + +.offset11 { + margin-left: 900px; +} + +.row-fluid { + width: 100%; + *zoom: 1; +} + +.row-fluid:before, .row-fluid:after { + display: table; + content: ""; +} + +.row-fluid:after { + clear: both; +} + +.row-fluid>[class*="span"] { + float: left; + margin-left: 2.127659574%; +} + +.row-fluid>[class*="span"]:first-child { + margin-left: 0; +} + +.row-fluid>.span1 { + width: 6.382978723%; +} + +.row-fluid>.span2 { + width: 14.89361702%; +} + +.row-fluid>.span3 { + width: 23.404255317%; +} + +.row-fluid>.span4 { + width: 31.914893614%; +} + +.row-fluid>.span5 { + width: 40.425531911%; +} + +.row-fluid>.span6 { + width: 48.93617020799999%; +} + +.row-fluid>.span7 { + width: 57.446808505%; +} + +.row-fluid>.span8 { + width: 65.95744680199999%; +} + +.row-fluid>.span9 { + width: 74.468085099%; +} + +.row-fluid>.span10 { + width: 82.97872339599999%; +} + +.row-fluid>.span11 { + width: 91.489361693%; +} + +.row-fluid>.span12 { + width: 99.99999998999999%; +} + +.container { + width: 940px; + margin-left: auto; + margin-right: auto; + *zoom: 1; +} + +.container:before, .container:after { + display: table; + content: ""; +} + +.container:after { + clear: both; +} + +.container-fluid { + padding-left: 20px; + padding-right: 20px; + *zoom: 1; +} + +.container-fluid:before, .container-fluid:after { + display: table; + content: ""; +} + +.container-fluid:after { + clear: both; +} + +p { + margin: 0 0 9px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + line-height: 18px; +} + +p small { + font-size: 11px; + color: #999999; +} + +.lead { + margin-bottom: 18px; + font-size: 20px; + font-weight: 200; + line-height: 27px; +} + +h1, h2, h3, h4, h5, h6 { + margin: 1px; + font-weight: bold; + color: #333333; + text-rendering: optimizelegibility; +} + +h1 small, h2 small, h3 small, h4 small, h5 small, h6 small { + font-weight: normal; + color: #999999; +} + +h1 { + font-size: 30px; + line-height: 36px; +} + +h1 small { + font-size: 18px; +} + +h2 { + font-size: 24px; + line-height: 36px; +} + +h2 small { + font-size: 18px; +} + +h3 { + line-height: 27px; + font-size: 18px; +} + +h3 small { + font-size: 14px; +} + +h4, h5, h6 { + line-height: 18px; +} + +h4 { + font-size: 14px; +} + +h4 small { + font-size: 12px; +} + +h5 { + font-size: 12px; +} + +h6 { + font-size: 11px; + color: #999999; + text-transform: uppercase; +} + +.page-header { + padding-bottom: 17px; + margin: 18px 0; + border-bottom: 1px solid #eeeeee; +} + +.page-header h1 { + line-height: 1; +} + +ul, ol { + padding: 0; + margin: 0 0 9px 25px; +} + +ul ul, ul ol, ol ol, ol ul { + margin-bottom: 0; +} + +ul { + list-style: disc; +} + +ol { + list-style: decimal; +} + +li { + line-height: 24px; +} + +ul.unstyled, ol.unstyled { + margin-left: 0; + list-style: none; +} + +dl { + margin-bottom: 18px; +} + +dt, dd { + line-height: 18px; +} + +dt { + font-weight: bold; +} + +dd { + margin-left: 9px; +} + +hr { + margin: 18px 0; + border: 0; + border-top: 1px solid #eeeeee; + border-bottom: 1px solid #ffffff; +} + +strong { + font-weight: bold; +} + +em { + font-style: italic; +} + +.muted { + color: #999999; +} + +abbr { + font-size: 90%; + text-transform: uppercase; + border-bottom: 1px dotted #ddd; + cursor: help; +} + +blockquote { + padding: 0 0 0 15px; + margin: 0 0 18px; + border-left: 5px solid #eeeeee; +} + +blockquote p { + margin-bottom: 0; + font-size: 16px; + font-weight: 300; + line-height: 22.5px; +} + +blockquote small { + display: block; + line-height: 18px; + color: #999999; +} + +blockquote small:before { + content: '\2014 \00A0'; +} + +blockquote.pull-right { + float: right; + padding-left: 0; + padding-right: 15px; + border-left: 0; + border-right: 5px solid #eeeeee; +} + +blockquote.pull-right p, blockquote.pull-right small { + text-align: right; +} + +q:before, q:after, blockquote:before, blockquote:after { + content: ""; +} + +address { + display: block; + margin-bottom: 18px; + line-height: 18px; + font-style: normal; +} + +small { + font-size: 100%; +} + +cite { + font-style: normal; +} + +code, pre { + padding: 0 3px 2px; + font-family: Menlo, Monaco, "Courier New", monospace; + font-size: 12px; + color: #333333; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +code { + padding: 3px 4px; + color: #d14; + background-color: #f7f7f9; + border: 1px solid #e1e1e8; +} + +pre { + display: block; + padding: 8.5px; + margin: 0 0 9px; + font-size: 12px; + line-height: 18px; + background-color: #f5f5f5; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, 0.15); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + white-space: pre; + white-space: pre-wrap; + word-break: break-all; + word-wrap: break-word; +} + +pre.prettyprint { + margin-bottom: 18px; +} + +pre code { + padding: 0; + color: inherit; + background-color: transparent; + border: 0; +} + +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; +} + +.label { + padding: 2px 4px 3px; + font-size: 11.049999999999999px; + font-weight: bold; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #999999; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +.label:hover { + color: #ffffff; + text-decoration: none; +} + +.label-important { + background-color: #b94a48; +} + +.label-important:hover { + background-color: #953b39; +} + +.label-warning { + background-color: #f89406; +} + +.label-warning:hover { + background-color: #c67605; +} + +.label-success { + background-color: #468847; +} + +.label-success:hover { + background-color: #356635; +} + +.label-info { + background-color: #3a87ad; +} + +.label-info:hover { + background-color: #2d6987; +} + +table { + max-width: 100%; + border-collapse: collapse; + border-spacing: 0; +} + +.table { + width: 100%; + margin-bottom: 18px; +} + +.table th, .table td { + padding: 8px; + line-height: 18px; + text-align: left; + vertical-align: top; + border-top: 1px solid #ddd; +} + +.table th { + font-weight: bold; +} + +.table thead th { + vertical-align: bottom; +} + +.table thead:first-child tr th, .table thead:first-child tr td { + border-top: 0; +} + +.table tbody+tbody { + border-top: 2px solid #ddd; +} + +.table-condensed th, .table-condensed td { + padding: 4px 5px; +} + +.table-bordered { + border: 1px solid #ddd; + border-collapse: separate; + *border-collapse: collapsed; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.table-bordered th+th, .table-bordered td+td, .table-bordered th+td, + .table-bordered td+th { + border-left: 1px solid #ddd; +} + +.table-bordered thead:first-child tr:first-child th, .table-bordered tbody:first-child tr:first-child th, + .table-bordered tbody:first-child tr:first-child td { + border-top: 0; +} + +.table-bordered thead:first-child tr:first-child th:first-child, + .table-bordered tbody:first-child tr:first-child td:first-child { + -webkit-border-radius: 4px 0 0 0; + -moz-border-radius: 4px 0 0 0; + border-radius: 4px 0 0 0; +} + +.table-bordered thead:first-child tr:first-child th:last-child, + .table-bordered tbody:first-child tr:first-child td:last-child { + -webkit-border-radius: 0 4px 0 0; + -moz-border-radius: 0 4px 0 0; + border-radius: 0 4px 0 0; +} + +.table-bordered thead:last-child tr:last-child th:first-child, + .table-bordered tbody:last-child tr:last-child td:first-child { + -webkit-border-radius: 0 0 0 4px; + -moz-border-radius: 0 0 0 4px; + border-radius: 0 0 0 4px; +} + +.table-bordered thead:last-child tr:last-child th:last-child, + .table-bordered tbody:last-child tr:last-child td:last-child { + -webkit-border-radius: 0 0 4px 0; + -moz-border-radius: 0 0 4px 0; + border-radius: 0 0 4px 0; +} + +.table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th + { + background-color: #f9f9f9; +} + +.table tbody tr:hover td, .table tbody tr:hover th { + background-color: #f5f5f5; +} + +table .span1 { + float: none; + width: 44px; + margin-left: 0; +} + +table .span2 { + float: none; + width: 124px; + margin-left: 0; +} + +table .span3 { + float: none; + width: 204px; + margin-left: 0; +} + +table .span4 { + float: none; + width: 284px; + margin-left: 0; +} + +table .span5 { + float: none; + width: 364px; + margin-left: 0; +} + +table .span6 { + float: none; + width: 444px; + margin-left: 0; +} + +table .span7 { + float: none; + width: 524px; + margin-left: 0; +} + +table .span8 { + float: none; + width: 604px; + margin-left: 0; +} + +table .span9 { + float: none; + width: 684px; + margin-left: 0; +} + +table .span10 { + float: none; + width: 764px; + margin-left: 0; +} + +table .span11 { + float: none; + width: 844px; + margin-left: 0; +} + +table .span12 { + float: none; + width: 924px; + margin-left: 0; +} + +form { + margin: 0 0 18px; +} + +fieldset { + padding: 0; + margin: 0; + border: 0; +} + +legend { + display: block; + width: 100%; + padding: 0; + margin-bottom: 27px; + font-size: 19.5px; + line-height: 36px; + color: #333333; + border: 0; + border-bottom: 1px solid #eee; +} + +legend small { + font-size: 13.5px; + color: #999999; +} + +label, input, button, select, textarea { + font-size: 13px; + font-weight: normal; + line-height: 18px; +} + +input, button, select, textarea { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} + +label { + display: block; + margin-bottom: 5px; + color: #333333; +} + +input, textarea, select, .uneditable-input { + display: inline-block; + width: 210px; + height: 22px; + padding: 4px; + margin-bottom: 9px; + font-size: 13px; + line-height: 18px; + color: #555555; + border: 1px solid #ccc; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} + +.uneditable-textarea { + width: auto; + height: auto; +} + +label input, label textarea, label select { + display: block; +} + +input[type="image"], input[type="checkbox"], input[type="radio"] { + width: auto; + height: auto; + padding: 0; + margin: 3px 0; + *margin-top: 0; + /* IE7 */ + line-height: normal; + cursor: pointer; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + border: 0 \9; + /* IE9 and down */ +} + +input[type="image"] { + border: 0; +} + +input[type="file"] { + width: auto; + padding: initial; + line-height: initial; + border: initial; + background-color: #ffffff; + background-color: initial; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +input[type="button"], input[type="reset"], input[type="submit"] { + width: auto; + height: auto; +} + +select, input[type="file"] { + height: 28px; + /* In IE7, the height of the select element cannot be changed by height, only font-size */ + *margin-top: 4px; + /* For IE7, add top margin to align select with labels */ + line-height: 28px; +} + +input[type="file"] { + line-height: 18px \9; +} + +select { + width: 220px; + background-color: #ffffff; +} + +select[multiple], select[size] { + height: auto; +} + +input[type="image"] { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +textarea { + height: auto; +} + +input[type="hidden"] { + display: none; +} + +.radio, .checkbox { + padding-left: 18px; +} + +.radio input[type="radio"], .checkbox input[type="checkbox"] { + float: left; + margin-left: -18px; +} + +.controls>.radio:first-child, .controls>.checkbox:first-child { + padding-top: 5px; +} + +.radio.inline, .checkbox.inline { + display: inline-block; + padding-top: 5px; + margin-bottom: 0; + vertical-align: middle; +} + +.radio.inline+.radio.inline, .checkbox.inline+.checkbox.inline { + margin-left: 10px; +} + +input, textarea { + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-transition: border linear 0.2s, box-shadow linear 0.2s; + -moz-transition: border linear 0.2s, box-shadow linear 0.2s; + -ms-transition: border linear 0.2s, box-shadow linear 0.2s; + -o-transition: border linear 0.2s, box-shadow linear 0.2s; + transition: border linear 0.2s, box-shadow linear 0.2s; +} + +input:focus, textarea:focus { + border-color: rgba(82, 168, 236, 0.8); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px + rgba(82, 168, 236, 0.6); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px + rgba(82, 168, 236, 0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px + rgba(82, 168, 236, 0.6); + outline: 0; + outline: thin dotted \9; + /* IE6-9 */ +} + +input[type="file"]:focus, input[type="radio"]:focus, input[type="checkbox"]:focus, + select:focus { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +.input-mini { + width: 60px; +} + +.input-small { + width: 90px; +} + +.input-medium { + width: 150px; +} + +.input-large { + width: 210px; +} + +.input-xlarge { + width: 270px; +} + +.input-xxlarge { + width: 530px; +} + +input[class*="span"], select[class*="span"], textarea[class*="span"], + .uneditable-input { + float: none; + margin-left: 0; +} + +input.span1, textarea.span1, .uneditable-input.span1 { + width: 50px; +} + +input.span2, textarea.span2, .uneditable-input.span2 { + width: 130px; +} + +input.span3, textarea.span3, .uneditable-input.span3 { + width: 210px; +} + +input.span4, textarea.span4, .uneditable-input.span4 { + width: 290px; +} + +input.span5, textarea.span5, .uneditable-input.span5 { + width: 370px; +} + +input.span6, textarea.span6, .uneditable-input.span6 { + width: 450px; +} + +input.span7, textarea.span7, .uneditable-input.span7 { + width: 530px; +} + +input.span8, textarea.span8, .uneditable-input.span8 { + width: 610px; +} + +input.span9, textarea.span9, .uneditable-input.span9 { + width: 690px; +} + +input.span10, textarea.span10, .uneditable-input.span10 { + width: 770px; +} + +input.span11, textarea.span11, .uneditable-input.span11 { + width: 850px; +} + +input.span12, textarea.span12, .uneditable-input.span12 { + width: 930px; +} + +input[disabled], select[disabled], textarea[disabled], input[readonly], + select[readonly], textarea[readonly] { + background-color: #f5f5f5; + border-color: #ddd; + cursor: not-allowed; +} + +.control-group.warning>label, .control-group.warning .help-block, + .control-group.warning .help-inline { + color: #c09853; +} + +.control-group.warning input, .control-group.warning select, + .control-group.warning textarea { + color: #c09853; + border-color: #c09853; +} + +.control-group.warning input:focus, .control-group.warning select:focus, + .control-group.warning textarea:focus { + border-color: #a47e3c; + -webkit-box-shadow: 0 0 6px #dbc59e; + -moz-box-shadow: 0 0 6px #dbc59e; + box-shadow: 0 0 6px #dbc59e; +} + +.control-group.warning .input-prepend .add-on, .control-group.warning .input-append .add-on + { + color: #c09853; + background-color: #fcf8e3; + border-color: #c09853; +} + +.control-group.error>label, .control-group.error .help-block, + .control-group.error .help-inline { + color: #b94a48; +} + +.control-group.error input, .control-group.error select, .control-group.error textarea + { + color: #b94a48; + border-color: #b94a48; +} + +.control-group.error input:focus, .control-group.error select:focus, + .control-group.error textarea:focus { + border-color: #953b39; + -webkit-box-shadow: 0 0 6px #d59392; + -moz-box-shadow: 0 0 6px #d59392; + box-shadow: 0 0 6px #d59392; +} + +.control-group.error .input-prepend .add-on, .control-group.error .input-append .add-on + { + color: #b94a48; + background-color: #f2dede; + border-color: #b94a48; +} + +.control-group.success>label, .control-group.success .help-block, + .control-group.success .help-inline { + color: #468847; +} + +.control-group.success input, .control-group.success select, + .control-group.success textarea { + color: #468847; + border-color: #468847; +} + +.control-group.success input:focus, .control-group.success select:focus, + .control-group.success textarea:focus { + border-color: #356635; + -webkit-box-shadow: 0 0 6px #7aba7b; + -moz-box-shadow: 0 0 6px #7aba7b; + box-shadow: 0 0 6px #7aba7b; +} + +.control-group.success .input-prepend .add-on, .control-group.success .input-append .add-on + { + color: #468847; + background-color: #dff0d8; + border-color: #468847; +} + +input:focus:required:invalid, textarea:focus:required:invalid, select:focus:required:invalid + { + color: #b94a48; + border-color: #ee5f5b; +} + +input:focus:required:invalid:focus, textarea:focus:required:invalid:focus, + select:focus:required:invalid:focus { + border-color: #e9322d; + -webkit-box-shadow: 0 0 6px #f8b9b7; + -moz-box-shadow: 0 0 6px #f8b9b7; + box-shadow: 0 0 6px #f8b9b7; +} + +.form-actions { + padding: 17px 20px 18px; + margin-top: 18px; + margin-bottom: 18px; + background-color: +backformaction+; + border-top: 1px solid #ddd; +} + +.uneditable-input { + display: block; + background-color: #ffffff; + border-color: #eee; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025); + cursor: not-allowed; +} + +:-moz-placeholder { + color: #999999; +} + +::-webkit-input-placeholder { + color: #999999; +} + +.help-block { + display: block; + margin-top: 5px; + margin-bottom: 0; + color: #999999; +} + +.help-inline { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + *zoom: 1; + margin-bottom: 9px; + vertical-align: middle; + padding-left: 5px; +} + +.input-prepend, .input-append { + margin-bottom: 5px; + *zoom: 1; +} + +.input-prepend:before, .input-append:before, .input-prepend:after, + .input-append:after { + display: table; + content: ""; +} + +.input-prepend:after, .input-append:after { + clear: both; +} + +.input-prepend input, .input-append input, .input-prepend .uneditable-input, + .input-append .uneditable-input { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +.input-prepend input:focus, .input-append input:focus, .input-prepend .uneditable-input:focus, + .input-append .uneditable-input:focus { + position: relative; + z-index: 2; +} + +.input-prepend .uneditable-input, .input-append .uneditable-input { + border-left-color: #ccc; +} + +.input-prepend .add-on, .input-append .add-on { + float: left; + display: block; + width: auto; + min-width: 16px; + height: 18px; + margin-right: -1px; + padding: 4px 5px; + font-weight: normal; + line-height: 18px; + color: #999999; + text-align: center; + text-shadow: 0 1px 0 #ffffff; + background-color: #f5f5f5; + border: 1px solid #ccc; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.input-prepend .active, .input-append .active { + background-color: #a9dba9; + border-color: #46a546; +} + +.input-prepend .add-on { + *margin-top: 1px; + /* IE6-7 */ +} + +.input-append input, .input-append .uneditable-input { + float: left; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.input-append .uneditable-input { + border-left-color: #eee; + border-right-color: #ccc; +} + +.input-append .add-on { + margin-right: 0; + margin-left: -1px; + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +.input-append input:first-child { + *margin-left: -160px; +} + +.input-append input:first-child+.add-on { + *margin-left: -21px; +} + +.search-query { + padding-left: 14px; + padding-right: 14px; + margin-bottom: 0; + -webkit-border-radius: 14px; + -moz-border-radius: 14px; + border-radius: 14px; +} + +.form-search input, .form-inline input, .form-horizontal input, + .form-search textarea, .form-inline textarea, .form-horizontal textarea, + .form-search select, .form-inline select, .form-horizontal select, + .form-search .help-inline, .form-inline .help-inline, .form-horizontal .help-inline, + .form-search .uneditable-input, .form-inline .uneditable-input, + .form-horizontal .uneditable-input { + display: inline-block; + margin-bottom: 0; +} + +.form-search .hide, .form-inline .hide, .form-horizontal .hide { + display: none; +} + +.form-search label, .form-inline label, .form-search .input-append, + .form-inline .input-append, .form-search .input-prepend, .form-inline .input-prepend + { + display: inline-block; +} + +.form-search .input-append .add-on, .form-inline .input-prepend .add-on, + .form-search .input-append .add-on, .form-inline .input-prepend .add-on + { + vertical-align: middle; +} + +.form-search .radio, .form-inline .radio, .form-search .checkbox, + .form-inline .checkbox { + margin-bottom: 0; + vertical-align: middle; +} + +.control-group { + margin-bottom: 9px; +} + +legend+.control-group { + margin-top: 18px; + -webkit-margin-top-collapse: separate; +} + +.form-horizontal .control-group { + margin-bottom: 18px; + *zoom: 1; +} + +.form-horizontal .control-group:before, .form-horizontal .control-group:after + { + display: table; + content: ""; +} + +.form-horizontal .control-group:after { + clear: both; +} + +.form-horizontal .control-label { + float: left; + width: 140px; + padding-top: 5px; + text-align: right; +} + +.form-horizontal .controls { + margin-left: 160px; +} + +.form-horizontal .form-actions { + padding-left: 160px; +} + +.btn { + display: inline-block; + padding: 4px 10px 4px; + margin-bottom: 0; + font-size: 13px; + line-height: 18px; + color: #333333; + text-align: center; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + vertical-align: middle; + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), + to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(top, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', + endColorstr='#e6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); + border: 1px solid #ccc; + border-bottom-color: #bbb; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px + rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px + rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px + rgba(0, 0, 0, 0.05); + cursor: pointer; + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); + *margin-left: .3em; +} + +.btn:hover, .btn:active, .btn.active, .btn.disabled, .btn[disabled] { + background-color: #e6e6e6; +} + +.btn:active, .btn.active { + background-color: #cccccc \9; +} + +.btn:first-child { + *margin-left: 0; +} + +.btn:hover { + color: #333333; + text-decoration: none; + background-color: #e6e6e6; + background-position: 0 -15px; + -webkit-transition: background-position 0.1s linear; + -moz-transition: background-position 0.1s linear; + -ms-transition: background-position 0.1s linear; + -o-transition: background-position 0.1s linear; + transition: background-position 0.1s linear; +} + +.btn:focus { + outline: thin dotted #333; + outline: 5px auto -webkit-focus-ring-color; + outline-offset: -2px; +} + +.btn.active, .btn:active { + background-image: none; + -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px + rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px + rgba(0, 0, 0, 0.05); + box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px + rgba(0, 0, 0, 0.05); + background-color: #e6e6e6; + background-color: #d9d9d9 \9; + outline: 0; +} + +.btn.disabled, .btn[disabled] { + cursor: default; + background-image: none; + background-color: #e6e6e6; + opacity: 0.65; + filter: alpha(opacity = 65); + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + +.btn-large { + padding: 9px 14px; + font-size: 15px; + line-height: normal; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.btn-large [class^="icon-"] { + margin-top: 1px; +} + +.btn-small { + padding: 5px 9px; + font-size: 11px; + line-height: 16px; +} + +.btn-small [class^="icon-"] { + margin-top: -1px; +} + +.btn-mini { + padding: 2px 6px; + font-size: 11px; + line-height: 14px; +} + +.btn-primary, .btn-primary:hover, .btn-warning, .btn-warning:hover, + .btn-danger, .btn-danger:hover, .btn-success, .btn-success:hover, + .btn-info, .btn-info:hover, .btn-inverse, .btn-inverse:hover { + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + color: #ffffff; +} + +.btn-primary.active, .btn-warning.active, .btn-danger.active, + .btn-success.active, .btn-info.active, .btn-dark.active { + color: rgba(255, 255, 255, 0.75); +} + +.btn-primary { + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #0088cc, #0044cc); + background-image: -ms-linear-gradient(top, #0088cc, #0044cc); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), + to(#0044cc)); + background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); + background-image: -o-linear-gradient(top, #0088cc, #0044cc); + background-image: linear-gradient(top, #0088cc, #0044cc); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', + endColorstr='#0044cc', GradientType=0); + border-color: #0044cc #0044cc #002a80; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); +} + +.btn-primary:hover, .btn-primary:active, .btn-primary.active, + .btn-primary.disabled, .btn-primary[disabled] { + background-color: #0044cc; +} + +.btn-primary:active, .btn-primary.active { + background-color: #003399 \9; +} + +.btn-warning { + background-color: #faa732; + background-image: -moz-linear-gradient(top, #fbb450, #f89406); + background-image: -ms-linear-gradient(top, #fbb450, #f89406); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fbb450), + to(#f89406)); + background-image: -webkit-linear-gradient(top, #fbb450, #f89406); + background-image: -o-linear-gradient(top, #fbb450, #f89406); + background-image: linear-gradient(top, #fbb450, #f89406); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fbb450', + endColorstr='#f89406', GradientType=0); + border-color: #f89406 #f89406 #ad6704; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); +} + +.btn-warning:hover, .btn-warning:active, .btn-warning.active, + .btn-warning.disabled, .btn-warning[disabled] { + background-color: #f89406; +} + +.btn-warning:active, .btn-warning.active { + background-color: #c67605 \9; +} + +.btn-danger { + background-color: #da4f49; + background-image: -moz-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -ms-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ee5f5b), + to(#bd362f)); + background-image: -webkit-linear-gradient(top, #ee5f5b, #bd362f); + background-image: -o-linear-gradient(top, #ee5f5b, #bd362f); + background-image: linear-gradient(top, #ee5f5b, #bd362f); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ee5f5b', + endColorstr='#bd362f', GradientType=0); + border-color: #bd362f #bd362f #802420; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); +} + +.btn-danger:hover, .btn-danger:active, .btn-danger.active, .btn-danger.disabled, + .btn-danger[disabled] { + background-color: #bd362f; +} + +.btn-danger:active, .btn-danger.active { + background-color: #942a25 \9; +} + +.btn-success { + background-color: #5bb75b; + background-image: -moz-linear-gradient(top, #62c462, #51a351); + background-image: -ms-linear-gradient(top, #62c462, #51a351); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#62c462), + to(#51a351)); + background-image: -webkit-linear-gradient(top, #62c462, #51a351); + background-image: -o-linear-gradient(top, #62c462, #51a351); + background-image: linear-gradient(top, #62c462, #51a351); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#62c462', + endColorstr='#51a351', GradientType=0); + border-color: #51a351 #51a351 #387038; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); +} + +.btn-success:hover, .btn-success:active, .btn-success.active, + .btn-success.disabled, .btn-success[disabled] { + background-color: #51a351; +} + +.btn-success:active, .btn-success.active { + background-color: #408140 \9; +} + +.btn-info { + background-color: #49afcd; + background-image: -moz-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -ms-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5bc0de), + to(#2f96b4)); + background-image: -webkit-linear-gradient(top, #5bc0de, #2f96b4); + background-image: -o-linear-gradient(top, #5bc0de, #2f96b4); + background-image: linear-gradient(top, #5bc0de, #2f96b4); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5bc0de', + endColorstr='#2f96b4', GradientType=0); + border-color: #2f96b4 #2f96b4 #1f6377; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); +} + +.btn-info:hover, .btn-info:active, .btn-info.active, .btn-info.disabled, + .btn-info[disabled] { + background-color: #2f96b4; +} + +.btn-info:active, .btn-info.active { + background-color: #24748c \9; +} + +.btn-inverse { + background-color: #393939; + background-image: -moz-linear-gradient(top, #454545, #262626); + background-image: -ms-linear-gradient(top, #454545, #262626); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#454545), + to(#262626)); + background-image: -webkit-linear-gradient(top, #454545, #262626); + background-image: -o-linear-gradient(top, #454545, #262626); + background-image: linear-gradient(top, #454545, #262626); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#454545', + endColorstr='#262626', GradientType=0); + border-color: #262626 #262626 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); +} + +.btn-inverse:hover, .btn-inverse:active, .btn-inverse.active, + .btn-inverse.disabled, .btn-inverse[disabled] { + background-color: #262626; +} + +.btn-inverse:active, .btn-inverse.active { + background-color: #0c0c0c \9; +} + +button.btn, input[type="submit"].btn { + *padding-top: 2px; + *padding-bottom: 2px; +} + +button.btn::-moz-focus-inner, input[type="submit"].btn::-moz-focus-inner + { + padding: 0; + border: 0; +} + +button.btn.large, input[type="submit"].btn.large { + *padding-top: 7px; + *padding-bottom: 7px; +} + +button.btn.small, input[type="submit"].btn.small { + *padding-top: 3px; + *padding-bottom: 3px; +} + +[class^="icon-"], [class*=" icon-"] { + display: inline-block; + width: 14px; + height: 14px; + line-height: 14px; + vertical-align: text-top; + background-image: url("../img/glyphicons-halflings.png"); + background-position: 14px 14px; + background-repeat: no-repeat; + *margin-right: .3em; +} + +[class^="icon-"]:last-child, [class*=" icon-"]:last-child { + *margin-left: 0; +} + +.icon-white { + background-image: url("../img/glyphicons-halflings-white.png"); +} + +.icon-glass { + background-position: 0 0; +} + +.icon-music { + background-position: -24px 0; +} + +.icon-search { + background-position: -48px 0; +} + +.icon-envelope { + background-position: -72px 0; +} + +.icon-heart { + background-position: -96px 0; +} + +.icon-star { + background-position: -120px 0; +} + +.icon-star-empty { + background-position: -144px 0; +} + +.icon-user { + background-position: -168px 0; +} + +.icon-film { + background-position: -192px 0; +} + +.icon-th-large { + background-position: -216px 0; +} + +.icon-th { + background-position: -240px 0; +} + +.icon-th-list { + background-position: -264px 0; +} + +.icon-ok { + background-position: -288px 0; +} + +.icon-remove { + background-position: -312px 0; +} + +.icon-zoom-in { + background-position: -336px 0; +} + +.icon-zoom-out { + background-position: -360px 0; +} + +.icon-off { + background-position: -384px 0; +} + +.icon-signal { + background-position: -408px 0; +} + +.icon-cog { + background-position: -432px 0; +} + +.icon-trash { + background-position: -456px 0; +} + +.icon-home { + background-position: 0 -24px; +} + +.icon-file { + background-position: -24px -24px; +} + +.icon-time { + background-position: -48px -24px; +} + +.icon-road { + background-position: -72px -24px; +} + +.icon-download-alt { + background-position: -96px -24px; +} + +.icon-download { + background-position: -120px -24px; +} + +.icon-upload { + background-position: -144px -24px; +} + +.icon-inbox { + background-position: -168px -24px; +} + +.icon-play-circle { + background-position: -192px -24px; +} + +.icon-repeat { + background-position: -216px -24px; +} + +.icon-refresh { + background-position: -240px -24px; +} + +.icon-list-alt { + background-position: -264px -24px; +} + +.icon-lock { + background-position: -287px -24px; +} + +.icon-flag { + background-position: -312px -24px; +} + +.icon-headphones { + background-position: -336px -24px; +} + +.icon-volume-off { + background-position: -360px -24px; +} + +.icon-volume-down { + background-position: -384px -24px; +} + +.icon-volume-up { + background-position: -408px -24px; +} + +.icon-qrcode { + background-position: -432px -24px; +} + +.icon-barcode { + background-position: -456px -24px; +} + +.icon-tag { + background-position: 0 -48px; +} + +.icon-tags { + background-position: -25px -48px; +} + +.icon-book { + background-position: -48px -48px; +} + +.icon-bookmark { + background-position: -72px -48px; +} + +.icon-print { + background-position: -96px -48px; +} + +.icon-camera { + background-position: -120px -48px; +} + +.icon-font { + background-position: -144px -48px; +} + +.icon-bold { + background-position: -167px -48px; +} + +.icon-italic { + background-position: -192px -48px; +} + +.icon-text-height { + background-position: -216px -48px; +} + +.icon-text-width { + background-position: -240px -48px; +} + +.icon-align-left { + background-position: -264px -48px; +} + +.icon-align-center { + background-position: -288px -48px; +} + +.icon-align-right { + background-position: -312px -48px; +} + +.icon-align-justify { + background-position: -336px -48px; +} + +.icon-list { + background-position: -360px -48px; +} + +.icon-indent-left { + background-position: -384px -48px; +} + +.icon-indent-right { + background-position: -408px -48px; +} + +.icon-facetime-video { + background-position: -432px -48px; +} + +.icon-picture { + background-position: -456px -48px; +} + +.icon-pencil { + background-position: 0 -72px; +} + +.icon-map-marker { + background-position: -24px -72px; +} + +.icon-adjust { + background-position: -48px -72px; +} + +.icon-tint { + background-position: -72px -72px; +} + +.icon-edit { + background-position: -96px -72px; +} + +.icon-share { + background-position: -120px -72px; +} + +.icon-check { + background-position: -144px -72px; +} + +.icon-move { + background-position: -168px -72px; +} + +.icon-step-backward { + background-position: -192px -72px; +} + +.icon-fast-backward { + background-position: -216px -72px; +} + +.icon-backward { + background-position: -240px -72px; +} + +.icon-play { + background-position: -264px -72px; +} + +.icon-pause { + background-position: -288px -72px; +} + +.icon-stop { + background-position: -312px -72px; +} + +.icon-forward { + background-position: -336px -72px; +} + +.icon-fast-forward { + background-position: -360px -72px; +} + +.icon-step-forward { + background-position: -384px -72px; +} + +.icon-eject { + background-position: -408px -72px; +} + +.icon-chevron-left { + background-position: -432px -72px; +} + +.icon-chevron-right { + background-position: -456px -72px; +} + +.icon-plus-sign { + background-position: 0 -96px; +} + +.icon-minus-sign { + background-position: -24px -96px; +} + +.icon-remove-sign { + background-position: -48px -96px; +} + +.icon-ok-sign { + background-position: -72px -96px; +} + +.icon-question-sign { + background-position: -96px -96px; +} + +.icon-info-sign { + background-position: -120px -96px; +} + +.icon-screenshot { + background-position: -144px -96px; +} + +.icon-remove-circle { + background-position: -168px -96px; +} + +.icon-ok-circle { + background-position: -192px -96px; +} + +.icon-ban-circle { + background-position: -216px -96px; +} + +.icon-arrow-left { + background-position: -240px -96px; +} + +.icon-arrow-right { + background-position: -264px -96px; +} + +.icon-arrow-up { + background-position: -289px -96px; +} + +.icon-arrow-down { + background-position: -312px -96px; +} + +.icon-share-alt { + background-position: -336px -96px; +} + +.icon-resize-full { + background-position: -360px -96px; +} + +.icon-resize-small { + background-position: -384px -96px; +} + +.icon-plus { + background-position: -408px -96px; +} + +.icon-minus { + background-position: -433px -96px; +} + +.icon-asterisk { + background-position: -456px -96px; +} + +.icon-exclamation-sign { + background-position: 0 -120px; +} + +.icon-gift { + background-position: -24px -120px; +} + +.icon-leaf { + background-position: -48px -120px; +} + +.icon-fire { + background-position: -72px -120px; +} + +.icon-eye-open { + background-position: -96px -120px; +} + +.icon-eye-close { + background-position: -120px -120px; +} + +.icon-warning-sign { + background-position: -144px -120px; +} + +.icon-plane { + background-position: -168px -120px; +} + +.icon-calendar { + background-position: -192px -120px; +} + +.icon-random { + background-position: -216px -120px; +} + +.icon-comment { + background-position: -240px -120px; +} + +.icon-magnet { + background-position: -264px -120px; +} + +.icon-chevron-up { + background-position: -288px -120px; +} + +.icon-chevron-down { + background-position: -313px -119px; +} + +.icon-retweet { + background-position: -336px -120px; +} + +.icon-shopping-cart { + background-position: -360px -120px; +} + +.icon-folder-close { + background-position: -384px -120px; +} + +.icon-folder-open { + background-position: -408px -120px; +} + +.icon-resize-vertical { + background-position: -432px -119px; +} + +.icon-resize-horizontal { + background-position: -456px -118px; +} + +.btn-group { + position: relative; + *zoom: 1; + *margin-left: .3em; +} + +.btn-group:before, .btn-group:after { + display: table; + content: ""; +} + +.btn-group:after { + clear: both; +} + +.btn-group:first-child { + *margin-left: 0; +} + +.btn-group+.btn-group { + margin-left: 5px; +} + +.btn-toolbar { + margin-top: 9px; + margin-bottom: 9px; +} + +.btn-toolbar .btn-group { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + *zoom: 1; +} + +.btn-group .btn { + position: relative; + float: left; + margin-left: -1px; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.btn-group .btn:first-child { + margin-left: 0; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + border-top-left-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + border-bottom-left-radius: 4px; +} + +.btn-group .btn:last-child, .btn-group .dropdown-toggle { + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; + border-top-right-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; + border-bottom-right-radius: 4px; +} + +.btn-group .btn.large:first-child { + margin-left: 0; + -webkit-border-top-left-radius: 6px; + -moz-border-radius-topleft: 6px; + border-top-left-radius: 6px; + -webkit-border-bottom-left-radius: 6px; + -moz-border-radius-bottomleft: 6px; + border-bottom-left-radius: 6px; +} + +.btn-group .btn.large:last-child, .btn-group .large.dropdown-toggle { + -webkit-border-top-right-radius: 6px; + -moz-border-radius-topright: 6px; + border-top-right-radius: 6px; + -webkit-border-bottom-right-radius: 6px; + -moz-border-radius-bottomright: 6px; + border-bottom-right-radius: 6px; +} + +.btn-group .btn:hover, .btn-group .btn:focus, .btn-group .btn:active, + .btn-group .btn.active { + z-index: 2; +} + +.btn-group .dropdown-toggle:active, .btn-group.open .dropdown-toggle { + outline: 0; +} + +.btn-group .dropdown-toggle { + padding-left: 8px; + padding-right: 8px; + -webkit-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 + 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 + rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.125), inset 0 1px 0 + rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + *padding-top: 5px; + *padding-bottom: 5px; +} + +.btn-group.open { + *z-index: 1000; +} + +.btn-group.open .dropdown-menu { + display: block; + margin-top: 1px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.btn-group.open .dropdown-toggle { + background-image: none; + -webkit-box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.15), 0 1px 2px + rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.15), 0 1px 2px + rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 6px rgba(0, 0, 0, 0.15), 0 1px 2px + rgba(0, 0, 0, 0.05); +} + +.btn .caret { + margin-top: 7px; + margin-left: 0; +} + +.btn:hover .caret, .open.btn-group .caret { + opacity: 1; + filter: alpha(opacity = 100); +} + +.btn-primary .caret, .btn-danger .caret, .btn-info .caret, .btn-success .caret, + .btn-inverse .caret { + border-top-color: #ffffff; + opacity: 0.75; + filter: alpha(opacity = 75); +} + +.btn-small .caret { + margin-top: 4px; +} + +.nav { + margin-left: 0; + margin-bottom: 18px; + list-style: none; +} + +.nav>li>a { + display: block; +} + +.nav>li>a:hover { + text-decoration: none; + background-color: #eeeeee; +} + +.nav .nav-header { + display: block; + padding: 3px 15px; + font-size: 11px; + font-weight: bold; + line-height: 18px; + color: #999999; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-transform: uppercase; +} + +.nav li+.nav-header { + margin-top: 9px; +} + +.nav-list { + padding-left: 14px; + padding-right: 14px; + margin-bottom: 0; +} + +.nav-list>li>a, .nav-list .nav-header { + margin-left: -15px; + margin-right: -15px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} + +.nav-list>li>a { + padding: 3px 15px; +} + +.nav-list .active>a, .nav-list .active>a:hover { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); + background-color: #0088cc; +} + +.nav-list [class^="icon-"] { + margin-right: 2px; +} + +.nav-tabs, .nav-pills { + *zoom: 1; +} + +.nav-tabs:before, .nav-pills:before, .nav-tabs:after, .nav-pills:after { + display: table; + content: ""; +} + +.nav-tabs:after, .nav-pills:after { + clear: both; +} + +.nav-tabs>li, .nav-pills>li { + float: left; +} + +.nav-tabs>li>a, .nav-pills>li>a { + padding-right: 12px; + padding-left: 12px; + margin-right: 2px; + line-height: 14px; +} + +.nav-tabs { + border-bottom: 1px solid #ddd; +} + +.nav-tabs>li { + margin-bottom: -1px; +} + +.nav-tabs>li>a { + padding-top: 9px; + padding-bottom: 9px; + border: 1px solid transparent; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} + +.nav-tabs>li>a:hover { + border-color: #eeeeee #eeeeee #dddddd; +} + +.nav-tabs>.active>a, .nav-tabs>.active>a:hover { + color: #555555; + background-color: #ffffff; + border: 1px solid #ddd; + border-bottom-color: transparent; + cursor: default; +} + +.nav-pills>li>a { + padding-top: 8px; + padding-bottom: 8px; + margin-top: 2px; + margin-bottom: 2px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} + +.nav-pills .active>a, .nav-pills .active>a:hover { + color: #ffffff; + background-color: #0088cc; +} + +.nav-stacked>li { + float: none; +} + +.nav-stacked>li>a { + margin-right: 0; +} + +.nav-tabs.nav-stacked { + border-bottom: 0; +} + +.nav-tabs.nav-stacked>li>a { + border: 1px solid #ddd; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.nav-tabs.nav-stacked>li:first-child>a { + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} + +.nav-tabs.nav-stacked>li:last-child>a { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} + +.nav-tabs.nav-stacked>li>a:hover { + border-color: #ddd; + z-index: 2; +} + +.nav-pills.nav-stacked>li>a { + margin-bottom: 3px; +} + +.nav-pills.nav-stacked>li:last-child>a { + margin-bottom: 1px; +} + +.nav-tabs .dropdown-menu, .nav-pills .dropdown-menu { + margin-top: 1px; + border-width: 1px; +} + +.nav-pills .dropdown-menu { + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.nav-tabs .dropdown-toggle .caret, .nav-pills .dropdown-toggle .caret { + border-top-color: #0088cc; + margin-top: 6px; +} + +.nav-tabs .dropdown-toggle:hover .caret, .nav-pills .dropdown-toggle:hover .caret + { + border-top-color: #005580; +} + +.nav-tabs .active .dropdown-toggle .caret, .nav-pills .active .dropdown-toggle .caret + { + border-top-color: #333333; +} + +.nav>.dropdown.active>a:hover { + color: #000000; + cursor: pointer; +} + +.nav-tabs .open .dropdown-toggle, .nav-pills .open .dropdown-toggle, + .nav>.open.active>a:hover { + color: #ffffff; + background-color: #999999; + border-color: #999999; +} + +.nav .open .caret, .nav .open.active .caret, .nav .open a:hover .caret { + border-top-color: #ffffff; + opacity: 1; + filter: alpha(opacity = 100); +} + +.tabs-stacked .open>a:hover { + border-color: #999999; +} + +.tabbable { + *zoom: 1; +} + +.tabbable:before, .tabbable:after { + display: table; + content: ""; +} + +.tabbable:after { + clear: both; +} + +.tab-content { + overflow: hidden; +} + +.tabs-below .nav-tabs, .tabs-right .nav-tabs, .tabs-left .nav-tabs { + border-bottom: 0; +} + +.tab-content>.tab-pane, .pill-content>.pill-pane { + display: none; +} + +.tab-content>.active, .pill-content>.active { + display: block; +} + +.tabs-below .nav-tabs { + border-top: 1px solid #ddd; +} + +.tabs-below .nav-tabs>li { + margin-top: -1px; + margin-bottom: 0; +} + +.tabs-below .nav-tabs>li>a { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} + +.tabs-below .nav-tabs>li>a:hover { + border-bottom-color: transparent; + border-top-color: #ddd; +} + +.tabs-below .nav-tabs .active>a, .tabs-below .nav-tabs .active>a:hover { + border-color: transparent #ddd #ddd #ddd; +} + +.tabs-left .nav-tabs>li, .tabs-right .nav-tabs>li { + float: none; +} + +.tabs-left .nav-tabs>li>a, .tabs-right .nav-tabs>li>a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} + +.tabs-left .nav-tabs { + float: left; + margin-right: 19px; + border-right: 1px solid #ddd; +} + +.tabs-left .nav-tabs>li>a { + margin-right: -1px; + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} + +.tabs-left .nav-tabs>li>a:hover { + border-color: #eeeeee #dddddd #eeeeee #eeeeee; +} + +.tabs-left .nav-tabs .active>a, .tabs-left .nav-tabs .active>a:hover { + border-color: #ddd transparent #ddd #ddd; + *border-right-color: #ffffff; +} + +.tabs-right .nav-tabs { + float: right; + margin-left: 19px; + border-left: 1px solid #ddd; +} + +.tabs-right .nav-tabs>li>a { + margin-left: -1px; + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} + +.tabs-right .nav-tabs>li>a:hover { + border-color: #eeeeee #eeeeee #eeeeee #dddddd; +} + +.tabs-right .nav-tabs .active>a, .tabs-right .nav-tabs .active>a:hover { + border-color: #ddd #ddd #ddd transparent; + *border-left-color: #ffffff; +} + +.navbar { + overflow: visible; + margin-bottom: 18px; +} + +.navbar-inner { + padding-left: 20px; + padding-right: 20px; + background-color: #2c2c2c; + background-image: -moz-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: -ms-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), + to(#222222)); + background-image: -webkit-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: -o-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: linear-gradient(top, +mozColor1+, +mozColor2+); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', + endColorstr='#222222', GradientType=0); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 + rgba(0, 0, 0, 0.1); + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 + rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 + rgba(0, 0, 0, 0.1); +} + +.btn-navbar { + display: none; + float: right; + padding: 7px 10px; + margin-left: 5px; + margin-right: 5px; + background-color: #2c2c2c; + background-image: -moz-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: -ms-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#333333), + to(#222222)); + background-image: -webkit-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: -o-linear-gradient(top, +mozColor1+, +mozColor2+); + background-image: linear-gradient(top, +mozColor1+, +mozColor2+); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#333333', + endColorstr='#222222', GradientType=0); + border-color: #222222 #222222 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 + rgba(255, 255, 255, 0.075); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 + rgba(255, 255, 255, 0.075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 + rgba(255, 255, 255, 0.075); +} + +.btn-navbar:hover, .btn-navbar:active, .btn-navbar.active, .btn-navbar.disabled, + .btn-navbar[disabled] { + background-color: #222222; +} + +.btn-navbar:active, .btn-navbar.active { + background-color: #080808 \9; +} + +.btn-navbar .icon-bar { + display: block; + width: 18px; + height: 2px; + background-color: #f5f5f5; + -webkit-border-radius: 1px; + -moz-border-radius: 1px; + border-radius: 1px; + -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); + -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); + box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); +} + +.btn-navbar .icon-bar+.icon-bar { + margin-top: 3px; +} + +.nav-collapse.collapse { + height: auto; +} + +.navbar .brand:hover { + text-decoration: none; + color: +ooptionhover+; +} + +.navbar .brand { + float: left; + display: block; + padding: 8px 20px 12px; + margin-left: -100px; + font-size: 24px; + font-weight: 200; + line-height: 1; + color: +ooptioncolor+; +} + +.navbar .navbar-text { + margin-bottom: 0; + line-height: 40px; + color: #999999; +} + +.navbar .navbar-text a:hover { + color: #ffffff; + background-color: transparent; +} + +.navbar .btn, .navbar .btn-group { + margin-top: 5px; +} + +.navbar .btn-group .btn { + margin-top: 0; +} + +.navbar-form { + margin-bottom: 0; + *zoom: 1; +} + +.navbar-form:before, .navbar-form:after { + display: table; + content: ""; +} + +.navbar-form:after { + clear: both; +} + +.navbar-form input, .navbar-form select { + display: inline-block; + margin-top: 5px; + margin-bottom: 0; +} + +.navbar-form .radio, .navbar-form .checkbox { + margin-top: 5px; +} + +.navbar-form input[type="image"], .navbar-form input[type="checkbox"], + .navbar-form input[type="radio"] { + margin-top: 3px; +} + +.navbar-form .input-append, .navbar-form .input-prepend { + margin-top: 6px; + white-space: nowrap; +} + +.navbar-form .input-append input, .navbar-form .input-prepend input { + margin-top: 0; +} + +.navbar-search { + position: relative; + float: left; + margin-top: 6px; + margin-bottom: 0; +} + +.navbar-search .search-query { + padding: 4px 9px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 13px; + font-weight: normal; + line-height: 1; + color: #ffffff; + color: rgba(255, 255, 255, 0.75); + background: #666; + background: rgba(255, 255, 255, 0.3); + border: 1px solid #111; + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px + rgba(255, 255, 255, 0.15); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px + rgba(255, 255, 255, 0.15); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 0px + rgba(255, 255, 255, 0.15); + -webkit-transition: none; + -moz-transition: none; + -ms-transition: none; + -o-transition: none; + transition: none; +} + +.navbar-search .search-query :-moz-placeholder { + color: #eeeeee; +} + +.navbar-search .search-query::-webkit-input-placeholder { + color: #eeeeee; +} + +.navbar-search .search-query:hover { + color: #ffffff; + background-color: #999999; + background-color: rgba(255, 255, 255, 0.5); +} + +.navbar-search .search-query:focus, .navbar-search .search-query.focused + { + padding: 5px 10px; + color: #333333; + text-shadow: 0 1px 0 #ffffff; + background-color: #ffffff; + border: 0; + -webkit-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + -moz-box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + box-shadow: 0 0 3px rgba(0, 0, 0, 0.15); + outline: 0; +} + +.navbar-fixed-top { + position: fixed; + top: 0; + right: 0; + left: 0; + z-index: 1030; +} + +.navbar-fixed-top .navbar-inner { + padding-left: 0; + padding-right: 0; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} + +.navbar .nav { + position: relative; + left: 0; + display: block; + float: left; + margin: 0 10px 0 0; +} + +.navbar .nav.pull-right { + float: right; +} + +.navbar .nav>li { + display: block; + float: left; +} + +.navbar .nav>li>* { + float: none; + padding: 13px 10px 11px; + line-height: 19px; + color: +ooptmaincolor+; + text-decoration: none; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} + +.navbar .nav>li>a:hover { + background-color: transparent; + color: #ffffff; + text-decoration: none; +} + +.navbar .nav .active>a, .navbar .nav .active>a:hover { + color: #ffffff; + text-decoration: none; + background-color: #222222; +} + +.navbar .divider-vertical { + height: 40px; + width: 1px; + margin: 0 9px; + overflow: hidden; + background-color: #222222; + border-right: 1px solid #333333; +} + +.navbar .nav.pull-right { + margin-left: 10px; + margin-right: 0; +} + +.navbar .dropdown-menu { + margin-top: 1px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.navbar .dropdown-menu:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 9px; +} + +.navbar .dropdown-menu:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 10px; +} + +.navbar .nav .dropdown-toggle .caret, .navbar .nav .open.dropdown .caret + { + border-top-color: #ffffff; +} + +.navbar .nav .active .caret { + opacity: 1; + filter: alpha(opacity = 100); +} + +.navbar .nav .open>.dropdown-toggle, .navbar .nav .active>.dropdown-toggle, + .navbar .nav .open.active>.dropdown-toggle { + background-color: transparent; +} + +.navbar .nav .active>.dropdown-toggle:hover { + color: #ffffff; +} + +.navbar .nav.pull-right .dropdown-menu { + left: auto; + right: 0; +} + +.navbar .nav.pull-right .dropdown-menu:before { + left: auto; + right: 12px; +} + +.navbar .nav.pull-right .dropdown-menu:after { + left: auto; + right: 13px; +} + +.breadcrumb { + padding: 7px 14px; + margin: 0 0 18px; + background-color: #fbfbfb; + background-image: -moz-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -ms-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), + to(#f5f5f5)); + background-image: -webkit-linear-gradient(top, #ffffff, #f5f5f5); + background-image: -o-linear-gradient(top, #ffffff, #f5f5f5); + background-image: linear-gradient(top, #ffffff, #f5f5f5); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', + endColorstr='#f5f5f5', GradientType=0); + border: 1px solid #ddd; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: inset 0 1px 0 #ffffff; + -moz-box-shadow: inset 0 1px 0 #ffffff; + box-shadow: inset 0 1px 0 #ffffff; +} + +.breadcrumb li { + display: inline-block; + text-shadow: 0 1px 0 #ffffff; +} + +.breadcrumb .divider { + padding: 0 5px; + color: #999999; +} + +.breadcrumb .active a { + color: #333333; +} + +.pagination { + height: 36px; + margin: 18px 0; +} + +.pagination ul { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + *zoom: 1; + margin-left: 0; + margin-bottom: 0; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); +} + +.pagination li { + display: inline; +} + +.pagination a { + float: left; + padding: 0 14px; + line-height: 34px; + text-decoration: none; + border: 1px solid #ddd; + border-left-width: 0; +} + +.pagination a:hover, .pagination .active a { + background-color: #f5f5f5; +} + +.pagination .active a { + color: #999999; + cursor: default; +} + +.pagination .disabled a, .pagination .disabled a:hover { + color: #999999; + background-color: transparent; + cursor: default; +} + +.pagination li:first-child a { + border-left-width: 1px; + -webkit-border-radius: 3px 0 0 3px; + -moz-border-radius: 3px 0 0 3px; + border-radius: 3px 0 0 3px; +} + +.pagination li:last-child a { + -webkit-border-radius: 0 3px 3px 0; + -moz-border-radius: 0 3px 3px 0; + border-radius: 0 3px 3px 0; +} + +.pagination-centered { + text-align: center; +} + +.pagination-right { + text-align: right; +} + +.pager { + margin-left: 0; + margin-bottom: 18px; + list-style: none; + text-align: center; + *zoom: 1; +} + +.pager:before, .pager:after { + display: table; + content: ""; +} + +.pager:after { + clear: both; +} + +.pager li { + display: inline; +} + +.pager a { + display: inline-block; + padding: 5px 14px; + background-color: #fff; + border: 1px solid #ddd; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + border-radius: 15px; +} + +.pager a:hover { + text-decoration: none; + background-color: #f5f5f5; +} + +.pager .next a { + float: right; +} + +.pager .previous a { + float: left; +} + +.alert { + padding: 8px 35px 8px 14px; + margin-bottom: 18px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + background-color: #fcf8e3; + border: 1px solid #fbeed5; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +.alert, .alert-heading { + color: #c09853; +} + +.alert .close { + position: relative; + top: -2px; + right: -21px; + line-height: 18px; +} + +.alert-success { + background-color: #dff0d8; + border-color: #d6e9c6; +} + +.alert-success, .alert-success .alert-heading { + color: #468847; +} + +.alert-danger, .alert-error { + background-color: #f2dede; + border-color: #eed3d7; +} + +.alert-danger, .alert-error, .alert-danger .alert-heading, .alert-error .alert-heading + { + color: #b94a48; +} + +.alert-info { + background-color: #d9edf7; + border-color: #bce8f1; +} + +.alert-info, .alert-info .alert-heading { + color: #3a87ad; +} + +.alert-block { + padding-top: 14px; + padding-bottom: 14px; +} + +.alert-block>p, .alert-block>ul { + margin-bottom: 0; +} + +.alert-block p+p { + margin-top: 5px; +} + +.pull-right { + float: right; +} + +.pull-left { + float: left; +} + +.hide { + display: none; +} + +.show { + display: block; +} + +.invisible { + visibility: hidden; +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/css/hammer_A0.css b/screwdriver-3.5.6/box/snippets/css/hammer_A0.css new file mode 100644 index 0000000..0dd8417 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/css/hammer_A0.css @@ -0,0 +1,126 @@ +body { + font-family: Georgia, "Times New Roman", Times, serif; + font-size: 12px; + background-color: #CCFF99; + color: #000080; + border-top: 4px solid #993366; + border-right: 4px none #993366; + border-bottom: 4px solid #993366; + border-left: 4px none #993366; +} + +/* Headings */ +h1 { + font-size: 145% +} + +td { + font-family: "Times New Roman", Times, serif; + font-size: 17px; +} + +th { + font-family: "Times New Roman", Times, serif; + font-size: 14px; +} + +form { + font-family: "Times New Roman", Times, serif; + font-size: 12px; +} + +input { + font-family: "Times New Roman", Times, serif; + font-size: 12px; +} + +textarea { + font-family: "Times New Roman", Times, serif; + font-size: 12px; + border: thick double; +} + +select { + font-family: "Times New Roman", Times, serif; + font-size: 12px; +} + +ul { + font-family: "Times New Roman", Times, serif; + font-size: 12px; + list-style-type: circle; + list-style-position: outside; +} + +li { + font-family: "Times New Roman", Times, serif; + font-size: 12px; +} + +ol { + font-family: "Times New Roman", Times, serif; + font-size: 12px; + list-style-type: upper-alpha; + list-style-position: outside; +} + +.storia { + font-family: "Times New Roman", Times, serif; + font-size: 16px; + color: #007F00; + font-style: Normal; +} + +/* Table colors */ +.TableHeadingColor { + background: #CCCCFF +} /* Dark mauve */ +.TableSubHeadingColor { + background: #EEEEFF +} /* Light mauve */ +.TableRowColor { + background: #FFFFFF +} /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { + font-size: 110%; + font-family: Helvetica, Arial, sans-serif +} + +.FrameHeadingFont { + font-size: 110%; + font-family: Helvetica, Arial, sans-serif +} + +.FrameItemFont { + font-size: 110%; + font-family: Helvetica, Arial, sans-serif +} + +/* Navigation bar fonts and colors */ +.NavBarCell1 { + background-color: #EEEEFF; +} /* Light mauve */ +.NavBarCell1Rev { + background-color: #00008B; +} /* Dark Blue */ +.NavBarFont1 { + font-family: Arial, Helvetica, sans-serif; + color: #000000; +} + +.NavBarFont1Rev { + font-family: Arial, Helvetica, sans-serif; + color: #FFFFFF; +} + +.NavBarCell2 { + font-family: Arial, Helvetica, sans-serif; + background-color: #FFFFFF; +} + +.NavBarCell3 { + font-family: Arial, Helvetica, sans-serif; + background-color: #FFFFFF; +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/css/screwdriver.css b/screwdriver-3.5.6/box/snippets/css/screwdriver.css new file mode 100644 index 0000000..4412f31 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/css/screwdriver.css @@ -0,0 +1,57 @@ +.checkdress { + margin-top: 0px; + margin-bottom: 14px; +} + +.labeldress { + margin-top: 0px; + margin-bottom: -10px; +} + +.formdress { + margin-left: 40px; +} + +.radiodress { + font-size: 13px; +} + +.formn_btn { + display: inline-block; + padding: 4px 12px 3px; + margin-bottom: 9px; + font-size: 13px; + line-height: 18px; + color: blue; + text-align: center; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); + vertical-align: middle; + background-color: #f5f5f5; + background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -ms-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), + to(#e6e6e6)); + background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); + background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); + background-image: linear-gradient(top, #ffffff, #e6e6e6); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', + endColorstr='#e6e6e6', GradientType=0); + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); + border: 1px solid #ccc; + border-bottom-color: #bbb; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px + rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px + rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px + rgba(0, 0, 0, 0.05); + cursor: pointer; + filter: progid:DXImageTransform.Microsoft.gradient(enabled= false); + *margin-left: .3em; +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_0.txt b/screwdriver-3.5.6/box/snippets/depen_0.txt new file mode 100644 index 0000000..6a8f066 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_0.txt @@ -0,0 +1,5 @@ + + javax.servlet + jsp-api + 2.0 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_1.txt b/screwdriver-3.5.6/box/snippets/depen_1.txt new file mode 100644 index 0000000..62101ef --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_1.txt @@ -0,0 +1,42 @@ + + javax.servlet + javax.servlet-api + 3.1.0 + + + xercesImpl + xerces + 2.9.1 + + + + commons-fileupload + commons-fileupload + 1.3.1 + + + org.apache.commons + commons-io + 1.3.2 + + + commons-codec + commons-codec + 1.4 + + + + net.sourceforge.wurfl + wurfl + 1.3.1.1 + + + logback-classic + ch.qos.logback + + + slf4j-api + org.slf4j + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_2.txt b/screwdriver-3.5.6/box/snippets/depen_2.txt new file mode 100644 index 0000000..b4fcee2 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_2.txt @@ -0,0 +1,42 @@ + + xercesImpl + xerces + 2.9.1 + + + javax.servlet + jsp-api + 2.0 + + + + commons-codec + commons-codec + 1.4 + + + commons-fileupload + commons-fileupload + 1.2.2 + + + + net.sourceforge.wurfl + wurfl + 1.3.1.1 + + + logback-classic + ch.qos.logback + + + slf4j-api + org.slf4j + + + + + javassist + javassist + 3.12.1.GA + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_3.txt b/screwdriver-3.5.6/box/snippets/depen_3.txt new file mode 100644 index 0000000..7bd9686 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_3.txt @@ -0,0 +1,37 @@ + + cglib + cglib-nodep + 2.2.2 + runtime + + + com.h2database + h2 + 1.3.163 + runtime + + + javax.servlet + jsp-api + 2.0 + + + javax.validation + validation-api + 1.0.0.GA + + + joda-time + joda-time + 2.0 + + + org.slf4j + slf4j-api + 1.6.4 + + + org.slf4j + slf4j-log4j12 + 1.6.4 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_4.txt b/screwdriver-3.5.6/box/snippets/depen_4.txt new file mode 100644 index 0000000..4f70d14 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_4.txt @@ -0,0 +1,35 @@ + + xercesImpl + xerces + 2.9.1 + + + javax.servlet + jsp-api + 2.0 + + + commons-codec + commons-codec + 1.4 + + + commons-fileupload + commons-fileupload + 1.2.2 + + + javassist + javassist + 3.12.1.GA + + + org.slf4j + slf4j-log4j12 + 1.7.5 + + + org.slf4j + slf4j-api + 1.7.5 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_apache_ldap.txt b/screwdriver-3.5.6/box/snippets/depen_apache_ldap.txt new file mode 100644 index 0000000..ad26fde --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_apache_ldap.txt @@ -0,0 +1,20 @@ + + org.apache.directory.server + apacheds-core + 1.5.5 + + + org.apache.directory.server + apacheds-protocol-ldap + 1.5.5 + + + org.apache.directory.shared + shared-ldap + 0.9.15 + + + org.springframework.security + spring-security-ldap + 3.1.0.RELEASE + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_captcha_1.1.txt b/screwdriver-3.5.6/box/snippets/depen_captcha_1.1.txt new file mode 100644 index 0000000..ac7e44a --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_captcha_1.1.txt @@ -0,0 +1,5 @@ + + com.google.code.maven-play-plugin.org.playframework + jj-simplecaptcha + 1.1 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_captcha_1.2.1.txt b/screwdriver-3.5.6/box/snippets/depen_captcha_1.2.1.txt new file mode 100644 index 0000000..337358f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_captcha_1.2.1.txt @@ -0,0 +1,5 @@ + + com.google.code.maven-play-plugin.org.playframework + jj-simplecaptcha + 1.2.1 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_hvalid.txt b/screwdriver-3.5.6/box/snippets/depen_hvalid.txt new file mode 100644 index 0000000..e8a6a7f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_hvalid.txt @@ -0,0 +1,5 @@ + + org.hibernate + hibernate-validator + +hvalid+ + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_jackson.txt b/screwdriver-3.5.6/box/snippets/depen_jackson.txt new file mode 100644 index 0000000..6898c23 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_jackson.txt @@ -0,0 +1,11 @@ + + org.codehaus.jackson + jackson-core-asl + +jackson+ + + + org.codehaus.jackson + jackson-mapper-asl + +jackson+ + runtime + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_secu_3.1.txt b/screwdriver-3.5.6/box/snippets/depen_secu_3.1.txt new file mode 100644 index 0000000..c681b34 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_secu_3.1.txt @@ -0,0 +1,26 @@ + + org.springframework.security + spring-security-core + ${org.springframework.security.version} + + + org.springframework.security + spring-security-web + ${org.springframework.security.version} + + + org.springframework.security + spring-security-config + ${org.springframework.security.version} + + + spring-asm + org.springframework + + + + + org.springframework.security + spring-security-taglibs + ${org.springframework.security.version} + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_secu_3.2.txt b/screwdriver-3.5.6/box/snippets/depen_secu_3.2.txt new file mode 100644 index 0000000..c681b34 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_secu_3.2.txt @@ -0,0 +1,26 @@ + + org.springframework.security + spring-security-core + ${org.springframework.security.version} + + + org.springframework.security + spring-security-web + ${org.springframework.security.version} + + + org.springframework.security + spring-security-config + ${org.springframework.security.version} + + + spring-asm + org.springframework + + + + + org.springframework.security + spring-security-taglibs + ${org.springframework.security.version} + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_spring_3.1.0.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_spring_3.1.0.RELEASE.txt new file mode 100644 index 0000000..0d61930 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_spring_3.1.0.RELEASE.txt @@ -0,0 +1,66 @@ + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-asm + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + javax.servlet + jstl + 1.2 + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_spring_3.1.1.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_spring_3.1.1.RELEASE.txt new file mode 100644 index 0000000..8874112 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_spring_3.1.1.RELEASE.txt @@ -0,0 +1,65 @@ + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-asm + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + javax.servlet + jstl + 1.2 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_spring_3.2.0.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_spring_3.2.0.RELEASE.txt new file mode 100644 index 0000000..887c042 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_spring_3.2.0.RELEASE.txt @@ -0,0 +1,67 @@ + + org.springframework + spring-core + ${spring.version} + + + spring-asm + org.springframework + + + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + javax.servlet + jstl + 1.2 + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_spring_3.2.13.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_spring_3.2.13.RELEASE.txt new file mode 100644 index 0000000..843515f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_spring_3.2.13.RELEASE.txt @@ -0,0 +1,66 @@ + + org.springframework + spring-core + ${spring.version} + + + spring-asm + org.springframework + + + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + javax.servlet + jstl + 1.2 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_spring_4.0.3.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_spring_4.0.3.RELEASE.txt new file mode 100644 index 0000000..95e4749 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_spring_4.0.3.RELEASE.txt @@ -0,0 +1,66 @@ + + org.springframework + spring-core + ${spring.version} + + + spring-asm + org.springframework + + + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + javax.servlet + jstl + 1.2 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_spring_4.3.12.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_spring_4.3.12.RELEASE.txt new file mode 100644 index 0000000..95e4749 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_spring_4.3.12.RELEASE.txt @@ -0,0 +1,66 @@ + + org.springframework + spring-core + ${spring.version} + + + spring-asm + org.springframework + + + + + org.springframework + spring-expression + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-context-support + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + org.springframework + spring-orm + ${spring.version} + + + org.springframework + spring-web + ${spring.version} + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-jdbc + ${spring.version} + + + javax.servlet + jstl + 1.2 + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_tiles.txt b/screwdriver-3.5.6/box/snippets/depen_tiles.txt new file mode 100644 index 0000000..e217a4f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_tiles.txt @@ -0,0 +1,37 @@ + + + org.apache.tiles + tiles-core + ${apache.tiles.version} + + + slf4j-api + org.slf4j + + + + + org.apache.tiles + tiles-api + ${apache.tiles.version} + + + org.apache.tiles + tiles-jsp + ${apache.tiles.version} + + + org.apache.tiles + tiles-servlet + ${apache.tiles.version} + + + org.apache.tiles + tiles-servlet-wildcard + ${apache.tiles.version} + + + org.apache.tiles + tiles-template + ${apache.tiles.version} + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_validator.txt b/screwdriver-3.5.6/box/snippets/depen_validator.txt new file mode 100644 index 0000000..6f078d2 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_validator.txt @@ -0,0 +1,5 @@ + + javax.validation + validation-api + 1.0.0.GA + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/depen_webflow_2.3.3.RELEASE.txt b/screwdriver-3.5.6/box/snippets/depen_webflow_2.3.3.RELEASE.txt new file mode 100644 index 0000000..cbb89ff --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/depen_webflow_2.3.3.RELEASE.txt @@ -0,0 +1,5 @@ + + org.springframework.webflow + spring-webflow + 2.3.3.RELEASE + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/filte.txt b/screwdriver-3.5.6/box/snippets/filte.txt new file mode 100644 index 0000000..9509fc3 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/filte.txt @@ -0,0 +1,49 @@ + + characterEncodingFilter + org.springframework.web.filter.CharacterEncodingFilter + + encoding + UTF-8 + + + forceEncoding + true + + + + characterEncodingFilter + /* + + + ResponseOverrideFilter + org.displaytag.filter.ResponseOverrideFilter + + + ResponseOverrideFilter + /* + + + HttpMethodFilter + org.springframework.web.filter.HiddenHttpMethodFilter + + + HttpMethodFilter + /* + + + + crossSiteScriptingFilter + +zoccolo+.web.filter.CrossSiteScriptingFilter + + + crossSiteScriptingFilter + /* + + + JsessionIdRemoveFilter + +zoccolo+.web.filter.JsessionIdRemoveFilter + + + JsessionIdRemoveFilter + /* + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/htv_3.4.txt b/screwdriver-3.5.6/box/snippets/htv_3.4.txt new file mode 100644 index 0000000..14ea331 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/htv_3.4.txt @@ -0,0 +1,44 @@ + + org.hibernate + hibernate-core + 3.3.2.GA + + + org.hibernate + hibernate-annotations + 3.4.0.GA + + + org.hibernate + hibernate-commons-annotations + 3.1.0.GA + + + org.hibernate + hibernate-tools + 3.2.3.GA + + + javax.validation + validation-api + 1.0.0.GA + + + org.slf4j + slf4j-api + 1.6.4 + runtime + + + org.slf4j + slf4j-api + 1.6.4 + runtime + + + org.slf4j + slf4j-log4j12 + 1.6.4 + runtime + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/hv_3.4.txt b/screwdriver-3.5.6/box/snippets/hv_3.4.txt new file mode 100644 index 0000000..06a7327 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/hv_3.4.txt @@ -0,0 +1,33 @@ + + org.hibernate + hibernate-core + 3.3.2.GA + + + org.hibernate + hibernate-annotations + 3.4.0.GA + + + org.hibernate + hibernate-commons-annotations + 3.1.0.GA + + + org.hibernate + hibernate-tools + 3.2.3.GA + + + org.slf4j + slf4j-api + 1.6.4 + runtime + + + org.slf4j + slf4j-log4j12 + 1.6.4 + runtime + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/hv_3.5.txt b/screwdriver-3.5.6/box/snippets/hv_3.5.txt new file mode 100644 index 0000000..96b9708 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/hv_3.5.txt @@ -0,0 +1,37 @@ + + org.hibernate + hibernate-core + 3.3.2.GA + + + org.hibernate + hibernate-annotations + 3.4.0.GA + + + org.hibernate + hibernate-commons-annotations + 3.1.0.GA + + + org.hibernate + hibernate-tools + 3.2.3.GA + + + org.slf4j + slf4j-api + 1.6.4 + runtime + + + org.slf4j + slf4j-log4j12 + 1.6.4 + runtime + + + javassist + javassist + 3.12.1.GA + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/hv_3.6.txt b/screwdriver-3.5.6/box/snippets/hv_3.6.txt new file mode 100644 index 0000000..7fa1ace --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/hv_3.6.txt @@ -0,0 +1,35 @@ + + org.hibernate + hibernate-core + 3.6.6.Final + + + org.hibernate + hibernate-annotations + 3.5.6-Final + + + org.hibernate + hibernate-commons-annotations + 3.2.0.Final + + + org.hibernate + hibernate-tools + 3.6.0.Final + + + org.slf4j + slf4j-api + 1.6.0 + + + org.hibernate + hibernate-search + 3.4.1.Final + + + javassist + javassist + 3.12.1.GA + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/hv_5.1.0.Final.txt b/screwdriver-3.5.6/box/snippets/hv_5.1.0.Final.txt new file mode 100644 index 0000000..bc82e63 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/hv_5.1.0.Final.txt @@ -0,0 +1,22 @@ + + org.hibernate + hibernate-core + 5.1.0.Final + + + antlr + antlr + + + + + org.hibernate + hibernate-entitymanager + 5.1.0.Final + + + antlr + antlr + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/jacksonView.txt b/screwdriver-3.5.6/box/snippets/jacksonView.txt new file mode 100644 index 0000000..63d8bf2 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jacksonView.txt @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/ActiveDirectoryLdapAuthoritiesPopulator.java b/screwdriver-3.5.6/box/snippets/java/ActiveDirectoryLdapAuthoritiesPopulator.java new file mode 100644 index 0000000..f557ffd --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ActiveDirectoryLdapAuthoritiesPopulator.java @@ -0,0 +1,37 @@ +package +zoccolo+.security.ldap.userdetails.ad; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.springframework.ldap.core.DirContextOperations; +import org.springframework.ldap.core.DistinguishedName; +import org.springframework.ldap.core.LdapRdn; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider; +import org.springframework.security.ldap.userdetails.LdapAuthoritiesPopulator; + +/** + * An {@link LdapAuthoritiesPopulator} that is based on the {@link ActiveDirectoryLdapAuthenticationProvider}. The + * implementation obtains the {@link GrantedAuthority}'s from the userData's memberOf attribute. It then uses the last + * {@link LdapRdn}'s value as the {@link GrantedAuthority}. + * + * @author Rob Winch + * @see ActiveDirectoryLdapAuthenticationProvider + */ +public final class ActiveDirectoryLdapAuthoritiesPopulator + implements LdapAuthoritiesPopulator { + + @Override + public Collection getGrantedAuthorities(DirContextOperations userData, String username) { + String[] groups = userData.getStringAttributes("memberOf"); + List authorities = new ArrayList(); + + for (String group : groups) { + LdapRdn authority = new DistinguishedName(group).removeLast(); + authorities.add(new SimpleGrantedAuthority(authority.getValue())); + } + return authorities; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/AntiSamyListener.java b/screwdriver-3.5.6/box/snippets/java/AntiSamyListener.java new file mode 100644 index 0000000..8bf9b0c --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/AntiSamyListener.java @@ -0,0 +1,55 @@ +package +zoccolo+.web.listener; + +import +zoccolo+.web.sanitizer.XssSanitizer; + +import java.io.InputStream; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import org.apache.log4j.Logger; +import org.owasp.validator.html.PolicyException; + +public class AntiSamyListener + implements ServletContextListener { + + public static final String POLICY_FILE_PATH = "policy_file_path"; + public static final String ANTISAMY_SANITIZER = "sanitizer"; + + static Logger log = Logger.getLogger(AntiSamyListener.class); + + public void contextDestroyed(ServletContextEvent servletContextEvent) { + log.info("Context destroyed"); + } + + public void contextInitialized(ServletContextEvent servletContextEvent) { + ServletContext servletContext = servletContextEvent.getServletContext(); + String policyFilePath = (String) servletContext.getInitParameter(POLICY_FILE_PATH); + if (policyFilePath == null) { + throw new RuntimeException( + "Policy file path is null. Please set it up in web.xml!!!"); + } + log.info("XSS Policy file path read."); + + InputStream is = getClass().getClassLoader().getResourceAsStream( + policyFilePath); + try { + is.available(); + log.info("XSS Policy file loaded."); + } catch (Exception e) { + throw new RuntimeException("Policy file " + policyFilePath + + " does not exists!"); + } + + try { + XssSanitizer sanitizer = new XssSanitizer(policyFilePath); + log.info("XSS Sanitizer created."); + servletContext.setAttribute(ANTISAMY_SANITIZER, sanitizer); + log.info("XSS bound in Servlet Context as: " + ANTISAMY_SANITIZER); + } catch (PolicyException pex) { + throw new RuntimeException("Policy exception: " + pex.getMessage()); + } + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/ApplicUserAuthenticationProvider.java b/screwdriver-3.5.6/box/snippets/java/ApplicUserAuthenticationProvider.java new file mode 100644 index 0000000..adcaee6 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ApplicUserAuthenticationProvider.java @@ -0,0 +1,34 @@ +package +zoccolo+.web.authentication; + +import java.util.Collection; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Component; + +import +zoccolo+.web.authentication.+userpass+UsernamePasswordAuthenticationToken; +import +zoccolo+.web.authentication.authority.UserAuthorityUtils; +import +domain+.screwdriver.+dsname+.+dbschema+.+tabuser+; +import +zoccolo+.+rail+.dao.I+Rail++tabuser+Dao; + +/** Autenticazione */ +@Component +public class +Applicaz+UserAuthenticationProvider + implements AuthenticationProvider { + + private I+Rail++tabuser+Dao<+tabuser+> +rail++tabuser+; + + @Autowired + public +Applicaz+UserAuthenticationProvider(I+Rail++tabuser+Dao<+tabuser+> +rail++tabuser+) { + if (+rail++tabuser+ == null) { + throw new IllegalArgumentException( + "Screwdriver: +rail++tabuser+ cannot be null"); + } + this.+rail++tabuser+ = +rail++tabuser+; + } \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/Belonger.java b/screwdriver-3.5.6/box/snippets/java/Belonger.java new file mode 100644 index 0000000..2ae6ab8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/Belonger.java @@ -0,0 +1,21 @@ +package +zoccolo+.security; + +import java.util.Collection; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.User; + +public class Belonger extends User { + + public Belonger(String username, String password, boolean enabled, + boolean accountNonExpired, boolean credentialsNonExpired, + boolean accountNonLocked, + Collection authorities) { + super(username, password, enabled, accountNonExpired, + credentialsNonExpired, accountNonLocked, authorities); + } + + private static final long serialVersionUID = 4190186200539186925L; + + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/ControllerBelong.java b/screwdriver-3.5.6/box/snippets/java/ControllerBelong.java new file mode 100644 index 0000000..5fa4f36 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ControllerBelong.java @@ -0,0 +1,4 @@ +package +zoccolo+.web.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/ControllerBelongLDAP.java b/screwdriver-3.5.6/box/snippets/java/ControllerBelongLDAP.java new file mode 100644 index 0000000..e48b5a8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ControllerBelongLDAP.java @@ -0,0 +1,6 @@ +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.ldap.userdetails.InetOrgPerson; +import org.springframework.security.ldap.userdetails.LdapUserDetails; +import org.springframework.security.ldap.userdetails.Person; + diff --git a/screwdriver-3.5.6/box/snippets/java/CrossSiteScriptingFilter.java b/screwdriver-3.5.6/box/snippets/java/CrossSiteScriptingFilter.java new file mode 100644 index 0000000..3ba5863 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/CrossSiteScriptingFilter.java @@ -0,0 +1,56 @@ +package +zoccolo+.web.filter; + +import +zoccolo+.web.servlet.HttpRequestWrapper; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; + +public class CrossSiteScriptingFilter implements Filter { + + static Logger log = Logger.getLogger(CrossSiteScriptingFilter.class); + + @SuppressWarnings("unused") + private FilterConfig filterConfig; + + /** + * @see Filter#destroy() + */ + public void destroy() { + this.filterConfig = null; + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException, ServletException { + + String sessionid = ((HttpServletRequest) request).getSession().getId(); + // be careful overwriting: JSESSIONID may have been set with other flags + ((HttpServletResponse) response).setHeader("SET-COOKIE", "JSESSIONID=" + sessionid + ";Path=/; HttpOnly"); + + chain.doFilter(new HttpRequestWrapper((HttpServletRequest)request), response); + } + + /** + * @see Filter#init(FilterConfig) + */ + public void init(FilterConfig filterConfig) throws ServletException { + this.filterConfig = filterConfig; + log.info("CrossSiteScriptingFilter correctly initialized."); + } + + /* screwdriver_knife */ + +} + diff --git a/screwdriver-3.5.6/box/snippets/java/Crud.java b/screwdriver-3.5.6/box/snippets/java/Crud.java new file mode 100644 index 0000000..2e76695 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/Crud.java @@ -0,0 +1,23 @@ + // R = READ + private ModelAndView screw+jsp+R(+Jsp+Form +jsp+Form) { + return new ModelAndView("+screwModel+", "belong", + +jsp+Form); + } + + // C = CREATE + private ModelAndView screw+jsp+C(+Jsp+Form +jsp+Form) { + Notice notice = new Notice(); + return new ModelAndView("answers/ok", "belong", notice); + } + + // U = UPDATE + private ModelAndView screw+jsp+U(+Jsp+Form +jsp+Form) { + Notice notice = new Notice(); + return new ModelAndView("answers/ok", "belong", notice); + } + + // D = DELETE + private ModelAndView screw+jsp+D(+Jsp+Form +jsp+Form) { + Notice notice = new Notice(); + return new ModelAndView("answers/ok", "belong", notice); + } diff --git a/screwdriver-3.5.6/box/snippets/java/DomainSpringSecurityUserContext.java b/screwdriver-3.5.6/box/snippets/java/DomainSpringSecurityUserContext.java new file mode 100644 index 0000000..42972e6 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/DomainSpringSecurityUserContext.java @@ -0,0 +1,50 @@ +package +zoccolo+.web.authentication; + +import java.util.Collection; + +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + +import +zoccolo+.web.authentication.authority.UserAuthorityUtils; +import +tabposition+.+tabella+; + +/** + * An implementation of {@link UserContext} that looks up the {@link CalendarUser} using the Spring Security's + * {@link Authentication} by principal name. + * + * @author Rob Winch + * + */ +@Component +public class SpringSecurityUserContext implements UserContext { + /** + * Get the {@link CalendarUser} by casting the {@link Authentication}'s principal to a {@link CalendarUser}. + */ + @Override + public +tabella+ getCurrentUser() { + SecurityContext context = SecurityContextHolder.getContext(); + Authentication authentication = context.getAuthentication(); + if (authentication == null) { + return null; + } + return (+tabella+) authentication.getPrincipal(); + } + + /** + * Sets the {@link CalendarUser} as the current {@link Authentication}'s principal. It uses + */ + @Override + public void setCurrentUser(+tabella+ user) { + if (user == null) { + throw new IllegalArgumentException("user cannot be null"); + } + Collection authorities = UserAuthorityUtils.createAuthorities(user); + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(user, + user.get+password+(),authorities); + SecurityContextHolder.getContext().setAuthentication(authentication); + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/DomainUsernamePasswordAuthenticationFilter.java b/screwdriver-3.5.6/box/snippets/java/DomainUsernamePasswordAuthenticationFilter.java new file mode 100644 index 0000000..61c7ce1 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/DomainUsernamePasswordAuthenticationFilter.java @@ -0,0 +1,39 @@ +package +zoccolo+.web.authentication; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +import +zoccolo+.web.authentication.DomainUsernamePasswordAuthenticationToken; + +/** + * An extension to the existing {@link UsernamePasswordAuthenticationFilter} that obtains a domain parameter and then + * creates a {@link DomainUsernamePasswordAuthenticationToken}. + * + * @author Rob Winch + * + */ +public final class DomainUsernamePasswordAuthenticationFilter extends UsernamePasswordAuthenticationFilter { + + public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) + throws AuthenticationException { + if (!request.getMethod().equals("POST")) { + throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); + } + + String username = obtainUsername(request); + String password = obtainPassword(request); + String domain = request.getParameter("domain"); + + DomainUsernamePasswordAuthenticationToken authRequest = new DomainUsernamePasswordAuthenticationToken(username, + password, domain); + + setDetails(request, authRequest); + return this.getAuthenticationManager().authenticate(authRequest); + } + /* screwdriver_knife */ +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/DomainUsernamePasswordAuthenticationToken.java b/screwdriver-3.5.6/box/snippets/java/DomainUsernamePasswordAuthenticationToken.java new file mode 100644 index 0000000..e965f1d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/DomainUsernamePasswordAuthenticationToken.java @@ -0,0 +1,34 @@ +package +zoccolo+.web.authentication; + +import java.util.Collection; + +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; + +import +jpapath+.+tabella+; + +public final class DomainUsernamePasswordAuthenticationToken + + extends UsernamePasswordAuthenticationToken { + + private final String domain; + + public DomainUsernamePasswordAuthenticationToken(String principal, String credentials, String domain) { + super(principal, credentials); + this.domain = domain; + } + + public DomainUsernamePasswordAuthenticationToken(+tabella+ principal, String credentials, String domain, + Collection authorities) { + super(principal, credentials, authorities); + this.domain = domain; + } + + public String getDomain() { + return domain; + } + + private static final long serialVersionUID = -5138870746127783L; + + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/DoorControllerBelong.java b/screwdriver-3.5.6/box/snippets/java/DoorControllerBelong.java new file mode 100644 index 0000000..b5b8698 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/DoorControllerBelong.java @@ -0,0 +1,43 @@ +package +zoccolo+.web.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; +import javax.servlet.http.HttpServletRequest; + +import +zoccolo+.web.model.utility.Notice; +/**

+ * Home page controller. + *

+*/ +@Controller +public class DoorControllerBelong { + + @RequestMapping("/") + public String welcome() { + return "home/index"; + } + + @RequestMapping("/default") + public String welcomeDefault() { + return "home/index"; + } + + @RequestMapping("/login/form") + public String chiSei() { + return "home/login"; + } + + +signup+ + + @RequestMapping("/answers/errorPage") + public ModelAndView materia_1(HttpServletRequest request) { + Notice notice = new Notice(); + notice.setScrewFormattedText("Unauthorized access, user " + + request.getUserPrincipal().getName() + + " has no sufficient faculties."); + return new ModelAndView("answers/error", "belong", notice); + } + + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/GenericComponent.java b/screwdriver-3.5.6/box/snippets/java/GenericComponent.java new file mode 100644 index 0000000..73f33bf --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/GenericComponent.java @@ -0,0 +1,19 @@ +package +zoccolo+.web.controller; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; + +public class GenericComponent { + + protected final Log logger = LogFactory.getLog(this.getClass()); + + @Autowired + public ApplicationContext context; + + public String getMessage(String key, Object ...variables) { + return context.getMessage(key, variables, null); + } + +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/GenericController.java b/screwdriver-3.5.6/box/snippets/java/GenericController.java new file mode 100644 index 0000000..864c8ee --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/GenericController.java @@ -0,0 +1,43 @@ +package +zoccolo+.web.controller; + +import +zoccolo+.web.controller.GenericComponent; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.ModelAndView; + +public class GenericController extends GenericComponent { + + @ExceptionHandler(Exception.class) + public ModelAndView handleError(HttpServletRequest req, Exception exception) { + logger.error("Request: " + req.getRequestURL() + " raised " + exception); + + exception.printStackTrace(); + ModelAndView mav = new ModelAndView("page.error"); + + return mav; + } + + + protected String localizeViewName(String viewBaseName, HttpServletRequest request) { + + String ret = viewBaseName; + String lang = getSessionAttribute("lang", request); + + if ("en".equals(lang)) + ret += ".en"; + return ret; + } + + @SuppressWarnings("unchecked") + protected T getSessionAttribute(String name, HttpServletRequest request) { + try { + T toReturn = (T) request.getSession().getAttribute(name); + return toReturn == null ? null : toReturn; + } catch (ClassCastException e) { + return null; + } + } + +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/GenericCrud.java b/screwdriver-3.5.6/box/snippets/java/GenericCrud.java new file mode 100644 index 0000000..24c1520 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/GenericCrud.java @@ -0,0 +1,114 @@ +package +zoccolo+.generic; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.springframework.dao.DataAccessException; + +public abstract interface GenericCrud { + + public abstract void clear() + + throws DataAccessException, Exception; + + public abstract void delete(T entity) + + throws DataAccessException, Exception; + + public abstract void deleteById(ID id) + + throws DataAccessException, Exception; + + public abstract List findAll() + + throws HibernateException, Exception; + + public abstract List findAll(Order order) + + throws HibernateException, Exception; + + public abstract List findByCriteria(Criterion... criterion) + + throws HibernateException, Exception; + + public abstract List findByCriteria(Order order, Criterion... criterion) + + throws HibernateException, Exception; + + public abstract T findUniqueByCriteria(Criterion... criterion) + + throws HibernateException, Exception; + + public abstract List findByExample(T exampleInstance, + String[] excludeProperty) + + throws HibernateException, Exception; + + public abstract T findById(ID id, boolean lock) + + throws DataAccessException, Exception; + + public abstract void flush() + + throws DataAccessException, Exception; + + public abstract T makePersistent(T entity) + + throws DataAccessException, Exception; + + public abstract void makeTransient(T entity) + + throws DataAccessException, Exception; + + public abstract void save(T entity) + + throws DataAccessException, Exception; + + public abstract void saveOrUpdate(T entity) + + throws DataAccessException, Exception; + + public void update(T entity) + + throws DataAccessException, Exception; + + public void merge(T entity) + + throws DataAccessException, Exception; + + public String getDialect() + + throws HibernateException, Exception; + + public List oneColumnQuery(final String q) + + throws HibernateException, Exception; + + public List manyColumnQuery(final String q) + + throws HibernateException; + + public Integer howManyRows(Criterion... criterion) + + throws DataAccessException; + + public Integer howManyRows() + + throws DataAccessException; + + public Integer howManyRowsAlias(String p, String alias, + Criterion... criterion) + + throws DataAccessException; + + /* screwdriver_knife */ + +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA1.java b/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA1.java new file mode 100644 index 0000000..c44217a --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA1.java @@ -0,0 +1,221 @@ +package +zoccolo+.+rail+; + +import +zoccolo+.generic.GenericCrud; + +import java.io.Serializable; +import java.lang.reflect.ParameterizedType; +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.LockMode; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Example; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.impl.SessionFactoryImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.dao.DataAccessException; +import org.springframework.orm.hibernate3.HibernateTemplate; +import org.springframework.transaction.annotation.Transactional; + +@Transactional("+rail+TxManager") +public abstract class Generic+Rail+DaoImpl + implements GenericCrud { + + private final Class persistentClass; + + @Autowired(required = true) + @Qualifier("+rail+Template") + protected HibernateTemplate +rail+Template; + + @SuppressWarnings("unchecked") + public Generic+Rail+DaoImpl() { + this.persistentClass = (Class) ((ParameterizedType) getClass() + .getGenericSuperclass()).getActualTypeArguments()[0]; + } + + public void clear() throws DataAccessException { + +rail+Template.clear(); + } + + public void delete(T entity) throws DataAccessException { + +rail+Template.delete(entity); + } + + public void deleteById(ID id) throws DataAccessException { + T entity = +rail+Template.get(persistentClass, id); + +rail+Template.delete(entity); + } + + public List findAll() throws HibernateException { + return findByCriteria(); + } + + @SuppressWarnings("unchecked") + public List findAll(Order order) throws HibernateException { + Criteria crit = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass); + crit.addOrder(order); + return crit.list(); + } + + @SuppressWarnings("unchecked") + public List findByCriteria(Order order, Criterion... criterion) + throws HibernateException { + Criteria criteria = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass).addOrder(order); + for (Criterion c : criterion) { + criteria.add(c); + } + return criteria.list(); + } + + @SuppressWarnings("unchecked") + public List findByCriteria(Criterion... criterion) + throws HibernateException { + Criteria criteria = +rail+Template.getSessionFactory() + .getCurrentSession().createCriteria(persistentClass); + for (Criterion c : criterion) { + criteria.add(c); + } + return criteria.list(); + } + + @SuppressWarnings("unchecked") + public String getDialect() + + throws HibernateException { + + SessionFactoryImpl sfi = (SessionFactoryImpl) +rail+Template + .getSessionFactory(); + return sfi.getDialect().toString(); + } + + @SuppressWarnings("unchecked") + public List oneColumnQuery(final String q) + + throws HibernateException { + + Session session = +rail+Template.getSessionFactory() + .getCurrentSession(); + Query query = session.createQuery(q); + return (List) query.list(); + } + + @SuppressWarnings("unchecked") + public List manyColumnQuery(final String q) + + throws HibernateException { + + Session session = +rail+Template.getSessionFactory() + .getCurrentSession(); + Query query = session.createQuery(q); + return (List) query.list(); + } + + @Override + public Integer howManyRows(Criterion... criterion) + + throws DataAccessException { + + Criteria criteria = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass) + .setProjection(Projections.rowCount()); + for (Criterion c : criterion) { + criteria.add(c); + } + return (Integer)criteria.uniqueResult(); + } + + @Override + public Integer howManyRowsAlias(String p, String alias, Criterion... criterion) + + throws DataAccessException { + + Criteria criteria = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass) + .setProjection(Projections.rowCount()); + criteria.createAlias(p, alias); + for (Criterion c : criterion) { + criteria.add(c); + } + return (Integer)criteria.uniqueResult(); + } + + @Override + public Integer howManyRows() throws DataAccessException { + Criteria criteria = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass) + .setProjection(Projections.rowCount()); + return (Integer)criteria.uniqueResult(); + } + + @SuppressWarnings("unchecked") + public T findUniqueByCriteria(Criterion... criterion) + throws HibernateException { + Criteria crit = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass); + for (Criterion c : criterion) { + crit.add(c); + } + return (T) crit.uniqueResult(); + } + + @SuppressWarnings("unchecked") + public List findByExample(T exampleInstance, String[] excludeProperty) + throws HibernateException { + Criteria crit = +rail+Template.getSessionFactory().getCurrentSession() + .createCriteria(persistentClass); + Example example = Example.create(exampleInstance); + for (String exclude : excludeProperty) { + example.excludeProperty(exclude); + } + crit.add(example); + return crit.list(); + } + + public T findById(ID id, boolean lock) throws DataAccessException { + T entity; + if (lock) + entity = +rail+Template.load(persistentClass, id, LockMode.UPGRADE); + else + entity = +rail+Template.load(persistentClass, id); + + return entity; + } + + public void flush() throws DataAccessException { + +rail+Template.flush(); + } + + public T makePersistent(T entity) throws DataAccessException { + +rail+Template.saveOrUpdate(entity); + return entity; + } + + public void makeTransient(T entity) throws DataAccessException { + +rail+Template.delete(entity); + } + + public void save(T entity) throws DataAccessException { + +rail+Template.save(entity); + } + + public void saveOrUpdate(T entity) throws DataAccessException { + +rail+Template.saveOrUpdate(entity); + } + + public void update(T entity) throws DataAccessException { + +rail+Template.update(entity); + } + + public void merge(T entity) throws DataAccessException { + +rail+Template.merge(entity); + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA2.java b/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA2.java new file mode 100644 index 0000000..a81ab3b --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA2.java @@ -0,0 +1,332 @@ +package +zoccolo+.+rail+; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceException; +import javax.persistence.Tuple; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Expression; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import javax.persistence.Query; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.transaction.annotation.Transactional; + +import +zoccolo+.jpa.Filter; +import +zoccolo+.jpa.Order; +import +zoccolo+.jpa.OrderBuilder.OrderType; +import +zoccolo+.jpa.PaginatedFilter; +import +zoccolo+.jpa.SearchParameter; +import +zoccolo+.jpa.dao.GenericDao; + +/** + * Implementation of the interface for dao management.
+ * IMPORTANT - Reference to the persistence context JPA is set in this implementation. + * + * @param + */ +public abstract class Generic+Rail+DaoImpl implements GenericDao { + + public static final Logger logger = LogManager.getLogger(Generic+Rail+DaoImpl.class); + + @PersistenceContext(unitName="+rail+EntityManagerFactory") + protected EntityManager em; + + protected String generateDebugParameters(List> parameters) { + if (parameters == null || parameters.size() == 0) { + return "[]"; + } + StringBuffer paramsDebug = new StringBuffer("["); + for (SearchParameter parameter : parameters) { + paramsDebug.append(" ").append(parameter.getName()).append("=").append(parameter.getValue()); + } + paramsDebug.append("]"); + + return paramsDebug.toString(); + } + + protected List createOrderClauseList(CriteriaBuilder cb, Root root, Order[] order) { + List orderList = new ArrayList(); + if (order == null) return orderList; + + for (Order ord : order) { + if (OrderType.ASC.toString().equals(ord.getAsc())) { + orderList.add(cb.asc(root.get(ord.getOrder()))); + } else { + orderList.add(cb.desc(root.get(ord.getOrder()))); + } + } + return orderList; + } + + @Transactional(rollbackFor=PersistenceException.class) + public T create(T entity) { + if (logger.isDebugEnabled()) logger.debug("Create entity: " + entity); + em.persist(entity); + em.flush(); + return entity; + } + + @Transactional(rollbackFor=PersistenceException.class) + public T update(T entity) { + // Check if instance is detached + if (!em.contains(entity)) { + if (logger.isDebugEnabled()) logger.debug("Update entity: " + entity); + entity = em.merge(entity); + } + em.flush(); + return entity; + } + + @Transactional(rollbackFor=PersistenceException.class) + public void remove(T entity) { + if (logger.isDebugEnabled()) logger.debug("Remove entity: " + entity); + // check if instance is detached + if (!em.contains(entity)) { + entity = em.merge(entity); + } + em.remove(entity); + em.flush(); + } + + public T findUniqueById(Class entityClass, Integer id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", " + id + ")"); + T result = em.find(entityClass, id); + return result; + } + + public T findUniqueById(Class entityClass, Long id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", " + id + ")"); + T result = em.find(entityClass, id); + return result; + } + + public T findUniqueById(Class entityClass, String id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", '" + id + "')"); + T result = em.find(entityClass, id); + return result; + } + + public Collection findListBy(Class entityClass, String fieldName, + Class fieldClass, Object fieldValue) { + + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(entityClass); + Root root = cq.from(entityClass); + + Predicate predicate = cb.equal( + root.get(fieldName).as(fieldClass), + fieldValue); + + cq.where(predicate); + + TypedQuery tq = em.createQuery(cq); + + if (logger.isDebugEnabled()) logger.debug("Start of findListBy(" + entityClass + "," + + " '" + fieldName + "'" + " " + fieldClass + "" + " '" + fieldValue + "')"); + Collection results = tq.getResultList(); + + return results; + } + + public List like(Class fieldClazz, String fieldName, + Class valueClazz, String fieldValue) { + + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(fieldClazz); + Root root = cq.from(fieldClazz); + + + Predicate predicate = cb.like( + (Expression)cb.upper( root.get(fieldName).as(valueClazz)), "%"+ + fieldValue.toUpperCase()+"%"); + + cq.where(predicate); + + TypedQuery tq = em.createQuery(cq); + + List results = tq.getResultList(); + + return results; + } + + public Collection findAll(Class entityClass, Order ... order) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(entityClass); + Root root = cq.from(entityClass); + + cq.orderBy(createOrderClauseList(cb, root, order)); + + TypedQuery tq = em.createQuery(cq); + + if (logger.isDebugEnabled()) logger.debug("Start of findAll(" + entityClass + ") method"); + Collection result = tq.getResultList(); + + return result; + } + + public Boolean exists(Class entityClass, Integer id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ") method"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + public Boolean exists(Class entityClass, Long id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ") method"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + public Boolean exists(Class entityClass, String id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ") method"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + /** + * Metodo da implementare per effettuare un'inizializzazione di una entity + * con caricamenti di dati lazy. Per default restituisce la entity + * inalterata. + * + * la HibernateUtils.initialize(). + * + * @param entity + * @return + */ + protected T load(T entity) { + return entity; + } + + protected void setPagination(TypedQuery tq, Filter filter) { + if (filter instanceof PaginatedFilter) { + PaginatedFilter pfilter = (PaginatedFilter) filter; + + int firstResult = pfilter.getFirstResult(); + int pageSize = pfilter.getPageSize(); + + if (logger.isTraceEnabled()) logger.trace("Range (" + firstResult + ", " + pageSize + ")"); + tq.setFirstResult(firstResult); + tq.setMaxResults(pageSize); + } + } + + public Long count(Class entityClass) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result; + } + + public Long count(Class entityClass, Filter filter) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + + List predicates = new ArrayList(); + if (!filter.getParams().isEmpty()) { + predicates.add(getLikePredicate(cb, root, filter.getParams())); + } + if (predicates.size() > 0) { + cq.where(cb.and(predicates.toArray(new Predicate[] {}))); + } + + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result; + } + + + @SuppressWarnings("unchecked") + public List fetch(Class entityClass, Filter filter, Order... order) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createTupleQuery(); + Root root = cq.from(entityClass); + + List predicates = new ArrayList(); + if (!filter.getParams().isEmpty()) { + predicates.add(getLikePredicate(cb, root, filter.getParams())); + } + if (predicates.size() > 0) { + cq.where(cb.and(predicates.toArray(new Predicate[] {}))); + } + + cq.select(cb.tuple(root)); + + cq.distinct(true); + + cq.orderBy(createOrderClauseList(cb, root, order)); + + TypedQuery tq = em.createQuery(cq); + + setPagination(tq, filter); + List results = tq.getResultList(); + List loadedResults = new ArrayList(); + for (Tuple result : results) { + loadedResults.add(load((T) result.get(0))); + } + return loadedResults; + } + + + public boolean existsByFilename(Class entityClass, SearchParameter fileName) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + + Predicate p = cb.equal(root.get(fileName.getName()).as(String.class), fileName.getValue()); + cq.where(p); + + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result > 0; + } + + private Predicate getLikePredicate(CriteriaBuilder cb, Root root, List> parameters) { + List orPredicates = new ArrayList(); + + for (SearchParameter parameter : parameters) { + orPredicates.add(cb.like(cb.upper(root.get(parameter.getName()).as(String.class)), "%" + parameter.getValue().toUpperCase() + "%")); + } + + return cb.or(orPredicates.toArray(new Predicate[] {})); + } + + @SuppressWarnings("unchecked") + + public List oneColumnQuery(final String string) { + Query qu = em.createQuery(string); + List sE = qu.getResultList(); + return sE; + } + + public List manyColumnQuery(final String string) { + Query qu = em.createQuery(string); + List sE = qu.getResultList(); + return sE; + } + + public Object findByPrimary(Class entityClass, Object chiave) { + Object x = em.find(entityClass, chiave); + return x; + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA2JRE7.java b/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA2JRE7.java new file mode 100644 index 0000000..7e283f8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/GenericRailDaoImplJPA2JRE7.java @@ -0,0 +1,349 @@ +package +zoccolo+.+rail+; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceException; +import javax.persistence.Tuple; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Expression; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import javax.persistence.Query; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.transaction.annotation.Transactional; + +import +zoccolo+.jpa.Filter; +import +zoccolo+.jpa.Order; +import +zoccolo+.jpa.OrderBuilder.OrderType; +import +zoccolo+.jpa.PaginatedFilter; +import +zoccolo+.jpa.SearchParameter; +import +zoccolo+.jpa.dao.GenericDao; + +/** + * Implementation of the interface for dao management.
+ * IMPORTANT - Reference to the persistence context JPA is set in this implementation. + * + * @param + */ +public abstract class Generic+Rail+DaoImpl implements GenericDao { + + public static final Logger logger = LogManager.getLogger(Generic+Rail+DaoImpl.class); + + @PersistenceContext(unitName="+rail+EntityManagerFactory") + protected EntityManager em; + + protected String generateDebugParameters(List> parameters) { + if (parameters == null || parameters.size() == 0) { + return "[]"; + } + StringBuffer paramsDebug = new StringBuffer("["); + for (SearchParameter parameter : parameters) { + paramsDebug.append(" ").append(parameter.getName()).append("=").append(parameter.getValue()); + } + paramsDebug.append("]"); + + return paramsDebug.toString(); + } + + protected List createOrderClauseList(CriteriaBuilder cb, Root root, Order[] order) { + List orderList = new ArrayList<>(); + if (order == null) return orderList; + + for (Order ord : order) { + if (OrderType.ASC.toString().equals(ord.getAsc())) { + orderList.add(cb.asc(root.get(ord.getOrder()))); + } else { + orderList.add(cb.desc(root.get(ord.getOrder()))); + } + } + return orderList; + } + + @Override + @Transactional(rollbackFor=PersistenceException.class) + public T create(T entity) { + if (logger.isDebugEnabled()) logger.debug("Create entity: " + entity); + em.persist(entity); + em.flush(); + return entity; + } + + @Override + @Transactional(rollbackFor=PersistenceException.class) + public T update(T entity) { + // Check if instance is detached + if (!em.contains(entity)) { + if (logger.isDebugEnabled()) logger.debug("Update entity: " + entity); + entity = em.merge(entity); + } + em.flush(); + return entity; + } + + @Override + @Transactional(rollbackFor=PersistenceException.class) + public void remove(T entity) { + if (logger.isDebugEnabled()) logger.debug("Remove entity: " + entity); + // check if instance is detached + if (!em.contains(entity)) { + entity = em.merge(entity); + } + em.remove(entity); + em.flush(); + } + + @Override + public T findUniqueById(Class entityClass, Integer id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", " + id + ")"); + T result = em.find(entityClass, id); + return result; + } + + @Override + public T findUniqueById(Class entityClass, Long id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", " + id + ")"); + T result = em.find(entityClass, id); + return result; + } + + @Override + public T findUniqueById(Class entityClass, String id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", '" + id + "')"); + T result = em.find(entityClass, id); + return result; + } + + @Override + public Collection findListBy(Class entityClass, String fieldName, + Class fieldClass, Object fieldValue) { + + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(entityClass); + Root root = cq.from(entityClass); + + Predicate predicate = cb.equal( + root.get(fieldName).as(fieldClass), + fieldValue); + + cq.where(predicate); + + TypedQuery tq = em.createQuery(cq); + + if (logger.isDebugEnabled()) logger.debug("Start of findListBy(" + entityClass + "," + + " '" + fieldName + "'" + " " + fieldClass + "" + " '" + fieldValue + "')"); + Collection results = tq.getResultList(); + + return results; + } + + @Override + public List like(Class fieldClazz, String fieldName, + Class valueClazz, String fieldValue) { + + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(fieldClazz); + Root root = cq.from(fieldClazz); + + + Predicate predicate = cb.like( + (Expression)cb.upper( root.get(fieldName).as(valueClazz)), "%"+ + fieldValue.toUpperCase()+"%"); + + cq.where(predicate); + + TypedQuery tq = em.createQuery(cq); + + List results = tq.getResultList(); + + return results; + } + + + @Override + public Collection findAll(Class entityClass, Order ... order) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(entityClass); + Root root = cq.from(entityClass); + + cq.orderBy(createOrderClauseList(cb, root, order)); + + TypedQuery tq = em.createQuery(cq); + + if (logger.isDebugEnabled()) logger.debug("Start of findAll(" + entityClass + ") method"); + Collection result = tq.getResultList(); + + return result; + } + + @Override + public Boolean exists(Class entityClass, Integer id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ") method"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + @Override + public Boolean exists(Class entityClass, Long id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ") method"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + @Override + public Boolean exists(Class entityClass, String id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ") method"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + /** + * Metodo da implementare per effettuare un'inizializzazione di una entity + * con caricamenti di dati lazy. Per default restituisce la entity + * inalterata. + * + * la HibernateUtils.initialize(). + * + * @param entity + * @return + */ + protected T load(T entity) { + return entity; + } + + protected void setPagination(TypedQuery tq, Filter filter) { + if (filter instanceof PaginatedFilter) { + PaginatedFilter pfilter = (PaginatedFilter) filter; + + int firstResult = pfilter.getFirstResult(); + int pageSize = pfilter.getPageSize(); + + if (logger.isTraceEnabled()) logger.trace("Range (" + firstResult + ", " + pageSize + ")"); + tq.setFirstResult(firstResult); + tq.setMaxResults(pageSize); + } + } + + @Override + public Long count(Class entityClass) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result; + } + + @Override + public Long count(Class entityClass, Filter filter) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + + List predicates = new ArrayList<>(); + if (!filter.getParams().isEmpty()) { + predicates.add(getLikePredicate(cb, root, filter.getParams())); + } + if (predicates.size() > 0) { + cq.where(cb.and(predicates.toArray(new Predicate[] {}))); + } + + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result; + } + + @Override + @SuppressWarnings("unchecked") + public List fetch(Class entityClass, Filter filter, Order... order) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createTupleQuery(); + Root root = cq.from(entityClass); + + List predicates = new ArrayList<>(); + if (!filter.getParams().isEmpty()) { + predicates.add(getLikePredicate(cb, root, filter.getParams())); + } + if (predicates.size() > 0) { + cq.where(cb.and(predicates.toArray(new Predicate[] {}))); + } + + cq.select(cb.tuple(root)); + + cq.distinct(true); + + cq.orderBy(createOrderClauseList(cb, root, order)); + + TypedQuery tq = em.createQuery(cq); + + setPagination(tq, filter); + List results = tq.getResultList(); + List loadedResults = new ArrayList(); + for (Tuple result : results) { + loadedResults.add(load((T) result.get(0))); + } + return loadedResults; + } + + @Override + public boolean existsByFilename(Class entityClass, SearchParameter fileName) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + + Predicate p = cb.equal(root.get(fileName.getName()).as(String.class), fileName.getValue()); + cq.where(p); + + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result > 0; + } + + private Predicate getLikePredicate(CriteriaBuilder cb, Root root, List> parameters) { + List orPredicates = new ArrayList(); + + for (SearchParameter parameter : parameters) { + orPredicates.add(cb.like(cb.upper(root.get(parameter.getName()).as(String.class)), "%" + parameter.getValue().toUpperCase() + "%")); + } + + return cb.or(orPredicates.toArray(new Predicate[] {})); + } + + @SuppressWarnings("unchecked") + @Override + public List oneColumnQuery(final String string) { + Query qu = em.createQuery(string); + List sE = qu.getResultList(); + return sE; + } + + @Override + public List manyColumnQuery(final String string) { + Query qu = em.createQuery(string); + List sE = qu.getResultList(); + return sE; + } + + @Override + public Object findByPrimary(Class entityClass, Object chiave) { + Object x = em.find(entityClass, chiave); + return x; + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/HttpRequestWrapper.java b/screwdriver-3.5.6/box/snippets/java/HttpRequestWrapper.java new file mode 100644 index 0000000..7379934 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/HttpRequestWrapper.java @@ -0,0 +1,83 @@ +package +zoccolo+.web.servlet; + +import +zoccolo+.web.listener.AntiSamyListener; + +import +zoccolo+.web.sanitizer.XssSanitizer; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; + +import org.owasp.validator.html.CleanResults; +import org.owasp.validator.html.PolicyException; +import org.owasp.validator.html.ScanException; + +public class HttpRequestWrapper extends HttpServletRequestWrapper { + + private XssSanitizer sanitizer; + + public HttpRequestWrapper(HttpServletRequest servletRequest) { + super(servletRequest); + this.sanitizer = (XssSanitizer) + this.getSession().getServletContext(). + getAttribute(AntiSamyListener.ANTISAMY_SANITIZER); + if(this.sanitizer == null) + throw new RuntimeException("Antisamy is not bound in ServletContext"); + } + + @Override + public String[] getParameterValues(String parameter) { + String[] retVal = null; + String[] values = super.getParameterValues(parameter); + if(values != null) + { + retVal = new String[values.length]; + for(int i = 0; i < values.length; i++) + { + if(values[i] != null) + retVal[i] = this.cleanXss(values[i]); + else + retVal[i] = values[i]; + } + } + return retVal; + } + + @Override + public String getParameter(String parameter) { + String paramValue = super.getParameter(parameter); + if(paramValue != null) + return this.cleanXss(paramValue); + else + return null; + } + + @Override + public String getHeader(String name) { + String value = super.getHeader(name); + if(value != null) + return this.cleanXss(value); + else + return null; + } + + private String cleanXss(String parameterValue){ + String retVal = null; + if(parameterValue != null) { + try + { + CleanResults cr = this.sanitizer.scan(parameterValue); + retVal = cr.getCleanHTML(); + } + catch (ScanException e) + { + throw new RuntimeException("ScanException: "+e.getMessage()); + } + catch (PolicyException e) + { + throw new RuntimeException("ScanException: "+e.getMessage()); + } + } + return retVal; + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/JsessionIdRemoveFilter.java b/screwdriver-3.5.6/box/snippets/java/JsessionIdRemoveFilter.java new file mode 100644 index 0000000..2cf1c53 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/JsessionIdRemoveFilter.java @@ -0,0 +1,87 @@ +package +zoccolo+.web.filter; + +import java.io.IOException; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpServletResponseWrapper; + +/** + * Servlet Filter implementation class JsessionIdRemoveFilter + */ +public class JsessionIdRemoveFilter implements Filter { + + /** + * Default constructor. + */ + public JsessionIdRemoveFilter() { + } + + /** + * @see Filter#destroy() + */ + public void destroy() { + } + + /** + * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) + */ + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { + if (!(req instanceof HttpServletRequest)) { + chain.doFilter(req, res); + return; + } + + HttpServletRequest request = (HttpServletRequest) req; + HttpServletResponse response = (HttpServletResponse) res; + // Redirect requests with JSESSIONID in URL to clean version + // (old links bookmarked/stored by bots) + // This is ONLY triggered if the request did not also contain a + // JSESSIONID cookie! Which should be fine for bots... + if (request.isRequestedSessionIdFromURL()) { + String url = request.getRequestURL() + .append(request.getQueryString() != null ? "?" + + request.getQueryString() : + "").toString(); + response.setHeader("Location", url); + response.sendError(HttpServletResponse.SC_MOVED_PERMANENTLY); + return; + } + // Prevent rendering of JSESSIONID in URLs for all outgoing links + HttpServletResponseWrapper wrappedResponse = new + HttpServletResponseWrapper( + response) { + @Override + public String encodeRedirectUrl(String url) { + return url; + } + @Override + public String encodeRedirectURL(String url) { + return url; + } + @Override + public String encodeUrl(String url) { + return url; + } + @Override + public String encodeURL(String url) { + return url; + } + }; + + chain.doFilter(req, wrappedResponse); + } + + /** + * @see Filter#init(FilterConfig) + */ + public void init(FilterConfig fConfig) throws ServletException { + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/King.java b/screwdriver-3.5.6/box/snippets/java/King.java new file mode 100644 index 0000000..e97be1a --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/King.java @@ -0,0 +1,27 @@ +package +zoccolo+.domain; + +import java.io.Serializable; + +public class King implements Serializable { + + private String userid; + private String password; + + private static final long serialVersionUID = 8433999509932007961L; + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/KingDao.java b/screwdriver-3.5.6/box/snippets/java/KingDao.java new file mode 100644 index 0000000..916d8b8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/KingDao.java @@ -0,0 +1,13 @@ +package +zoccolo+.web.authentication; + +import java.util.List; + +import org.springframework.dao.EmptyResultDataAccessException; + +import +zoccolo+.domain.King; + +public interface KingDao { + + King getUser(String id); + +} diff --git a/screwdriver-3.5.6/box/snippets/java/KingDaoImpl.java b/screwdriver-3.5.6/box/snippets/java/KingDaoImpl.java new file mode 100644 index 0000000..78a1fa3 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/KingDaoImpl.java @@ -0,0 +1,17 @@ +package +zoccolo+.web.authentication; + +import java.util.List; + +import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.stereotype.Repository; + +import +zoccolo+.domain.King; + +@Repository +public class KingDaoImpl implements KingDao { + + public King getUser(String id) { + King king = new King(); + return king; + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/LoggedUser.java b/screwdriver-3.5.6/box/snippets/java/LoggedUser.java new file mode 100644 index 0000000..5d9b341 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/LoggedUser.java @@ -0,0 +1,16 @@ +package +zoccolo+.web.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface LoggedUser { + + /* screwdriver_knife */ + +} diff --git a/screwdriver-3.5.6/box/snippets/java/LoggedUserMethodArgumentResolver.java b/screwdriver-3.5.6/box/snippets/java/LoggedUserMethodArgumentResolver.java new file mode 100644 index 0000000..92a0925 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/LoggedUserMethodArgumentResolver.java @@ -0,0 +1,45 @@ +package +zoccolo+.web.resolver; + +import +zoccolo+.security.Belonger; +import +zoccolo+.web.annotation.LoggedUser; + +import java.security.Principal; + +import org.springframework.core.MethodParameter; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.support.WebArgumentResolver; +import org.springframework.web.bind.support.WebDataBinderFactory; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.method.support.HandlerMethodArgumentResolver; +import org.springframework.web.method.support.ModelAndViewContainer; + +@Component +public class LoggedUserMethodArgumentResolver + implements HandlerMethodArgumentResolver { + + @Override + public boolean supportsParameter(MethodParameter methodParameter) { + return + methodParameter.getParameterAnnotation(LoggedUser.class) != null + && methodParameter.getParameterType().equals(Belonger.class); + } + + @Override + public Object resolveArgument(MethodParameter methodParameter, + ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + WebDataBinderFactory binderFactory) throws Exception { + + if (this.supportsParameter(methodParameter)) { + Principal principal = webRequest.getUserPrincipal(); + return principal==null?null:(Belonger) ((Authentication) principal).getPrincipal(); + } + else { + return WebArgumentResolver.UNRESOLVED; + } + } + + /* screwdriver_knife */ + +} diff --git a/screwdriver-3.5.6/box/snippets/java/Notice.java b/screwdriver-3.5.6/box/snippets/java/Notice.java new file mode 100644 index 0000000..139495c --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/Notice.java @@ -0,0 +1,40 @@ +package +zoccolo+.web.model.utility; + +import org.apache.log4j.Logger; + +public class Notice { + + /** ordinary logger */ + @SuppressWarnings("unused") + private static final Logger logger = Logger.getLogger( + Notice.class); + + /** proprietà  del bean */ + private String screwFormattedText; + + /** proprietà  del bean */ + private String screwFreeText; + + /** standard get method */ + public String getScrewFreeText() { + return screwFreeText; + } + + /** standard set method, argument String */ + public void setScrewFreeText(String screwFreeText) { + this.screwFreeText = screwFreeText; + } + + /** standard get method */ + public String getScrewFormattedText() { + + return this.screwFormattedText; + } + + /** standard set method, argument String */ + public void setScrewFormattedText(String s) { + + this.screwFormattedText = s; + } + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/QuartzJob.java b/screwdriver-3.5.6/box/snippets/java/QuartzJob.java new file mode 100644 index 0000000..53f03b3 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/QuartzJob.java @@ -0,0 +1,33 @@ +package +zoccolo+.job; + +import +zoccolo+.task.impl.+Quartztask+TaskImpl; + +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.quartz.QuartzJobBean; +import org.springframework.web.context.support.SpringBeanAutowiringSupport; + +public class +Quartzjob+ extends QuartzJobBean { + + private static final Logger log = Logger.getLogger(+Quartzjob+.class); + + @Autowired + +Quartztask+TaskImpl task; + + @Override + protected void executeInternal(JobExecutionContext arg0) + + throws JobExecutionException { + + try { + log.debug("executeInternal..."); + SpringBeanAutowiringSupport + .processInjectionBasedOnCurrentContext(this); + task.execute(arg0); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/QuartzTask.java b/screwdriver-3.5.6/box/snippets/java/QuartzTask.java new file mode 100644 index 0000000..7b634e5 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/QuartzTask.java @@ -0,0 +1,8 @@ +package +zoccolo+.task; + +import org.quartz.JobExecutionContext; + +public interface +Quartztask+Task { + + public void execute(JobExecutionContext ctx) throws Exception; +} diff --git a/screwdriver-3.5.6/box/snippets/java/QuartzTaskImpl.java b/screwdriver-3.5.6/box/snippets/java/QuartzTaskImpl.java new file mode 100644 index 0000000..76f6286 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/QuartzTaskImpl.java @@ -0,0 +1,24 @@ +package +zoccolo+.task.impl; + +import java.util.Date; + +import org.apache.log4j.Logger; +import org.quartz.JobExecutionContext; +import org.springframework.web.context.support.SpringBeanAutowiringSupport; + +import +zoccolo+.task.+Quartztask+Task; + +public class +Quartztask+TaskImpl implements +Quartztask+Task { + + private static final Logger log = Logger.getLogger( + +Quartztask+TaskImpl.class); + + public void execute(JobExecutionContext ctx) + + throws Exception { + + SpringBeanAutowiringSupport + .processInjectionBasedOnCurrentContext(this); + /* screwdriver_knife */ + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/ScrewInterceptor.java b/screwdriver-3.5.6/box/snippets/java/ScrewInterceptor.java new file mode 100644 index 0000000..0462f30 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ScrewInterceptor.java @@ -0,0 +1,38 @@ +package +zoccolo+.web.interceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.web.servlet.HandlerInterceptor; +import org.springframework.web.servlet.ModelAndView; + +public class +nocciolo+ implements HandlerInterceptor { + + public void afterCompletion(HttpServletRequest arg0, + HttpServletResponse arg1, Object arg2, Exception arg3) + throws Exception { + // TODO Auto-generated method stub + } + + public void postHandle(HttpServletRequest arg0, + HttpServletResponse arg1, Object arg2, ModelAndView arg3) + throws Exception { + // TODO Auto-generated method stub + } + + public boolean preHandle(HttpServletRequest arg0, + HttpServletResponse arg1, Object arg2) throws Exception { + /* 2020-01-20: if I set "return false", I obtain a white home page, + * nothing works. */ + return true; + } + + public void afterConcurrentHandlingStarted( + HttpServletRequest request, HttpServletResponse response, Object handler) + throws Exception { + // TODO Auto-generated method stub + } + + /* screwdriver_knife */ + +} diff --git a/screwdriver-3.5.6/box/snippets/java/SimpleSpringSecurityUserContext.java b/screwdriver-3.5.6/box/snippets/java/SimpleSpringSecurityUserContext.java new file mode 100644 index 0000000..42972e6 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/SimpleSpringSecurityUserContext.java @@ -0,0 +1,50 @@ +package +zoccolo+.web.authentication; + +import java.util.Collection; + +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.stereotype.Component; + +import +zoccolo+.web.authentication.authority.UserAuthorityUtils; +import +tabposition+.+tabella+; + +/** + * An implementation of {@link UserContext} that looks up the {@link CalendarUser} using the Spring Security's + * {@link Authentication} by principal name. + * + * @author Rob Winch + * + */ +@Component +public class SpringSecurityUserContext implements UserContext { + /** + * Get the {@link CalendarUser} by casting the {@link Authentication}'s principal to a {@link CalendarUser}. + */ + @Override + public +tabella+ getCurrentUser() { + SecurityContext context = SecurityContextHolder.getContext(); + Authentication authentication = context.getAuthentication(); + if (authentication == null) { + return null; + } + return (+tabella+) authentication.getPrincipal(); + } + + /** + * Sets the {@link CalendarUser} as the current {@link Authentication}'s principal. It uses + */ + @Override + public void setCurrentUser(+tabella+ user) { + if (user == null) { + throw new IllegalArgumentException("user cannot be null"); + } + Collection authorities = UserAuthorityUtils.createAuthorities(user); + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(user, + user.get+password+(),authorities); + SecurityContextHolder.getContext().setAuthentication(authentication); + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/SimpleUsernamePasswordAuthenticationFilter.java b/screwdriver-3.5.6/box/snippets/java/SimpleUsernamePasswordAuthenticationFilter.java new file mode 100644 index 0000000..210b2b9 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/SimpleUsernamePasswordAuthenticationFilter.java @@ -0,0 +1,47 @@ +package +zoccolo+.web.authentication; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.springframework.security.authentication.AuthenticationServiceException; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +import +zoccolo+.web.authentication.SimpleUsernamePasswordAuthenticationToken; + +/** + * An extension to the existing + * {@link UsernamePasswordAuthenticationFilter} that obtains + * a domain parameter and then + * creates a {@link DomainUsernamePasswordAuthenticationToken}. + * + * @author Rob Winch + * + */ +public final class SimpleUsernamePasswordAuthenticationFilter + + extends UsernamePasswordAuthenticationFilter { + + public Authentication attemptAuthentication(HttpServletRequest + request, HttpServletResponse response) + + throws AuthenticationException { + + if (!request.getMethod().equals("POST")) { + throw new AuthenticationServiceException( + "Authentication method not supported: " + + request.getMethod()); + } + String username = obtainUsername(request); + String password = obtainPassword(request); + + SimpleUsernamePasswordAuthenticationToken authRequest + = new SimpleUsernamePasswordAuthenticationToken(username, + password); + + setDetails(request, authRequest); + return this.getAuthenticationManager().authenticate(authRequest); + } + /* screwdriver_knife */ +} \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/SimpleUsernamePasswordAuthenticationToken.java b/screwdriver-3.5.6/box/snippets/java/SimpleUsernamePasswordAuthenticationToken.java new file mode 100644 index 0000000..1558737 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/SimpleUsernamePasswordAuthenticationToken.java @@ -0,0 +1,33 @@ +package +zoccolo+.web.authentication; + +import java.util.Collection; + +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import +jpapath+.+tabella+; + +public final class SimpleUsernamePasswordAuthenticationToken + + extends UsernamePasswordAuthenticationToken { + + private static final long serialVersionUID = -5138870746127783L; + + public SimpleUsernamePasswordAuthenticationToken(String principal, + String credentials) { + super(principal, credentials); + } + + public SimpleUsernamePasswordAuthenticationToken(Utenti principal, + String credentials, + Collection authorities) { + super(principal, credentials, authorities); + } + + +newMethod+ + + /* screwdriver_knife */ +} diff --git a/screwdriver-3.5.6/box/snippets/java/UserAuthorityUtils.java b/screwdriver-3.5.6/box/snippets/java/UserAuthorityUtils.java new file mode 100644 index 0000000..aa16b11 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/UserAuthorityUtils.java @@ -0,0 +1,36 @@ +package +zoccolo+.web.authentication.authority; + +import java.util.Collection; +import java.util.List; + +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.AuthorityUtils; + +import +tabposition+.+tabella+; + +/** + * A utility class used for creating the {@link GrantedAuthority}'s given a {@link +tabella+}. In a real solution + * this would be looked up in the existing system, but for simplicity our original system had no notion of authorities. + * + * @author Rob Winch + * + */ +public final class UserAuthorityUtils { + + private static final List ADMIN_ROLES = AuthorityUtils.createAuthorityList("ROLE_ADMIN", + "ROLE_USER"); + private static final List USER_ROLES = AuthorityUtils.createAuthorityList("ROLE_USER"); + + private UserAuthorityUtils() { + + } + + public static Collection createAuthorities(+tabella+ user) { + String username = user.getChiave(); +// NON CANCELLARE + if (username.startsWith("admin")) { + return ADMIN_ROLES; + } + return USER_ROLES; + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/UserContext.java b/screwdriver-3.5.6/box/snippets/java/UserContext.java new file mode 100644 index 0000000..a9927fe --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/UserContext.java @@ -0,0 +1,20 @@ +package +zoccolo+.web.authentication; + +import +beanposition+.+bean+; + +public interface UserContext { + + /** + * Gets the currently logged in {@link +bean+} or null if there is no authenticated user. + * + * @return + */ + +bean+ getCurrentUser(); + + /** + * Sets the currently logged in {@link +bean+}. + * @param user the logged in {@link +bean+}. Cannot be null. + * @throws IllegalArgumentException if the {@link +bean+} is null. + */ + void setCurrentUser(+bean+ user); +} diff --git a/screwdriver-3.5.6/box/snippets/java/XssSanitizer.java b/screwdriver-3.5.6/box/snippets/java/XssSanitizer.java new file mode 100644 index 0000000..defb638 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/XssSanitizer.java @@ -0,0 +1,37 @@ +package +zoccolo+.web.sanitizer; + +import org.owasp.validator.html.AntiSamy; +import org.owasp.validator.html.CleanResults; +import org.owasp.validator.html.Policy; +import org.owasp.validator.html.PolicyException; +import org.owasp.validator.html.ScanException; + +public class XssSanitizer { + + private AntiSamy antiSamy; + private Policy policy; + + + public XssSanitizer(String policyFilePath) throws PolicyException{ + this.policy = Policy.getInstance(this.getClass().getResourceAsStream(policyFilePath)); + + this.antiSamy = new AntiSamy(this.policy); + } + + public CleanResults scan(String input) throws ScanException, PolicyException{ + if(input == null) + throw new ScanException("input parameter is null."); + CleanResults cleanResults = this.antiSamy.scan(input); + return cleanResults; + } + + public AntiSamy getAntiSamy() { + return antiSamy; + } + + public Policy getPolicy() { + return policy; + } + /* screwdriver_knife */ +} + diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/Filter.java b/screwdriver-3.5.6/box/snippets/java/jpa2/Filter.java new file mode 100644 index 0000000..1f86f99 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/Filter.java @@ -0,0 +1,14 @@ +package +zoccolo+.jpa; + +import java.util.ArrayList; +import java.util.List; + +import +zoccolo+.jpa.SearchParameter; + +public class Filter { + private List> params = new ArrayList>(); + + public List> getParams() { + return params; + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/GenericDao.java b/screwdriver-3.5.6/box/snippets/java/jpa2/GenericDao.java new file mode 100644 index 0000000..c73bae2 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/GenericDao.java @@ -0,0 +1,140 @@ +package +zoccolo+.jpa.dao; + +import java.util.Collection; +import java.util.List; + +import +zoccolo+.jpa.Filter; +import +zoccolo+.jpa.Order; +import +zoccolo+.jpa.SearchParameter; + +/** + * Generic CRUD interface implemented by all DAOs. + * + * @param entity to be managed. + */ +public interface GenericDao { + + /** + * Persist the entity in DB (though a flush). + * + * @param entity + * @return + */ + T create(T entity); + + /** + * Flush DB changes made in the entity, merging if the entity + * is detached from the session. + * + * @param entity + * @return + */ + T update(T entity); + + /** + * Effettua la rimozione dell'entity da db, effettuando il flush. + * Esegue il merge se l'entity è detached dalla sessione. + * + * @param entity + */ + void remove(T entity); + + /** + * Ritrova l'entity con id associato. + * + * @param entityClass + * @param id + * @return + */ + T findUniqueById(Class entityClass, Integer id); + + /** + * Ritrova l'entity con id associato. + * + * @param entityClass + * @param id + * @return + */ + T findUniqueById(Class entityClass, Long id); + + /** + * Ritrova l'entity con id associato. + * + * @param entityClass + * @param id + * @return + */ + T findUniqueById(Class entityClass, String id); + + /** + * Effettua una ricerca generica per il valore di un parametro. + * + * @param entityClass Tipo di entity da ricercare. + * @param fieldName Nome del campo di ricerca. + * @param fieldClass Classe del campo di ricerca. + * @param fieldValue Valore del campo di ricerca. + * + * @return Elenco non ordinato dei valori trovati. + */ + Collection findListBy(Class entityClass, String fieldName, Class fieldClass, Object fieldValue); + + /** + * Effettua una ricerca full con ordinamento. + * + * @param entityClass Tipo di entity da ricercare. + * @param order Elenco di elementi di ordinamento + * @return Elenco ordinato di tutti gli elementi della tabella indicata dall'entity. + */ + Collection findAll(Class entityClass, Order ... order); + + /** + * Verifica se esiste un record dall'id specificato. + * + * @param id + * @param entityClass + * @return + */ + Boolean exists(Class entityClass, Integer id); + + /** + * Verifica se esiste un record dall'id specificato. + * + * @param id + * @param entityClass + * @return + */ + Boolean exists(Class entityClass, Long id); + + /** + * Verifica se esiste un record dall'id specificato. + * + * @param id + * @param entityClass + * @return + */ + Boolean exists(Class entityClass, String id); + + /** + * Ottiene una lista di risultati con una like. + * + * @param fieldValue + * @param clazz + * @return + */ + List like(Class fieldClazz, String fieldName, Class class1, String fieldValue); + + Long count(Class entityClass); + + Long count(Class entityClass, Filter filter); + + List fetch(Class entityClass, Filter filter, Order... order); + + boolean existsByFilename(Class entityClass, SearchParameter fileName); + + List oneColumnQuery(final String string); + + List manyColumnQuery(final String string); + + Object findByPrimary(Class entityClass, Object chiave); + +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/GenericDaoImpl.java b/screwdriver-3.5.6/box/snippets/java/jpa2/GenericDaoImpl.java new file mode 100644 index 0000000..4a5e10d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/GenericDaoImpl.java @@ -0,0 +1,341 @@ +package +zoccolo+.jpa.dao.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.PersistenceException; +import javax.persistence.Tuple; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Expression; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import javax.persistence.Query; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.transaction.annotation.Transactional; + +import +zoccolo+.jpa.Filter; +import +zoccolo+.jpa.Order; +import +zoccolo+.jpa.OrderBuilder.OrderType; +import +zoccolo+.jpa.PaginatedFilter; +import +zoccolo+.jpa.SearchParameter; +import +zoccolo+.jpa.dao.GenericDao; + +/** + * Implementation of the interface for dao management.
+ * IMPORTANT - Reference to the persistence context JPA is set in this implementation. + * + * @param + */ +public abstract class GenericDaoImpl implements GenericDao { + + public static final Logger logger = LogManager.getLogger(GenericDaoImpl.class); + + @PersistenceContext(unitName="+rail+EntityManagerFactory") + protected EntityManager em; + + protected String generateDebugParameters(List> parameters) { + if (parameters == null || parameters.size() == 0) { + return "[]"; + } + StringBuffer paramsDebug = new StringBuffer("["); + for (SearchParameter parameter : parameters) { + paramsDebug.append(" ").append(parameter.getName()).append("=").append(parameter.getValue()); + } + paramsDebug.append("]"); + + return paramsDebug.toString(); + } + + protected List createOrderClauseList(CriteriaBuilder cb, Root root, Order[] order) { + List orderList = new ArrayList<>(); + if (order == null) return orderList; + + for (Order ord : order) { + if (OrderType.ASC.toString().equals(ord.getAsc())) { + orderList.add(cb.asc(root.get(ord.getOrder()))); + } else { + orderList.add(cb.desc(root.get(ord.getOrder()))); + } + } + return orderList; + } + + @Override + @Transactional(rollbackFor=PersistenceException.class) + public T create(T entity) { + if (logger.isDebugEnabled()) logger.debug("Create entity: " + entity); + em.persist(entity); + em.flush(); + return entity; + } + + @Override + @Transactional(rollbackFor=PersistenceException.class) + public T update(T entity) { + // Check if instance is detached + if (!em.contains(entity)) { + if (logger.isDebugEnabled()) logger.debug("Update entity: " + entity); + entity = em.merge(entity); + } + em.flush(); + return entity; + } + + @Override + @Transactional(rollbackFor=PersistenceException.class) + public void remove(T entity) { + if (logger.isDebugEnabled()) logger.debug("Remove entity: " + entity); + // check if instance is detached + if (!em.contains(entity)) { + entity = em.merge(entity); + } + em.remove(entity); + em.flush(); + } + + @Override + public T findUniqueById(Class entityClass, Integer id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", " + id + ")"); + T result = em.find(entityClass, id); + return result; + } + + @Override + public T findUniqueById(Class entityClass, Long id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", " + id + ")"); + T result = em.find(entityClass, id); + return result; + } + + @Override + public T findUniqueById(Class entityClass, String id) { + if (logger.isDebugEnabled()) logger.debug("findUniqueById(" + entityClass.getName() + ", '" + id + "')"); + T result = em.find(entityClass, id); + return result; + } + + @Override + public Collection findListBy(Class entityClass, String fieldName, + Class fieldClass, Object fieldValue) { + + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(entityClass); + Root root = cq.from(entityClass); + + Predicate predicate = cb.equal( + root.get(fieldName).as(fieldClass), + fieldValue); + + cq.where(predicate); + + TypedQuery tq = em.createQuery(cq); + + if (logger.isDebugEnabled()) logger.debug("Start of findListBy(" + entityClass + "," + + " '" + fieldName + "'" + " " + fieldClass + "" + " '" + fieldValue + "')"); + Collection results = tq.getResultList(); + + return results; + } + + @Override + public List like(Class fieldClazz, String fieldName, + Class valueClazz, String fieldValue) { + + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(fieldClazz); + Root root = cq.from(fieldClazz); + + + Predicate predicate = cb.like( + (Expression)cb.upper( root.get(fieldName).as(valueClazz)), "%"+ + fieldValue.toUpperCase()+"%"); + + cq.where(predicate); + + TypedQuery tq = em.createQuery(cq); + + List results = tq.getResultList(); + + return results; + } + + + @Override + public Collection findAll(Class entityClass, Order ... order) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + + CriteriaQuery cq = cb.createQuery(entityClass); + Root root = cq.from(entityClass); + + cq.orderBy(createOrderClauseList(cb, root, order)); + + TypedQuery tq = em.createQuery(cq); + + if (logger.isDebugEnabled()) logger.debug("Start of findAll(" + entityClass + ")"); + Collection result = tq.getResultList(); + + return result; + } + + @Override + public Boolean exists(Class entityClass, Long id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ")"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + @Override + public Boolean exists(Class entityClass, String id) { + if (logger.isDebugEnabled()) logger.debug("Start of exists(" + entityClass + ", " + id + ")"); + T result = em.find(entityClass, id); + return result == null ? false : true; + } + + /** + * Metodo da implementare per effettuare un'inizializzazione di una entity + * con caricamenti di dati lazy. Per default restituisce la entity + * inalterata. + * + * la HibernateUtils.initialize(). + * + * @param entity + * @return + */ + protected T load(T entity) { + return entity; + } + + protected void setPagination(TypedQuery tq, Filter filter) { + if (filter instanceof PaginatedFilter) { + PaginatedFilter pfilter = (PaginatedFilter) filter; + + int firstResult = pfilter.getFirstResult(); + int pageSize = pfilter.getPageSize(); + + if (logger.isTraceEnabled()) logger.trace("Range (" + firstResult + ", " + pageSize + ")"); + tq.setFirstResult(firstResult); + tq.setMaxResults(pageSize); + } + } + + @Override + public Long count(Class entityClass) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result; + } + + @Override + public Long count(Class entityClass, Filter filter) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + + List predicates = new ArrayList<>(); + if (!filter.getParams().isEmpty()) { + predicates.add(getLikePredicate(cb, root, filter.getParams())); + } + if (predicates.size() > 0) { + cq.where(cb.and(predicates.toArray(new Predicate[] {}))); + } + + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result; + } + + @Override + @SuppressWarnings("unchecked") + public List fetch(Class entityClass, Filter filter, Order... order) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createTupleQuery(); + Root root = cq.from(entityClass); + + List predicates = new ArrayList<>(); + if (!filter.getParams().isEmpty()) { + predicates.add(getLikePredicate(cb, root, filter.getParams())); + } + if (predicates.size() > 0) { + cq.where(cb.and(predicates.toArray(new Predicate[] {}))); + } + + cq.select(cb.tuple(root)); + + cq.distinct(true); + + cq.orderBy(createOrderClauseList(cb, root, order)); + + TypedQuery tq = em.createQuery(cq); + + setPagination(tq, filter); + List results = tq.getResultList(); + List loadedResults = new ArrayList(); + for (Tuple result : results) { + loadedResults.add(load((T) result.get(0))); + } + return loadedResults; + } + + @Override + public boolean existsByFilename(Class entityClass, SearchParameter fileName) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(Long.class); + Root root = cq.from(entityClass); + + Predicate p = cb.equal(root.get(fileName.getName()).as(String.class), fileName.getValue()); + cq.where(p); + + cq.select(cb.count(root)); + + TypedQuery tq = em.createQuery(cq); + Long result = tq.getSingleResult(); + return result > 0; + } + + private Predicate getLikePredicate(CriteriaBuilder cb, Root root, List> parameters) { + List orPredicates = new ArrayList(); + + for (SearchParameter parameter : parameters) { + orPredicates.add(cb.like(cb.upper(root.get(parameter.getName()).as(String.class)), "%" + parameter.getValue().toUpperCase() + "%")); + } + + return cb.or(orPredicates.toArray(new Predicate[] {})); + } + + @SuppressWarnings("unchecked") + @Override + public List oneColumnQuery(final String string) { + Query qu = em.createQuery(string); + List sE = qu.getResultList(); + return sE; + } + + @Override + public List manyColumnQuery(final String string) { + Query qu = em.createQuery(string); + List sE = qu.getResultList(); + return sE; + } + + @Override + public Object findByPrimary(Class entityClass, Object chiave) { + Object x = em.find(entityClass, chiave); + return x; + } +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/Order.java b/screwdriver-3.5.6/box/snippets/java/jpa2/Order.java new file mode 100644 index 0000000..411447c --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/Order.java @@ -0,0 +1,8 @@ +package +zoccolo+.jpa; + +public interface Order { + + public String getOrder(); + public String getAsc(); + +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/OrderBuilder.java b/screwdriver-3.5.6/box/snippets/java/jpa2/OrderBuilder.java new file mode 100644 index 0000000..1d810c5 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/OrderBuilder.java @@ -0,0 +1,63 @@ +package +zoccolo+.jpa; + +import java.util.ArrayList; +import java.util.List; + +public class OrderBuilder { + + public static enum OrderType { + ASC("asc"), DESC("desc"); + + private String value; + + private OrderType(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value.toString(); + } + } + + private List orders; + + public OrderBuilder() { + orders = new ArrayList(); + } + + public OrderBuilder add(final String order) { + orders.add(new Order() { + public String getOrder() { + return order; + } + + public String getAsc() { + return OrderType.ASC.toString(); + } + }); + return this; + } + + public OrderBuilder add(final String order, final String asc) { + orders.add(new Order() { + public String getOrder() { + return order; + } + + public String getAsc() { + return asc; + } + }); + return this; + } + + public List getOrders() { + return orders; + } + + public Order[] toArray() { + return orders.toArray(new Order[] {}); + } + +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/PaginatedFilter.java b/screwdriver-3.5.6/box/snippets/java/jpa2/PaginatedFilter.java new file mode 100644 index 0000000..5c829d2 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/PaginatedFilter.java @@ -0,0 +1,30 @@ +package +zoccolo+.jpa; + +public class PaginatedFilter extends Filter { + + private int firstResult = 1; + + private int pageSize = 5; + + public PaginatedFilter(int firstResult, int pageSize) { + this.firstResult = firstResult; + this.pageSize = pageSize; + } + + public int getFirstResult() { + return firstResult; + } + + public void setFirstResult(int firstResult) { + this.firstResult = firstResult; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/SearchParameter.java b/screwdriver-3.5.6/box/snippets/java/jpa2/SearchParameter.java new file mode 100644 index 0000000..d040571 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/SearchParameter.java @@ -0,0 +1,7 @@ +package +zoccolo+.jpa; + +public interface SearchParameter { + String getName(); + T getValue(); + Class getType(); +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/SearchParameterBuilder.java b/screwdriver-3.5.6/box/snippets/java/jpa2/SearchParameterBuilder.java new file mode 100644 index 0000000..ddfa38b --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/SearchParameterBuilder.java @@ -0,0 +1,71 @@ +package +zoccolo+.jpa; + +import javax.persistence.metamodel.SingularAttribute; + +public class SearchParameterBuilder { + + public static SearchParameter getStringParam(String name, String value) { + return new StringParameter(name, value); + } + + /** + * Per parametri anonimi. + */ + public static SearchParameter getStringParam(String value) { + return getStringParam("", value); + } + + public static SearchParameter getParam(SingularAttribute sa, final T value) { + return new SingularParameter(sa, value); + } + + /** + * Il value non deve essere null. + */ + public static SearchParameter getParam(final String name, final T value) { + return new SearchParameter() { + @Override + public String getName() { + return name; + } + + @Override + public T getValue() { + return value; + } + + @SuppressWarnings("unchecked") + @Override + public Class getType() { + return (Class) value.getClass(); + } + }; + } + + /** + * Per parametri anonimi. + */ + public static SearchParameter getParam(String value) { + return getParam("", value); + } + + public static SearchParameter getParam(final String name, final T value, final Class clazz) { + return new SearchParameter() { + @Override + public String getName() { + return name; + } + + @Override + public T getValue() { + return value; + } + + @Override + public Class getType() { + return clazz; + } + }; + } + +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/SingularParameter.java b/screwdriver-3.5.6/box/snippets/java/jpa2/SingularParameter.java new file mode 100644 index 0000000..68ee2bb --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/SingularParameter.java @@ -0,0 +1,31 @@ +package +zoccolo+.jpa; + +import javax.persistence.metamodel.SingularAttribute; + +public class SingularParameter implements SearchParameter { + + private final String name; + + private final T value; + + private final Class type; + + public SingularParameter(SingularAttribute sa, T value) { + this.name = sa.getName(); + this.value = value; + this.type = sa.getJavaType(); + } + + public String getName() { + return name; + } + + public T getValue() { + return value; + } + + public Class getType() { + return type; + } + +} diff --git a/screwdriver-3.5.6/box/snippets/java/jpa2/StringParameter.java b/screwdriver-3.5.6/box/snippets/java/jpa2/StringParameter.java new file mode 100644 index 0000000..4767ebc --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/jpa2/StringParameter.java @@ -0,0 +1,26 @@ +package +zoccolo+.jpa; + +public class StringParameter implements SearchParameter { + + private final String name; + + private final String value; + + public StringParameter(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public Class getType() { + return String.class; + } + +} diff --git a/screwdriver-3.5.6/box/snippets/java/ldapAuthenticationModel.java b/screwdriver-3.5.6/box/snippets/java/ldapAuthenticationModel.java new file mode 100644 index 0000000..8f6862e --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ldapAuthenticationModel.java @@ -0,0 +1,9 @@ + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if(authentication == null) { + throw new IllegalStateException("authentication cannot be null. Make sure you are logged in."); + } + Object principal = authentication.getPrincipal(); + model.addAttribute("user", principal); + model.addAttribute("isLdapUserDetails", principal instanceof LdapUserDetails); + model.addAttribute("isLdapPerson", principal instanceof Person); + model.addAttribute("isLdapInetOrgPerson", principal instanceof InetOrgPerson); \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/java/ldapAuthenticationModelService.java b/screwdriver-3.5.6/box/snippets/java/ldapAuthenticationModelService.java new file mode 100644 index 0000000..cbc78f4 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/java/ldapAuthenticationModelService.java @@ -0,0 +1,9 @@ + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if(authentication == null) { + throw new IllegalStateException("authentication cannot be null. Make sure you are logged in."); + } + Object principal = userDetailsService.loadUserByUsername(authentication.getName()); + model.addAttribute("user", principal); + model.addAttribute("isLdapUserDetails", principal instanceof LdapUserDetails); + model.addAttribute("isLdapPerson", principal instanceof Person); + model.addAttribute("isLdapInetOrgPerson", principal instanceof InetOrgPerson); diff --git a/screwdriver-3.5.6/box/snippets/jsp/base_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/base_jsp.txt new file mode 100644 index 0000000..60b7b5a --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/base_jsp.txt @@ -0,0 +1,17 @@ + +<%@ page language="java" pageEncoding="+charset+" contentType="text/html; charset=+charset+" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> ++sec+ ++pragma+ + + +header+ + +navigation+ + ++belong+ + ++text+ ++footer+ + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/jsp/error_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/error_jsp.txt new file mode 100644 index 0000000..e405698 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/error_jsp.txt @@ -0,0 +1,31 @@ + +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> + + + + + + +navigation+ + +
Error
+

${belong.screwFreeText}

+
+ +
+ + + +

+ +

+ + diff --git a/screwdriver-3.5.6/box/snippets/jsp/footer_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/footer_jsp.txt new file mode 100644 index 0000000..454e17f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/footer_jsp.txt @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/jsp/header_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/header_jsp.txt new file mode 100644 index 0000000..2fd96ad --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/header_jsp.txt @@ -0,0 +1,13 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + +titolo+: ${pageTitle} + + + + + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/jsp/login_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/login_jsp.txt new file mode 100644 index 0000000..3bb4ef5 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/login_jsp.txt @@ -0,0 +1,59 @@ + +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + + + + + + <c:out value="${pageTitle}"/> + + + + + + + + + + + + +
+ +
+
+
+ +
+ +
+ Failed to login. + + Reason: + +
+
+ +
+ You have been logged out. +
+
+ + + + +
+ +
+
+
+ + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/jsp/ok_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/ok_jsp.txt new file mode 100644 index 0000000..9ac34e8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/ok_jsp.txt @@ -0,0 +1,22 @@ + +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> + + + + + +
OK
+

${belong.screwFreeText}

+
+ +
+ + + + + diff --git a/screwdriver-3.5.6/box/snippets/jsp/warning_jsp.txt b/screwdriver-3.5.6/box/snippets/jsp/warning_jsp.txt new file mode 100644 index 0000000..5b4320d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/jsp/warning_jsp.txt @@ -0,0 +1,22 @@ + +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> + + + + + +
Warning
+

${belong.screwFreeText}

+
+ +
+ + + + + diff --git a/screwdriver-3.5.6/box/snippets/listn_0.txt b/screwdriver-3.5.6/box/snippets/listn_0.txt new file mode 100644 index 0000000..03c1701 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/listn_0.txt @@ -0,0 +1,7 @@ + + + org.springframework.web.context.ContextLoaderListener + + + org.springframework.web.context.request.RequestContextListener + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/pom_build.txt b/screwdriver-3.5.6/box/snippets/pom_build.txt new file mode 100644 index 0000000..32f4aac --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/pom_build.txt @@ -0,0 +1,71 @@ + + +final.name+ + + + ${basedir}/src/main/resources + + *.properties + + + + + + org.apache.maven.plugins + maven-compiler-plugin + +maven.compiler.plugin+ + + ${pom.java.version} + ${pom.java.version} + + + + org.apache.maven.plugins + maven-war-plugin + +maven.war.plugin+ + + .svn/,**/.svn/ + false + + + + maven-clean-plugin + +maven.clean.plugin+ + + + + ${basedir}/src/main/webapp/WEB-INF/lib + + *.jar + + + + ${basedir}/src/main/webapp/WEB-INF/classes + + *.properties + **/*.class + *.xml + + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0.0 + + + initialize + + read-project-properties + + + + pom.properties + + + + + + + diff --git a/screwdriver-3.5.6/box/snippets/pompr_0.txt b/screwdriver-3.5.6/box/snippets/pompr_0.txt new file mode 100644 index 0000000..e69de29 diff --git a/screwdriver-3.5.6/box/snippets/properties/config.properties b/screwdriver-3.5.6/box/snippets/properties/config.properties new file mode 100644 index 0000000..5520ddd --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/properties/config.properties @@ -0,0 +1 @@ +# screwdriver_knife \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/properties/log4j.properties b/screwdriver-3.5.6/box/snippets/properties/log4j.properties new file mode 100644 index 0000000..2810c2c --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/properties/log4j.properties @@ -0,0 +1,20 @@ +# Root logger option +log4j.rootLogger=INFO, file +# Spring logger option +log4j.logger.org.springframework=WARN + +# Redirect log messages to console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%c{1}(%M:%L) - %m%n + +# Redirect log messages to a log file +log4j.appender.file=org.apache.log4j.RollingFileAppender + +#outputs to Jboss home +log4j.appender.file.File=${jboss.base.dir}/log/+applicaz+.log +log4j.appender.file.MaxFileSize=5MB +log4j.appender.file.MaxBackupIndex=10 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}(%M:%L) - %m%n \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/robots.txt b/screwdriver-3.5.6/box/snippets/robots.txt new file mode 100644 index 0000000..77470cb --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/secuFilte.txt b/screwdriver-3.5.6/box/snippets/secuFilte.txt new file mode 100644 index 0000000..4c11c5a --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/secuFilte.txt @@ -0,0 +1,10 @@ + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + springSecurityFilterChain + /* + REQUEST + ERROR + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaDispatcher_3.1.0.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaDispatcher_3.1.0.RELEASE.txt new file mode 100644 index 0000000..8b9a91d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaDispatcher_3.1.0.RELEASE.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaDispatcher_3.1.1.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaDispatcher_3.1.1.RELEASE.txt new file mode 100644 index 0000000..8b9a91d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaDispatcher_3.1.1.RELEASE.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaDispatcher_3.2.13.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaDispatcher_3.2.13.RELEASE.txt new file mode 100644 index 0000000..8b5c852 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaDispatcher_3.2.13.RELEASE.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaDispatcher_4.0.3.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaDispatcher_4.0.3.RELEASE.txt new file mode 100644 index 0000000..d929860 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaDispatcher_4.0.3.RELEASE.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaDispatcher_4.3.12.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaDispatcher_4.3.12.RELEASE.txt new file mode 100644 index 0000000..d929860 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaDispatcher_4.3.12.RELEASE.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaOrm_3.1.0.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaOrm_3.1.0.RELEASE.txt new file mode 100644 index 0000000..9837e29 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaOrm_3.1.0.RELEASE.txt @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaOrm_3.2.13.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaOrm_3.2.13.RELEASE.txt new file mode 100644 index 0000000..844bfb7 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaOrm_3.2.13.RELEASE.txt @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaOrm_4.0.3.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaOrm_4.0.3.RELEASE.txt new file mode 100644 index 0000000..aed372e --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaOrm_4.0.3.RELEASE.txt @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaOrm_4.3.12.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaOrm_4.3.12.RELEASE.txt new file mode 100644 index 0000000..aed372e --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaOrm_4.3.12.RELEASE.txt @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaService_3.1.0.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaService_3.1.0.RELEASE.txt new file mode 100644 index 0000000..2bc5ed8 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaService_3.1.0.RELEASE.txt @@ -0,0 +1,13 @@ + + diff --git a/screwdriver-3.5.6/box/snippets/testaService_3.2.13.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaService_3.2.13.RELEASE.txt new file mode 100644 index 0000000..8bc23c6 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaService_3.2.13.RELEASE.txt @@ -0,0 +1,13 @@ + + diff --git a/screwdriver-3.5.6/box/snippets/testaService_4.0.3.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaService_4.0.3.RELEASE.txt new file mode 100644 index 0000000..2a54793 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaService_4.0.3.RELEASE.txt @@ -0,0 +1,13 @@ + + diff --git a/screwdriver-3.5.6/box/snippets/testaService_4.3.12.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaService_4.3.12.RELEASE.txt new file mode 100644 index 0000000..2a54793 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaService_4.3.12.RELEASE.txt @@ -0,0 +1,13 @@ + + diff --git a/screwdriver-3.5.6/box/snippets/testaSpringProperties_3.1.0.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaSpringProperties_3.1.0.RELEASE.txt new file mode 100644 index 0000000..ed78abc --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaSpringProperties_3.1.0.RELEASE.txt @@ -0,0 +1,13 @@ + + + diff --git a/screwdriver-3.5.6/box/snippets/testaSpringProperties_3.2.13.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaSpringProperties_3.2.13.RELEASE.txt new file mode 100644 index 0000000..c98bfe3 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaSpringProperties_3.2.13.RELEASE.txt @@ -0,0 +1,13 @@ + + + diff --git a/screwdriver-3.5.6/box/snippets/testaSpringProperties_4.0.3.RELEASE.txt b/screwdriver-3.5.6/box/snippets/testaSpringProperties_4.0.3.RELEASE.txt new file mode 100644 index 0000000..fee951d --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaSpringProperties_4.0.3.RELEASE.txt @@ -0,0 +1,13 @@ + + + diff --git a/screwdriver-3.5.6/box/snippets/testaSpringSecurity_3.1.txt b/screwdriver-3.5.6/box/snippets/testaSpringSecurity_3.1.txt new file mode 100644 index 0000000..435f40f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaSpringSecurity_3.1.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaSpringSecurity_3.2.txt b/screwdriver-3.5.6/box/snippets/testaSpringSecurity_3.2.txt new file mode 100644 index 0000000..61a583b --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaSpringSecurity_3.2.txt @@ -0,0 +1,14 @@ + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaTiles_2.txt b/screwdriver-3.5.6/box/snippets/testaTiles_2.txt new file mode 100644 index 0000000..d2d0d44 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaTiles_2.txt @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/testaTiles_3.txt b/screwdriver-3.5.6/box/snippets/testaTiles_3.txt new file mode 100644 index 0000000..c247a00 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/testaTiles_3.txt @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/uvListener.txt b/screwdriver-3.5.6/box/snippets/uvListener.txt new file mode 100644 index 0000000..4a4fa2c --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/uvListener.txt @@ -0,0 +1,3 @@ + + org.springframework.security.web.session.HttpSessionEventPublisher + diff --git a/screwdriver-3.5.6/box/snippets/web.xml.spring.txt b/screwdriver-3.5.6/box/snippets/web.xml.spring.txt new file mode 100644 index 0000000..46e1c06 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/web.xml.spring.txt @@ -0,0 +1,21 @@ + + + + 20 + + + + DispatcherServlet + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + + /WEB-INF/spring/DispatcherServlet.xml + + + +startup+ + + + DispatcherServlet + / + diff --git a/screwdriver-3.5.6/box/snippets/web.xml.txt b/screwdriver-3.5.6/box/snippets/web.xml.txt new file mode 100644 index 0000000..ee159ef --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/web.xml.txt @@ -0,0 +1,13 @@ + + + + 20 + + + + + + + + + diff --git a/screwdriver-3.5.6/box/snippets/web_captcha.txt b/screwdriver-3.5.6/box/snippets/web_captcha.txt new file mode 100644 index 0000000..d6f38b7 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/web_captcha.txt @@ -0,0 +1,10 @@ + + SimpleCaptcha + nl.captcha.servlet.SimpleCaptchaServlet + + + + SimpleCaptcha + /captcha.png + diff --git a/screwdriver-3.5.6/box/snippets/weberror.txt b/screwdriver-3.5.6/box/snippets/weberror.txt new file mode 100644 index 0000000..cc2f74f --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/weberror.txt @@ -0,0 +1,10 @@ + + + + 404 + /notFound + + + 500 + /notFound + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/webmime.txt b/screwdriver-3.5.6/box/snippets/webmime.txt new file mode 100644 index 0000000..81a510e --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/webmime.txt @@ -0,0 +1,20 @@ + + ttf + application/x-font-ttf + + + woff + application/font-woff + + + woff2 + application/font-woff + + + eot + application/vnd.ms-fontobject + + + map + text/plain + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/xml/policy.xml b/screwdriver-3.5.6/box/snippets/xml/policy.xml new file mode 100644 index 0000000..a16fa6a --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/xml/policy.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + force non-empty with a '+' at the end instead of '*' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + g + grin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/box/snippets/xml/quartz-job.xml b/screwdriver-3.5.6/box/snippets/xml/quartz-job.xml new file mode 100644 index 0000000..b00a63b --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/xml/quartz-job.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +applicaz+ + AUTO + org.quartz.simpl.SimpleThreadPool + 25 + 5 + 60000 + org.quartz.impl.jdbcjobstore.JobStoreTX + org.quartz.impl.jdbcjobstore.StdJDBCDelegate + false + QRTZ_ + true + 20000 + dataSource + 90000 + + + + + + + + + + + + + + + true + + + + + diff --git a/screwdriver-3.5.6/box/snippets/xml/root-context.xml b/screwdriver-3.5.6/box/snippets/xml/root-context.xml new file mode 100644 index 0000000..5cb2a94 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/xml/root-context.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/screwdriver-3.5.6/box/snippets/xml/security-ldap-explicitly.xml b/screwdriver-3.5.6/box/snippets/xml/security-ldap-explicitly.xml new file mode 100644 index 0000000..03032c1 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/xml/security-ldap-explicitly.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/box/snippets/xml/webflow.xml b/screwdriver-3.5.6/box/snippets/xml/webflow.xml new file mode 100644 index 0000000..6264743 --- /dev/null +++ b/screwdriver-3.5.6/box/snippets/xml/webflow.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/screwdriver-3.5.6/lib/jsp-api-2.2.jar b/screwdriver-3.5.6/lib/jsp-api-2.2.jar new file mode 100644 index 0000000..64e1b74 Binary files /dev/null and b/screwdriver-3.5.6/lib/jsp-api-2.2.jar differ diff --git a/screwdriver-3.5.6/lib/log4j-1.2.17.jar b/screwdriver-3.5.6/lib/log4j-1.2.17.jar new file mode 100644 index 0000000..068867e Binary files /dev/null and b/screwdriver-3.5.6/lib/log4j-1.2.17.jar differ diff --git a/screwdriver-3.5.6/log4j-1.2.17.jar b/screwdriver-3.5.6/log4j-1.2.17.jar new file mode 100644 index 0000000..068867e Binary files /dev/null and b/screwdriver-3.5.6/log4j-1.2.17.jar differ diff --git a/screwdriver-3.5.6/log4j.properties b/screwdriver-3.5.6/log4j.properties new file mode 100644 index 0000000..24c7fde --- /dev/null +++ b/screwdriver-3.5.6/log4j.properties @@ -0,0 +1,14 @@ +log4j.rootLogger=info, file, stdout + +# Direct log messages to a log file +log4j.appender.file=org.apache.log4j.DailyRollingFileAppender +log4j.appender.file.File=logs/screwdriver.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + diff --git a/screwdriver-3.5.6/makejar.xml b/screwdriver-3.5.6/makejar.xml new file mode 100644 index 0000000..2b0b763 --- /dev/null +++ b/screwdriver-3.5.6/makejar.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/pom.xml b/screwdriver-3.5.6/pom.xml new file mode 100644 index 0000000..0f247d6 --- /dev/null +++ b/screwdriver-3.5.6/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + it.ramecera.ict + screwdriver + 3.5.6 + screwdriver + http://www.ramecera.it + + UTF-8 + + a java source code generator + + + log4j + log4j + 1.2.17 + + + javax.servlet.jsp + jsp-api + 2.2 + + + + src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + + true + it.ramecera.screwdriver.Hammer + + + + + + + \ No newline at end of file diff --git a/screwdriver-3.5.6/properties.dtd b/screwdriver-3.5.6/properties.dtd new file mode 100644 index 0000000..4a22bd5 --- /dev/null +++ b/screwdriver-3.5.6/properties.dtd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/screwdriver-3.5.6/silver.ele b/screwdriver-3.5.6/silver.ele new file mode 100644 index 0000000..6b5c328 --- /dev/null +++ b/screwdriver-3.5.6/silver.ele @@ -0,0 +1,45 @@ +primary+JBoss EAP 7.1_uv_s4_h5_jpa2 +hvalid+4.2.0.Final +userpass+trivial +xprovider+class +uspaformuser+ramecera,oxford +uspaformadmin+admin,manchester +company+it.ramecera +odefcss+prince+obackcolor+azure+ocolor+darkgreen+opadding+12+ofontsize+90+omargin+120+oalign+center +odefcss+dati+obackcolor+azure+ocolor+black+opadding+20+ofontsize+30+omargin+12+oalign+left +odefcss+mediumheight+obackcolor+azure+ocolor+black+opadding+20+ofontsize+20+omargin+12+oalign+left +bdefmenu+resin+bfixedtop+ +blabel+Home+burl+/ +blabel+Tables list+burl+/whole/list +blabel+AUTHORS+burl+/superior/au_single +blabel+ACTORS+burl+/superior/ac_single +blabel+NOVELS+burl+/superior/no_single +bdefmenu+tray +blabel+Home+burl+/ +blabel+Contribute+burl+/whole/list +indexjsp++bmenu+tray+ooptbackcol1+orange+ooptbackcol2+brown+ooptioncolor+black+ooptionhover+white +text+MY SILVER+cssclass+prince +jsp+master/tables_list.jsp+string+tlnotice+belong+tlnotice+cssclass+mediumheight+bmenu+resin+pagetitle+List of the DB tables +formn+tlbox+flabel+Choose a DB table+fcartel+O---O---O+ftokens+actors, authors, novels +jsp+master/au_single.jsp+string+au_text+belong+au_text+cssclass+mediumheight+bmenu+resin+pagetitle+CRUD on "authors" table+crud+ +formt+key+flabel+Key +formt+name+flabel+First name +formt+surname+flabel+Last name +formn+modifier+flabel+Registered by+fcartel+O---O---O+hsqln+select concat(firstName, ' ', lastName) from Actor where star != 0+dao+IRail0ActorDao +jsp+master/ac_single.jsp+string+ac_text+belong+ac_text+cssclass+mediumheight+bmenu+resin+pagetitle+CRUD on "actors" table+crud+ +formt+key+flabel+Key +formt+name+flabel+First name +formt+surname+flabel+Last name +formr+position+flabel+Work position+ftokens+clerk,manager,chairman+fstart+1 +formn+modifier+flabel+Registered by+fcartel+O---O---O+hsqln+select concat(firstName, ' ', lastName) from Actor where star != 0+dao+IRail0ActorDao +jsp+master/no_single.jsp+string+no_text+belong+no_text+cssclass+mediumheight+bmenu+resin+pagetitle+CRUD on "novels" table+crud+ +formt+key+flabel+Key +formt+name+flabel+Title +formt+language+flabel+Language +formt+no_author+flabel+Author +formn+modifier+flabel+Registered by+fcartel+O---O---O+hsqln+select concat(firstName, ' ', lastName) from Actor where star != 0+dao+IRail0ActorDao +requmap+superior/au_single+goal+master/au_single.jsp+permit+admin +requmap+superior/ac_single+goal+master/ac_single.jsp+permit+admin +requmap+superior/no_single+goal+master/no_single.jsp+permit+admin +requmap+whole/list+goal+master/tables_list.jsp+permit+admin +hdefrail+0+hjndi+waxds+hdbschema+copper+hdbms+postgres \ No newline at end of file diff --git a/screwdriver-3.5.6/silver.properties b/screwdriver-3.5.6/silver.properties new file mode 100644 index 0000000..b815c18 --- /dev/null +++ b/screwdriver-3.5.6/silver.properties @@ -0,0 +1,4 @@ +input_directory=. +output_directory=../. +inside=false +freeze= \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/CutComments.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/CutComments.java new file mode 100644 index 0000000..28de85f --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/CutComments.java @@ -0,0 +1,302 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +package it.ramecera.salad.analysis; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.FileBase; + +/** + *

+ * Creation date: 2020-10-03
+ * Last updated: 2020-10-03
+ * Company: Rameceraâ„¢
+ *

+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ */ +public class CutComments { + + /** conventional sign */ + final static private char BELL = 7; + /** conventional sign */ + final static private String BELLS = String.valueOf(BELL); + /** conventional sign */ + final static private char DQ = 34; + + /** + *

+ * Creation date: 2020-04-18
+ * Last updated: 2020-04-18
+ * Company: Ramecera + * + * @author Massimo Maglioni + *

+ * Description: + *

+ * @param s text to process + * @param fb file informations + * @return 3 text strings + * @throws ExactException */ + public static String[] production(final String s, FileBase fb) + + throws ExactException { + + String[] d = new String[3]; + String t = s; + /* I delete all carriage-return characters */ + t = t.replaceAll("\\r", ""); + /* mercy corrections: "/** /**" becomes "/**" */ + t = t.replaceAll("\\x2f\\x2a\\x2a\\x20\\x2f\\x2a\\x2a", "/**"); + /* mercy corrections: "/** /**" becomes "/**" */ + t = t.replaceAll("\\x2f\\x2a\\x2a\\x20+\\x2f\\x2a\\x2a", "/**"); + /* mercy corrections: delete initial string + * "slash** * *slash" */ + t = t.replaceFirst("\\x2f\\x2a\\x2a\\n\\x20\\x2a\\x20\\n\\x" + + "20\\x2a\\x2f\\n", ""); + /* mercy corrections: "// /*" becomes "/**" */ + t = t.replaceAll("\\x2f\\x2f\\x20+\\x2f\\x2a", "/*"); + String[] text1E, text2E; + // -------- PRODUCTION ------------- + /* production of the fliles BCI */ + text1E = production1(fb.fileName, "bci", t, "/*", "*/"); + /* production of the fliles LCI and NUD */ + text2E = production2(fb.fileName, "lci", text1E[1], "//", + Candies.LF); + // --------------------------------- + d[0] = text1E[0]; + d[1] = text2E[0]; + d[2] = text2E[1]; + return d; + } + + /** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * + * @author Massimo Maglioni + *

+ * Description: it produces the block comments text and a + * java file whithout them (line comments are still + * present). + *

+ * @param fileName obvious + * @param extension obvious + * @param input input text + * @param flip the opening string: slash-asterisk + * @param flop the closing string: asterisk-slash + * @return the two text, blocks comments and the nude text(line + * comments are still present). + * @throws ExactException */ + private static String[] production1(final String fileName, + final String extension, final String input, + final String flip, final String flop) + + throws ExactException { + + String t = input; + String[] u = new String[2]; + /* nude text */ + String tn = ""; + String cit = ""; + int lJ = indexSearch(t, flip, fileName, true); + int wJ = lJ; + int endJ = -1, wendJ = 0; + System.out.println(fileName); + while (lJ > -1) { + wJ = lJ; + /* I'm looking for the next one because I have to check that + * the closing of the comment does not go beyond the next + * opening; it would be an important irregularity */ + lJ = indexSearch(t, flip, lJ + 1, true, fileName); + /* max is the maximum limit, it must not go beyond */ + int maxJ = 0; + if (lJ == -1) { + maxJ = t.length(); + } else { + maxJ = lJ; + } + wendJ = endJ; + /* my corrections (+1, +2, -2) keep in mind the opening and + * closing strings */ + endJ = indexSearch(t, flop, wJ + 1, true, fileName) + 2; + if ((endJ == -1 | endJ > maxJ)) { + throw new ExactException("In the file " + fileName + + " the succession of the comments is wrong."); + } else { + /* single is the single block comment */ + /* now the closure was found before maximum value + * (maxJ), so it would be fine... */ + String single = t.substring(wJ + 2, endJ - 2); + String before = t.substring(wendJ + 1, wJ); + /* ...but I must make sure that I have not left behind a + * closure, because it would denounce the consecutive + * presence of 2 closings in the previous block */ + if (indexSearch(before, flop, fileName, false) > -1) { + throw new ExactException("In the file " + fileName + + " the string " + flop + + " is present in a wrong position."); + } + tn += before + extension + BELLS + Candies.LF; + single = Strings.compact_A(single); + /* mercy corrections: search " * ", replace " " */ + single = single.replaceAll("\\x20\\x2a\\x20", " "); + cit += single + Candies.LF; + } + } + tn += t.substring(endJ + 1); + int cL = cit.length(); + if (cL > 0) { + /* I delete the last character, it is a line feed */ + cit = cit.substring(0, cL - 1); + } + u[0] = cit; + u[1] = tn; + return u; + } + + /** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * + * @author Massimo Maglioni + *

+ * Description: it produce the line comments text and a java + * file whithout any comment (nude). + *

+ * @param fileName obvious + * @param extension obvious + * @param input input text + * @param flip the opening string: // + * @param flop the closing string: a line feed + * @return the two text, line comments and the nude text (comments + * are present no more). + * @throws ExactException */ + private static String[] production2(final String fileName, + final String extension, final String input, + final String flip, final String flop) + + throws ExactException { + + String t = input; + String[] u = new String[2]; + String tn = ""; + String cit = ""; + int lJ = indexSearch(t, flip, fileName, false); + int endJ = 0, wendJ = 0; + while (lJ > -1) { + wendJ = endJ; + endJ = indexSearch(t, flop, lJ + 1, false, fileName); + if (endJ == -1) { + endJ = t.length(); + } + String single = t.substring(lJ, endJ); + tn += t.substring(wendJ, lJ) + extension + BELLS; + single = Strings.compact_A(single); + cit += single.substring(2).trim() + Candies.LF; + lJ = indexSearch(t, flip, endJ, false, fileName); + } + tn += t.substring(endJ); + int cL = cit.length(); + if (cL > 0) { + /* I delete the last character, it is a line feed */ + cit = cit.substring(0, cL - 1); + } + u[0] = cit; + u[1] = tn; + return u; + } + + /** + *

+ * Creation date: 2020-04-10
+ * Last updated: 2020-04-10
+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ * @param text + * @param x + * @param k + * @param type true=block comment, false=line comment + * @param fileName obvious + * @return */ + private static int indexSearch(final String text, final String x, + final int k, final boolean type, String fileName) { + int j = 1; + int m = k - 1; + String before0 = null; + while (j % 2 == 1) { + m = text.indexOf(x, m + 1); + if (m == -1 | (x.equals(Candies.LF) & !type)) { + break; + } + int from = 0; + if (k > 1) { + from = k - 1; + } + if (type) { + before0 = text.substring(from, m + 2); // block + } else { + before0 = text.substring(from + 1, m + 2); // line + } + /* I cancel all double backslashes \\ (to avoid error dued + * to possible presence of a string "\\" */ + String before1 = before0.replaceAll("\\x5c\\x5c", ""); + /* I cancel all double quotes contained in a constant string + * (x5cx22-->\") */ + String before2 = before1.replaceAll("\\x5c\\x22", ""); + // /* I cancel all characters contained in a line comment */ + // String before2 = before1.replaceAll("\\x2f\\x2f.+\\n", + // ""); + /* I cancel all double quotes (\") contained in a block + * comment */ + String before3 = before2.replaceAll("\\n", ""); + String before4 = before3.replaceAll("\\r", ""); + String before5 = before4.replaceAll( + "\\x2f\\x2a.+?\\x2a\\x2f", ""); + j = Mix.charQ(before5, DQ); + if (j % 2 == 1) { + // if (x.equals("//")) { + // System.out.println("geppo"); + // } + System.out.println("-----------------cerco>" + x + + "<---- in >" + fileName + + "<------------------"); + // System.out.println("intervento double-quote" + // + Candies.LF + before0); + } + } + return m; + } + + /** + *

+ * Creation date: 2020-04-10
+ * Last updated: 2020-04-10
+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ * @param text + * @param x + * @param type true=block comment, false=line comment + * @param k + * @return */ + private static int indexSearch(final String text, final String x, + final String fileName, boolean type) { + return indexSearch(text, x, 0, type, fileName); + } + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/Flute.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/Flute.java new file mode 100644 index 0000000..6307cd1 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/Flute.java @@ -0,0 +1,513 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.analysis; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; + +/** + *

+ * Elementary structure of a Java class; interfaces and inner classes + * are excluded. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class Flute { + + // PUBLIC PROPERTIES + + /** the file to be analyzed */ + public File file; + /** the package */ + public String fpackage; + /** if it is abstract */ + public boolean fabstract; + /** the list of imports, without the word import and without a final + * semicolon */ + public List fimportE = new ArrayList(); + /** class name */ + public String fclass; + /** the extends */ + public String fextends; + /** the implementations */ + public String fimplements; + /** visibility: public = 3 default = 1 */ + public int fvisibilita; + /** if it is final */ + public boolean ffinal; + /** if it is static */ + public boolean fstatic; + /** class annotations */ + public List fannotationE; + /** list of class properties */ + public List fpropertyE = new ArrayList(); + /** list of class methods */ + public List fmethodE = new ArrayList(); + + /** scope of the properties of a Java class */ + public static final String[] VISIBILITA = { "default", "private", + "protected", "public" }; + + // PRIVATE PROPERTY + + private String t; + private int penna; + + /** conventional sign */ + final static private char BELL = 7; + final static private String BELLS = String.valueOf(BELL); + /** conventional sign */ + final static private String ALFA = "alfa" + BELLS; + /** conventional sign */ + final static private String BETA0 = "beta0" + BELLS; + /** conventional sign */ + final static private String BETA1 = "beta1" + BELLS; + /** conventional sign */ + final static private String GAMMA0 = "gamma0" + BELLS; + /** conventional sign */ + final static private String GAMMA1 = "gamma1" + BELLS; + /** quotes */ + final static private char VIRGOLETTE = 34; + /** open parenthesis */ + final static private char PARENTESI_APERTA = 40; + /** open parenthesis */ + final static private char PARENTESI_CHIUSA = 41; + /** conventional sign */ + final static private String CAVA0 = "(flax28x7b"; + /** conventional sign */ + final static private String CAVA1 = "flax7dx29)"; + /** conventional sign */ + final static private String ALT_CHIO = "flax40"; + + /** @param file file to be analyzed */ + public Flute(File file) { + this.file = file; + } + + /** @param g file to be analyzed */ + public Flute(final String g) { + this.file = new File(g); + } + + /** + *

+ * Analysis of a .java file to extract its salient elements. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni + * @throws IOException standard exception + * @throws FileNotFoundException exceptionals standard + * @throws ExactException standard exception */ + final public void analyze() + + throws FileNotFoundException, IOException, ExactException { + + t = Equipment.oneString(file); + /* I remove all comments, including those of javadoc; I foresee + * both the case and the end-line is CR + LF, and the case of + * only LF */ + t = t.replaceAll("\\x2f\\x2f.+\\x0d", ""); + t = t.replaceAll("\\x2f\\x2f.+\\x0a", ""); + t = Strings.compact_A(t); + /* with the combination. +? I intend to capture all the + * characters until the next end-comment notification, ie x2ax2f + * (asterisk-slash); if instead I had written only. +, he would + * have gone to capture the last end-comment */ + t = t.replaceAll("\\x2f\\x2a.+?\\x2a\\x2f", ""); + t = t.replaceAll("\\x5c\\x22", ALFA); // backslash and quotes + // equal and opening brace + t = t.replaceAll("\\x3d\\s?\\x7b", "=" + GAMMA0); + // closing brace and semicolon + t = t.replaceAll("\\x7d\\s?\\x3b", GAMMA1 + ";"); + // closing brace and comma + t = t.replaceAll("\\x7d\\s?\\x2c", GAMMA1 + ","); + // closing brace and closed round bracket + t = t.replaceAll("\\x7d\\s?\\x29", GAMMA1 + ")"); + int virgoletteQ = Mix.charQ(t, VIRGOLETTE); + if (virgoletteQ % 2 != 0) { + ExactException ce = new ExactException(); + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.code = 20060001; + throw ce; + } + /* there must be at least one opening brace */ + int ga = t.indexOf(123); + if (ga == -1) { + ExactException ce = new ExactException(); + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.code = 20060002; + throw ce; + } + char punto_e_virgola = 59; + interni(BETA0, punto_e_virgola); + char chiusa_parentesi = 41; + interni(BETA1, chiusa_parentesi); + /* the prologue goes from the beginning of the file to the + * declaration of the name of the class included */ + String prologo = t.substring(0, ga); + String[] q = prologo.split("\\x3b"); // 3b is semicolon + if (!q[0].trim().startsWith("package")) { + ExactException ce = new ExactException(); + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.code = 20060004; + throw ce; + } else { + fpackage = q[0].replaceFirst("\\s*package\\s", "").trim(); + } + for (int m = 1; m < q.length - 1; m++) { + String x = q[m].replaceFirst("\\s*import\\s", ""); + fimportE.add(x.trim()); + } + String centro0 = q[q.length - 1].trim(); + fannotationE = annota(centro0); + String centro1 = centro0.substring(penna); + int impleJ = centro1.indexOf(" implements "); + int extJ = centro1.indexOf(" extends "); + String centro2 = null; + if (impleJ > -1 & extJ == -1) { + centro2 = centro1.substring(0, impleJ); + /* 12 is the length of the string "implements" */ + fimplements = centro1.substring(impleJ + 12); + } else if (impleJ == -1 & extJ > -1) { + centro2 = centro1.substring(0, extJ); + /* 9 is the length of the string "extends" */ + fextends = centro1.substring(extJ + 9); + } else if (impleJ > -1 & extJ > -1) { + if (impleJ < extJ) { + ExactException ce = new ExactException(); + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.code = 20060006; + throw ce; + } + centro2 = centro1.substring(0, extJ); + /* 9 is the length of the string "extends" */ + fextends = centro1.substring(extJ + 9, impleJ); + /* 12 is the length of the string "implements" */ + fimplements = centro1.substring(impleJ + 12); + } + String[] b1 = Strings.parole_A(centro2); + for (int k = 0; k < b1.length; k++) { + if (b1[k].equals("static")) { + fstatic = true; + } else if (b1[k].equals("final")) { + ffinal = true; + } else if (b1[k].equals("abstract")) { + fabstract = true; + } else if (b1[k].equals("public")) { + fvisibilita = 3; + } else if (b1[k].substring(0, 1).matches("\\p{Upper}")) { + fclass = b1[k]; + } + } + /* the body is what follows the prologue (see above), then from + * the first clip, which opens the course of the class, + * onwards */ + String corpo = t.substring(ga + 1); + /* in the body I have to correct the existence of complex + * annotations that contain round braces that braces, open and + * closed */ + corpo = corpo.replaceAll("\\x28\\x7b", CAVA0); + corpo = corpo.replaceAll("\\x7d\\x29", CAVA1); + String[] r = corpo.split("\\x7d"); // 7d is the closing brace + for (int m = 0; m < r.length - 1; m++) { + int i = r[m].indexOf(123); // 123 is the opening brace + if (i == -1) { + ExactException ce = new ExactException(); + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.code = 20060007; + throw ce; + } else { + JavaMethod method = new JavaMethod(); + method.grezzo0 = r[m].substring(0, i).trim(); + String[] p0 = method.grezzo0.split("\\x3b"); // x3b =; + for (int j = 0; j < p0.length - 1; j++) { + JavaProperty property = new JavaProperty(); + String grezzo5 = p0[j]; + int pareAperteQ = Mix.charQ(grezzo5, + PARENTESI_APERTA); + int pareChiuseQ = Mix.charQ(grezzo5, + PARENTESI_CHIUSA); + if (pareAperteQ != pareChiuseQ) { + ExactException ce = new ExactException(); + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.code = 20060003; + throw ce; + } + int ugualeJ = -1; + do { + /* 61 is the same */ + ugualeJ = grezzo5.indexOf(61, ugualeJ + 1); + if (ugualeJ == -1) { + break; + } + String prima = grezzo5.substring(0, ugualeJ); + pareAperteQ = Mix.charQ(prima, + PARENTESI_APERTA); + pareChiuseQ = Mix.charQ(prima, + PARENTESI_CHIUSA); + } while (pareAperteQ > pareChiuseQ); + if (ugualeJ > -1) { + property.fvalore = ripristina(grezzo5.substring( + ugualeJ + 1)); + if (property.fvalore.startsWith("new ")) { + property.fnew = property.fvalore.substring( + 4); + property.fvalore = null; + } + grezzo5 = grezzo5.substring(0, ugualeJ); + } + property.fannotationE = annota(grezzo5); + if (property.fannotationE.size() > 0) { + grezzo5 = grezzo5.substring(penna - 1); + } + String[] b2 = Strings.parole_A(grezzo5); + /* the propery name is the last word */ + property.fnome = b2[b2.length - 1]; + for (int k = 0; k < b2.length - 1; k++) { + if (b2[k].endsWith("[]")) { + b2[k] = b2[k].substring(0, b2[k].length() + - 2); + property.quadre = true; + } + if (b2[k].equals("static")) { + property.fstatic = true; + } else if (b2[k].equals("final")) { + property.ffinal = true; + } else if (b2[k].equals("abstract")) { + property.fabstract = true; + } else if (b2[k].equals("public")) { + property.fvisibilita = 3; + } else if (b2[k].equals("protected")) { + property.fvisibilita = 2; + } else if (b2[k].equals("private")) { + property.fvisibilita = 1; + } else if (b2[k].equals("int") | b2[k].equals( + "double") | b2[k].equals("byte") | b2[k] + .equals("short") | b2[k].equals( + "float") | b2[k].equals( + "boolean") + | b2[k].equals("char") | b2[k].equals( + "long")) { + property.fprimitivo = b2[k]; + } else if (b2[k].substring(0, 1).matches( + "\\p{Upper}")) { + property.fclasse = b2[k]; + } + } + fpropertyE.add(property); + } + method.testata = p0[p0.length - 1]; + method.row1 = r[m].substring(i + 1).trim(); + if (!method.row1.equals("")) { + // 3b is the semicolon + String[] p1 = method.row1.split("\\x3b"); + for (int j = 0; j < p1.length; j++) { + String ist = ripristina(p1[j]); + method.istruzioneE.add(ist); + } + } + fmethodE.add(method); + } + } + for (int j = 0; j < fannotationE.size(); j++) { + JavaAnnotation a = fannotationE.get(j); + if (a.fargument != null) { + a.tokenE = a.fargument.split("\\x2c"); // x2c is comma + for (int k = 0; k < a.tokenE.length; k++) { + String x = a.tokenE[k].trim(); + a.tokenE[k] = x.trim(); + String[] d = new String[2]; + int m = x.indexOf(Candies.EQUALITY_SIGN); + if (m > -1) { + d[0] = x.substring(0, m).trim(); + d[1] = x.substring(m + 1).trim(); + if (d[1].startsWith("\"") & d[1].endsWith("\"") + & d[1].length() > 1) { + d[1] = d[1].substring(1, d[1].length() - 1); + } + if (a.paramE.containsKey(d[0])) { + ExactException ce = new ExactException(); + ce.code = 20060008; + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + ce.datum = "The parameters of annotation @" + + a.fnome + " aren't unique: " + x + + "."; + throw ce; + } else { + a.paramE.put(d[0], d[1]); + } + } + } + } + } + } + + final private void interni(final String tappo, final char c) { + int j0 = 0, j1 = 0; + // int k = 0; + j0 = t.indexOf(34, 0); // 34 are the quotes " + j1 = t.indexOf(34, j0 + 1); + while (j0 > -1) { + // k ++; + int n = t.indexOf(c, j0); + /* if there is and is less than the next ... */ + if (n > -1 & n < j1) { + /* ... then I found an internal character */ + t = t.substring(0, n) + tappo + t.substring(n + 1); + j1 += tappo.length() - 1; + } + j0 = t.indexOf(34, j1 + 1); + j1 = t.indexOf(34, j0 + 1); + } + } + + final private List annota(final String a0) + + throws ExactException { + + String a = a0; + List aE = new ArrayList(); + /* remediation of all annotations nested in correspondence of + * the pair CAVA0 and CAVA1 " */ + String pezzo0 = null; + String pezzo1 = null; + String pezzo2 = null; + int nc0 = a.indexOf(CAVA0); + int nc1 = a.indexOf(CAVA1); + if (nc0 > 1 & nc1 > 1) { + pezzo0 = a.substring(0, nc0); + pezzo1 = a.substring(nc0, nc1); + pezzo2 = a.substring(nc1); + pezzo1 = pezzo1.replaceAll("\\x40", ALT_CHIO); + a = pezzo0 + pezzo1 + pezzo2; + } + int j0 = 0, j1 = 0; + // int k = 0; + j0 = a.indexOf(64, 0); // 64 is the snail @ + j1 = a.indexOf(64, j0 + 1); + /* now I have to correct the value of j1, because there might be + * nested annotations; I don't have to stop on snails that are + * inside the pair of braces */ + /* GAMMA1 is the closing brace */ + int g0 = a.indexOf(GAMMA1 + ")", j0 + 1); + /* if j1 -1) { + /* for each annotation I have the index j0 which points to + * the scroll, but also j1 which points to the next */ + // k ++; + int pta0 = a.indexOf(40, j0); // 40 is the open parenthesis + JavaAnnotation z = null; + /* if the open round bracket is and is less than the next + * ... */ + if (pta0 > -1 & (pta0 < j1 | j1 == -1)) { + /* ... then I found a topic, I look for the closing + * parenthesis */ + /* 41 is the closing parenthesis */ + int ptc0 = a.indexOf(41, pta0); + /* but now I have to correct the value of ptc0 because I + * need not the next closed parenthesis, but the one + * that really corresponds to a closing; in fact it is + * necessary to take into account the nested + * annotations */ + int ptc1 = a.indexOf(GAMMA1 + ")", pta0); + /* if I found GAMMA1), that's the good value */ + if (ptc1 > -1) { + ptc0 = ptc1; + } + if (ptc0 == -1 | (ptc0 > j1 & j1 > -1)) { + ExactException ce = new ExactException(); + ce.code = 20060005; + ce.className = fclass + + " (analized by it.ramecera.salad.analysis.Flute)"; + throw ce; + } + penna = ptc0; + /* the instantiated annotation, in the case of nested + * annotations, is the most external; the internal ones + * are part of the internal material (topic properties) + * of the first */ + z = new JavaAnnotation(a.substring(j0 + 1, pta0), a + .substring(pta0 + 1, ptc0)); + } else if (j1 == -1) { + /* if it isn't there, and we are at the last + * annotation */ + penna = a.indexOf(32, j0); + z = new JavaAnnotation(a.substring(j0 + 1, penna), + null); + } else { + /* if it is not there, and we are not at the last + * annotation */ + penna = j1 - 1; + z = new JavaAnnotation(a.substring(j0 + 1, penna), + null); + } + aE.add(z); + /* in the first search there is no +1 because, unlike the + * quotes, I don't have to look for separate couples, but a + * couple that starts with the second element of the + * previous couple */ + if (j1 == -1) { + j0 = -1; + } else { + j0 = a.indexOf(64, j1); + } + j1 = a.indexOf(64, j0 + 1); + } + penna += 2; + return aE; + } + + String ripristina(final String s) { + String r = s; + r = r.replaceAll(ALFA, "\""); + r = r.replaceAll(BETA0, ";"); + r = r.replaceAll(BETA1, ")"); + r = r.replaceAll(GAMMA0, "{"); + r = r.replaceAll(GAMMA1, "}"); + return r.trim(); + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaAnnotation.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaAnnotation.java new file mode 100644 index 0000000..7d33634 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaAnnotation.java @@ -0,0 +1,47 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.analysis; + +import java.util.HashMap; +import java.util.Map; + +/** + *

+ * Annotation in a Java class, both class, property, and method + * annotations. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class JavaAnnotation { + + /** @param fnome name of annotation + * @param fargomento argument of annotation */ + public JavaAnnotation(final String fnome, final String fargomento) { + super(); + this.fnome = fnome; + this.fargument = fargomento; + } + + /** name without the "at" character */ + public String fnome; + /** argument */ + public String fargument; + /** arguments token */ + public String[] tokenE; + /** arguments parameters */ + public Map paramE = new HashMap(); +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaMethod.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaMethod.java new file mode 100644 index 0000000..35a85e7 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaMethod.java @@ -0,0 +1,52 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.analysis; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * Property of a Java class. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class JavaMethod { + /** visibility: public = 3, protected = 2, default = 0, private = + * 1 */ + public int fvisibilita; + /** if it is abstract */ + public boolean fabstract; + /** if it is final */ + public boolean ffinal; + /** if it is static */ + public boolean fstatic; + /** raw content n. 0 */ + public String grezzo0; + /** raw content n. 1 */ + public String row1; + /** name of the method */ + public String fnome; + /** elementary type returned */ + public String fprimitivo; + /** type returned */ + public String fclasse; + /** the source code, list of instructions without the semicolon */ + public List istruzioneE = new ArrayList(); + /** line containing the method name */ + public String testata; +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaProperty.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaProperty.java new file mode 100644 index 0000000..ccec2bc --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/analysis/JavaProperty.java @@ -0,0 +1,54 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.analysis; + +import java.util.List; + +/** + *

+ * Property of a Java class. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class JavaProperty { + /** the primitive type (int, boolean, etc .; String is not + * primitive) returned; otherwise it remains null */ + public String fprimitivo; + /** name of the returned class */ + public String fclasse; + /** name of the property */ + public String fnome; + /** if there is a new (then simple = false), it says what is after + * the new; if not present, it is null */ + public String fnew; + /** visibility: public = 3, protected = 2, private = 1, default = + * 0 */ + public int fvisibilita; + /** if it is abstract */ + public boolean fabstract; + /** if it is final */ + public boolean ffinal; + /** if it is static */ + public boolean fstatic; + /** property value */ + public String fvalore; + /** if it is an array defined by [] */ + public boolean quadre; + + /** class annotations */ + public List fannotationE; +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Candies.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Candies.java new file mode 100644 index 0000000..abb1c81 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Candies.java @@ -0,0 +1,112 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +import java.util.Properties; + +/** + *

+ * Treatment of property data. This data is conventionally called + * candy. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public interface Candies { + + /** ordinary properties */ + public Properties properties = new Properties(); + + /** peculiar character */ + public static final char H92 = 92; // backslash + /** peculiar character */ + public static final char H47 = 47; // slash; + /** peculiar character */ + public static final String SLASH = String.valueOf(H47); + /** peculiar character */ + public static final char PARENTESI_APERTA = 40; + /** peculiar character */ + public static final char PARENTESI_CHIUSA = 41; + /** peculiar character */ + public static final char LINE_FEED = 10; + /** peculiar character */ + public final static char H13 = 13; + /** peculiar character */ + public final static char H171 = 171; + /** peculiar character */ + public final static char H160 = 160; + /** peculiar character */ + public final static char H187 = 187; + /** peculiar character */ + public final static char EQUALITY_SIGN = 61; + /** peculiar character */ + public final static String SPACE = " "; + /** peculiar character */ + public final static String NON_BREAKING = String.valueOf(H160); + /** peculiar character */ + public final static String CAAP = String.valueOf(H171); + /** peculiar character */ + public final static String CACH = String.valueOf(H187); + /** peculiar character */ + public final static String CR = String.valueOf(H13); + /** peculiar character */ + public static final String LF = String.valueOf(LINE_FEED); + /** peculiar character */ + public static final char TAB = 9; + /** peculiar character */ + public static final String TABS = String.valueOf(TAB); + /** peculiar character */ + public String UNDERSCORE = "_"; + /** peculiar character */ + public String COMMA = ","; + /** peculiar character */ + public String COLON = ":"; + /** particular codes, operations of a file corrections */ + public int SURGERY1 = 1; + /** particular signs */ + public static final String SEGNO_A = "çvç"; + /** particular signs */ + public static final String[] CRUD = { "C", "R", "U", "D" }; + /** Roman numerals from 1 to 50 */ + public static final String[] ROMANI = { "", "I", "II", "III", "IV", + "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", + "XIV", "XV", "XVI", "XVII", "XVIII", "IXX", "XX", "XXI", + "XXII", "XXIII", "XXIV", "XXV", "XXVI", "XXVII", "XXVIII", + "IXXX", "XXX", "XXXI", "XXXII", "XXXIII", "XXXIV", "XXXV", + "XXXVI", "XXXVII", "XXXVIII", "XXXIX", "XXXX", "XXXXI", + "XXXXII", "XXXXIII", "XXXXIV", "XXXXV", "XXXXVI", "XXXXVII", + "XXXXVIII", "IL", "L" }; + + /** + *

+ * Reads the properties file and returns it on the same object t. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param p name of the properties file + * @throws ExactException objecting if the data contained in the + * properties file is incorrect */ + public abstract void readProperties(String p) + + throws ExactException; + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/ExactException.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/ExactException.java new file mode 100644 index 0000000..fe0cea1 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/ExactException.java @@ -0,0 +1,157 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +/** + *

+ * Class to handle an exception with a code specification. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-13
+ * Modifications: none
+ *

+ * + * @author M. Maglioni */ + +public class ExactException + + extends Exception { + + /** pure formality */ + static final long serialVersionUID = 0; + + /** string information, for use as desired */ + public String datum; + + /** numerical information, for use as desired */ + public int code; + + /** full information, for use as desired */ + public int n; + + /** in which class the exception occurred */ + public String className; + + /** in which method the exception occurred */ + public String method; + + /** in which element the exception occurred */ + public int line; + + /** + *

+ * Default constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-13
+ * Modifications: none
+ *

+ */ + public ExactException() { + + } + + /** + *

+ * Next constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * Modifications: none
+ *

+ * + * @param s message associated with the exception, sent to the + * superclass */ + public ExactException(final String s) { + super(s); + } + + /** + *

+ * Next constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-13
+ * Modifications: none
+ *

+ * + * @param datum message associated with the exception + * @param code error code + * @param className obvious + * @param methodName obvious */ + public ExactException(final String datum, final int code, + final String className, final String methodName) { + super(datum); + this.datum = datum; + this.code = code; + this.className = className; + this.method = methodName; + } + + /** + *

+ * Next constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-13
+ * Modifications: none
+ *

+ * + * @param datum message associated with the exception + * @param code error code + * @param className obvious + * @param methodName obvious + * @param line which element produced an error */ + public ExactException(final String datum, final int code, + final String className, final String methodName, + final int line) { + super(datum); + this.datum = datum; + this.code = code; + this.className = className; + this.method = methodName; + this.line = line; + } + + /** + *

+ * Creation date: 2020-04-20
+ * Last updated: 2020-04-20
+ * Class: ExactException + * + * @author M. Maglioni + *

+ * Description: + *

+ * @return the datum */ + public String getData() { + return datum; + } + + /** + *

+ * Creation date: 2020-04-20
+ * Last updated: 2020-06-13
+ * Class: ExactException + * + * @author M. Maglioni + *

+ * Description: + *

+ * @param datum obvious */ + public void setDatum(String datum) { + this.datum = datum; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/HandleDate.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/HandleDate.java new file mode 100644 index 0000000..63c3c75 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/HandleDate.java @@ -0,0 +1,1764 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; +import java.util.jar.Attributes; +import java.util.regex.Pattern; + +/** + *

+ * Various utility methods. Compared to the previous version, all the + * deprecated methods have been canceled. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni */ +public class HandleDate { + + /* error code: 200yyxxx */ + + /** + *

+ * Constructs a date in the XML standard, with double quotation + * marks, starting from a numerical date written as yyyymmmmgg (as + * happens on the DB Guritel). + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 08/04 08: corrected the format from # dd / MM / yyyy # to # MM / + * dd / yyyy #
+ *

+ * + * @param i the number to be transformed + * @return the date in XML format */ + public static String dataPerXML_A(int i) { + String year = new DecimalFormat("0000").format(i / 10000); + String month = new DecimalFormat("00").format(i % 10000 / 100); + String day = new DecimalFormat("00").format(i % 100); + return "\"" + year + "-" + month + "-" + day + "\""; + } + + /** + *

+ * Constructs the date pattern in the form yyyy mm dd differently + * depending on the DBMS used. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 08/04 08: corrected the format from # dd / MM / yyyy # to # MM / + * dd / yyyy #
+ *

+ * + * @param d the date to be formatted, Date + * @param jd object the jdbc of the DB server + * @return the necessary pattern */ + public static String dataPerDBMS_A(Date d, String jd) { + + if (Pattern.matches("jdbc:db2:\\p{Graph}+", jd) | jd + .equalsIgnoreCase("DB2")) + return "'" + new SimpleDateFormat("yyyy-MM-dd").format(d) + + "'"; + else if (Pattern.matches("jdbc:odbc:\\p{Graph}+", jd) | jd + .equalsIgnoreCase("Access")) + return "#" + new SimpleDateFormat("MM/dd/yyyy").format(d) + + "#"; // style + // English, + // mmddyy + else + return new SimpleDateFormat("dd/MM/yyyy").format(d); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c the date to be formatted, Calendar object + * @param jd the jdbc of the DB server + * @return the necessary pattern */ + public static String dataPerDBMS_A(Calendar c, String jd) { + + return dataPerDBMS_A(c.getTime(), jd); + } + + /** + *

+ * Constructs the date and time pattern in the form yyyy MM dd hh mm + * ss differently according to the DBMS used. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d the date to be formatted + * @param jd the url of the DB server + * @return the necessary pattern + * @since SVutensiliJ4_1.3.0 */ + public static String dataPerDBMS_B(Date d, String jd) { + + if (Pattern.matches("jdbc:db2:\\p{Graph}+", jd) | jd + .equalsIgnoreCase("DB2")) + return "'" + new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss") + .format(d) + "'"; + else if (Pattern.matches("jdbc:odbc:\\p{Graph}+", jd) | jd + .equalsIgnoreCase("Access")) + return "#" + new SimpleDateFormat("MM/dd/yyyy HH.mm.ss") + .format(d) + "#"; // English style, MMddyy + else if (Pattern.matches("jdbc:hsqldb:\\p{Graph}+", jd)) + return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + .format(d) + "'"; + else + return new SimpleDateFormat("dd/MM/yyyy HH.mm.ss").format( + d); + } + + /** + *

+ * Constructs the date and time pattern in the form yyyy MM dd hh mm + * ss differently according to the DBMS used. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d the date to be formatted + * @param jd the url of the DB server + * @return the necessary pattern + * @since SVutensiliJ4_1.3.0 */ + public static String dataPerDBMS_B(Timestamp d, String jd) { + + if (Pattern.matches("jdbc:db2:\\p{Graph}+", jd) | jd + .equalsIgnoreCase("DB2")) + return "'" + new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS") + .format(d) + "'"; + else if (Pattern.matches("jdbc:odbc:\\p{Graph}+", jd) | jd + .equalsIgnoreCase("Access")) + return "#" + new SimpleDateFormat("MM/dd/yyyy HH.mm.ss.SSS") + .format(d) + "#"; // English style, MMddyy + else if (Pattern.matches("jdbc:hsqldb:\\p{Graph}+", jd)) + return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") + .format(d) + "'"; + else + return new SimpleDateFormat("dd/MM/yyyy HH.mm.ss.SSS") + .format(d); + } + + /** + *

+ * Constructs the date and time pattern in the form yyyy MM dd hh mm + * ss differently according to the DBMS used. Overload of + * dataPerDBMS_B to make use of Calendar objects instead of Date + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d the date to be formatted + * @param u the url of the DB server + * @return the necessary pattern + * @since SVsalad_2.0.0 */ + public static String dataPerDBMS_C(Calendar d, String u) { + + if (Pattern.matches("jdbc:db2:\\p{Graph}+", u) | u + .equalsIgnoreCase("DB2")) + return "'" + new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss") + .format(d.getTime()) + "'"; + else if (Pattern.matches("jdbc:odbc:\\p{Graph}+", u)) + return "#" + new SimpleDateFormat("MM/dd/yyyy HH.mm.ss") + .format(d.getTime()) + "#"; // English style, + // mmddyy + else if (Pattern.matches("jdbc:hsqldb:\\p{Graph}+", u)) + return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + .format(d.getTime()) + "'"; + else if (Pattern.matches("jdbc:postgresql:\\p{Graph}+", u)) + return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + .format(d.getTime()) + "'"; + else + return new SimpleDateFormat("dd/MM/yyyy HH.mm.ss").format(d + .getTime()); + } + + /** + *

+ * Constructs the date and time pattern in the form yyyy MM dd hh mm + * ss differently according to the DBMS used. Overload of + * dataPerDBMS_B to make use of Timestamp objects instead of Date + *

+ *

+ * Creation date: 2020-04-09
+ * last modified date: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d the date to be formatted + * @param u the url of the DB server + * @return the necessary pattern + * @since salad_0 */ + public static String dataPerDBMS_C(Timestamp d, String u) { + + if (Pattern.matches("jdbc:db2:\\p{Graph}+", u) | u + .equalsIgnoreCase("DB2")) + return "'" + new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss") + .format(d.getTime()) + "'"; + else if (Pattern.matches("jdbc:odbc:\\p{Graph}+", u)) + return "#" + new SimpleDateFormat("MM/dd/yyyy HH.mm.ss") + .format(d.getTime()) + "#"; // English style, + // mmddyy + else if (Pattern.matches("jdbc:hsqldb:\\p{Graph}+", u)) + return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + .format(d.getTime()) + "'"; + else + return new SimpleDateFormat("dd/MM/yyyy HH.mm.ss").format(d + .getTime()); + } + + /** + *

+ * Constructs the date and time pattern in the form "yyyy MM dd hh + * mm ss SSS" in different ways depending on the DBMS used. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d the date to be formatted + * @param u the url of the DB server + * @return the necessary pattern + * @since salad_0 */ + public static String dataPerDBMS_D(Timestamp d, String u) { + + if (Pattern.matches("jdbc:db2:\\p{Graph}+", u) | u + .equalsIgnoreCase("DB2")) + return "'" + new SimpleDateFormat("yyyy-MM-dd-HH.mm.ss.SSS") + .format(d.getTime()) + "'"; + else if (Pattern.matches("jdbc:odbc:\\p{Graph}+", u)) + return "#" + new SimpleDateFormat("MM/dd/yyyy HH.mm.ss") + .format(d.getTime()) + "#"; // English style, + // mmddyy + else if (Pattern.matches("jdbc:hsqldb:\\p{Graph}+", u)) + return "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") + .format(d.getTime()) + "'"; + else + return new SimpleDateFormat("dd/MM/yyyy HH.mm.ss").format(d + .getTime()); + } + + /** + *

+ * Constructs the date and time pattern in the form yyyy MM dd hh mm + * ss differently according to the DBMS used. It differs from the + * previous version in that the date is provided as a long. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param l the date to be formatted in the form of a number of + * milliseconds + * @param u the url of the DB server + * @return the necessary pattern + * @since SVutensiliJ4_1.3.0 */ + public static String dataPerDBMS_B(long l, String u) { + + return dataPerDBMS_B(new Date(l), u); + } + + /** attention, not accented vowels, for caution */ + public static String[] italianWeekDays = { + + "", "domenica", "lunedi", "martedi", "mercoledi", "giovedi", + "venerdi", "sabato" }; + + /** months of the year */ + public static String[] italianWeekMonths = { + + "gennaio", "febbraio", "marzo", "aprile", "maggio", + "giugno", "luglio", "agosto", "settembre", "ottobre", + "novembre", "dicembre" }; + + /** length of months of the year, formatted 00 */ + public static String[] longTimeMonths = { + + "31", "28", "31", "30", "31", "30", "31", "31", "30", "31", + "30", "31" }; + + /** + *

+ * Simple routine to transform a date from yyyymmdd to dd / MM / + * yyyy. Old name: acconciaData0. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s string to format + * @return formatted date string */ + public static String acconciaData_A(String s) { + + return s.substring(6, 8) + "/" + s.substring(4, 6) + "/" + s + .substring(0, 4); + } + + /** + *

+ * Simple routine to transform a date from MM / dd / yyyy to dd / MM + * / yyyy. Old name: acconciaData1. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s string to format + * @return formatted date string */ + public static String acconciaData_B(String s) { + + return s.substring(3, 5) + "/" + s.substring(0, 2) + "/" + s + .substring(6, 10); + } + + /** + *

+ * Simple routine to transform a date from date-object to + * month-extended g yyyy. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param d date to be processed + * @return date string in extended format */ + public static String acconciaData_C(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return c.get(Calendar.DAY_OF_MONTH) + Candies.SPACE + + italianWeekMonths[c.get(Calendar.MONTH)] + + Candies.SPACE + c.get(Calendar.YEAR); + } + + /** + *

+ * Simple routine to transform a date from date-object to dd / MM / + * yy. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * 12/06 09: fixed error on "form" sign
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_D(Calendar c) { + + return new DecimalFormat("00").format(c.get( + Calendar.DAY_OF_MONTH)) + "/" + new DecimalFormat("00") + .format(c.get(Calendar.MONTH) + 1) + "/" + + new DecimalFormat("00").format(c.get(Calendar.YEAR) + % 100); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d date to be processed + * @return date string in dd / MM / yy format */ + public static String acconciaData_D(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_D(c); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param millis date to be processed, expressed in milliseconds + * @return date string in format dd / MM / yy */ + public static String acconciaData_D(long millis) { + + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(millis); + return acconciaData_D(c); + } + + /** + *

+ * Simple routine to transform a date from Calendar object to + * yyyy-MM-dd. Remember that the form yyyy-MM-dd is the XML standard + * for writing dates. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_E(Calendar c) { + + return new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + "-" + new DecimalFormat("00").format(c.get( + Calendar.MONTH) + 1) + "-" + new DecimalFormat( + "00").format(c.get( + Calendar.DAY_OF_MONTH)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param millis data to be processed, expressed in milliseconds + * @return date string in extended format */ + public static String acconciaData_E(long millis) { + + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(millis); + return acconciaData_E(c); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d date to be processed + * @return date string in yyyy-MM-dd format */ + public static String acconciaData_E(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_E(c); + } + + /** + *

+ * Simple routine to transform a date from date-object to dd / MM / + * yyyy. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_F(Calendar c) { + + return new DecimalFormat("00").format(c.get( + Calendar.DAY_OF_MONTH)) + "/" + new DecimalFormat("00") + .format(c.get(Calendar.MONTH) + 1) + "/" + + new DecimalFormat("0000").format(c.get( + Calendar.YEAR)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d data to be processed + * @return date string in extended format */ + public static String acconciaData_F(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_F(c); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d data to be processed + * @return date string in extended format */ + public static String acconciaData_F(Timestamp d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_F(c); + } + + /** + *

+ * Simple routine to transform a date from date-object to yyyymmdd. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_G(Calendar c) { + + return new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + new DecimalFormat("00").format(c.get(Calendar.MONTH) + + 1) + new DecimalFormat("00").format(c.get( + Calendar.DAY_OF_MONTH)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d data to be processed + * @return date string in extended format */ + public static String acconciaData_G(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_G(c); + } + + /** + *

+ * Simple routine to transform a date from date-object to dd / MM / + * yyyy hh: mm: ss. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_H(Calendar c) { + + return new DecimalFormat("00").format(c.get( + Calendar.DAY_OF_MONTH)) + "/" + new DecimalFormat("00") + .format(c.get(Calendar.MONTH) + 1) + "/" + + new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + Candies.SPACE + new DecimalFormat("00").format(c.get( + Calendar.HOUR_OF_DAY)) + ":" + + new DecimalFormat("00").format(c.get(Calendar.MINUTE)) + + ":" + new DecimalFormat("00").format(c.get( + Calendar.SECOND)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d date to be processed + * @return date string in format dd / MM / yy hh: mm: ss */ + public static String acconciaData_H(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_H(c); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param millis date to be processed, expressed in milliseconds + * @return date string in format dd / MM / yy hh: mm: ss */ + public static String acconciaData_H(long millis) { + + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(millis); + return acconciaData_H(c); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param timestamp date to be processed, expressed as timestamp + * @return date string in format dd / MM / yy hh: mm: ss */ + public static String acconciaData_H(Timestamp timestamp) { + + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(timestamp.getTime()); + return acconciaData_H(c); + } + + /** + *

+ * Simple routine to transform a date from data-object to hh: mm: + * ss. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Changes:
+ * 2020-04-09: changed the name from acconciaData_h to + * acconciaData_O
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_O(Calendar c) { + + return new DecimalFormat("00").format(c.get( + Calendar.HOUR_OF_DAY)) + ":" + new DecimalFormat("00") + .format(c.get(Calendar.MINUTE)) + ":" + + new DecimalFormat("00").format(c.get( + Calendar.SECOND)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param millis data to be processed, expressed in milliseconds + * @return date string in format hh: mm: ss */ + public static String acconciaData_O(long millis) { + + Calendar c = Calendar.getInstance(); + c.setTimeInMillis(millis); + return acconciaData_O(c); + } + + /** + *

+ * Simple routine to transform a date from yyyy-mm-dd (XML standard) + * to a Date object + *

+ *

+ * Creation date: 2020-04-09
+ * last modified date: 10/21 / 10 + *

+ * + * @param s string to format + * @return formatted date string + * @throws ExactException objects if the date given is incorrect */ + + public static Date acconciaData_I(String s) + + throws ExactException { + + return pacco(s.substring(8, 10), s.substring(5, 7), s.substring( + 0, 4)); + } + + /** + *

+ * Simple routine to transform a date from yyyymmdd to a Date + * object. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s string to format + * @return formatted date string + * @throws ExactException object if the date provided is + * incorrect */ + + public static Date acconciaData_K(String s) + + throws ExactException { + + return pacco(s.substring(6, 8), s.substring(4, 6), s.substring( + 0, 4)); + } + + /** + *

+ * Simple routine to transform a date from yyyy-mm-dd (XML standard) + * to an 8-digit number yyyymmdd + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s the date in XML format + * @return the date as integer + * @throws ExactException objecting if the given date is + * incorrect */ + + public static int acconciaData_L(String s) + + throws ExactException { + + try { + int giorno = Integer.valueOf(s.substring(8, 10)); + int mese = Integer.valueOf(s.substring(5, 7)); + int anno = Integer.valueOf(s.substring(0, 4)); + return anno * 10000 + mese * 100 + giorno; + } catch (NumberFormatException nfe) { + throw new ExactException(nfe.getMessage(), 100300, + "HandleDate", ""); + } + } + + /** + *

+ * Simple routine to transform a date from data-object to + * yyyymmdd_hhmmss. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_J(Calendar c) { + + return new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + new DecimalFormat("00").format(c.get(Calendar.MONTH) + + 1) + new DecimalFormat("00").format(c.get( + Calendar.DAY_OF_MONTH)) + "_" + + new DecimalFormat("00").format(c.get( + Calendar.HOUR_OF_DAY)) + new DecimalFormat("00") + .format(c.get(Calendar.MINUTE)) + + new DecimalFormat("00").format(c.get( + Calendar.SECOND)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d data to be processed + * @return date string in extended format */ + public static String acconciaData_J(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_J(c); + } + + /** + *

+ * Simple routine to transform a date from dd / mm / yyyy HH.mm.ss + * to a Date object. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s string to format + * @return formatted date string + * @throws ExactException object if the date provided is + * incorrect */ + + public static Date acconciaData_M(String s) + + throws ExactException { + + return pacco(s.substring(0, 2), s.substring(3, 5), s.substring( + 6, 10), s.substring(11, 13), s.substring(14, 16), s + .substring(17, 19)); + } + + /** + *

+ * Simple routine to transform a date from dd / mm / yyyy to Date + * object. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s string to format + * @return formatted date string + * @throws ExactException object if the date provided is + * incorrect */ + + public static Date acconciaData_P(String s) + + throws ExactException { + + return pacco(s.substring(0, 2), s.substring(3, 5), s.substring( + 6, 10)); + } + + /** + *

+ * Simple routine to transform a date from date-object to yyyy / mm + * / dd hh: mm: ss. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_N(Calendar c) { + + return new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + "/" + new DecimalFormat("00").format(c.get( + Calendar.MONTH) + 1) + "/" + new DecimalFormat( + "00").format(c.get( + Calendar.DAY_OF_MONTH)) + + Candies.SPACE + new DecimalFormat("00").format(c.get( + Calendar.HOUR_OF_DAY)) + ":" + + new DecimalFormat("00").format(c.get(Calendar.MINUTE)) + + ":" + new DecimalFormat("00").format(c.get( + Calendar.SECOND)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d date to be processed + * @return date string in format dd / MM / yy hh: mm: ss */ + public static String acconciaData_N(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_N(c); + } + + /** + *

+ * Simple routine to transform a date from date-object to yyyy / mm + * / dd. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c date to be processed + * @return date string in extended format */ + public static String acconciaData_Q(Calendar c) { + + return new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + "/" + new DecimalFormat("00").format(c.get( + Calendar.MONTH) + 1) + "/" + new DecimalFormat( + "00").format(c.get( + Calendar.DAY_OF_MONTH)); + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d data to be processed + * @return date string in extended format */ + public static String acconciaData_Q(Date d) { + + Calendar c = Calendar.getInstance(); + c.setTime(d); + return acconciaData_Q(c); + } + + /** + *

+ * Set the hours, minutes, seconds and milliseconds to 0. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param c the date to be processed + * @return the purified date of hours, minutes, seconds and + * milliseconds */ + public static Calendar ammazzaMinuti(Calendar c) { + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.MILLISECOND, 0); + return c; + } + + /** + *

+ * Routine to produce the current time in the form hh: mm: ss. + *

+ *

+ * Creation date: 22 / apr / 08
+ * Last updated: 22 / apr / 08 + *

+ *

+ * Changes:
+ *

+ * + * @return the current time */ + public static String currentTime_B() { + + TimeZone tz = TimeZone.getTimeZone("Europe/Paris"); + Calendar c = Calendar.getInstance(tz); + return new DecimalFormat("00").format(c.get( + Calendar.HOUR_OF_DAY)) + ":" + new DecimalFormat("00") + .format(c.get(Calendar.MINUTE)) + ":" + + new DecimalFormat("00").format(c.get( + Calendar.SECOND)); + } + + /** + *

+ * Formal date check. It can be customized using the format + * parameter. + *

+ *

+ * Creation date: 21 / Feb / 08
+ * Last updated: 21 / Feb / 08 + *

+ *

+ * Changes:
+ *

+ * + * @param data obvious + * @param format for example: dd-MM-yyyy + * @return true or false */ + public static boolean eDataValida(String data, String format) { + + try { + SimpleDateFormat sdf = new SimpleDateFormat(format); + sdf.setLenient(false); + sdf.parse(data); + Date d = sdf.getCalendar().getTime(); + String s = new SimpleDateFormat(format).format(d); + return s.equals(data); + } catch (ParseException e) { + return false; + } catch (IllegalArgumentException e) { + return false; + } + } + + /** + *

+ * Formal check of a written date such as: 5 September 1980. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param data obvious + * @return true or false */ + public static Date eLongValidDate(String data) { + String t = Strings.compact_A(data); + String[] wordE = t.split(Candies.SPACE); + if (wordE.length != 3) + return null; + int i = 0; + for (; i < 12 && !wordE[1].equalsIgnoreCase( + italianWeekMonths[i]); i++) + ; + if (i == 12) + return null; + try { + return pacco(wordE[0], Integer.valueOf(i + 1).toString(), + wordE[2]); + } catch (ExactException e) { + return null; + } + } + + /** + *

+ * Production of today's date in the form dd / mm / yyyy. + *

+ * Creation date: 22 / apr / 08
+ * Last updated: 22 / apr / 08 + *

+ *

+ * Changes:
+ *

+ * + * @return la string containing today's date */ + public static String currentDate_C() { + + TimeZone tz = TimeZone.getTimeZone("Europe/Paris"); + Calendar c = Calendar.getInstance(tz); + return new DecimalFormat("00").format(c.get( + Calendar.DAY_OF_MONTH)) + "/" + new DecimalFormat("00") + .format(c.get(Calendar.MONTH) + 1) + "/" + + new DecimalFormat("0000").format(c.get( + Calendar.YEAR)); + } + + /** + *

+ * Production of today's date in the form yyyy / MM / dd. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return la string containing today's date + * @since 2.1.0, package 2.0.0 */ + public static String dataCorrente_D() { + + TimeZone tz = TimeZone.getTimeZone("Europe/Paris"); + Calendar c = Calendar.getInstance(tz); + return new DecimalFormat("0000").format(c.get(Calendar.YEAR)) + + "/" + new DecimalFormat("00").format(c.get( + Calendar.MONTH) + 1) + "/" + new DecimalFormat( + "00").format(c.get( + Calendar.DAY_OF_MONTH)); + } + + /** + *

+ * Calculation of how many days there are in a month. The month must + * be given as a number from 1 to 12. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes :
+ * 2020-04-09: added the else to the if, otherwise it was an error + *
+ * 2020-04-09: corrected error on the sign of "form"
+ *

+ * + * @param mese month, as a number from 1 to 12 + * @param anno a positive 4-digit number + * @return how many days; if the month is incorrect, an empty string + * returns */ + public static String quantiGiorniMese(int mese, int anno) { + + String q = ""; + if (mese < 1 | mese > 12) + return q; + if ((anno % 4) == 0 & (anno % 400) > 0) + longTimeMonths[1] = "29"; + else + // 2020-04-09 + longTimeMonths[1] = "28"; + return longTimeMonths[mese - 1]; + } + + /** + *

+ * Transformation of a date from three integers: day, month, year to + * a Date object. The month must be given as a number from 1 to 12. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param day as a number from 1 to 28, 29, 30 or 31 + * @param month as a number from 1 to 12 + * @param year a 4-digit positive number + * @return l Date object; if the month is incorrect, return an empty + * string + * @throws ExactException exception for incorrect date */ + public static Date pacco(int day, int month, int year) + throws ExactException { + + if (!eDataValida(day + "-" + month + "-" + year, "d-M-yyyy")) { + ExactException ce = new ExactException("yyyy-MM-dd=" + year + + "-" + month + "-" + day, 100301, "HandleDate", + ""); + throw ce; + } + Calendar c = Calendar.getInstance(); + c.set(year, month - 1, day, 0, 0, 0); + c.set(Calendar.MILLISECOND, 0); + Date d = c.getTime(); + return d; + } + + /** + *

+ * Variant of the previous one using 3 strings instead of 3 numbers. + * Transformation of a date from three integers: day, month, year to + * a Date object. The month must be provided as a number from 1 to + * 12.
+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param dayS as string from 1 to 28, 29, 30 or 31 + * @param monthS as string from 1 to 12 + * @param yearS as string, 4 digits + * @return the Date object; if the month is incorrect, return an + * empty string + * @throws ExactException exception for incorrect date */ + public static Date pacco(final String dayS, final String monthS, + final String yearS) + + throws ExactException { + + int giorno = Integer.valueOf(dayS).intValue(); + int mese = Integer.valueOf(monthS).intValue(); + int anno = Integer.valueOf(yearS).intValue(); + return pacco(giorno, mese, anno); + } + + /** + *

+ * Variant of the previous one that returns a Calendar object + * instead of a Date.
+ *

+ * Creation date: 2020-04-09
+ * last modified date: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param dayS as string from 1 to 28, 29, 30 or 31 + * @param monthS as string from 1 to 12 + * @param yearS as string, 4 digits + * @return the Date object; if the month is incorrect, return an + * empty string + * @throws ExactException exception for incorrect date */ + public static Calendar calPacco(final String dayS, + final String monthS, final String yearS) + throws ExactException { + + int giorno = Integer.valueOf(dayS).intValue(); + int mese = Integer.valueOf(monthS).intValue(); + int anno = Integer.valueOf(yearS).intValue(); + Calendar c = Calendar.getInstance(); + c.setTime(pacco(giorno, mese, anno)); + c = ammazzaMinuti(c); + return c; + } + + /** + *

+ * Variant of the previous one using a single string of the type d / + * M / yyyy or d-M-yyyy. If the date is not valid, the usual + * ExactException is made. For practical reasons it was necessary to + * move from CodeExceprion to ExactException. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s input string + * @return the object Date + * @throws ExactException exception for null or incorrect date */ + public static Date pacco(final String s) + + throws ExactException { + + ExactException ne = new ExactException(); + ne.datum = "date=" + s; + if (s == null) + throw ne; + String t[] = s.split("-"); + String u[] = s.split("/"); + try { + if (t.length == 3) + return pacco(t[0], t[1], t[2]); + else if (u.length == 3) + return pacco(u[0], u[1], u[2]); + else { + throw ne; + } + } catch (ExactException e) { + throw ne; + } + } + + /** + *

+ * Variant of the previous one using a single string of the type + * yyyy-mm-dd (it is also the XML standard). If the date is not + * valid, the usual ExactException is made. For practical reasons it + * was necessary to move from ExactException to ExactException. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s input string + * @return the object Date + * @throws ExactException exception for null or incorrect date + * @since 3 */ + public static Calendar xml(final String s) + + throws ExactException { + + ExactException ne = new ExactException(); + ne.datum = "date=" + s; + if (s == null) + throw ne; + String t[] = s.split("-"); + try { + if (t.length == 3) + return calPacco(t[2], t[1], t[0]); + else { + throw ne; + } + } catch (ExactException e) { + throw ne; + } + } + + /** + *

+ * Transformation of a date from 6 integers: day, month, year, hour, + * minutes, seconds to a Date object. The month must be given as a + * number from 1 to 12. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param day as a number from 1 to 28, 29, 30 or 31 + * @param month as a number from 1 to 12 + * @param year a 4-digit positive number + * @param hours the hours of the day + * @param minutes the minutes of the hour + * @param seconds the seconds of the minute + * @return the Date object; if the month is incorrect, return an + * empty string + * @throws ExactException exception for incorrect date */ + public static Date pacco(final int day, final int month, + final int year, final int hours, final int minutes, + final int seconds) + + throws ExactException { + + if (!eDataValida(day + "-" + month + "-" + year, "dd-MM-yyyy") + | hours > 23 | hours < 0 | minutes > 59 | minutes < 0 + | seconds > 59 | seconds < 0) { + ExactException ce = new ExactException( + "gg-mm-aaaa hh:mm:ss=" + day + "-" + month + "-" + + year + Candies.SPACE + hours + ":" + + minutes + ":" + seconds, 100302, + "HandleDate", ""); + throw ce; + } + Calendar c = Calendar.getInstance(); + c.set(year, month - 1, day, hours, minutes, seconds); + c.set(Calendar.MILLISECOND, 0); + return c.getTime(); + } + + /** + *

+ * Variant of the previous one using 6 strings instead of 6 numbers. + * Transformation of a date from 6 integers: day, month, year, + * hours, minutes and seconds into a Date object.
+ *

+ * Creation date: 2020-04-09
+ * Last updated: 21 / 11/08 + *

+ *

+ * Changes:
+ *

+ * + * @param dayS as a string from 1 to 28, 29, 30 or 31 + * @param monthS as a string from 1 to 12 + * @param yearS as string, 4 digits + * @param hoursS as string, 2 digits + * @param minutesS as string, 2 digits + * @param secondsS as string, 2 digits + * @return the Date object; if the month is incorrect, return an + * empty string + * @throws ExactException exception for incorrect date */ + public static Date pacco(final String dayS, final String monthS, + final String yearS, final String hoursS, + final String minutesS, final String secondsS) + + throws ExactException { + + int giorno = Integer.valueOf(dayS).intValue(); + int mese = Integer.valueOf(monthS).intValue(); + int anno = Integer.valueOf(yearS).intValue(); + int ore = Integer.valueOf(hoursS).intValue(); + int minuti = Integer.valueOf(minutesS).intValue(); + int secondi = Integer.valueOf(secondsS).intValue(); + return pacco(giorno, mese, anno, ore, minuti, secondi); + } + + /** + *

+ * Calculation of the number of days between two dates of type + * Calendar, independent of the type of calendar. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param d1 The first date. + * @param d2 The second date. + * @return The number of days between the two dates. Zero is + * returned if the dates are the same, one if the dates are + * adjacent, etc. The order of the dates does not matter, + * the value returned is always >= 0. If Calendar types + * of d1 and d2 are different, the result may not be + * accurate. */ + public static int quantiGiorni(Calendar d1, Calendar d2) { + + if (d1.after(d2)) { // swap dates so that d1 is start and d2 is + // end + Calendar swap = d1; + d1 = d2; + d2 = swap; + } + int days = d2.get(Calendar.DAY_OF_YEAR) - d1.get( + Calendar.DAY_OF_YEAR); + int y2 = d2.get(Calendar.YEAR); + if (d1.get(Calendar.YEAR) != y2) { + d1 = (Calendar) d1.clone(); + do { + days += d1.getActualMaximum(Calendar.DAY_OF_YEAR); + d1.add(Calendar.YEAR, 1); + } while (d1.get(Calendar.YEAR) != y2); + } + return days; + } + + /** + *

+ * Calculation of the date contained in a manifest such as + * Built-Date. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param attributes the attributes of the manifest + * @return data as object Date + * @throws ExactException exception for incorrect date */ + public static Date builtDate(Attributes attributes) + throws ExactException { + + Date data = null; + String dataS = attributes.getValue("Built-Date"); + if (dataS.length() == 16) + data = pacco(dataS.substring(8, 10), dataS.substring(5, 7), + dataS.substring(0, 4), dataS.substring(11, 13), + dataS.substring(14, 16), "0"); + else + data = pacco(dataS.substring(8, 10), dataS.substring(5, 7), + dataS.substring(0, 4), dataS.substring(11, 13), + dataS.substring(14, 16), dataS.substring(17, 19)); + return data; + } + + /** + *

+ * Examination of a date written in a text-box. It is to be used if + * you want to test the date just while the operator is writing it, + * digit by digit. The year is always 4 digits. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param data exception for incorrect date + * @param dataMin minimum acceptable value for the date + * @param dataMax maximum acceptable value for the date + * @return the date, if it is valid; otherwise a null returns */ + public static Calendar dataFluida(final String data, + Calendar dataMin, Calendar dataMax) { + + if (Pattern.matches("\\d{1,2}/\\d{1,2}/\\d{4}", data) + && (HandleDate.eDataValida(data, "d/M/yyyy") + | HandleDate.eDataValida(data, "dd/M/yyyy") + | HandleDate.eDataValida(data, "d/MM/yyyy") + | HandleDate.eDataValida(data, "dd/MM/yyyy"))) { + String[] parola = new String[2]; + int anno = 0, mese = 0, giorno = 0; + parola = data.split("/"); + anno = Integer.valueOf(parola[2]); + mese = Integer.valueOf(parola[1]); + giorno = Integer.valueOf(parola[0]); + Calendar c = Calendar.getInstance(); + c.set(anno, mese - 1, giorno, 0, 0, 0); + c.set(Calendar.MILLISECOND, 0); + if (c.compareTo(dataMin) >= 0 & c.compareTo(dataMax) <= 0) + return c; + else + return null; + } else + return null; + } + + /** + *

+ * Transformation of a date + time as a string into a Calendar + * object. It must be of the type g / m / yyyy hh: mm: ss or g / m / + * yyyy hh: mm: ss, sss or g / m / yyyy hh: mm: ss.sss. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param b string date + time + * @return true or false + * @throws ExactException standard exception */ + public static Calendar formatBoxCal(final String b) + + throws ExactException { + + /* error code: 20050xxx */ + + ExactException ce = new ExactException(); + ce.className = "HandleDate"; + ce.method = "formatBox"; + ce.code = 0; + Calendar c = Calendar.getInstance(); + if (b == null || b.isEmpty()) { + ce.code = 20050000; + ce.datum = "The provided datum is null or empty."; + throw ce; + } + String s = Strings.compact_A(b); + String[] p = s.split("\\x20"); // the space character + if (p.length != 2) { + ce.datum = "The provided datum is incorrect," + + " it must contain one space."; + ce.code = 20050001; + throw ce; + } + if (!eDataValida(p[0], "d/M/yyyy")) { + ce.datum = "The provided date is uncorrect, it must be" + + " written according to format d/M/yyyy."; + ce.code = 20050002; + throw ce; + } + String[] q = p[0].split("\\x2f"); // the slash character + c.set(Calendar.DAY_OF_MONTH, Integer.valueOf(q[0]).intValue()); + c.set(Calendar.MONTH, Integer.valueOf(q[1]).intValue() - 1); + c.set(Calendar.YEAR, Integer.valueOf(q[2]).intValue()); + Integer[] y = eOraValida(p[1]); + if (y == null) { + ce.datum = "The provided time is incorrect, it must be " + + " written according to format" + + " hh:mm:ss or hh:mm:ss,sss."; + ce.code = 20050003; + throw ce; + } + c.set(Calendar.HOUR_OF_DAY, y[0].intValue()); + c.set(Calendar.MINUTE, y[1].intValue()); + c.set(Calendar.SECOND, y[2].intValue()); + c.set(Calendar.MILLISECOND, y[3].intValue()); + return c; + } + + /** + *

+ * Variant of the previous one, produces a Timestamp object instead + * of a Calendar object. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param b the string date + time + * @return the object Timestamp + * @throws ExactException application exception */ + public static Timestamp formatBoxTim(final String b) + + throws ExactException { + + Calendar c = formatBoxCal(b); + long l = c.getTimeInMillis(); + return new Timestamp(l); + } + + /** + *

+ * Formal time control. It must be of the type hh: mm: ss or hh: mm: + * ss, sss or hh: mm: ss.sss. If it is not correct, the method + * returns a null value. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param now obvious + * @return true or false */ + public static Integer[] eOraValida(String now) { + + /* error code: 20051xxx */ + + Integer[] x = new Integer[4]; + if (now == null || now.isEmpty()) { + return null; + } + String[] r = now.split("\\x3a"); // 3a is the colon character + if (r.length != 3) { + return null; + } + r[0] = r[0].trim(); + r[1] = r[1].trim(); + r[2] = r[2].trim(); + /* I turn the point into a comma when milliseconds are + * expressed */ + r[2] = r[2].replaceFirst("\\x2e", ","); + if (!r[0].matches("\\d{2}") | !r[1].matches("\\d{2}")) { + return null; + } else if (r[2].matches("\\d{2}")) { + x[0] = Integer.valueOf(r[0]); + x[1] = Integer.valueOf(r[1]); + x[2] = Integer.valueOf(r[2]); + x[3] = Integer.valueOf(0); + if (x[0].intValue() > 23 | x[1].intValue() > 59 | x[2] + .intValue() > 59) { + return null; + } else { + return x; + } + } else if (r[2].matches("\\d{2}\\x2c\\d{3}")) { + x[0] = Integer.valueOf(r[0]); + x[1] = Integer.valueOf(r[1]); + x[2] = Integer.valueOf(r[2].substring(0, 2)); + x[3] = Integer.valueOf(r[2].substring(3, 6)); + if (x[0].intValue() > 23 | x[1].intValue() > 59 | x[2] + .intValue() > 59) { + return null; + } else { + return x; + } + } else { + return null; + } + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/MatriceCaratteri.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/MatriceCaratteri.java new file mode 100644 index 0000000..c25d0a1 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/MatriceCaratteri.java @@ -0,0 +1,32 @@ +/** + * + */ +package it.ramecera.salad.everyday; + +/** + *

+ * Bean contenitore per una una matrice bidimensionale di caratteri, pi� + * un punto a 2 dimensioni che indica le coordinate dell'angolo in alto + * a sinistra della matrice, rispetto ad un riferimento pi� grande. + *

+ *

+ * azienda: Ramecera
+ * data creazione: 2014-01-17
+ * data ultima modifica: 2014-01-17 + *

+ *

+ * Modifiche:
+ * + *

+ * + * @author M. Maglioni + * @since 6.1 */ + +public class MatriceCaratteri { + + /** le coordinate dell'angolo superiore sinistro della matrice nel + * suo contesto */ + public Point2D dove = new Point2D(); + /** la matrice di caratteri */ + public char[][] x; +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Mix.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Mix.java new file mode 100644 index 0000000..c4d9533 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Mix.java @@ -0,0 +1,1662 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +import java.io.File; +import java.io.FilenameFilter; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.regex.Pattern; +// import org.eclipse.jface.dialogs.MessageDialog; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.file.FileBase; +import it.ramecera.salad.graphic.Placard; + +/** + *

+ * Various utility methods. + *

+ *

+ * Company: Ramecera™ ​​
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-24S
+ *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni */ + +public class Mix { + + // CONSTANT + /** 2 spaces */ + public final static String DOUBLEBLANK = " "; + + /** + *

+ * First make a trim. If the first character is a capital letter, + * this method converts it to lower case; otherwise it does nothing. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20 + *

+ * Modifications:
+ *

+ * + * @param g the complete path of file + * @return la lowercase string */ + public static String lowercaseFirstChar(final String g) { + if (g == null) { + return null; + } + String s = g.trim(); + if (s.equals("")) { + return s; + } + char ini = s.charAt(0); + if (ini > 64 & ini < 91) { // if it is capitalized + String iniziale = s.substring(0, 1); + String resto = s.substring(1); + return iniziale.toLowerCase() + resto; + } else { + return s; + } + } + + /** + *

+ * First make a trim. If the first character is an lowercase letter, + * this method converts it to uppercase; otherwise it does nothing. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20 + *

+ * Modifications:
+ *

+ * + * @param g the complete path of file + * @return la uppercase string */ + public static String uppercaseFirstChar(final String g) { + if (g == null) { + return null; + } + String s = g.trim(); + if (s.equals("")) { + return s; + } + char ini = s.charAt(0); + if (ini > 96 & ini < 123) { // if it is lowercase + String iniziale = s.substring(0, 1); + String resto = s.substring(1); + return iniziale.toUpperCase() + resto; + } else { + return s; + } + } + + /** + *

+ * Given a complete file path, it produces an array of 3 strings + * containing respectively: the path, the file, the character (slash + * or backslash) that separates the path from the file. Example: + * /monte/mare/stella.bmp produces: / monte / mare, stella.bmp, /. + *
+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * Modifications:
+ *

+ * + * @param g the complete path of file + * @return the 3 elements produced */ + public static String[] separaPath(final String g) { + String e[] = new String[3]; + if (g.indexOf(92) > -1) { // character 92 is the backslash + e[2] = "\\"; + } else { + e[2] = "/"; + } + String h = g.replaceAll("\\x5c", "/"); + String[] d = h.split("\\x2f"); + e[1] = d[d.length - 1]; + if (g.equals(e[1])) { + e[2] = ""; + e[0] = ""; + } else { + e[0] = g.substring(0, g.length() - 1 - e[1].length()); + } + return e; + } + + /** + *

+ * Given a complete path of files, it produces an array of 3 strings + * containing respectively: the path, the name of the file without + * extension and without final dot, the extension without initial + * dot. Example: /monte/mare/stella.bmp produces: / monte / mare, + * stella, bmp.
+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param g the complete path of file + * @return the 3 elements produced */ + public static String[] analizzaPath(final String g) { + String e[] = new String[3]; + String h = g.replaceAll("\\x5c", "/");// the hex 5c is the + // backslash + String[] d = h.split("\\x2f");// hex 2f is slash + e[1] = d[d.length - 1]; + if (g.equals(e[1])) { + e[0] = ""; + } else { + e[0] = g.substring(0, g.length() - 1 - e[1].length()); + } + e[2] = estraiExtension(e[1]); + if (e[2] == null) { + e[2] = ""; + } + e[1] = e[1].substring(0, e[1].length() - e[2].length() - 1); + return e; + } + + /** + *

+ * It could have been an overload of the previous method, but the + * name was changed because only the type of return changes. + *

+ * Creation date: 11 apr 2019
+ * Last updated: 11 apr 2019
+ *

+ * Modifications:
+ *

+ * + * @param file the complete path of file + * @return i 3 elements produced */ + public static FileBase analizzaPathBase(File file) { + String e[] = analizzaPath(file.getPath()); + FileBase fb = new FileBase(e[0], e[1], e[2], 0); + return fb; + } + + /** + *

+ * Given a string, it produces 3 different versions of the same: + *

+ *
    + *
  • all lowercase
  • + *
  • all uppercase
  • + *
  • all words with initials capital
  • + *
+ *

+ * The text is compacted to eliminate double spaces. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param s the phrase to convert + * @return the 3 elements produced */ + public static String[] like_A(final String s) { + String s1 = compattaSpazi_B(s); + String[] u = new String[3]; + if (s1.equals("")) { + u[0] = ""; + u[1] = ""; + u[2] = ""; + return u; + } + u[0] = s1.toLowerCase(); + u[1] = s1.toUpperCase(); + String v[] = u[0].split(Candies.SPACE); + String z = ""; + for (String t : v) { + z += Candies.SPACE + t.substring(0, 1).toUpperCase() + t + .substring(1); + } + u[2] = z.substring(1); + return u; + } + + /** + *

+ * Extracts the bits that make up an integer. All the bits minus the + * last one, the one indicating the sign, are extracted; therefore, + * for a 32-bit integer, the 31 bits further left are extracted. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param i the number to be sent + * @return the array of bits */ + public static Boolean[] sbitta_A(final int i) { + Boolean[] b = new Boolean[Integer.SIZE - 1]; + double p; + int u; + for (int j = 0; j < Integer.SIZE - 1; j++) { + p = Math.pow(2, j); + u = (int) Math.round(p); + b[j] = Boolean.valueOf((i & u) == u); + } + return b; + } + + /** + *

+ * Creation of a sequence of identical characters in quantity q. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param c the character to be appended + * @param q the amount of spaces to be appended + * @return the string of q spaces */ + public static String piastrelle(final char c, final int q) { + String sequenza = "", car = String.valueOf(c); + for (int i = 0; i < q; i++) + sequenza = sequenza.concat(car); + return sequenza; + } + + /** + *

+ * Creation of a sequence of groups of identical characters in + * quantity q. It differs from the previous one in that it + * accumulates groups of characters instead of a single character. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s the group of characters to be appended + * @param q the amount of spaces to be appended + * @return the string of q spaces */ + public static String piastrelle(final String s, final int q) { + String sequenza = ""; + for (int i = 0; i < q; i++) + sequenza = sequenza.concat(s); + return sequenza; + } + + /** + *

+ * Calculation of an array of characters starting from its + * hexadecimal code. We speak of ordinary characters, that is, + * within the ASCII set. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param m character array to convert + * @return ordinary character array + * @throws ExactException occurs if the hexadecimal code is + * incorrect */ + public static char[] daEsadAChar(char[] m) + + throws ExactException { + + if (m.length % 2 != 0) + throw new ExactException( + "The quantity of characrters is not an even number."); + if (!Pattern.matches("\\p{XDigit}+", String.copyValueOf(m))) + throw new ExactException( + "Any characters not between 0 and f are present."); + char[] ml = new char[m.length]; + int[] k = new int[m.length]; + char[] n = new char[m.length / 2]; + // I convert to lowercase + for (int i = 0; i < m.length; i++) { + if (Character.isDigit(m[i])) + ml[i] = m[i]; + else + ml[i] = Character.toLowerCase(m[i]); + } + // I convert each character into an integer + for (int i = 0; i < m.length; i++) { + if (ml[i] < 'a') + k[i] = ml[i] - 48; + else + k[i] = ml[i] - 87; + } + // I calculate the true character + for (int i = 0; i < m.length; i += 2) { + n[i / 2] = (char) (k[i] * 16 + k[i + 1]); + } + return n; + } + + /** + *

+ * Calculation of an array of characters starting from its + * hexadecimal code. We speak of ordinary characters, that is, + * within the ASCII set. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m character array to convert + * @return ordinary character array + * @throws ExactException trigger if the hexadecimal code is + * incorrect */ + public static byte[] daEsadAByte(byte[] m) + + throws ExactException { + + char v = 0; + if (m.length % 2 != 0) + throw new ExactException( + "The quantity of characrters is not even: " + + m.length + "."); + for (int j = 0; j < m.length; j++) { + v = (char) (m[j]); + if (!Pattern.matches("\\p{XDigit}+", Character.toString( + v))) { + throw new ExactException("At position " + j + + " any characters not between 0 and f are present: " + + v + " cioè " + m[j]); + } + } + byte[] ml = new byte[m.length]; // the same input array + // convert + // lowercase + int[] k = new int[m.length]; + byte[] n = new byte[m.length / 2]; + // I convert to lowercase + for (int i = 0; i < m.length; i++) { + v = (char) (m[i]); + if (Character.isDigit(v)) + ml[i] = m[i]; + else + ml[i] = (byte) ((Character.toLowerCase(v)) - 127); + } + // I convert each character into an integer + for (int i = 0; i < m.length; i++) { + if (ml[i] < -30) // -30 = character a + k[i] = ml[i] + 79; // -79 = zero character + else + k[i] = ml[i] + 40; // the character W 87, distant 10 + // positions from to + } + // I calculate the true character + for (int i = 0; i < m.length; i += 2) { + n[i / 2] = (byte) ((k[i] * 16 + k[i + 1]) - 127); + } + return n; + } + + /** + *

+ * Calculation of an array of characters starting from its + * hexadecimal code. We speak of Unicode characters, therefore 4 + * hexadecimal characters for each character. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m character array to convert + * @return ordinary character array + * @throws ExactException occurs if the hexadecimal code is + * incorrect */ + public static char[] daEsadACharUnicode(char[] m) + throws ExactException { + if (m.length % 4 != 0) + throw new ExactException( + "The quantity of characters is not a multiple of 4."); + if (!Pattern.matches("\\p{XDigit}+", String.copyValueOf(m))) + throw new ExactException( + "Any characters not between 0 and f are present."); + char[] ml = new char[m.length]; + int[] k = new int[m.length]; + char[] n = new char[m.length / 4]; + // I convert to lowercase + for (int i = 0; i < m.length; i++) { + if (Character.isDigit(m[i])) + ml[i] = m[i]; + else + ml[i] = Character.toLowerCase(m[i]); + } + // I convert each character into an integer + for (int i = 0; i < m.length; i++) { + if (ml[i] < 'a') + k[i] = ml[i] - 48; + else + k[i] = ml[i] - 87; + } + // I calculate the true character + for (int i = 0; i < m.length; i += 4) { + n[i / 4] = (char) (k[i] * 4096 + k[i + 1] * 256 + k[i + 2] + * 16 + k[i + 3]); + } + return n; + } + + /** + *

+ * Calculation of an array of hexadecimal codes starting from an + * array of ordinary characters, that is, within the ASCII set. + * Obviously the output is twice as long. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m character array to convert + * @return lowercase hexadecimal character array + * @see "prog. bigExport_1.1.0, data class of Export" + * @see "prog. bigExport_2.0.0, data class of DiExport" + * @since 1.2.2 */ + public static char[] daCharAdEsad(char[] m) { + int[] k = new int[m.length]; + char[] n = new char[m.length * 2]; + char[] c = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' }; + for (int i = 0; i < m.length; i++) + k[i] = m[i]; + for (int i = 0; i < m.length; i++) { + n[i * 2] = c[k[i] / 16]; + n[i * 2 + 1] = c[k[i] % 16]; + } + return n; + } + + /** + *

+ * Encrypting a string from a key. The encrypted output is further + * transformed into hexadecimal. As a result, the output is twice as + * long. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m character array to convert + * @param key encryption key + * @return encrypted character array + * @throws ExactException incorrect use */ + public static char[] crittaSemplice_A(char[] m, final String key) + + throws ExactException { + + if (m == null | key == null) { + throw new ExactException("One or some given parameters" + + " are null."); + } + String chiave1 = key; + while (chiave1.length() < m.length) { + chiave1 += chiave1; + } + char[] z = new char[m.length]; + String chiave2 = chiave1.substring(0, m.length); + char[] c = chiave2.toCharArray(); + for (int i = 0; i < z.length; i++) + z[i] = (char) (m[i] ^ c[i]); + return daCharAdEsad(z); + } + + /** + *

+ * Decryption of a string, to be coupled to what obtained with the + * crittaSemplice_A method. The string is first transformed from + * hexadecimal to ASCII, then decrypted with the same key with which + * it was encrypted. Obviously the output is half the length. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m character array to convert + * @param key encryption key + * @return encrypted character array + * @throws ExactException incorrect use */ + public static char[] decrittaSemplice_A(char[] m, final String key) + + throws ExactException { + + if (m == null | key == null) { + throw new ExactException( + "One or some given parameters are null."); + } + String chiave1 = key; + if (m.length % 2 != 0) { + throw new ExactException( + "The quantity of characters to decript is not an even number."); + } + while (chiave1.length() < m.length / 2) { + chiave1 += chiave1; + } + char[] z = new char[m.length / 2]; + char[] m1 = Mix.daEsadAChar(m); + String chiave2 = chiave1.substring(0, z.length); + char[] c = chiave2.toCharArray(); + for (int i = 0; i < z.length; i++) + z[i] = (char) (m1[i] ^ c[i]); + return z; + } + + /** + *

+ * Calculation of a 6-character array of the domain [A-Z0-9] + * starting from a long integer not greater than 36 raised to 6. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * + * @param m integer long + * @return character array of the domain [A-Z0-9 ] */ + public static char[] daLong6Char(final long m) { + long xm = m; + int q = 0; + long w = 0; + char[] n = new char[6]; + char[] c = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z' }; + for (int i = 5; i > -1; i--) { + w = (long) Math.pow(36, i); + q = (int) (xm / w); + n[i] = c[q]; + xm -= q * w; + } + return n; + } + + /** + *

+ * Calculation of a 3-character array of the domain [A-Z0-9] + * starting from a long integer not exceeding 36 raised to 3. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * + * @param m integer long + * @return character array of the domain [A-Z0-9 ] + * @since 2.0.0 */ + public static char[] daLong3Char(final long m) { + long xm = m; + int q = 0; + long w = 0; + char[] n = new char[3]; + char[] c = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z' }; + for (int i = 2; i > -1; i--) { + w = (long) Math.pow(36, i); + q = (int) (xm / w); + n[i] = c[q]; + xm -= q * w; + } + return n; + } + + /** + *

+ * Calculation of an array of 1 or 2 characters of the domain [A-Z] + * starting from an integer not greater than 701 (26 + 26 26 - 1). + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m number integer long + * @return domain character array [AZ] */ + public static char[] daLong2Char(final int m) { + int xm = m; + int q = 0; + long w = 0; + char[] n2 = new char[2]; + char[] n1 = new char[1]; + char[] c = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z' }; + if (xm < 26) { + n1[0] = c[xm]; + return n1; + } else { + xm -= 26; + for (int i = 1; i > -1; i--) { + w = (long) Math.pow(26, i); + q = (int) (xm / w); + n2[i] = c[q]; + xm -= q * w; + } + return n2; + } + } + + /** + *

+ * Calculation of an array of hexadecimal codes starting from an + * array of Unicode characters. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param m character array to convert + * @return lowercase hexadecimal character array */ + public static char[] fromCharToEsadUnicode(char[] m) { + int[] k = new int[m.length]; // I prepare an array of integers + // in + // help + // of the input array + char[] n = new char[m.length * 4]; // I prepare the output + // array, + // long + // the quadruple + char[] c = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' }; + for (int i = 0; i < m.length; i++) + k[i] = m[i]; // I transform the input array into integers + for (int i = 0; i < m.length; i++) { + n[i * 4] = c[k[i] / 4096]; + n[i * 4 + 1] = c[(k[i] % 4096) / 256]; + n[i * 4 + 2] = c[(k[i] % 256) / 16]; + n[i * 4 + 3] = c[(k[i] % 16)]; + } + return n; + } + + /** + *

+ * Work around the error that occurs when using the main main "args" + * argument. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param args the same array coming from the main. + * @return a null string or the first argument. + * @since 1.0.0 */ + public static String un_arg(String[] args) { + if (args.length == 0) { + return ""; + } + return args[0]; + } + + /** + *

+ * Simple routine to put two double angle quotes, before and after a + * string. + *

+ *

+ * creation date: 2020-03-10
+ * + * @param a the input string + * @return the string with the double angle quotes */ + final public static String dress_A(final String a) { + String s = Candies.CAAP + a + Candies.CACH; + return s; + } + + /** + *

+ * Simple routine to make sure that a path indication actually ends + * with slash or backslash. If not, add it. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * 10/04 08: added the trim + * + * @param y the path to check + * @return the path complete with slash or backslash */ + public static String dress_C(final String y) { + String s = y.trim(); + if (!s.endsWith("/") & !s.endsWith("\\")) + s += System.getProperty("file.separator"); + return s; + } + + /** + *

+ * Simple routine to make sure that a path indication actually ends + * with slash. If not, add it. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @param y the path to check + * @return the complete path of slash */ + public static String dress_CU(final String y) { + String s = y.trim(); + if (!s.endsWith("/") & !s.endsWith("\\")) + s += "/"; + return s; + } + + /** + *

+ * Simple routine to make sure that the indication of a path + * actually ends with slash or backslash, but with different + * criteria compared to vesti_CU. If not, add it. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * 10/04 08: added the trim + * + * @param y the path to be checked + * @return the path complete with slash or backslash */ + public static String dress_D(final String y) { + String s = y.trim(); + // if there is at least one backslash + if (s.indexOf(92) > -1 & !s.endsWith("\\")) { + s += "\\"; + // if there is at least one slash + } else if (s.indexOf(47) > -1 & !s.endsWith("/")) { + s += "/"; + } else if (!s.endsWith("/") & !s.endsWith("\\")) { + s += System.getProperty("file.separator"); + } + return s; + } + + /** + *

+ * Simple routine to delay code execution. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param thousandths duration of the delay in thousandths of a + * second */ + public static void ritardo0(final long thousandths) { + long i = System.currentTimeMillis(); + while (System.currentTimeMillis() < (i + thousandths)) { + } + ; + } + + /** + *

+ * Routine to count the occurrence of a certain character in a + * string. It is a faster method than transforming the whole string + * into many characters and then counting. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param s the string to be examined + * @param t the character to be examined search for + * @return how many times */ + public static int charQ(final String s, final char t) { + int i = 0, j = 0; + if (s == null) + return i; + int tn = t; + j = s.indexOf(tn, j); + while (j != -1) { + i++; + j = s.indexOf(tn, j + 1); + } + return i; + } + + /** + *

+ * Routine for finding the last occurrence of a given character in a + * string. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param s the string to be examined + * @param t the character to be search for + * @return how many times */ + public static int ultimaPosizione(final String s, final char t) { + int j = 0, jW = -1; + if (s == null) + return -1; + int tn = t; + j = s.indexOf(tn, j); + while (j != -1) { + jW = j; + j = s.indexOf(tn, j + 1); + } + return jW; + } + + /** + *

+ * Routine to extract the extension from a file name. Return null if + * there is no extension. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Modifications: 2020-04-09: replaced the last return from return + * null to return ""
+ * + * @param g the file name to be analyzed + * @return how many times */ + public static String estraiExtension(final String g) { + /* split according to the point character */ + String u[] = g.split("\\x2e"); + String e = null; + if (u.length == 1) { + return null; + } else { + e = u[u.length - 1].toLowerCase(); + } + /* if the extension contains neither slash nor backslash, it is + * OK */ + if (e.indexOf(47) == -1 & e.indexOf(92) == -1) { + return e; + } else { /* otherwise it is not an extension */ + return ""; + } + } + + /** + *

+ * Routine to find the last occurrence of a given string in a + * string. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param s the string to be examined + * @param t the string to be examined search for + * @return how many times */ + public static int ultimaPosizione(final String s, final String t) { + int j = 0, jW = -1; + if (s == null) + return -1; + j = s.indexOf(t, j); + while (j != -1) { + jW = j; + j = s.indexOf(t, j + 1); + } + return jW; + } + + /** + *

+ * Routine for counting the occurrence of a given substring in a + * string. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param tutto string to be examined + * @param parte substring from search for + * @return how many times */ + public static int stringheQ(final String tutto, + final String parte) { + int i = 0, j = 0; + if (tutto == null) + return i; + String p1 = parte; + int pL = parte.length(); + j = tutto.indexOf(p1, j); + while (j != -1) { + i++; + j = tutto.indexOf(p1, j + pL); + } + return i; + } + + /** + *

+ * Routine to verify that the content of a string is an integer, + * compatible with the int type. Warning, using Pattern.matches ("\\ + * d +", xxxxx) I would also verify the absence of the + or - sign. + * I don't need to. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 10/11 / 08: added trim on the input parameter 2020-04-09: null + * possibility provided + *

+ * + * @param s string to be verified + * @return true or false if the content is numeric or not + * @since 1.2.2 */ + public static boolean verificaIntero(final String s) { + int m; + try { + m = Integer.parseInt(s.trim()); + /* just to not have the hassle of the warning: the local + * variable is never read */ + if ((m + 1) == (m + 1)) { + m = 0; + } + return true; + } catch (NumberFormatException e) { + return false; + } catch (NullPointerException e) { + return false; + } + } + + /** + *

+ * Routine to verify that the content of a string is an integer, + * compatible with the long type. Warning, using Pattern.matches + * ("\\ d +", xxxxx) I would also verify the absence of the + or - + * sign. I don't need to. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 10/11 / 08: added the trim on the input parameter 2020-04-09: + * null possibility provided + *

+ * + * @param s string to be verified + * @return true or false if the content is numeric or not + * @since 1.2.2 */ + public static boolean verificaLong(final String s) { + long m; + try { + m = Long.parseLong(s.trim()); + /* just to not have the hassle of the warning: the local + * variable is never read */ + if ((m + 1) == (m + 1)) { + m = 0; + } + return true; + } catch (NumberFormatException e) { + return false; + } catch (NullPointerException e) { + return false; + } + } + + /** Routine to verify that the content of a string is an integer, + * compatible with the short type. + * + * @param s string to check + * @return true or false if the content is numeric or not + * @since 1.2.2 */ + public static boolean verificaShort(final String s) { + int m; + try { + m = Short.parseShort(s); + if ((m + 1) == (m + 1)) { + /* just to not have the hassle of the warning: the local + * variable is never read */ + m = 0; + } + return true; + } catch (NumberFormatException e) { + return false; + } + } + + /** + *

+ * Implementation of the accept method for the FilenameFilter + * interface. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return a new object FilenameFilter + * @param filter the pattern to be compared, to implement + * filtering */ + public static final FilenameFilter fileFilter(final String filter) { + final String s = filter; + return new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + String path = new File(name).getName(); + return Pattern.matches(s, path); + } + }; + } + + /** + *

+ * Implementation of the accept method for the FilenameFilter + * interface. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return a new FilenameFilter + * @since 1.2.1 object */ + public static final FilenameFilter filterDirectory() { + return new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return new File(dress_CU(dir.getPath()) + name) + .isDirectory(); + } + }; + } + + /** + *

+ * Implementation of the accept method for the FilenameFilter + * interface. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param filter filter for searching + * @return a new FilenameFilter object */ + public static final FilenameFilter filtroDirectory( + final String filter) { + final String s = filter; + return new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + File file = new File(dress_CU(dir.getPath()) + name); + String path = file.getName(); + return file.isDirectory() & Pattern.matches(s, path); + } + }; + } + + /** + *

+ * Convenience for checking the nullity of a string. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return true if the string is a null object or an empty string + * @param s the string to be checked */ + public static final boolean isNothing(final String s) { + return s == null || s.equals(""); + } + + /** + *

+ * If it is a color of those expected for CSS. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return true If the color to be checked is a color of those + * provided for the CSS + * @param s string to evaluate */ + public static final boolean isCssColor(final String s) { + String t = s.toLowerCase(); + int i = 0; + for (; i < Universal.cssColorE.length; i++) { + if (t.equals(Universal.cssColorE[i].toLowerCase())) + break; + } + return i < Universal.cssColorE.length; + } + + /** + *

+ * Compact a phrase (string) containing more than one blank between + * words in a phrase containing individual blanks. An alternative + * algorithm for obtaining an identical result is found in + * Strings.compatta_A (String).
+ * Ex: "___John__goes_to____school___"
+ * becomes: "John goes to school" + *

+ *

+ * Deprecated 2013- 08-29 because it is too slow, replaced with + * it.ramecera.salad.everyday.Strings.compatta_A. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 2020-04-09: added final to parameter a, and slightly modified the + * algorithm
+ * 2020-04-09: added trim
+ *

+ * + * @param a the string to be compacted + * @return the compacted string */ + public static String compactingSpaces_A(final String a) { + if (a == null) + return null; + int j; + String b = a.trim(); + /* algorithm: all look for a double blank, then glue the two + * substrings so that it becomes a single blank; cycle until + * there are no more */ + j = b.lastIndexOf(DOUBLEBLANK, b.length()); + while (j != -1) { + b = b.substring(0, j) + b.substring(j + 1); + j = b.lastIndexOf(DOUBLEBLANK, j - 1); + } + return b.trim(); + } + + /** Transform any empty string into a null string. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param s the string to be tested + * @return the resulting string + * @since 1.2.2 */ + public static String stringaNulla(final String s) { + if (s != null && s.equals("")) + return null; + else + return s; + } + + /** Transform any null string into an empty string. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s the string to be tested + * @return the resulting string + * @since 1.2.2 */ + public static String nonNullo(final String s) { + if (s == null) + return ""; + else + return s; + } + + /** Turn any null string into a zero. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 2020-04-09: changed the time with the or double + *

+ * + * @param s the string to be tested + * @return the resulting string + * @since 1.3.0 */ + public static int nonNulloInt(final String s) { + if (s == null || !verificaIntero(s)) + return 0; + else + return Integer.parseInt(s); + } + + /** Cut the first n characters of a string, and if the string is + * shorter this method does nothing: it just returns the string. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s the string to be cut + * @param i how many characters you want to cut + * @return the resulting string */ + public static String taglia(final String s, final int i) { + if (s == null) + return ""; + if (s.length() > i) + return s.substring(0, i); + else + return s; + } + + /** + *

+ * Delete n characters at the bottom of a string, if they coincide + * with the string supplied to the second parameter. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param s the string to be shortened + * @param tail the string to be compared with the tail of the string + * s + * @return the resulting string + * @since 1.3.0, SVutensiliJ4_1.3.0 */ + public static String tagliaLaCoda(final String s, + final String tail) { + if (s != null && s.endsWith(tail)) + return s.substring(0, s.length() - tail.length()); + else + return s; + } + + /** Latin numeral adverbs */ + // + // public static String [] adverbNumerale = { + // "", "semel", "bis", "ter", "quater", "quinquies", "sexies", + // "F" + // "octies", "novies", + // "decies", "undecies", "duodecies", "ter decies", "quater decies", + // "quindecies", "sedecies", + // "septies decies", "octies decies", "novies decies", + // "vicies", "vicies semel", "vicies bis", "vicies ter", + // "vicies quater", + // "vicies quinquies", + // "vicies sexies", "vicies septies", "duodetricies", "undetricies", + // "tricies", "tricies semel", "tricies bis", "tricies ter", + // "tricies quater", + // "tricies quinquies", "tricies sexies", "tricies septies", + // "Duodequadragies" + // "undequadragies", "quadragies", "quadragies semel", "quadragies + // BIS", + // "quadragies ter", + // "quadragies quater", "quadragies quinquies", "quadragies sexies", + // "quadragies septies", + // "duodequinquagies", "undequinquagies" + // }; + // they are different: 13, 14, 16, 18, 19 + public static String[] avverbioNumerale = { "", "semel", "bis", + "ter", "quater", "quinquies", "sexies", "septies", "octies", + "novies", "decies", "undecies", "duodecies", "terdecies", + "quaterdecies", "quindecies", "sex decies", + "septies decies", "duodevicies", "undevicies", "vicies", + "vicies semel", "vicies bis", "vicies ter", "vicies quater", + "vicies quinquies", "vicies sexies", "vicies septies", + "duodetricies", "undetricies", "tricies", "tricies semel", + "tricies bis", "tricies ter", "tricies quater", + "tricies quinquies", "tricies sexies", "tricies septies", + "duodequadragies", "undequadragies", "quadragies", + "quadragies semel", "quadragies bis", "quadragies ter", + "quadragies quater", "quadragies quinquies", + "quadragies sexies", "quadragies septies", + "duodequinquagies", "undequinquagies" }; + + /** + *

+ * Cleans a phrase (string) clean from the characters TAB, CR, LF, + * FF, VT and compacts everything. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * 2020-04-09: the replacement must not be with a null string but + * with a space character
+ *

+ * + * @param a the string to be compacted + * @return the compacted string + * @since 1.4.0, toolsJ4_2.0.0 */ + @Deprecated + public static String compattaSpazi_B(final String a) { + if (a == null) + return null; + String t = a.replaceAll("[\\t\\n\\x0B\\f\\r]", " "); // 2020-04-09 + return compactingSpaces_A(t); + } + + /** + *

+ * Closes multiple statements and related connection. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param statement the array of statements of the connection to the + * DB + * @param connection the connection to the DB + * @since salad_2.0.0 */ + public static void collapse(Statement[] statement, + Connection connection) { + try { + for (int i = 0; i < statement.length; i++) { + if (statement[i] != null) + statement[i].close(); + } + } catch (SQLException e0) { + } + try { + if (connection != null) + connection.close(); + } catch (SQLException e1) { + } + } + + /** Closes multiple statements and related connection. + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param statement the statement of the connection to the DB + * @param connection the connection to the DB + * @since salad_2.0.0 */ + public static void collapse(Statement statement, + Connection connection) { + try { + if (statement != null) + statement.close(); + if (connection != null) + connection.close(); + } catch (SQLException e1) { + } + } + + /** + *

+ * Externation of a message, exposes a sign and writes it on the + * sysout. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * 10/01 / 11: facilitation of braces introduced instead of + * corporals
+ *

+ * + * @param m the message */ + public static void disclosing(final String m) { + /* x7d is the closing brace */ + String m0 = m.replaceAll("\\x7d", "»"); + /* x7b is the opening brace */ + String m1 = m0.replaceAll("\\x7b", "«"); + System.out.println("Placard: " + m1); + new Placard(null, m1, "Warning"); + } + + /** + *

+ * Routine for externalizing an error. There is no extension. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Changes: + *

+ * + * @param m my message + * @param t message title + * @param logger obvious */ + static public void discloseError(final String m, final String t, + Logger logger) { + /* x7d is the closing brace */ + String m0 = m.replaceAll("\\x7d", "»"); + /* x7b is the opening brace */ + String m1 = m0.replaceAll("\\x7b", "«"); + new Placard(null, m1, t); + logger.error(t + ": " + m1); + } + + /** + *

+ * Routine for externalizing an error. There is no extension. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Changes: + *

+ * + * @param m my message + * @param t message title + * @param logger obvious */ + static public void discloseInfo(final String m, final String t, + Logger logger) { + /* x7d is the closing brace */ + String m0 = m.replaceAll("\\x7d", "»"); + /* x7b is the opening brace */ + String m1 = m0.replaceAll("\\x7b", "«"); + new Placard(null, m1, t); + logger.info(t + ": " + m1); + } + + /** + *

+ * Routine for the externalization of a warning. There is no + * extension. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Changes: + *

+ * + * @param m my message + * @param t message title + * @param logger obvious */ + static public void discloseWarning(final String m, final String t, + Logger logger) { + /* x7d is the closing brace */ + String m0 = m.replaceAll("\\x7d", "»"); + /* x7b is the opening brace */ + String m1 = m0.replaceAll("\\x7b", "«"); + new Placard(null, m1, t); + logger.warn(t + ": " + m1); + } + + /** + *

+ * Method to switch from a software version in the form 3, 4.2, or + * 2.0.11 to the form 3000000, 4002000, 2000011. + *

+ *

+ * Creation date: 2020-04-09
+ * data last modification: 2020-04-09 + *

+ * + * @param x the string indicating the version + * @param message the message to be displayed in case of + * irregularity + * @param code error code + * @return the number representing the absolute version + * @throws ExactException ordinary exception */ + public static int absoluteVersion(final String x, + final String message, final int code) + + throws ExactException { + + int sostanza = 0; + ExactException ee = new ExactException(); + /* if a dash is present, only what is left of the dash is taken + * into account; if it is not present, what is there is worth; + * the possible presence of an alphabetical string in the queue + * is not considered */ + String g[] = x.split("\\x2d"); + /* is divided into substrings by adopting the dot as a + * separator */ + String h[] = g[0].split("\\x2e"); + /* the possible presence of an alphabetical string in the queue + * is not considered */ + if (h.length == 1 && h[0].matches("\\d") || (h.length == 2 + && h[0].matches("\\d+") && h[1].matches( + "\\p{Alpha}+"))) { + sostanza = Integer.valueOf(h[0]) * 1000000; + } else if (h.length == 2 && h[0].matches("\\d+") && h[1] + .matches("\\d+")) { + sostanza = Integer.valueOf(h[0]) * 1000000 + Integer + .valueOf(h[1]) * 1000; + } else if (h.length == 3 && h[0].matches("\\d+") && h[1] + .matches("\\d+") && h[2].matches("\\p{Upper}+")) { + sostanza = Integer.valueOf(h[0]) * 1000000 + Integer + .valueOf(h[1]) * 1000; + } else if (h.length == 3 && h[0].matches("\\d+") && h[1] + .matches("\\d+") && h[2].matches("\\d+")) { + sostanza = Integer.valueOf(h[0]) * 1000000 + Integer + .valueOf(h[1]) * 1000 + Integer.valueOf(h[2]); + } else if (h.length == 4 && h[0].matches("\\d+") && h[1] + .matches("\\d+") && h[2].matches("\\d+") && h[3] + .matches("\\p{Alpha}+")) { + sostanza = Integer.valueOf(h[0]) * 1000000 + Integer + .valueOf(h[1]) * 1000 + Integer.valueOf(h[2]); + } else { + ee.code = code; + ee.datum = message; + throw ee; + } + return sostanza; + } + + /** + *

+ * Creation date: 2020-05-29
+ * Last updated: 2020-05-29
+ * Class: Mix + * + * @author M. Maglioni + *

+ * Description: it trasnform the format of a version from + * string n.n.n to an integer, base is 1000. Example: 3.5.1 + * becomes 3005001. + *

+ * @param v the version formatted n.n.n + * @return the version as an integer */ + public static Integer versionFormat_A(final String v) { + String[] x = v.split("\\x2e"); + int xd = x.length; + switch (xd) { + case 1: + if (x[0].matches("\\d{1,3}")) { + return Integer.valueOf(x[0]) * 1000000; + } else { + return null; + } + case 2: + if (x[0].matches("\\d{1,3}") & x[1].matches("\\d{1,3}")) { + return Integer.valueOf(x[0]) * 1000000 + Integer + .valueOf(x[1]) * 1000; + } else { + return null; + } + case 3: + if (x[0].matches("\\d{1,3}") & x[1].matches("\\d{1,3}") + & x[2].matches("\\d{1,3}")) { + return Integer.valueOf(x[0]) * 1000000 + Integer + .valueOf(x[1]) * 1000 + Integer.valueOf(x[2]); + } else { + return null; + } + default: + return null; + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Point2D.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Point2D.java new file mode 100644 index 0000000..ff1b396 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Point2D.java @@ -0,0 +1,55 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +/** + *

+ * Bean container for a 2-dimensional point. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-06-13
+ * Last updated: 2020-06-13 + *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni + * @since 1.2.3 */ +public class Point2D { + + /** y coordinate */ + public int row; + /** x coordinate */ + public int column; + + /** default constructor */ + public Point2D() { + } + + /** + *

+ * Useful constructor + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param y the row + * @param x the column */ + public Point2D(int y, int x) { + row = y; + column = x; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/StartingOperations.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/StartingOperations.java new file mode 100644 index 0000000..0c64125 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/StartingOperations.java @@ -0,0 +1,301 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// + +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintStream; +import java.util.InvalidPropertiesFormatException; +import java.util.Properties; + +import it.ramecera.salad.graphic.Placard; + +/** + *

+ * General utility class for managing properties files. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 2020-04-09: abandonment of SWT graphics in favor of Swing
+ *

+ * + * @author M. Maglioni */ +public class StartingOperations { + + /** + *

+ * Reading the properties file, this is an XML file. Since the + * routine already includes several error messages, in case of catch + * you will have to simply return, without displaying + * anything else; if anything, you can log the event. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-19-02
+ *

+ *

+ * Modifications:
+ * 2020-04-09: replaced SWT type message-box with Swing type + * Placard, ver. 2.0.0
+ * 2020-04-09: improvement of error messages, ver. 2.0.1
+ * 2020-04-09: added graphic parameter, it must not issue message + * boxes when the graphic is not foreseen, for example because it is + * in non-graphic Unix, ver. 2.1.0
+ *

+ * + * @param propertiesF the name of the file, positioned at the root + * of the project, of the XML type, containing the true + * graphic + * @param graphicOption true if it is possible to emit graphic + * elements; false if the message simply goes to System.out + * @return the properties extracted from the file, in object of the + * class Properties + * @throws ExactException standard exception */ + public static Properties myPropertiesXML(String propertiesF, + boolean graphicOption) + + throws ExactException { + + Properties p = new Properties(); + String a; + try { + p.loadFromXML(new FileInputStream(propertiesF)); + return p; + } catch (InvalidPropertiesFormatException e) { + a = "The file " + Mix.dress_A(propertiesF) + + " is incorrect."; + if (graphicOption) { + System.out.println(a); + new Placard(null, a); + } else { + System.out.println(a); + } + throw new ExactException(a, 100104, "StartingOperations", + ""); + } catch (FileNotFoundException e) { + if (propertiesF.equals("")) + a = "It's not indicated any properties file."; + else + a = "The file " + Mix.dress_A(propertiesF) + + " is not present."; + if (graphicOption) { + System.out.println(a); + new Placard(null, a); + } else { + System.out.println(a); + } + throw new ExactException(a, 100105, "StartingOperations", + ""); + } catch (IOException e) { + a = "The file " + Mix.dress_A(propertiesF) + + " isn't readable."; + if (graphicOption) { + System.out.println(a); + new Placard(null, a); + } else { + System.out.println(a); + } + throw new ExactException(a, 100106, "StartingOperations", + ""); + } + } + + /** + *

+ * Read the properties file. Since the routine already includes + * several error messages, in case of catch you will have to simply + * return, without displaying anything else; if anything, you + * can log the event. + *

+ *

+ * Creation date: 2020-10-02
+ * Last updated: 2020-10-02
+ *

+ *

+ * Historys:
+ *

+ * + * @param propertiesF the name of the file, positioned at the root + * of the project + * @param graphicOption true if it is possible to emit graphic + * elements; false if the message simply goes to System.out + * @return the properties extracted from the file, in object of the + * class Properties + * @throws ExactException standard exception */ + public static Properties myProperties(String propertiesF, + boolean graphicOption) + + throws ExactException { + + if (propertiesF == null) { + throw new ExactException("Instead of indicating a " + + "properties file, there is a null.", 100107, + "StartingOperations", "myProperties"); + } + Properties p = new Properties(); + String a = ""; + try { + p.load(new FileInputStream(propertiesF)); + return p; + } catch (InvalidPropertiesFormatException e) { + a = "The file " + Mix.dress_A(propertiesF) + + " is incorrect."; + if (graphicOption) { + System.out.println(a); + new Placard(null, a); + } else { + System.out.println(a); + } + throw new ExactException(a, 100108, "StartingOperations", + ""); + } catch (FileNotFoundException e) { + if (propertiesF.equals("")) + a = "It's not indicated any properties file."; + else + a = "The file " + Mix.dress_A(propertiesF) + + " is not present."; + if (graphicOption) { + System.out.println(a); + new Placard(null, a); + } else { + System.out.println(a); + } + throw new ExactException(a, 100109, "StartingOperations", + ""); + } catch (IOException e) { + a = "The file " + Mix.dress_A(propertiesF) + + " isn't readable."; + if (graphicOption) { + System.out.println(a); + new Placard(null, a); + } else { + System.out.println(a); + } + throw new ExactException(a, 100110, "StartingOperations", + ""); + } + } + + /** + *

+ * Writing the properties file, this is an XML file. + *

+ *

+ * Creation date: 2020-04-09
+ * last modification: 2020-04-09 + *

+ *

+ * Modifications:
+ * 2020-04-09 : replaced SWT message-box with Swing type Placard, + * created version 2.0.0 + *

+ * + * @param propertiesF the name of the file, positioned at the root + * of the project, of XML type, containing the properties + * @param p the properties object to write to disk + * @throws Exception The file cannot be written. */ + public static void yourPropertiesXML(String propertiesF, + Properties p) + + throws Exception { + + Exception err = new Exception("Uncorrect"); + try { + PrintStream printStream = new PrintStream(propertiesF); + p.storeToXML(printStream, "Written on " + HandleDate + .currentDate_C() + Candies.SPACE + HandleDate + .currentTime_B(), "UTF-8"); + printStream.close(); + } catch (IOException e) { + new Placard(null, "The file " + Mix.dress_A(propertiesF) + + " isn't writable."); + throw err; + } catch (NullPointerException e) { + new Placard(null, "Setting error in file " + Mix.dress_A( + propertiesF) + "."); + throw err; + } + } + + /** + *

+ * Reading and checking the existence of a property. + *

+ *

+ * Creation date: 2020-04-09
+ * last modification: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param p the object that contains all the properties + * @param label the label of the property + * @return the data relating to that label + * @throws ExactException the label is not present, therefore the + * data is null */ + public static String whetherPresent(Properties p, + final String label) + + throws ExactException { + + String v = p.getProperty(label); + if (v == null) + throw new ExactException("The property " + Mix.dress_A( + label) + " is missing or null.", 100111, + "StartingOperations", ""); + return v; + } + + /** + *

+ * Reading and checking the existence of a Boolean property. + *

+ *

+ * Creation date: 2020-04-09
+ * last modification: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @since J6_1 + * @param p the object that contains all the properties + * @param label the label of the property + * @return the data relating to that label + * @throws ExactException the label is not present, therefore the + * data is null */ + public static boolean propertyPresenteBoolean(Properties p, + final String label) + + throws ExactException { + + String v = p.getProperty(label).trim(); + if (v == null) + throw new ExactException("The property " + Mix.dress_A( + label) + " is missing or null.", 100112, + "StartingOperations", ""); + if (v.equalsIgnoreCase("false")) { + return false; + } else if (v.equalsIgnoreCase("true")) { + return true; + } else { + throw new ExactException("The property «" + Mix.dress_A( + label) + " is neither true nor false.", 100113, + "StartingOperations", ""); + } + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/StringInt.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/StringInt.java new file mode 100644 index 0000000..02cf3af --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/StringInt.java @@ -0,0 +1,54 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +/** + *

+ * Bean container for a string and an integer. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni */ +public class StringInt { + + /** a string */ + public String s; + /** a number */ + public int i; + + /** default constructor */ + public StringInt() { + } + + /** + *

+ * Standard constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the string + * @param i the integer */ + public StringInt(final String s, final int i) { + this.s = s; + this.i = i; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Stringa2Int.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Stringa2Int.java new file mode 100644 index 0000000..0d52656 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Stringa2Int.java @@ -0,0 +1,54 @@ +package it.ramecera.salad.everyday; + +/** + *

+ * Bean contenitore per una stringa e 2 interi. + *

+ *

+ * azienda: Ramecera
+ * data creazione: 2014-01-28
+ * data ultima modifica: 2014-01-28 + *

+ *

+ * Modifiche:
+ * + *

+ * + * @author M. Maglioni + * @since 6.1 + */ +public class Stringa2Int { + + /** la stringa */ + public String s; + /** 1° numero intero */ + public int i0; + /** 2° numero intero */ + public int i1; + + /** costruttore di default */ + public Stringa2Int() { + } + + /** + *

+ * Costruttore standard. + *

+ *

+ * data creazione: 2014-01-28
+ * data ultima modifica: 2014-01-28 + *

+ *

+ * Modifiche:
+ *

+ * + * @param s la stringa + * @param i0 il primo intero + * @param i1 il secondo intero + */ + public Stringa2Int(final String s, final int i0, final int i1) { + this.s = s; + this.i0 = i0; + this.i1 = i1; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Strings.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Strings.java new file mode 100644 index 0000000..0612e39 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Strings.java @@ -0,0 +1,643 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import it.ramecera.salad.file.ReadMyFile; +import it.ramecera.salad.graphic.Dynamics; + +/** + *

+ * Static methods of various utility. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni + * @since 1.2.3 */ + +public class Strings { + // + /** XML and HTML entities */ + // public static final String[] tokenE = { "quot", "amp", "apos", + // "lt", + // "gt", + // "nbsp", "iexcl", "cent", "pound", "curren", "yen", "brvbar", + // "sect", "uml", "copy", "ordf", "laquo", "not", "shy", "reg", + // "macr", "deg", "plusmn", "sup2", "sup3", "acute", "micro", + // "para", + // "middot", "cedil", "sup1", "ordm", "raquo", "frac14", "frac12", + // "frac34", "iquest", "Agrave", "Aacute", "Acirc", "Atilde", + // "Auml", + // "Aring", "AElig", "Ccedil", "Egrave", "Eacute", "Ecirc", "Euml", + // "Igrave", "Iacute", "Icirc", "Iuml", "ETH", "Ntilde", "Ograve", + // "Oacute", "Ocirc", "Otilde", "Ouml", "times", "Oslash", "Ugrave", + // "Uacute", "Ucirc", "Uuml", "Yacute", "THORN", "szlig", "agrave", + // "aacute", "acirc", "atilde", "auml", "aring", "aelig", "ccedil", + // "egrave", "eacute", "ecirc", "euml", "igrave", "iacute", "icirc", + // "iuml", "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde", + // "ouml", "divide", "oslash", "ugrave", "uacute", "ucirc", "uuml", + // "yacute", "thorn", "yuml", "OElig", "oelig", "Scaron", "scaron", + // "Yuml", "fnof", "circ", "tilde", "Alpha", "Beta", "Gamma", + // "Delta", + // "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", + // "Mu", + // "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", + // "Phi", "Chi", "Psi", "Omega", "alpha", "beta", "gamma", "delta", + // "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", + // "mu", + // "nu", "xi", "omicron", "pi", "rho", "sigmaf", "sigma", "tau", + // "upsilon", "phi", "chi", "psi", "omega", "thetasym", "upsih", + // "piv", "ensp", "emsp", "thinsp", "zwnj", "zwj", "lrm", "rlm", + // "ndash", "mdash", "lsquo", "rsquo", "sbquo", "ldquo", "rdquo", + // "bdquo", "dagger", "Dagger", "bull", "hellip", "permil", "prime", + // "Prime", "lsaquo", "rsaquo", "oline", "frasl", "euro", "image", + // "weierp", "real", "trade", "alefsym", "larr", "uarr", "rarr", + // "darr", "harr", "crarr", "lArr", "uArr", "rArr", "dArr", "hArr", + // "forall", "part", "exist", "empty", "nabla", "isin", "notin", + // "ni", + // "prod", "sum", "minus", "lowast", "radic", "prop", "infin", + // "ang", + // "and", "or", "cap", "cup", "int", "there4", "sim", "cong", + // "asymp", + // "ne", "equiv", "le", "ge", "sub", "sup", "nsub", "sube", "supe", + // "oplus", "otimes", "perp", "sdot", "vellip", "lceil", "rceil", + // "lfloor", "rfloor", "lang", "rang", "loz", "spades", "clubs", + // "hearts", "diams" }; + // + // public static final String[] tradE = { "quot", "amp", "apos", + // "lt", + // "gt", + // "nbsp", "iexcl", "cent", "pound", "curren", "yen", "brvbar", + // "sect", "uml", "copy", "ordf", "laquo", "not", "shy", "reg", + // "macr", "deg", "plusmn", "sup2", "sup3", "acute", "micro", + // "para", + // "middot", "cedil", "sup1", "ordm", "raquo", "frac14", "frac12", + // "frac34", "iquest", "Agrave", "Aacute", "Acirc", "Atilde", + // "Auml", + // "Aring", "AElig", "Ccedil", "Egrave", "Eacute", "Ecirc", "Euml", + // "Igrave", "Iacute", "Icirc", "Iuml", "ETH", "Ntilde", "Ograve", + // "Oacute", "Ocirc", "Otilde", "Ouml", "times", "Oslash", "Ugrave", + // "Uacute", "Ucirc", "Uuml", "Yacute", "THORN", "szlig", "agrave", + // "aacute", "acirc", "atilde", "auml", "aring", "aelig", "ccedil", + // "è", "é", "ecirc", "euml", "igrave", "iacute", "icirc", "iuml", + // "eth", "ntilde", "ograve", "oacute", "ocirc", "otilde", "ouml", + // "divide", "oslash", "ugrave", "uacute", "ucirc", "uuml", + // "yacute", + // "thorn", "yuml", "OElig", "oelig", "Scaron", "scaron", "Yuml", + // "fnof", "circ", "tilde", "Alpha", "Beta", "Gamma", "Delta", + // "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda", + // "Mu", + // "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", + // "Phi", "Chi", "Psi", "Omega", "alpha", "beta", "gamma", "delta", + // "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda", + // "mu", + // "nu", "xi", "omicron", "pi", "rho", "sigmaf", "sigma", "tau", + // "upsilon", "phi", "chi", "psi", "omega", "thetasym", "upsih", + // "piv", "ensp", "emsp", "thinsp", "zwnj", "zwj", "lrm", "rlm", + // "ndash", "mdash", "lsquo", "rsquo", "sbquo", "ldquo", "rdquo", + // "bdquo", "dagger", "Dagger", "bull", "hellip", "permil", "prime", + // "Prime", "lsaquo", "rsaquo", "oline", "frasl", "euro", "image", + // "weierp", "real", "trade", "alefsym", "larr", "uarr", "rarr", + // "darr", "harr", "crarr", "lArr", "uArr", "rArr", "dArr", "hArr", + // "forall", "part", "exist", "empty", "nabla", "isin", "notin", + // "ni", + // "prod", "sum", "minus", "lowast", "radic", "prop", "infin", + // "ang", + // "and", "or", "cap", "cup", "int", "there4", "sim", "cong", + // "asymp", + // "ne", "equiv", "le", "ge", "sub", "sup", "nsub", "sube", "supe", + // "oplus", "otimes", "perp", "sdot", "vellip", "lceil", "rceil", + // "lfloor", "rfloor", "lang", "rang", "loz", "spades", "clubs", + // "hearts", "diams" }; + + /** entities to convert */ + public static final String[] tokenE = { "quot", "amp", "apos", "lt", + "gt", "agrave", "egrave", "eacute", "igrave", "ograve", + "ugrave", "rsquo", "ndash" }; + + /** converted entities */ + public static final String[] tradE = { "\"", "&", "'", "<", ">", + "à", "è", "é", "ì", "ò", "ù", "'", "-" }; + + /** + *

+ * Replaces the entities with what is indicated in the second table. + * array + *

+ *

+ * version: 1.0.0
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the sentence to be treated + * @return the array of words */ + public static String sostituisciEntities(final String s) { + if (s == null) { + return null; + } + String t = s; + String p = null; + String q = null; + int j = t.indexOf(38); + while (j > -1) { + p = t.substring(j + 1); + q = t.substring(0, j); + int l = 0; + for (; l < tokenE.length; l++) { + if (p.startsWith(tokenE[l] + ";")) { + break; + } + } + if (l < tokenE.length) { + t = q + tradE[l] + p.substring(tokenE[l].length() + 1); + } + j = t.indexOf(38, j + 1); + } + return t; + } + + /** + *

+ * Starting from a sentence, it produces the detached words and + * packed in an array. + *

+ *

+ * version: 1.0.0
+ * Creation date: 2020-04-09
+ * last modified date : 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the sentence to be treated + * @return the array of words */ + public static String[] parole_A(final String s) { + String t = compact_A(s); + return t.split(Candies.SPACE); + } + + /** + *

+ * Starting from a sentence, compact the multiple spaces between + * words by replacing them with a single space; it also eliminates + * head and tail spaces. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the sentence to be treated + * @return the compacted sentence */ + public static String compact_A(final String s) { + if (s == null) + return null; + String t = s.replaceAll("[\\t\\n\\x0B\\f\\r]", Candies.SPACE); // 2020-04-09 + t = t.trim(); + while (t.indexOf(Mix.DOUBLEBLANK) > -1) + t = t.replaceAll(Mix.DOUBLEBLANK, Candies.SPACE); + return t; + } + + /** + *

+ * Starting from a sentence, compact the multiple spaces between + * words by replacing them with a single space; it also eliminates + * head and tail spaces. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the sentence to be treated + * @return the compacted sentence */ + public static String compatta_B(final String s) { + if (s == null) + return null; + String t = s.replaceAll("[\\t\\n\\x0B\\f\\r]", Candies.SPACE); // 2020-04-09 + t = t.trim(); + while (t.indexOf(Mix.DOUBLEBLANK) > -1) + t = t.replaceAll(Mix.DOUBLEBLANK, Candies.SPACE); + /* refinement for java sources:). it becomes ). */ + t = t.replaceAll("\\x29\\x20\\x2e", ")."); + return t; + } + + /** + *

+ * Search for a string within a list-array of strings. If it finds + * it, it gives the row-column coordinates; if it does not find it, + * it gives coordinates -1 and -1. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param z the array list to search for + * @param s the string to search for + * @return the coordinates of the found string, or the pair of + * values ​​(-1, -1) */ + public static Point2D cercaStringa_A(List z, + final String s) { + + int zQ = z.size(); + int j = 0; + String riga = null; + for (; j < zQ; j++) { + riga = z.get(j); + if (riga.indexOf(s) > -1) + break; + } + if (j == zQ) + return new Point2D(-1, -1); + else + return new Point2D(j, z.get(j).indexOf(s)); + } + + /** + *

+ * Search for two ordered strings within an array list of strings. + * If it finds them, it gives the row-column coordinates of the + * first string; if it does not find it, it gives coordinates -1 and + * -1. Variant of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param z the array list to search for + * @param s0 the 1st string to search + * @param s1 the 2nd string to search + * @return the coordinates of the string found, or the pair of + * values ​​(-1, -1) */ + public static Point2D cercaStringa_A(List z, + final String s0, final String s1) { + + int zQ = z.size(); + int j = 0; + String riga = null; + for (; j < zQ; j++) { + riga = z.get(j); + if (riga.indexOf(s0) < riga.indexOf(s1) & riga.indexOf( + s0) > -1) + break; + } + if (j == zQ) + return new Point2D(-1, -1); + else + return new Point2D(j, z.get(j).indexOf(s0)); + } + + /** + *

+ * Searches for three strings sorted within a list-array of strings. + * If it finds them, it gives the row-column coordinates of the + * first string; if it does not find it, it gives coordinates -1 and + * -1. Variant of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param z the array list to search for + * @param s0 the 1st string to search + * @param s1 the 2nd string to search + * @param s2 the 3rd string to search + * @return the coordinates of the found string, or the pair of + * values (-1, -1) */ + public static Point2D cercaStringa_A(List z, + final String s0, final String s1, final String s2) { + + int zQ = z.size(); + int j = 0; + String riga = null; + for (; j < zQ; j++) { + riga = z.get(j); + if (riga.indexOf(s0) < riga.indexOf(s1) & riga.indexOf( + s1) < riga.indexOf(s2) & riga.indexOf(s0) > -1) + break; + } + if (j == zQ) + return new Point2D(-1, -1); + else + return new Point2D(j, z.get(j).indexOf(s0)); + } + + /** + *

+ * Searches for a specific occurrence of a string within an array + * list of strings. If it finds it, it gives the row-column + * coordinates; if it does not find it, it gives coordinates -1 and + * -1. Variant of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param z the array list to search for + * @param s the string to search for + * @param occo occurrence of the string to search for + * @return the coordinates of the found string, or the pair of + * values ​​(-1, -1) */ + public static Point2D cercaStringa_A(List z, final String s, + final int occo) { + + int zQ = z.size(); + int j = 0; + int k = 0; + String riga = null; + for (; j < zQ; j++) { + riga = z.get(j); + if (riga.indexOf(s) > -1) + k++; + if (k == occo) + break; + } + if (j == zQ) + return new Point2D(-1, -1); + else + return new Point2D(j, z.get(j).indexOf(s)); + } + + /** + *

+ * Extracts tokens from a line of CSV files. If the line ends with + * the delimiting character, the delimiting character is not taken + * into account. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param t the line to be processed + * @param pv the separation character, usually; + * @param v2 the delimiting character, usually " + * @return the resulting string array */ + public static String[] gettoni_A(final String t, final String pv, + final String v2) { + if (t == null | pv.length() != 1 | v2.length() != 1) { + return null; + } + String[] s = t.split(pv); + for (int j = 0; j < s.length; j++) { + /* I have to treat each token (hypothesis that it is + * quotation marks): 1) I trim it, 2) I remove the first and + * last character quotation marks, 3) I replace the double + * character quotation marks with the single character */ + s[j] = s[j].trim(); + if (s[j].length() > 1 && s[j].startsWith(v2) && s[j] + .endsWith(v2)) { + s[j] = s[j].substring(1, s[j].length() - 1); + s[j] = s[j].replaceAll(v2 + "{2}", v2); + } + } + return s; + } + + /** + *

+ * Extracts the tokens from a line of CSV files, but (assuming that + * the characters are the semicolon and the double quotation mark) + * it takes into account the possibility that inside a token + * delimited by quotes there is a semicolon, which therefore should + * not be considered a delimiter. If a line ends with the delimiting + * character, the delimiting character is not taken into account. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param t the line to be processed + * @param pv the separation character, usually; + * @param v2 the delimitation character, usually " + * @return the resulting string array + * @throws ExactException standard exception */ + public static String[] tokens_B(final String t, final String pv, + final String v2) + + throws ExactException { + + if (t == null || t.length() == 0) { + throw new ExactException( + "The line to analyze is null or empty.", 101500, + "Strings", "gettoni_B"); + } else if (pv == null || pv.length() != 1) { + throw new ExactException("The separation character" + + " is null, empty or it is one.", 101501, + "Strings", "gettoni_B"); + } else if (v2 == null || v2.length() != 1) { + throw new ExactException("The delimitation character" + + " is null, empty or it is one.", 101502, + "Strings", "gettoni_B"); + } else if (v2.equals(pv)) { + throw new ExactException("The delimitation character" + + " must be different from the separation one.", + 101502, "Strings", "tokens_B"); + } + /* now I find a string that is certainly absent from the line to + * be examined, and that is suitable in reference to the + * separation and delimitation characters; I only use digits */ + int k = 0; + String w = ""; + String w1 = null; + for (; k < Integer.MAX_VALUE; k++) { + w1 = w + k; + if (t.indexOf(w1) == -1 & w1.indexOf(v2) == -1 & w1.indexOf( + pv) == -1) { + break; + } + } + /* the string w1 is used in place of the semicolons found inside + * strings marked with quotes. A restore operation follows */ + /* with this change I take into account that the split operation + * does not take into account a possible separation character + * that is exactly at the bottom of the line; this would be a + * mistake when I go to calculate the tokens quantities */ + String t0 = t + " "; + String[] b = t0.split(v2); + /* first check that the double quotes are in even quantities */ + int bL = b.length; + if (bL % 2 == 0) { + throw new ExactException( + "The quantity of the delimitation characters" + + " is an odd number, it is incorrect: " + + t, 101503, "Strings", "gettoni_B"); + } + String t1 = ""; + for (int i = 0; i < b.length; i++) { + if (i % 2 == 1 & b[i].indexOf(pv) > -1) { + b[i] = b[i].replaceAll(pv, w1); + } + t1 += b[i] + v2; + } + t1 = t1.substring(0, t1.length() - v2.length()); + String[] s = t1.split(pv); + for (int j = 0; j < s.length; j++) { + /* I have to treat each token (hypothesis that it is + * quotation marks): 1) I trim it, 2) I remove the first and + * last character quotation marks, 3) I replace the double + * character quotation marks with the single character */ + s[j] = s[j].trim(); + if (s[j].length() > 1 && s[j].startsWith(v2) && s[j] + .endsWith(v2)) { + s[j] = s[j].substring(1, s[j].length() - 1); + s[j] = s[j].replaceAll(v2 + "{2}", v2); + s[j] = s[j].replaceAll(w1, pv); // restoration + } + } + return s; + } + + /** + *

+ * Extracts the tokens from a line of CSV files, but (assuming that + * the characters are the semicolon and the double quotation mark) + * it takes into account the possibility that inside a token + * delimited by quotes there must be a semicolon, which therefore + * should not be considered a delimiter + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + * + * @param g the file input + * @param pv the separation character, usually; + * @param v2 the delimitation character, usually " + * @param din the progress bar with its neighboring labels + * @return the resulting string array + * @throws ExactException standard exception + * @throws IOException standard exception + * @throws FileNotFoundException standard exception */ + public static List> tokens_C(final String g, + final String pv, final String v2, Dynamics din) + + throws ExactException, FileNotFoundException, IOException { + + if (g == null || g.length() == 0) { + throw new ExactException("The given path is null or empty.", + 101504, "Strings", "tokens_C"); + } + List s = ReadMyFile.zebra_B(g); + List> tE = new ArrayList>(); + /* cycle on each row */ + String[] q = null; + List tokenE = null; + din.head.setText("0"); + din.head.paintImmediately(din.access.sinistra); + din.pb.setMinimum(0); + din.pb.setMaximum(s.size()); + for (int i = 0; i < s.size(); i++) { + din.head.setText(String.valueOf(i)); + din.head.paintImmediately(din.access.sinistra); + din.pb.setValue(i + 1); + din.pb.paintImmediately(din.access.bar); + q = tokens_B(s.get(i), pv, v2); + tokenE = new ArrayList(); + for (String f : q) { + tokenE.add(f); + } + tE.add(tokenE); + } + return tE; + } + + /** + *

+ * Clear all tags and spaces; therefore all words are sewn together. + *

+ * + * @param s my text + * @return the normalized string */ + public static String normalizzaTestoTaggato(final String s) { + if (s == null) { + return null; + } + String t = s.replaceAll("<\\p{ASCII}+?>", ""); + t = t.replaceAll("\\p{Space}+", ""); + return t; + } + + /** + *

+ * Searches for the first occurrence of a substring in a string and + * replaces it with something else. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the starting string + * @param target the substring to search for + * @param replace the string to replace + * @return the resulting string */ + public static String replaceFirst(final String s, + final String target, final String replace) { + if (s == null) { + return null; + } + int i = s.indexOf(target); + if (i == -1) { + return s; + } else { + return s.substring(0, i) + replace + s.substring(i + target + .length()); + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Universal.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Universal.java new file mode 100644 index 0000000..2ff75d0 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/everyday/Universal.java @@ -0,0 +1,181 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.everyday; + +/** + *

+ * List of ISO 3166-1 standard country codes. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @author M. Maglioni */ +public class Universal { + + /** list */ + public final static String[] charsetE = { "UTF-8", "ISO-8859-1", + "UTF-16" }; + /** list */ + public final static String[] countryCodeE = { "ax", "af", "al", + "dz", "as", "ad", "ao", "ai", "aq", "ag", "ar", "am", "aw", + "au", "at", "az", "bs", "bh", "bd", "bb", "by", "be", "bz", + "bj", "bm", "bt", "bo", "ba", "bw", "bv", "br", "io", "bn", + "bg", "bf", "bi", "kh", "cm", "ca", "cv", "ky", "cf", "td", + "cl", "cn", "cx", "cc", "co", "km", "cd", "cg", "ck", "cr", + "ci", "hr", "cu", "cy", "cz", "dk", "dj", "dm", "do", "ec", + "eg", "sv", "gq", "er", "ee", "et", "fk", "fo", "fj", "fi", + "fr", "gf", "pf", "tf", "ga", "gm", "ge", "de", "gh", "gi", + "gr", "gl", "gd", "gp", "gu", "gt", "gn", "gw", "gy", "ht", + "hm", "hn", "hk", "hu", "is", "in", "id", "ir", "iq", "ie", + "il", "it", "jm", "jp", "jo", "kz", "ke", "ki", "kp", "kr", + "kw", "kg", "la", "lv", "lb", "ls", "lr", "ly", "li", "lt", + "lu", "mo", "mk", "mg", "mw", "my", "mv", "ml", "mt", "mh", + "mq", "mr", "mu", "yt", "mx", "fm", "md", "mc", "mn", "ms", + "ma", "mz", "mm", "na", "nr", "np", "nl", "an", "nc", "nz", + "ni", "ne", "ng", "nu", "nf", "mp", "no", "om", "pk", "pw", + "ps", "pa", "pg", "py", "pe", "ph", "pn", "pl", "pt", "pr", + "qa", "re", "ro", "ru", "rw", "sh", "kn", "lc", "pm", "vc", + "ws", "sm", "st", "sa", "sn", "cs", "sc", "sl", "sg", "sk", + "si", "sb", "so", "za", "gs", "es", "lk", "sd", "sr", "sj", + "sz", "se", "ch", "sy", "tw", "tj", "tz", "th", "tl", "tg", + "tk", "to", "tt", "tn", "tr", "tm", "tc", "tv", "ug", "ua", + "ae", "gb", "us", "um", "uy", "uz", "vu", "va", "ve", "vn", + "vg", "vi", "wf", "eh", "ye", "zm", "zw" }; + /** list */ + public final static String[][] languageE = { { "Abkhazian", "AB" }, + { "Afar", "AA" }, { "Afrikaans", "AF" }, { "Albanian", + "SQ" }, { "Amharic", "AM" }, { "Arabic", "AR" }, { + "Armenian", "HY" }, { "Assamese", "AS" }, { + "Aymara", "AY" }, { "Azerbaijani", + "AZ" }, { "Bashkir", "BA" }, + { "Basque", "EU" }, { "Bengali,Bangla", "BN" }, { "Bhutani", + "DZ,Bangla" }, { "Bihari", "BH" }, { "Bislama", + "BI" }, { "Breton", "BR" }, { "Bulgarian", + "BG" }, { "Burmese", "MY" }, { + "Byelorussian", "BE" }, { + "Cambodian", "KM" }, + { "Catalan", "CA" }, { "Chinese", "ZH" }, { "Corsican", + "CO" }, { "Croatian", "HR,American" }, { "Czech", + "CS" }, { "Danish", "DA" }, { "Dutch", + "NL" }, { "English,American", + "EN" }, { "Esperanto", + "EO" }, { + "Estonian", + "ET" }, { + "Faeroese", + "FO" }, + { "Fiji", "FJ" }, { "Finnish", "FI" }, { "French", "FR" }, { + "Frisian", "FY" }, { "Gaelic (ScotsGaelic)", "GD" }, + { "Galician", "GL" }, { "Georgian", "KA" }, { "German", + "DE" }, { "Greek", "EL" }, { "Greenlandic", "KL" }, + { "Guarani", "GN" }, { "Gujarati", "GU" }, { "Hausa", + "HA" }, { "Hebrew", "IW" }, { "Hindi", "HI" }, { + "Hungarian", "HU" }, { "Icelandic", "IS" }, + { "Indonesian", "IN" }, { "Interlingua", "IA" }, { + "Interlingue", "IE" }, { "Inupiak", "IK" }, { + "Irish", "GA" }, { "Italian", "IT" }, { + "Japanese", "JA" }, { "Javanese", + "JW" }, { "Kannada", "KN" }, + { "Kashmiri", "KS" }, { "Kazakh", "KK" }, { "Kinyarwanda", + "RW" }, { "Kirghiz", "KY" }, { "Kirundi", "RN" }, { + "Korean", "KO" }, { "Kurdish", "KU" }, { + "Laothian", "LO" }, { "Latin", + "LA" }, { "Latvian,Lettish", + "LV" }, { "Lingala", + "LN,Lettish" }, + { "Lithuanian", "LT" }, { "Macedonian", "MK" }, { + "Malagasy", "MG" }, { "Malay", "MS" }, { + "Malayalam", "ML" }, { "Maltese", "MT" }, { + "Maori", "MI" }, { "Marathi", + "MR" }, { "Moldavian", + "MO" }, { + "Mongolian", + "MN" }, { + "Nauru", + "NA" }, + { "Nepali", "NE" }, { "Norwegian", "NO" }, { "Occitan", + "OC" }, { "Oriya", "OR" }, { "Oromo,Afan", + "OM,Afan" }, { "Pashto,Pushto", "PS" }, { + "Persian", "FA" }, { "Polish", + "PL" }, { "Portuguese", + "PT,Pushto" }, { + "Punjabi", + "PA" }, { + "Quechua", + "QU" }, + { "Rhaeto-Romance", "RM-Romance" }, { "Romanian", "RO" }, { + "Russian", "RU" }, { "Samoan", "SM" }, { "Sangro", + "SG" }, { "Sanskrit", "SA" }, { "Serbian", + "SR" }, { "Serbo-Croatian", "SH" }, + { "Sesotho", "ST-Croatian" }, { "Setswana", "TN" }, { + "Shona", "SN" }, { "Sindhi", "SD" }, { "Singhalese", + "SI" }, { "Siswati", "SS" }, { "Slovak", + "SK" }, { "Slovenian", "SL" }, { + "Somali", "SO" }, { + "Spanish", "ES" }, { + "Sudanese", + "SU" }, { + "Swahili", + "SW" }, + { "Swedish", "SV" }, { "Tagalog", "TL" }, { "Tajik", "TG" }, + { "Tamil", "TA" }, { "Tatar", "TT" }, { "Tegulu", "TE" }, { + "Thai", "TH" }, { "Tibetan", "BO" }, { "Tigrinya", + "TI" }, { "Tonga", "TO" }, { "Tsonga", + "TS" }, { "Turkish", "TR" }, { + "Turkmen", "TK" }, { "Twi", + "TW" }, { + "Ukrainian", + "UK" }, { + "Urdu", + "UR" }, + { "Uzbek", "UZ" }, { "Vietnamese", "VI" }, { "Volapuk", + "VO" }, { "Welsh", "CY" }, { "Wolof", "WO" }, { + "Xhosa", "XH" }, { "Yiddish", "JI" }, { + "Yoruba", "YO" }, { "Zulu", + "ZU" } }; + + /** list of valid colors for CSS */ + public final static String[] cssColorE = { "Black", "Navy", + "DarkBlue", "MediumBlue", "Blue", "DarkGreen", "Green", + "Teal", "DarkCyan", "DeepSkyBlue", "DarkTurquoise", + "MediumSpringGreen", "Lime", "SpringGreen", "Aqua", "Cyan", + "MidnightBlue", "DodgerBlue", "LightSeaGreen", + "ForestGreen", "SeaGreen", "DarkSlateGray", "LimeGreen", + "MediumSeaGreen", "Turquoise", "RoyalBlue", "SteelBlue", + "DarkSlateBlue", "MediumTurquoise", "Indigo", + "DarkOliveGreen", "CadetBlue", "CornflowerBlue", + "RebeccaPurple", "MediumAquaMarine", "DimGray", "SlateBlue", + "OliveDrab", "SlateGray", "LightSlateGray", + "MediumSlateBlue", "LawnGreen", "Chartreuse", "Aquamarine", + "Maroon", "Purple", "Olive", "Gray", "SkyBlue", + "LightSkyBlue", "BlueViolet", "DarkRed", "DarkMagenta", + "SaddleBrown", "DarkSeaGreen", "LightGreen", "MediumPurple", + "DarkViolet", "PaleGreen", "DarkOrchid", "YellowGreen", + "Sienna", "Brown", "DarkGray", "LightBlue", "GreenYellow", + "PaleTurquoise", "LightSteelBlue", "PowderBlue", + "FireBrick", "DarkGoldenRod", "MediumOrchid", "RosyBrown", + "DarkKhaki", "Silver", "MediumVioletRed", "IndianRed", + "Peru", "Chocolate", "Tan", "LightGray", "Thistle", + "Orchid", "GoldenRod", "PaleVioletRed", "Crimson", + "Gainsboro", "Plum", "BurlyWood", "LightCyan", "Lavender", + "DarkSalmon", "Violet", "PaleGoldenRod", "LightCoral", + "Khaki", "AliceBlue", "HoneyDew", "Azure", "SandyBrown", + "Wheat", "Beige", "WhiteSmoke", "MintCream", "GhostWhite", + "Salmon", "AntiqueWhite", "Linen", "LightGoldenRodYellow", + "OldLace", "Red", "Fuchsia", "Magenta", "DeepPink", + "OrangeRed", "Tomato", "HotPink", "Coral", "DarkOrange", + "LightSalmon", "Orange", "LightPink", "Pink", "Gold", + "PeachPuff", "NavajoWhite", "Moccasin", "Bisque", + "MistyRose", "BlanchedAlmond", "PapayaWhip", + "LavenderBlush", "SeaShell", "Cornsilk", "LemonChiffon", + "FloralWhite", "Snow", "Permission", "LightYellow", "Ivory", + "White" }; +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Abacus.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Abacus.java new file mode 100644 index 0000000..e9bc552 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Abacus.java @@ -0,0 +1,842 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ + +package it.ramecera.salad.file; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Calendar; +import java.util.StringTokenizer; +import java.util.TimeZone; +import java.util.regex.PatternSyntaxException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Class for various operations on files. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-15
+ *

+ *

+ * Changes:
+ * 2020-04-09: inserted method: public static void estraiFiltroZip + * (final String fileZipOut, File destDir, final String filter) + *
+ *

+ * + * @author M. Maglioni * */ +public class Abacus { + + private static final String sep = System.getProperty( + "file.separator"); + + /** + *

+ * Deletion of files from a directory and all its subdirectories, at + * all depths. Eventually the path remains but is empty. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-03 + *

+ *

+ * Changes:
+ * + * @param y the path to be demolished + * @throws ExactException error in the parameters provided */ + public static void destroyDirectory(final String y) + + throws ExactException { + + if (y == null) { + throw new ExactException( + "The directory name for method \"eraseFiles\" is null.", + 101000, "Abacus", ""); + } + Folder folder = new Folder(); + File[] elencoE = folder.fileObjects(".+", y); + if (elencoE == null) { + throw new ExactException("The directory " + Mix.dress_A(y) + + " does not exist.", 101004, "Abacus", ""); + } + for (File x : elencoE) { + try { + if (x.isFile()) { + x.delete(); + } else if (x.isDirectory()) { + destroyDirectory(x.getCanonicalPath()); + x.delete(); + } + } catch (IOException e) { + throw new ExactException("Errore di I/O", 101001, + "Abacus", ""); + } + } + } + + /** + *

+ * Deleting the files of a directory, filtered according to a + * pattern. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @return quantity of deleted files + * @param pattern the pattern to filter the files, according to the + * codes of the class java.util.regex.Pattern. + * @param y the path where to look for the files + * @throws ExactException error code in the provided parameters */ + public static int eraseFiles(final String pattern, final String y) + + throws ExactException { + + if (pattern == null) { + throw new ExactException( + "The pattern for method \"eraseFiles\" is null.", + 101002, "Abacus", ""); + } + if (y == null) { + throw new ExactException( + "The directory name for method \"eraseFiles\" is null.", + 101003, "Abacus", ""); + } + // if necessary, I put a slash in the queue + String y1 = Mix.dress_D(y); + File f = new File(y1); + int i = 0; + try { + String[] g = f.list(Mix.fileFilter(pattern)); + for (i = 0; i < g.length; i++) { + File h = new File(y1 + g[i]); + h.delete(); + } + } catch (PatternSyntaxException pse) { + return 0; + } + return i; + } + + /** + *

+ * Find the most recent file among those present in a directory, + * filtered according to a pattern. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 21/01 / 09: eliminated the milliseconds from the final result. + *
+ *

+ * + * @return the most recent modification date, expressed as long + * number + * @param x the pattern to filter the files, according to the codes + * of the java.util class. regex.Pattern. + * @param y the directory to search for files + * @since SVutensiliJ4_1.2.2, class 1.1.0 */ + public static long ilPiuGiovaneFile_A(final String x, + final String y) { + + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y1); + String[] g = f.list(Mix.fileFilter(x)); + int i; + long dateW = 0; + String nomeFileW = null; + for (i = 0; i < g.length; i++) { + File h = new File(y1 + g[i]); + if (h.lastModified() > dateW) { + dateW = h.lastModified(); + nomeFileW = h.getName(); + } + } + nomeFileW = nomeFileW + ""; // just to avoid the hassle of the + // warning + return dateW / 1000 * 1000; + } + + /** + *

+ * Find the most recent file among those present in a directory, + * filtered according to a pattern. It is returned not the name of + * the file, but its modification date, expressed as a Calendar + * object. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 21/01 / 09: milliseconds removed from the final result.
+ *

+ * + * @return the most recent modification date, expressed as a + * Calendar object; returns the date 2020-04-09 if the + * directory is empty + * @param x the pattern to filter the files, according to the codes + * of the class java.util.regex.Pattern. + * @param y the directory to search for files + * @since SVutensiliJ4_1.2.2, class 1.1.0 */ + public static Calendar ilPiuGiovaneFile_B(final String x, + final String y) { + + // if necessary, I put a slash in the queue + TimeZone tz = TimeZone.getTimeZone("Europe/Paris"); + Calendar calendarW = Calendar.getInstance(tz); + String y1 = Mix.dress_CU(y); + File f = new File(y1); + String[] g = f.list(Mix.fileFilter(x)); + if (g.length == 0) { + calendarW.set(Calendar.YEAR, 1900); + calendarW.set(Calendar.MONTH, 0); + calendarW.set(Calendar.DAY_OF_MONTH, 1); + return calendarW; + } + int i; + Calendar lastModified = Calendar.getInstance(tz); + calendarW.setTimeInMillis(0); + String nomeFileW = null; + for (i = 0; i < g.length; i++) { + File h = new File(y1 + g[i]); + lastModified.setTimeInMillis(h.lastModified()); + if (lastModified.after(calendarW)) { + calendarW = (Calendar) lastModified.clone(); + nomeFileW = h.getName(); + } + } + nomeFileW = nomeFileW + ""; // just to avoid the hassle of the + // warning + calendarW.set(Calendar.MILLISECOND, 0); + return calendarW; + } + + /** + *

+ * Count of files in a directory, filtered according to a pattern. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * + * @return quantity of files found + * @param x the pattern to filter the files, according to the codes + * of the class java.util.regex.Pattern. + * @param y path where to search for files + * @see "prog. bigExport_2.0.0, class ExportSchema_1" */ + public static int contaFile(final String x, final String y) { + + // if necessary, I put a slash in the queue + File f = new File(y); + if (!f.exists() || !f.isDirectory()) + return -1; + String[] g = f.list(Mix.fileFilter(x)); + return g.length; + } + + /** + *

+ * Physical copy of one file to another, declaring a maximum length. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 20/05 08: sets the condition that the file does not already exist + * identically
+ * 2020-04-09: elimination of the preventive cancellation because it + * is useless
+ * 2020-04-09: reintroduced the delete estimate
+ *

+ * + * @param in file in unput + * @param out file in output + * @param max maximum file length + * @throws Exception ordinary exception */ + public static void copyFile(File in, File out, final int max) + + throws Exception { + + /* this is an economy: do nothing if the output already exists + * and is identical */ + if (out.exists() && !out.isDirectory() && in + .lastModified() == out.lastModified() && in + .length() == out.length()) + return; + + if (out.exists() && !out.isDirectory()) + out.delete(); + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[max]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + /** + *

+ * Physical copy of one file on another; overload of the previous + * one. It differs from the previous one because there is no need to + * declare the maximum length. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 2013-08- 07: added the instruction setting the last modification + * date of the output file + *

+ * + * @param in file in unput + * @param out file in output + * @throws IOException standard exception */ + public static void copyFile(File in, File out) + + throws IOException { + + /* this is an economy: do nothing if the output already exists + * and is identical */ + if (out.exists() && !out.isDirectory() && in + .lastModified() == out.lastModified() && in + .length() == out.length()) + return; + + if (out.exists() && !out.isDirectory()) + out.delete(); + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[(int) in.length()]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + out.setLastModified(in.lastModified()); + } + + /** + *

+ * Physical copy of two files, queued, on another; an LF is placed + * between the two. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param i0 file in unput + * @param i1 file in unput + * @param o file in output + * @throws Exception ordinary exception */ + public static void mergeFile(String i0, String i1, String o) + + throws Exception { + + File in0 = new File(i0); + File in1 = new File(i1); + File out = new File(o); + if (out.exists() && !out.isDirectory()) + out.delete(); + FileInputStream fis0 = new FileInputStream(in0); + FileInputStream fis1 = new FileInputStream(in1); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[(int) in0.length()]; + int i = 0; + while ((i = fis0.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis0.close(); + fos.write(10); // line feed character + buf = new byte[(int) in1.length()]; + i = 0; + while ((i = fis1.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis1.close(); + fos.close(); + } + + /** + *

+ * Create a directory, if it doesn't already exist, after making + * sure it isn't a file.
+ * It can only create one directory at a time.
+ * Example: I have to create directory b in path C:/a;
+ * I must put the string: "C:/a/b" as the argument of the method, + * and I must first verify that C:/a exists.
+ *

+ *

+ * Creation date: 2020-09-03
+ * Last updated: 2020-09-03 + *

+ *

+ * Modifications:
+ *

+ * + * @param path to the directory to be built, complete with path */ + public static void buildDirectory(final String path) { + + File cradle = new File(path); + if (cradle.isFile()) + cradle.delete(); + if (!cradle.exists()) + cradle.mkdir(); + } + + /** + *

+ * Overload of the preceding method. + *

+ *

+ * Creation date: 2020-09-03
+ * Last updated: 2020-09-03 + *

+ *

+ * Modifications:
+ *

+ * + * @param cradle directory to be created */ + public static void buildDirectory(File cradle) { + + if (cradle.isFile()) + cradle.delete(); + if (!cradle.exists()) + cradle.mkdir(); + } + + /** + *

+ * Create a complete path, that is, make a succession of directories + * creations. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * Author: M. Maglioni + *

+ *

+ * Changes :
+ *

+ * + * @param path the directory to be built, complete with path */ + public static void costruisciDirectoryCompleta(final String path) { + StringTokenizer tokens = new StringTokenizer(path, System + .getProperty("file.separator")); + String[] segmenti = new String[tokens.countTokens()]; + int segmentiQ = 0; + while (tokens.hasMoreTokens()) { + segmenti[segmentiQ] = tokens.nextToken(); + segmentiQ++; + } + String percorso = segmenti[0]; + int i = 1; + while (i < segmenti.length) { + percorso += System.getProperty("file.separator") + + segmenti[i]; + buildDirectory(percorso); + i++; + } + } + + /** + *

+ * Create a complete path, that is, make a succession of directories + * creations. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * Author: M. Maglioni + *

+ *

+ * Changes :
+ *

+ * + * @param path the directory to be built, complete with path + * @param separator the separator (slash or backslash) inside the + * name of a path */ + public static void buildDirectoryCompletely(final String path, + final String separator) { + if (path.length() == 0) { + return; + } + StringTokenizer tokens = new StringTokenizer(path, separator); + String[] segmentE = new String[tokens.countTokens()]; + int segmentsQ = 0; + while (tokens.hasMoreTokens()) { + segmentE[segmentsQ] = tokens.nextToken(); + segmentsQ++; + } + String percorso = segmentE[0]; + int i = 1; + while (i < segmentE.length) { + percorso += System.getProperty("file.separator") + + segmentE[i]; + buildDirectory(percorso); + i++; + } + } + + /** + *

+ * Removing the extension from a file name. Deprecated on 2020-04-09 + * because it is not exact: if the file has no extension, and is + * preceded by a directory name containing a dot, it gives an + * incorrect result. The correct method to use is + * Mix.estraiExtension. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return the name of the file without extension (nor dot, of + * course) + * @param s the name of the complete file */ + @Deprecated + public static String senzaExtension(final String s) { + int i = s.lastIndexOf("."); + if (i == -1) + return s; + else + return s.substring(0, i); + } + + /** + *

+ * Creation date: 2020-05-19
+ * Last updated: 2020-05-19
+ * Class: Abacus + * + * @author M. Maglioni + *

+ * Description: + *

+ * @param fileZipInput name of the input file + * @param destDir output directory + * @throws FileNotFoundException obvious + * @throws IOException obvious */ + public static void extractAllFromZip(final String fileZipInput, + File destDir) + + throws FileNotFoundException, IOException { + + byte[] buffer = new byte[1024]; + ZipInputStream zis = new ZipInputStream(new FileInputStream( + fileZipInput)); + ZipEntry zipEntry = zis.getNextEntry(); + while (zipEntry != null) { + File newFile = newFile(destDir, zipEntry); + String s = destDir.getAbsolutePath().replaceAll("\\x5c", + "/") + "/" + zipEntry.getName(); + if (zipEntry.getName().endsWith("/")) { + Abacus.buildDirectoryCompletely(s, "/"); + } else { + String t[] = Mix.analizzaPath(s); + Abacus.buildDirectoryCompletely(t[0], "/"); + FileOutputStream fos = new FileOutputStream(newFile); + int len; + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len); + } + fos.close(); + } + zipEntry = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + } + + /** + *

+ * Creation date: 2020-05-19
+ * Last updated: 2020-09-14
+ * Class: Abacus + * + * @author M. Maglioni + *

+ * Description: extraction of files from a zip archive, + * filtered by a "startWith" and by an "except" + *

+ *

+ * History:
+ * The description of N# is in project plan report.
+ * 2020-09-14 implementation of N16
+ *

+ * @param fileZipInput name of the input file + * @param destDir output directory + * @param filter obvious + * @param except I don't have to copy the "dummy.txt" files, because + * they were added to the jar only to allow the creation of + * some empty directories. + * @throws FileNotFoundException obvious + * @throws IOException obvious */ + public static void extractFromZipFilter(final String fileZipInput, + File destDir, final String filter, final String except) + + throws FileNotFoundException, IOException { + + byte[] buffer = new byte[1024]; + ZipInputStream zis = new ZipInputStream(new FileInputStream( + fileZipInput)); + ZipEntry zipEntry = zis.getNextEntry(); + while (zipEntry != null) { + if (zipEntry.toString().startsWith(filter)) { + File newFile = newFile(destDir, zipEntry); + String s = destDir.getAbsolutePath().replaceAll("\\x5c", + "/") + "/" + zipEntry.getName(); + if (zipEntry.getName().endsWith("/")) { + Abacus.buildDirectoryCompletely(s, "/"); + } else { + String t[] = Mix.analizzaPath(s); + Abacus.buildDirectoryCompletely(t[0], "/"); + if (!newFile.getName().equals(except) | except + .equals("")) { + FileOutputStream fos = new FileOutputStream( + newFile); + int len; + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len); + } + fos.close(); + } + } + } + zipEntry = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + } + + private static File newFile(File destinationDir, ZipEntry zipEntry) + + throws IOException { + + File destFile = new File(destinationDir, zipEntry.getName()); + + String destDirPath = destinationDir.getCanonicalPath(); + String destFilePath = destFile.getCanonicalPath(); + if (!destFilePath.startsWith(destDirPath + File.separator)) { + throw new IOException("Entry is outside of the target dir: " + + zipEntry.getName()); + } + return destFile; + } + + /** + *

+ * Creation date: 2020-09-15
+ * Class: Abacus + *

+ *

+ * Description: delete a directory, with all its content. + *

+ * + * @param path object to delete + * @throws IOException ordinary exception */ + final public static void deleteDirectoryRecursion(Path path) + + throws IOException { + + LinkOption[] nfl = new LinkOption[] { + LinkOption.NOFOLLOW_LINKS }; + deleteDirectoryRecursion(path, nfl); + } + + /** + *

+ * Creation date: 2020-09-15
+ * Class: Abacus + *

+ *

+ * Description: delete a directory, with all its content. + *

+ * + * @param path object to delete + * @param nfl link options + * @throws IOException ordinary exception */ + final public static void deleteDirectoryRecursion(Path path, + LinkOption[] nfl) + + throws IOException { + + if (!Files.exists(path, nfl)) { + return; + } + if (Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS)) { + try (DirectoryStream entries = Files + .newDirectoryStream(path)) { + for (Path entry : entries) { + deleteDirectoryRecursion(entry, nfl); + } + } + } + Files.delete(path); + } + + /** + *

+ * Creation date: 2020-09-08
+ * Last updated: 2020-09-15
+ * Class: Abacus + *

+ *

+ * Description: copy all content of a directory. + *

+ * + * @param inPath input object + * @param outPath output object + * @param replace replace-existing optio + * @throws IOException ordinary exception */ + final public static void copyDirectoryRecursion(Path inPath, + Path outPath, final boolean replace) + + throws IOException { + + LinkOption[] nfl = new LinkOption[] { + LinkOption.NOFOLLOW_LINKS }; + copyDirectoryRecursion(inPath, outPath, replace, nfl); + } + + /** + *

+ * Creation date: 2020-09-08
+ * Last updated: 2020-09-15
+ * Class: Abacus + *

+ *

+ * Description: copy all content of a directory. + *

+ * + * @param inPath input object + * @param outPath output object + * @param replace replace-existing option + * @param nfl link options + * @throws IOException ordinary exception */ + final public static void copyDirectoryRecursion(Path inPath, + Path outPath, final boolean replace, LinkOption[] nfl) + + throws IOException { + + if (Files.exists(outPath, nfl) && !Files.isDirectory(outPath, + nfl)) { + throw new IOException("The output object " + Mix.dress_A( + outPath.toString()) + " is not a directory"); + } else if (!Files.exists(outPath, nfl)) { + Files.createDirectory(outPath); + } + try (DirectoryStream entries = Files.newDirectoryStream( + inPath)) { + for (Path entry : entries) { + Path n = new File(outPath.toFile().getAbsolutePath() + + sep + entry.getFileName()).toPath(); + if (Files.isDirectory(entry, + LinkOption.NOFOLLOW_LINKS)) { + if (!Files.exists(n)) { + Files.createDirectory(n); + } + copyDirectoryRecursion(entry, n, replace, nfl); + } else if (replace) { + Files.copy(entry, n, + StandardCopyOption.COPY_ATTRIBUTES, + StandardCopyOption.REPLACE_EXISTING); + } else { + Files.copy(entry, n, + StandardCopyOption.COPY_ATTRIBUTES); + } + } + } + } + + /** + *

+ * Creation date: 2020-09-08
+ * Last updated: 2020-09-15
+ * Class: Abacus + *

+ *

+ * Description: delete a directory, with all its content; + * overloading of the preceding one. + *

+ * + * @param file object to delete + * @throws IOException ordinary exception */ + final public static void deleteDirectoryRecursion(File file) + + throws IOException { + + deleteDirectoryRecursion(file.toPath()); + } + + /** + *

+ * Creation date: 2020-09-08
+ * Last updated: 2020-09-15
+ * Class: Abacus + *

+ *

+ * Description: copy a directory, with all its content; overloading + * of the preceding one. + *

+ * + * @param inputFile input object + * @param outputFile output object + * @param replace replace-existing option + * @throws IOException standard exception */ + final public static void copyDirectoryRecursion(File inputFile, + File outputFile, final boolean replace) + + throws IOException { + + copyDirectoryRecursion(inputFile.toPath(), outputFile.toPath(), + replace); + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Equipment.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Equipment.java new file mode 100644 index 0000000..7827ba9 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Equipment.java @@ -0,0 +1,1015 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.file; + +import java.io.BufferedInputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.graphic.Placard; + +/** + *

+ * Class for reading files. The class should not be instantiated. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 2020-04-09: various methods added 2020-04-09: modification of + * unicaStringaUnicode_B and creation of entities_A
+ *

+ * + * @author M. Maglioni */ + +public class Equipment { + + /** char Line Feed */ + public final static char LF = 10; // the line feed character + /** Line Feed font */ + public final static String LFS = Character.valueOf(LF).toString(); + + /** + *

+ * Reading a sequential file to deposit it on a single string. The + * file is fully deposited, for example the CR and/or LF are + * inserted exactly like all the other characters. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file input file + * @return string with the entire contents of the + * @throws FileNotFoundException is triggered when the file does not + * exist + * @throws IOException is triggered when it cannot be read, for any + * other reason. */ + public static String oneString(File file) + + throws IOException, FileNotFoundException { + + String s; + int j, k; + BufferedInputStream bis = null; + try { + FileInputStream fis = new FileInputStream(file); + bis = new BufferedInputStream(fis); + j = (int) file.length(); + char[] c = new char[j]; + for (k = 0; k < j; k++) + c[k] = (char) bis.read(); + bis.close(); + s = new String(c); + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + bis.close(); + throw e; + } + return s; + } + + /** + *

+ * Overload of the previous method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param g file name, including all path + * @return the all-inclusive string of all text + * @throws IOException ordinary exception + * @throws FileNotFoundException ordinary exception + * @since 1.0.0 - SVutensiliJ4_1.3.0 */ + public static String oneString(final String g) + + throws IOException, FileNotFoundException { + + return oneString(new File(g)); + } + + /** + *

+ * Overload of the previous method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param is the InputStream object to read + * @return the all-inclusive string of all text + * @throws IOException ordinary exception + * @throws FileNotFoundException ordinary exception + * @since 3 */ + public static String unicaStringa(InputStream is) + + throws IOException, FileNotFoundException { + + String s; + int j, k; + BufferedInputStream bis = null; + try { + bis = new BufferedInputStream(is); + j = is.available(); + char[] c = new char[j]; + for (k = 0; k < j; k++) + c[k] = (char) bis.read(); + bis.close(); + s = new String(c); + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + bis.close(); + throw e; + } + return s; + } + + /** + *

+ * Reading of a sequential file to deposit it on a single string, + * with transformation in UTF. The file is fully deposited, for + * example the CR and/or LF are inserted exactly like all the other + * characters. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file input file + * @param code code to be adopted + * @return string with the entire contents of the file + * @throws ExactException standard exception */ + public static String oneStringUnicode_A(File file, + final String code) + + throws ExactException { + + String s; + InputStreamReader isr = null; + if (file.length() > Integer.MAX_VALUE) { + throw new ExactException( + "The file length is greater than 2 GB," + + " it is not allowed.", 1108, "Equipment", + "oneStringUnicode_A"); + } else if (file.length() == 0) { + return ""; + } + try { + FileInputStream fis = new FileInputStream(file); + isr = new InputStreamReader(fis, code); + int j = (int) file.length(); + char[] c = new char[j]; + isr.read(c); + isr.close(); + int i; + for (i = j - 1; c[i] == 0; i--) + ; + s = (new String(c)).substring(0, i + 1); + } catch (UnsupportedEncodingException uee) { + throw new ExactException(uee.getMessage(), 100908, + "Equipment", "oneStringUnicode_A"); + } catch (FileNotFoundException fnfe) { + throw new ExactException("The file " + file.getPath() + + " was not found.", 100909, "Equipment", + "oneStringUnicode_A"); + } catch (IOException ioe) { + throw new ExactException(ioe.getMessage(), 100910, + "Equipment", "oneStringUnicode_A"); + } finally { + try { + isr.close(); + } catch (IOException e) { + // do nothing + } + } + return s; + } + + /** + *

+ * Reading of a sequential file to deposit it on a single string, + * with transformation in UTF. Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Changes:
+ *

+ * + * @param f input file + * @param code code to be adopted + * @return string with the entire contents of the file + * @throws ExactException standard exception */ + public static String oneStringUnicode_A(final String f, + final String code) + + throws ExactException { + + return oneStringUnicode_A(new File(f), code); + } + + /** + *

+ * Reading of a sequential file to deposit it on a single string, + * with transformation into UTF and use of XML-character + * &#xffff;.
+ * By ffff we mean 4 hexadecimal characters, example : + * e445, 00fe, ff4a, etc. which correspond to 16 bits.
+ * The code is regulated by the production [66] of the W3C.
+ * The file is fully deposited, for example the CR and / or LF are + * inserted exactly like all the other characters. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ * 29/12 08: extraction of part of the argorithm in the new + * entities_A method.
+ * 2020-04-09: replacement of the entities_A method with entities_B, + * to avoid saturation of the heap
+ *

+ * + * @param file input file + * @param code code to be adopted + * @return string with l the entire contents of the + * @throws FileNotFoundException is triggered when the file does not + * exist + * @throws IOException is triggered when it is not possible to read, + * for any other reason. + * @throws UnsupportedEncodingException UTF codes do not exist in + * that combination + * @since 2.0.0 - SVutensiliJ4_1.3.0 */ + public static String unicaStringaUnicode_B(File file, + final String code) + + throws UnsupportedEncodingException, IOException { + + String t = null; + InputStreamReader isr = null; + if (file.length() > Integer.MAX_VALUE / 2) + throw new IOException( + "The file length is greater than 1 GB, it is not allowed."); + try { + FileInputStream fis = new FileInputStream(file); + isr = new InputStreamReader(fis, code); + int m = (int) file.length(); + char[] c = new char[m]; // I prepare the array to + // accommodate i + // characters of the file + isr.read(c); // load the array c + isr.close(); // I close the file + t = String.valueOf(c); + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + isr.close(); + throw e; + } + return entities_C(t); + } + + /** + *

+ * Overload of the previous method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param is the InputStream object to be read + * @param code encoding UNICODE + * @return the all-inclusive string of all text + * @throws UnsupportedEncodingException ordinary exception + * @throws IOException ordinary exception + * @throws FileNotFoundException ordinary exception + * @since 3 */ + public static String unicaStringaUnicode_B(InputStream is, + final String code) + + throws UnsupportedEncodingException, IOException { + + String t = null; + InputStreamReader isr = null; + if (is.available() > Integer.MAX_VALUE / 2) + throw new IOException( + "The file length is greater than 1 GB, it is not allowed."); + try { + isr = new InputStreamReader(is, code); + int m = is.available(); + char[] c = new char[m]; // I prepare the array to + // accommodate i + // characters of the file + isr.read(c); // load the array c + isr.close(); // I close the file + t = String.valueOf(c); + } catch (IOException e) { + isr.close(); + throw e; + } + return entities_C(t); + } + + /** + *

+ * String-to-string transformation, using XML-character + * &#xffff;.
+ * By ffff we mean 4 hexadecimal characters, for example: + * e445, 00fe, ff4a, etc. which correspond to 16 bits.
+ * The code is regulated by W3C production [66].
+ *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 29 / 04/08 + *

+ *

+ * Changes:
+ *

+ * + * @param t input string + * @return oputput string */ + public static String entities_A(final String t) { + if (t == null) { + return null; + } + String s; + int m = t.length(); + if (m == 0) { + return t; + } + /* I prepare the array to accommodate the characters of the + * file */ + char[] c = new char[m]; + c = t.toCharArray(); // load the array c + int k; + /* downgraded to not process any null in the queue */ + for (k = m - 1; c[k] == 0; k--) + ; + /* at this point we start looking for unicode characters; you + * have chosen to convert to ￿ all characters beyond 255 + * of the ASCII. */ + /* I prepare another 8 times long array, because they could all + * be special characters */ + char[] d = new char[(k + 1) * 8]; + /* there are 2 parallel scrolling indices, i and j, but every + * now and then j jumps 7 more points because we have + * encountered the sequence ￿ */ + int i, j; + for (i = 0, j = 0; i <= k; i++, j++) { + if (c[i] < 256) + d[j] = c[i]; + else { + char[] uno = new char[1]; + char[] esa = new char[4]; + uno[0] = c[i]; + esa = Mix.fromCharToEsadUnicode(uno); + d[j] = '&'; + d[j + 1] = '#'; + d[j + 2] = 'x'; + d[j + 3] = esa[0]; + d[j + 4] = esa[1]; + d[j + 5] = esa[2]; + d[j + 6] = esa[3]; + d[j + 7] = ';'; + j += 7; + } + } + String r = new String(d); + s = r.substring(0, j); + return s; + } + + /** + *

+ * Variant of the previous one, it only makes the amount of heap + * memory required by the JVM variable. This variant was introduced + * because the multiplier 8 in the new char of the original version + * of the method was excessive when applying the method to an entire + * file, corrected when applying to a simple sentence, as happens in + * the justify_A method of the class it.ipzs.utensiliJN + * .comuni.Giustificazione. The multiplier becomes a topic of the + * method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param t input string + * @param h multiplier to decide how much heap memory space to take + * @return oputput string + * @since 3.0.0 - SVutensiliJ4_2.0.0 */ + public static String entities_A(final String t, final int h) { + if (t == null) { + return null; + } + String s; + int m = t.length(); + if (m == 0) { + return t; + } + char[] c = new char[m]; // I prepare the array to accommodate i + // characters + // of the file + c = t.toCharArray(); // load the array c + int k; + for (k = m - 1; c[k] == 0; k--) + ; // downgraded to not process any null in the queue + /* at this point we start looking for unicode characters; you + * have chosen to convert to ￿ all characters beyond 255 + * of the ASCII. */ + // I prepare another array long h times, because they could + // to be + // all + // Special characters + char[] d = new char[(k + 1) * h]; + /* there are 2 parallel scrolling indices, i and j, but every + * now and then j jumps 7 more points because we have + * encountered the sequence ￿ */ + int i, j; + for (i = 0, j = 0; i <= k; i++, j++) { + if (c[i] < 256) + d[j] = c[i]; + else { + char[] uno = new char[1]; + char[] esa = new char[4]; + uno[0] = c[i]; + esa = Mix.fromCharToEsadUnicode(uno); + d[j] = '&'; + d[j + 1] = '#'; + d[j + 2] = 'x'; + d[j + 3] = esa[0]; + d[j + 4] = esa[1]; + d[j + 5] = esa[2]; + d[j + 6] = esa[3]; + d[j + 7] = ';'; + j += 7; + } + } + String r = new String(d); + s = r.substring(0, j); + return s; + } + + /** + *

+ * String-to-string transformation, using XML-character + * &#xffff;.
+ * By ffff we mean 4 hexadecimal characters, for example: + * e445, 00fe, ff4a, etc. . which correspond to 16 bits.
+ * The code is regulated by W3C production [66].
+ * Version perfected compared to entities_A. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param t input string + * @return oputput string + * @since 3.0.0 - SVutensiliJ4_2.0.0 */ + public static String entities_C(final String t) { + return entities_C(t, 255); + } + + /** + *

+ * String-to-string transformation, using XML-character + * &#xffff;.
+ * By ffff we mean 4 hexadecimal characters, for example: + * e445, 00fe, ff4a, etc. . which correspond to 16 bits.
+ * The code is regulated by W3C production [66].
+ * Version perfected compared to entities_A. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param t input string + * @param limit limit beyond which the input transformation is + * triggered + * @return oputput string + * @since 3.0.0 - SVutensiliJ4_2.0.0 */ + public static String entities_C(final String t, final int limit) { + if (t == null) { + return null; + } + String s; + int m = t.length(); + if (m == 0) { + return t; + } + char[] c = new char[m]; // I prepare the array to accommodate i + // characters + // of the file + c = t.toCharArray(); // load the array c + int k; + for (k = m - 1; c[k] == 0; k--) + ; // downgraded to not process any null in the queue + int i, j, n; + n = 0; + for (i = 0; i <= k; i++) { // count in n how many characters + // will + // to be transformed + if (c[i] > limit) + n++; + } + /* at this point we start looking for unicode characters; you + * have chosen to convert to ￿ all characters beyond 255 + * of the ASCII. */ + /* I prepare another quite long array, taking into account the + * count of the characters just made */ + char[] d = new char[k + 1 + n * 7]; + /* there are 2 parallel scrolling indices, i and j, but every + * now and then j jumps 7 more points because we have + * encountered the sequence ￿ */ + for (i = 0, j = 0; i <= k; i++, j++) { + if (c[i] > limit) { + char[] uno = new char[1]; + char[] esa = new char[4]; + uno[0] = c[i]; + esa = Mix.fromCharToEsadUnicode(uno); + d[j] = '&'; + d[j + 1] = '#'; + d[j + 2] = 'x'; + d[j + 3] = esa[0]; + d[j + 4] = esa[1]; + d[j + 5] = esa[2]; + d[j + 6] = esa[3]; + d[j + 7] = ';'; + j += 7; + } else { + d[j] = c[i]; + } + } + String r = new String(d); + s = r.substring(0, j); + return s; + } + + /** + *

+ * Transformation of a text containing hexadecimal character + * reference into an ordinary 16-bit string per character; the + * code is regulated by W3C production [66]. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s string to be written + * @return the Unicode string + * @since SVutensiliJ4_1.3.0 */ + public static String entities_Z(final String s) { + + int k = 0, m = 0; + char[] h = new char[4]; // the 4 hexadecimal characters; es. + // 45ea, + // 005b, + // etc. + int sL = s.length(); + char[] c = s.toCharArray(); // the array of input characters + char[] d = new char[sL]; // the array of characters in output + char[] uno = new char[1]; // the unicode character obtained + try { + /* I'm looking for the combination &#x (& = 38, # = 35, x = + * 120), and a semicolon (; = 59) further ahead */ + for (k = 0, m = 0; k < sL; k++, m++) { + if (k < sL - 7 && c[k] == 38 && c[k + 1] == 35 && c[k + + 2] == 120 && c[k + 7] == 59) { + h[0] = c[k + 3]; + h[1] = c[k + 4]; + h[2] = c[k + 5]; + h[3] = c[k + 6]; + uno = Mix.daEsadACharUnicode(h); + d[m] = uno[0]; + k += 7; + } else { + d[m] = c[k]; + } + } + } catch (ExactException e) { + System.out.println( + "Uncorrect Hexadecimal codes were found: " + String + .copyValueOf(h)); + } + return new String(d); + } + + /** + *

+ * Writing a sequential file starting from the text of a string. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file output file + * @param s string to write + * @throws ExactException is triggered when the directory does not + * exist, or the file cannot be written */ + public static void scriviFileDaStringa(File file, final String s) + + throws ExactException { + + try { + PrintWriter out = new PrintWriter(new BufferedWriter( + new FileWriter(file))); + out.print(s); + out.close(); + } catch (FileNotFoundException nfe) { + throw new ExactException(nfe.getMessage() + + " - Not found directory: " + file.getName() + ".", + 100900, "Equipment", ""); + } catch (IOException ioe) { + throw new ExactException(ioe.getMessage() + + " - It is impossible to write in " + file + .getName() + ".", 100901, "Equipment", ""); + } + } + + /** + *

+ * Writing a sequential file starting from the text of a string. It + * differs from the writeFileFromStringa method because if + * everything is already exactly written it does nothing. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file input file + * @param s string to write false + * @return if the file was not written, for economy, being already + * present and identical; true if + * @throws ExactException is triggered when the directory does not + * exist, or it is not possible to write to the file */ + public static boolean writeFileFromOneString_economy(File file, + final String s) + + throws ExactException { + + try { + String t = oneString(file); + // if everything is already exactly written, go away + if (t.equals(s)) + return false; + } catch (FileNotFoundException e) { + } catch (IOException e) { + e.printStackTrace(); + } + try { + PrintWriter out = new PrintWriter(new BufferedWriter( + new FileWriter(file))); + out.print(s); + out.close(); + } catch (FileNotFoundException nfe) { + throw new ExactException(nfe.getMessage() + + " - Not found directory «" + file.getName() + + "».", 100902, "Equipment", ""); + } catch (IOException ioe) { + throw new ExactException(ioe.getMessage() + + " - It is impossible to write in the file «" + + file.getName() + "»", 100903, "Equipment", ""); + } + return true; + } + + /** + *

+ * Writing a sequential file starting from the text of a string, + * with transformation in UTF. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file output file + * @param s string to be written + * @param code Unicode code to be adopted + * @throws ExactException is triggered when the directory does not + * exist, or it is not possible to write to the file */ + public static void writeFileFromOneStringUnicode_A(File file, + final String s, final String code) + + throws ExactException { + + try { + FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, code); + osw.write(s, 0, s.length()); + osw.close(); + } catch (FileNotFoundException nfe) { + throw new ExactException(nfe.getMessage() + + ", or not found the directory «" + file.getName() + + "».", 100904, "Equipment", ""); + } catch (IOException ioe) { + throw new ExactException(ioe.getMessage() + + " - It is impossible to write in the «" + file + .getName() + "».", 100905, "Equipment", ""); + } + } + + /** + *

+ * Writing a sequential file starting from the text of a string, + * with transformation in UTF-16 and use of XML character-entity + * &#xffff;.
+ * The code is regulated by W3C production [66]. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file output file + * @param s string to be written + * @param code Unicode code to be adopted + * @throws ExactException is triggered when the directory does not + * exist, or it is not possible to write to the file */ + public static void scriviFileDaStringaUnicode_B(File file, + final String s, final String code) + + throws ExactException { + + int k = 0, m = 0; + char[] h = new char[4]; // the 4 hexadecimal characters; es. + // 45ea, + // 005b, + // etc. + int sL = s.length(); + char[] c = s.toCharArray(); // the array of input characters + char[] d = new char[sL]; // the array of characters in output + char[] uno = new char[1]; // the unicode character obtained + try { + /* I'm looking for the combination &#x (& = 38, # = 35, x = + * 120), and a semicolon (; = 59) further ahead */ + for (k = 0, m = 0; k < sL; k++, m++) { + if (k < sL - 7 && c[k] == 38 && c[k + 1] == 35 && c[k + + 2] == 120 && c[k + 7] == 59) { + h[0] = c[k + 3]; + h[1] = c[k + 4]; + h[2] = c[k + 5]; + h[3] = c[k + 6]; + uno = Mix.daEsadACharUnicode(h); + d[m] = uno[0]; + k += 7; + } else { + d[m] = c[k]; + } + } + } catch (ExactException e) { + System.out.println("Trovati codici esadecimali scorretti: " + + String.copyValueOf(h)); + } + String r = new String(d); + // if (replacement) + // m--; // when the character entity is in last place, + // must + // a correction + try { + FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, code); + osw.write(r, 0, m); + osw.close(); + } catch (FileNotFoundException nfe) { + throw new ExactException(nfe.getMessage() + + " - Not found the directory «" + file.getName() + + "».", 100906, "Equipment", ""); + } catch (IOException ioe) { + throw new ExactException(ioe.getMessage() + + " - It is impossible to write in the file «" + + file.getName() + "».", 100907, "Equipment", ""); + } + } + + /** + *

+ * Writing a file extracted from a zip, assuming the presence of + * Unicode characters. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param z the zip file + * @param ze entry (i.e. internal element) of the zip file + * @param output output file + * @param code the type of encoding Unicode + * @throws ExactException is triggered when the directory does not + * exist, or it is not possible to write to the file + * @throws IOException standard exception + * @since 3 */ + public static void scriviZipEntry(ZipFile z, ZipEntry ze, + File output, final String code) + + throws ExactException, IOException { + + InputStream is = z.getInputStream(ze); + String unica = Equipment.unicaStringaUnicode_B(is, code); + unica = "" + + LFS + unica; + Equipment.scriviFileDaStringaUnicode_B(output, unica, code); + } + + /** + *

+ * Writing an empty file; if it already exists, empty or full, the + * method does nothing; if èd is a directory, the method does + * nothing. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param file the file to be created + * @throws ExactException is triggered when the file cannot be + * written, for example because the path is wrong. */ + public static void scriviFileVuoto(File file) + + throws ExactException { + + if (file.exists()) { + return; + } + try { + PrintWriter out = new PrintWriter(new BufferedWriter( + new FileWriter(file))); + out.close(); + } catch (IOException ioe) { + throw new ExactException(ioe.getMessage() + + " - It is impossible to write in the file " + file + .getName() + ".", 100908, "Equipment", ""); + } + } + + /** + *

+ * Overload of the previous one. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param s the file to be created + * @throws ExactException is triggered when the file cannot be + * written, for example because the path is wrong. */ + public static void scriviFileVuoto(final String s) + + throws ExactException { + + scriviFileVuoto(new File(s)); + } + + /** + *

+ * Creation date: 2020-10-06
+ * Class: Sweat + *

+ *

+ * Description: this method read a file, modify one time the + * corresponding string, finally write it. + *

+ * + * @param dY directory + * @param f name of the file to be modified + * @param x regular expression + * @param y replacement */ + static public boolean surgery(final String dY, final String f, + final String x, final String y, Logger logger) { + + File file = new File(Mix.dress_C(dY) + f); + if (!file.exists() || !file.isFile()) { + Mix.discloseError("The file " + Mix.dress_A(f) + + " is not present. It is not possible to continue.", + "Stop", logger); + return false; + } + try { + /* I am reading inside drill */ + String p0 = Equipment.oneStringUnicode_A(file, "UTF-8"); + /* I am updating */ + String p1 = p0.replaceFirst(x, y); + /* I am writing inside drill */ + FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw; + osw = new OutputStreamWriter(fos, "UTF-8"); + osw.write(p1, 0, p1.length()); + osw.close(); + } catch (ExactException e) { + String message = ""; + if (e.className != null) { + message += "Class: " + e.className + Candies.LF; + } + if (e.method != null) { + message += "Method: " + e.method + Candies.LF; + } + if (e.datum != null) { + message += Candies.LF + e.datum; + } + logger.error(message); + new Placard(null, message, "Error code " + e.code); + return false; + } catch (IOException e) { + Mix.discloseError("I/O error on The file " + Mix.dress_A( + file.getAbsolutePath()) + + ". It is not possible to continue." + Candies.LF + + e.getMessage(), "Stop", logger); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/FileBase.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/FileBase.java new file mode 100644 index 0000000..dad71d4 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/FileBase.java @@ -0,0 +1,64 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.file; + +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @author M. Maglioni */ +public class FileBase { + + /** obvious */ + public String path; + /** obvious */ + public String fileName; + /** obvious */ + public String extension; + /** obvious */ + public int depth; + + /** obvious */ + public FileBase() { + + } + + /** @param path obvious + * @param fileName obvious + * @param extension obvious + * @param depth obvious */ + public FileBase(final String path, final String fileName, + final String extension, final int depth) { + super(); + this.path = path; + this.fileName = fileName; + this.extension = extension; + this.depth = depth; + } + + /** + *

+ * Creation date: 2020-04-16
+ * Last updated: 2020-04-16
+ * Class: FileBase + * + * @author M. Maglioni + *

+ * Description: + *

+ * @return the complete path and name of the file */ + public String getG() { + return Mix.dress_C(path) + fileName + "." + extension; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Folder.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Folder.java new file mode 100644 index 0000000..519a051 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/Folder.java @@ -0,0 +1,448 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ + +package it.ramecera.salad.file; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Processing of lists of files contained in a directory. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-19
+ *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni */ + +public class Folder { + + /** list of the files, with some their properties */ + public List fbE = new ArrayList(); + + /** + *

+ * Production of the list of files of a directory, filtered + * according to a pattern. It differs from the listFile + * method in that it produces an array of File objects and not + * simply their names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with the found files + * @param filter the pattern to filter the files, according to the + * codes of the class java.util.regex.Pattern. + * @param y the path where to search for files */ + public File[] fileObjects(final String filter, final String y) { + // if necessary, I put a slash in the queue + String y1 = Mix.dress_C(y); + File f = new File(y); + if (!f.exists() || !f.isDirectory()) // quality control + return null; + String[] s = f.list(Mix.fileFilter(filter)); + File[] of = new File[s.length]; + for (int j = 0; j < s.length; j++) { + of[j] = new File(y1 + s[j]); + } + return of; + } + + /** + *

+ * Production of the list of files of a directory, filtered + * according to a pattern. It differs from the fileObjects + * method in that it produces an array of file objects sorted by + * "Last update", and not simply their names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with the found files + * @param filter the pattern to filter the files, according to the + * codes of the class java.util.regex.Pattern. + * @param y the path where to search for files */ + public List oggettiFileOrdinaModi(final String filter, + final String y) { + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y); + if (!f.exists() || !f.isDirectory()) // quality control + return null; + String[] s = f.list(Mix.fileFilter(filter)); + List of = new ArrayList(); + for (String t : s) { + of.add(new File(y1 + t)); + } + Collections.sort(of, new MyComparatorFileModi()); + return of; + } + + /** + *

+ * Production of the list of subdirectories of a directory. It + * differs from the objectsFile method in that it produces an + * array of File objects sorted by Last update, and not simply their + * names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with directories found according to the + * codes of the java.util.regex.Pattern class. + * @param y the path where to search for files */ + public List dirObjects(final String y) { + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y); + // if the input directory does not exist, or is not a directory + // ... + if (!f.exists() || !f.isDirectory()) // quality control + return null; // nothing is done about it + String[] s = f.list(Mix.filterDirectory()); + List of = new ArrayList(); + for (String t : s) { + of.add(new File(y1 + t)); + } + return of; + } + + /** + *

+ * Production of the list of subdirectories of a directory. It + * differs from the objectsFile method in that it produces an + * array of File objects sorted by Last update, and not simply their + * names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with files found according to the codes + * of the java.util.regex.Pattern class. + * @param y the path where to search for files */ + public List oggettiDireOrdinaModi(final String y) { + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y); + // if the input directory does not exist, or is not a directory + // ... + if (!f.exists() || !f.isDirectory()) // quality control + return null; // nothing is done about it + String[] s = f.list(Mix.filterDirectory()); + List of = new ArrayList(); + for (String t : s) { + of.add(new File(y1 + t)); + } + Collections.sort(of, new MyComparatorFileModi()); + return of; + } + + /** + *

+ * Production of the list of files of a directory, filtered + * according to a pattern. It differs from the objectsFile + * method in that it produces an array of File objects sorted by + * Last update, and not simply their names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with the found files + * @param filter the pattern to filter the files, according to the + * codes of the class java.util.regex.Pattern. + * @param y the path where to search for files */ + public List oggettiFileOrdinaAlfa(final String filter, + final String y) { + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y); + if (!f.exists() || !f.isDirectory()) // quality control + return null; + String[] s = f.list(Mix.fileFilter(filter)); + List of = new ArrayList(); + for (String t : s) { + of.add(new File(y1 + t)); + } + Collections.sort(of, new MyComparatorFileAlfa()); + return of; + } + + /** + *

+ * Production of the list of subdirectories of a directory. It + * differs from the ObjectsDire method in that it produces an + * array of File objects sorted by date of last modification, and + * not simply their names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with files found according to the codes + * of the java.util.regex.Pattern class. + * @param y the path where to search for files */ + public List oggettiDireOrdinaAlfa(final String y) { + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y); + // if the input directory does not exist, or is not a directory + // ... + if (!f.exists() || !f.isDirectory()) // quality control + return null; // nothing is done about it + String[] s = f.list(Mix.filterDirectory()); + List of = new ArrayList(); + for (String t : s) { + of.add(new File(y1 + t)); + } + Collections.sort(of, new MyComparatorFileAlfa()); + return of; + } + + /** + *

+ * Production of the list of subdirectories of a directory. It + * differs from the ObjectsDire method in that it produces an + * array of File objects sorted by date of last modification, and + * not simply their names. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with files found according to the codes + * of the java.util.regex.Pattern class. + * @param y the path where to search for files + * @param filter filter for selecting files */ + public List oggettiDireOrdinaAlfa(final String filter, + final String y) { + + // if necessary, I put a slash in the queue + String y1 = Mix.dress_CU(y); + File f = new File(y); + // if the input directory does not exist, or is not a directory + // ... + if (!f.exists() || !f.isDirectory()) // quality control + return null; // nothing is done about it + String[] s = f.list(Mix.filtroDirectory(filter)); + List of = new ArrayList(); + for (String t : s) { + of.add(new File(y1 + t)); + } + Collections.sort(of, new MyComparatorFileAlfa()); + return of; + } + + /** + *

+ * Production of the list of files of a directory, filtered + * according to a pattern. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return array of strings with the found files + * @param filter the pattern to filter the files, according to the + * codes of the class java.util.regex.Pattern. + * @param y the path where to search for files */ + public String[] elencoFile(final String filter, final String y) { + File f = new File(y); + if (!f.exists() || !f.isDirectory()) // quality control + return null; + return f.list(Mix.fileFilter(filter)); + } + + /** + *

+ * Production of the list of files of a system of directories. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param y input directory + * @return the file list */ + public List fileImmersion(final String y) { + int profondita = 0; + ArrayList fbE = new ArrayList(); + File f = new File(y); + if (!f.exists() || !f.isDirectory()) { + return null; + } + fbE = new ArrayList(); + fileAccumulation(y, fbE, profondita); + return fbE; + } + + private void fileAccumulation(final String y, List fbE, + int profondita) { + File[] aE = fileObjects("\\p{ASCII}+", y); + FileBase fb = null; + for (File a : aE) { + if (a.isDirectory()) { + continue; + } + fb = Mix.analizzaPathBase(a); + fb.depth = profondita; + fbE.add(fb); + } + profondita++; + List bE = dirObjects(y); + for (File c : bE) { + fileAccumulation(c.getPath(), fbE, profondita); + } + } + + /** + *

+ * Production of the list of directories of a system of directories, + * filtered according to a pattern. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-09-08
+ * Last updated: 2020-09-08
+ *

+ * + * @param y input directory + * @param pattern obvious + * @return the file list */ + public List dirImmersion(final String y, + final String pattern) { + int depth = 0; + ArrayList fbE = new ArrayList(); + File f = new File(y); + if (!f.exists() || !f.isDirectory()) { + return null; + } + fbE = new ArrayList(); + dirAccumulation(y, fbE, depth, pattern); + return fbE; + } + + private void dirAccumulation(final String y, List dirE, + int depth, final String pattern) { + File[] aE = fileObjects(pattern, y); + for (File a : aE) { + if (a.isDirectory()) { + dirE.add(a.getPath()); + } + } + depth++; + List bE = dirObjects(y); + for (File c : bE) { + dirAccumulation(c.getPath(), dirE, depth, pattern); + } + } + + /** Class needed to sort files by date */ + class MyComparatorFileModi implements Comparator { + + /** + *

+ * Method of comparison based on the date of the last + * modification of the file. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param f1 first object (file) + * @param f2 second object (file) + * @return minor = -1, major = 1 or equal = 0 */ + @Override + public int compare(File f1, File f2) { + if (f2.lastModified() == f1.lastModified()) + return 0; + else if (f2.lastModified() > f1.lastModified()) + return 1; + else + return -1; + } + } + + /** Class needed to sort files alphabetically by name */ + class MyComparatorFileAlfa implements Comparator { + + /** + *

+ * Method of comparison based on the date of the last + * modification of the file. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param f1 first object (file) + * @param f2 second object (file) + * @return minor = -1, major = 1 or equal = 0 */ + @Override + public int compare(File f1, File f2) { + return f1.getName().compareTo(f2.getName()); + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/ReadMyFile.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/ReadMyFile.java new file mode 100644 index 0000000..4c6ebbc --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/file/ReadMyFile.java @@ -0,0 +1,213 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.file; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Class for reading files. The class should not be instantiated. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni */ + +public class ReadMyFile { + + /** + *

+ * Reading a sequential file. It is intended as structured with + * lines terminated by CR / LF or LF; the method reads the lines on + * a List of strings. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param g file name, complete with path + * @return a List of strings + * @throws FileNotFoundException is triggered when the file does not + * exist + * @throws IOException is triggered when it is not possible to read, + * for any other reason */ + public static List zebra_A(final String g) + + throws IOException, FileNotFoundException { + + List al = new ArrayList(); + al.clear(); + String riga = null; + FileReader fr = null; + try { + fr = new FileReader(g); + } catch (FileNotFoundException enf) { + throw enf; + } + BufferedReader in = new BufferedReader(fr); + do { + try { + riga = in.readLine(); + } catch (IOException eio) { + in.close(); + throw eio; + } + al.add(riga); + } while (riga != null); + in.close(); + al.remove(al.size() - 1); + return al; + } + + /** + *

+ * Reading a sequential file. It is intended as structured with + * lines terminated by CR / LF or LF; the method reads the lines on + * a List of strings. It differs from zebra_A in that it ignores + * empty lines, which therefore do not weigh down the list. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param g file name, complete with path + * @return a List of strings + * @throws FileNotFoundException is triggered when the file does not + * exist + * @throws IOException is triggered when it is not possible to read, + * for any other reason */ + public static List zebra_B(final String g) + + throws IOException, FileNotFoundException { + + List al = new ArrayList(); + String line = null; + FileReader fr = null; + try { + fr = new FileReader(g); + } catch (FileNotFoundException enf) { + throw enf; + } + BufferedReader in = new BufferedReader(fr); + do { + try { + line = in.readLine(); + } catch (IOException eio) { + in.close(); + throw eio; + } + if (line != null && !line.equals("")) { + al.add(line); + } + } while (line != null); + in.close(); + return al; + } + + /** + *

+ * Reading a sequential file. It is intended as structured with + * lines terminated by CR/LF or LF; the method reads the lines on a + * list of strings. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param file the object File to be read + * @param code Unicode code to be adopted + * @return a List of strings + * @throws ExactException standard exception */ + public static List zebra_C(File file, final String code) + + throws ExactException { + + String s = Equipment.oneStringUnicode_A(file, code); + List r = new ArrayList(); + String[] p = s.split("\\x0a"); + for (String q : p) { + if (q.endsWith(Candies.CR)) { + q = q.substring(0, q.length() - 1); + } + r.add(q); + } + return r; + } + + /** + *

+ * As above, but the input provided is a File object. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param f the file object + * @return a List of strings + * @throws FileNotFoundException is triggered when the file does not + * exist + * @throws IOException is triggered when it is not possible to read, + * for any other reason */ + public static List zebra_A(File f) + + throws IOException, FileNotFoundException { + + return zebra_A(f.getPath()); + } + + /** + *

+ * Production of the list of files of a directory, filtered + * according to a pattern. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @return an array list of strings with the found files + * @param x the pattern to filter the files, according to the codes + * of the java.util.regex.Pattern class. + * @param y the path to search for + * @since 1.0.0 files */ + public static List listaFile(final String x, + final String y) { + + // if necessary, I put a slash in the queue + File f = new File(y); + List l = new ArrayList(); + if (!f.exists() || !f.isDirectory()) // quality control + return l; + String[] sl = f.list(Mix.fileFilter(x)); + for (int i = 0; i < sl.length; i++) + l.add(sl[i]); + return l; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/AskForDelete.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/AskForDelete.java new file mode 100644 index 0000000..d0bdce7 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/AskForDelete.java @@ -0,0 +1,301 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.graphic; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Rectangle; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Display class of a message box. It is used simply by calling: new + * Placard (component_owner, message);
+ * or: new Placard (component_owner, message, header); no method needs + * to be invoked. For other details see the constructor. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class AskForDelete extends JDialog { + /** pure formality */ + private static final long serialVersionUID = 1L; + /** the panel containing the whole */ + private JPanel jContentPane = null; + /** the text of the message */ + private final String dispatch; + /** the title to the message */ + private String header = "Message:"; + /* the text-area object */ + private JTextArea textArea; + private int buttonX = 250; + private int buttonY = 250; + private int jdWidth = 607; + private int jdHeight = 350; + private final int taMargin = 18; + private final int taWidth = 565; + private int taHeight = 150; + private final int buWidth = 100; + private final int buHeight = 40; + private final int jdDowelTop = 55; + private final int jdDowelRight = 15; + private final int taDowelTop = 0; + private final int charsEveryLine = 68; + private final int lineFontVerdana16Height = 22; + private final int betweenButtons = 40; + /** the affirmative button */ + private JButton jButtonYes = null; + /** the negative button */ + private JButton jButtonNo = null; + /** says if I pressed yes (true) or not (false) */ + public boolean answer; + /** says if you need to lock the "yes" button */ + private boolean lockButtonYes; + + /** + *

+ * Only public property; warns that the message has been + * forwarded. */ + public boolean reduce; + + /** + *

+ * 2 parameter constructor. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s may be the message to be displayed */ + public AskForDelete(Frame owner, final String s) { + super(owner); + setFont(new Font("Verdana", Font.PLAIN, 15)); + dispatch = s; + initialize(); + } + + /** + *

+ * 3 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s the message to be displayed + * @param t the header of the message */ + public AskForDelete(Frame owner, String s, String t) { + super(owner); + dispatch = s; + header = t; + initialize(); + } + + /** + *

+ * 1 parameter constructor. In this case, the graphic component from + * which the pop-up of the message originates is indeterminate. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param s the message to display */ + public AskForDelete(String s) { + super(new Frame()); + dispatch = s; + initialize(); + } + + /** ordinary initialization */ + private void initialize() { + this.setSize(jdWidth, jdHeight); + // center on the screen + this.setModal(true); + this.setLocationRelativeTo(null); + this.setTitle(header); + this.setContentPane(getJContentPane()); + jButtonYes.setEnabled(!lockButtonYes); + this.setVisible(true); + reduce = true; + } + + /** + *

+ * 4 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself originates; it can be null + * @param s the message to be displayed + * @param t the head of the box + * @param lockButtonYes if it is necessary to block the "Yes" button + * for obvious opportunity */ + public AskForDelete(Frame owner, final String s, final String t, + final boolean lockButtonYes) { + + super(owner); + dispatch = s; + header = t; + this.lockButtonYes = lockButtonYes; + initialize(); + } + + /** This method initializes jContentPane + * + * @return javax.swing.JPanel + * @see #initialize () */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setBackground(new Color(250, 240, 230)); + textArea = new JTextArea(); + textArea.setEditable(false); + textArea.setFont(new Font("Verdana", Font.PLAIN, 16)); + textArea.setWrapStyleWord(true); + textArea.setLineWrap(true); + textArea.setBackground(new Color(250, 240, 230)); + /* estimate of the amount of lines in the message */ + int lineQ = dispatch.length() / charsEveryLine + 1 + Mix + .charQ(dispatch, Candies.LINE_FEED); + taHeight = taDowelTop + lineQ * lineFontVerdana16Height; + textArea.setBounds(taMargin, taMargin, taWidth, taHeight); + textArea.setText(dispatch); + jdWidth = taWidth + taMargin * 2 + jdDowelRight; + jdHeight = taHeight + taMargin * 3 + buHeight + jdDowelTop; + this.setSize(jdWidth, jdHeight); + jContentPane.add(textArea); + jContentPane.add(getJButtonYes(), null); + jContentPane.add(getJButtonNo(), null); + } + return jContentPane; + } + + /** This method initializes jButton Yes + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButtonYes() { + if (jButtonYes == null) { + jButtonYes = new JButton(); + buttonX = (jdWidth - betweenButtons - buWidth * 2) / 2; + buttonY = taMargin * 2 + taHeight; + jButtonYes.setBounds(new Rectangle(buttonX, buttonY, + buWidth, buHeight)); + jButtonYes.setText("Yes"); + jButtonYes.setEnabled(true); // generated + jButtonYes.setFont(new Font("Tahoma", Font.PLAIN, 14)); + jButtonYes.addMouseListener( + new java.awt.event.MouseAdapter() { + public void mouseClicked( + java.awt.event.MouseEvent e) { + if (jButtonYes.isEnabled()) { + jButtonYes_mouseClicked(); + } + } + }); + } + return jButtonYes; + } + + /** + *

+ * I close my box. + *

+ * + * @see #getJButtonYes () */ + private void jButtonYes_mouseClicked() { + answer = true; + dispose(); + } + + /** + *

+ * I close my box. + *

+ * + * @see #getJButtonNo () */ + private void jButtonNo_mouseClicked() { + answer = false; + dispose(); + } + + /** + *

+ * This method initializes jButtonNo. + *

+ * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButtonNo() { + if (jButtonNo == null) { + // try { + jButtonNo = new JButton(); + buttonX = (jdWidth - betweenButtons - buWidth * 2) / 2 + + buWidth + betweenButtons; + buttonY = taMargin * 2 + taHeight; + jButtonNo.setBounds(new Rectangle(buttonX, buttonY, buWidth, + buHeight)); + jButtonNo.setText("No"); // generated + jButtonNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); // generated + jButtonNo.addMouseListener( + new java.awt.event.MouseAdapter() { + public void mouseClicked( + java.awt.event.MouseEvent e) { + jButtonNo_mouseClicked(); + } + }); + } + return jButtonNo; + } +} // @jve: decl-index = 0: visual-constraint = "7.10" \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Dynamics.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Dynamics.java new file mode 100644 index 0000000..5fe4ddb --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Dynamics.java @@ -0,0 +1,53 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.graphic; + +import javax.swing.JLabel; +import javax.swing.JProgressBar; + +/** + *

+ * Simple union of a progress bar and 2 labels, one on the left (named + * head) and one above. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-06-01
+ * Last updated: 2020-06-01 + *

+ *

+ * Changes:
+ *

+ * + * @author M. Maglioni */ +public class Dynamics { + + /** the progress bar */ + public JProgressBar pb; + /** the label, generally above the progress bar */ + public JLabel left; + /** the label on the left */ + public JLabel head; + /** synchrony */ + public ProgressBarAccess access; + /** visibility */ + public boolean visibile = false; + + /** @param pb progress bar object + * @param left label above the progress bar + * @param head label to the left of the progress bar */ + public Dynamics(JProgressBar pb, JLabel left, JLabel head) { + super(); + this.pb = pb; + this.left = left; + this.head = head; + access = new ProgressBarAccess(pb.getBounds(), left.getBounds(), + head.getBounds()); + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Permission.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Permission.java new file mode 100644 index 0000000..58bb102 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Permission.java @@ -0,0 +1,301 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.graphic; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Rectangle; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Display class of a message box. It is used simply by calling: new + * Placard (component_owner, message);
+ * or: new Placard (component_owner, message, header); no method needs + * to be invoked. For other details see the constructor. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class Permission extends JDialog { + /** pure formality */ + private static final long serialVersionUID = 1L; + /** the panel containing the whole */ + private JPanel jContentPane = null; + /** the text of the message */ + private final String dispatch; + /** the title to the message */ + private String header = "Message:"; + /* the text-area object */ + private JTextArea textArea; + private int buttonX = 250; + private int buttonY = 250; + private int jdWidth = 607; + private int jdHeight = 350; + private final int taMargin = 18; + private final int taWidth = 565; + private int taHeight = 150; + private final int buWidth = 100; + private final int buHeight = 40; + private final int jdDowelTop = 55; + private final int jdDowelRight = 15; + private final int taDowelTop = 0; + private final int charsEveryLine = 68; + private final int lineFontVerdana16Height = 22; + private final int betweenButtons = 40; + /** the affirmative button */ + private JButton jButtonYes = null; + /** the negative button */ + private JButton jButtonNo = null; + /** says if I pressed yes (true) or not (false) */ + public boolean answer; + /** says if you need to lock the "yes" button */ + private boolean lockButtonYes; + + /** + *

+ * Only public property; warns that the message has been + * forwarded. */ + public boolean reduce; + + /** + *

+ * 2 parameter constructor. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s may be the message to be displayed */ + public Permission(Frame owner, final String s) { + super(owner); + setFont(new Font("Verdana", Font.PLAIN, 15)); + dispatch = s; + initialize(); + } + + /** + *

+ * 3 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s the message to be displayed + * @param t the header of the message */ + public Permission(Frame owner, String s, String t) { + super(owner); + dispatch = s; + header = t; + initialize(); + } + + /** + *

+ * 1 parameter constructor. In this case, the graphic component from + * which the pop-up of the message originates is indeterminate. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param s the message to display */ + public Permission(String s) { + super(new Frame()); + dispatch = s; + initialize(); + } + + /** ordinary initialization */ + private void initialize() { + this.setSize(jdWidth, jdHeight); + // center on the screen + this.setModal(true); + this.setLocationRelativeTo(null); + this.setTitle(header); + this.setContentPane(getJContentPane()); + jButtonYes.setEnabled(!lockButtonYes); + this.setVisible(true); + reduce = true; + } + + /** + *

+ * 4 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself originates; it can be null + * @param s the message to be displayed + * @param t the head of the box + * @param lockButtonYes if it is necessary to block the "Yes" button + * for obvious opportunity */ + public Permission(Frame owner, final String s, final String t, + final boolean lockButtonYes) { + + super(owner); + dispatch = s; + header = t; + this.lockButtonYes = lockButtonYes; + initialize(); + } + + /** This method initializes jContentPane + * + * @return javax.swing.JPanel + * @see #initialize () */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setBackground(new Color(250, 240, 230)); + textArea = new JTextArea(); + textArea.setEditable(false); + textArea.setFont(new Font("Verdana", Font.PLAIN, 16)); + textArea.setWrapStyleWord(true); + textArea.setLineWrap(true); + textArea.setBackground(new Color(250, 240, 230)); + /* estimate of the amount of lines in the message */ + int lineQ = dispatch.length() / charsEveryLine + 1 + Mix + .charQ(dispatch, Candies.LINE_FEED); + taHeight = taDowelTop + lineQ * lineFontVerdana16Height; + textArea.setBounds(taMargin, taMargin, taWidth, taHeight); + textArea.setText(dispatch); + jdWidth = taWidth + taMargin * 2 + jdDowelRight; + jdHeight = taHeight + taMargin * 3 + buHeight + jdDowelTop; + this.setSize(jdWidth, jdHeight); + jContentPane.add(textArea); + jContentPane.add(getJButtonYes(), null); + jContentPane.add(getJButtonNo(), null); + } + return jContentPane; + } + + /** This method initializes jButton Yes + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButtonYes() { + if (jButtonYes == null) { + jButtonYes = new JButton(); + buttonX = (jdWidth - betweenButtons - buWidth * 2) / 2; + buttonY = taMargin * 2 + taHeight; + jButtonYes.setBounds(new Rectangle(buttonX, buttonY, + buWidth, buHeight)); + jButtonYes.setText("Yes"); + jButtonYes.setEnabled(true); // generated + jButtonYes.setFont(new Font("Tahoma", Font.PLAIN, 14)); + jButtonYes.addMouseListener( + new java.awt.event.MouseAdapter() { + public void mouseClicked( + java.awt.event.MouseEvent e) { + if (jButtonYes.isEnabled()) { + jButtonYes_mouseClicked(); + } + } + }); + } + return jButtonYes; + } + + /** + *

+ * I close my box. + *

+ * + * @see #getJButtonYes () */ + private void jButtonYes_mouseClicked() { + answer = true; + dispose(); + } + + /** + *

+ * I close my box. + *

+ * + * @see #getJButtonNo () */ + private void jButtonNo_mouseClicked() { + answer = false; + dispose(); + } + + /** + *

+ * This method initializes jButtonNo. + *

+ * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButtonNo() { + if (jButtonNo == null) { + // try { + jButtonNo = new JButton(); + buttonX = (jdWidth - betweenButtons - buWidth * 2) / 2 + + buWidth + betweenButtons; + buttonY = taMargin * 2 + taHeight; + jButtonNo.setBounds(new Rectangle(buttonX, buttonY, buWidth, + buHeight)); + jButtonNo.setText("No"); // generated + jButtonNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); // generated + jButtonNo.addMouseListener( + new java.awt.event.MouseAdapter() { + public void mouseClicked( + java.awt.event.MouseEvent e) { + jButtonNo_mouseClicked(); + } + }); + } + return jButtonNo; + } +} // @jve: decl-index = 0: visual-constraint = "7.10" \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Placard.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Placard.java new file mode 100644 index 0000000..6481188 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Placard.java @@ -0,0 +1,209 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.graphic; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Rectangle; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Display class of a message box. It is used simply by calling: new + * Placard (component_owner, message);
+ * or: new Placard (component_owner, message, header); no method needs + * to be invoked. For other details see the constructor. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @author M. Maglioni */ +public class Placard extends JDialog { + /** pure formality */ + private static final long serialVersionUID = 1L; + /** the panel containing the whole */ + private JPanel jContentPane = null; + /** the OK button */ + private JButton jButton = null; + /** the text of the message */ + private final String dispatch; + /** the title to the message */ + private String header = "Message:"; + /* the text-area object */ + private JTextArea textArea; + private int buttonX = 250; + private int buttonY = 250; + private int jdWidth = 607; + private int jdHeight = 350; + private final int taMargin = 18; + private final int taWidth = 565; + private int taHeight = 150; + private final int buWidth = 100; + private final int buHeight = 40; + private final int jdDowelTop = 55; + private final int jdDowelRight = 15; + private final int taDowelTop = 0; + private final int charsEveryLine = 68; + private final int lineFontVerdana16Height = 22; + + /** + *

+ * Only public property; warns that the message has been + * forwarded. */ + public boolean reduce; + + /** + *

+ * 2 parameter constructor. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s may be the message to be displayed */ + public Placard(Frame owner, final String s) { + super(owner); + setFont(new Font("Verdana", Font.PLAIN, 15)); + dispatch = s; + initialize(); + } + + /** + *

+ * 3 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s the message to be displayed + * @param t the header of the message */ + public Placard(Frame owner, String s, String t) { + super(owner); + dispatch = s; + header = t; + initialize(); + } + + /** + *

+ * 1 parameter constructor. In this case, the graphic component from + * which the pop-up of the message originates is indeterminate. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param s the message to display */ + public Placard(String s) { + super(new Frame()); + dispatch = s; + initialize(); + } + + /** ordinary initialization */ + private void initialize() { + this.setSize(jdWidth, jdHeight); + // center on the screen + this.setModal(true); + this.setLocationRelativeTo(null); + this.setTitle(header); + this.setContentPane(getJContentPane()); + this.setVisible(true); + reduce = true; + } + + /** This method initializes jContentPane + * + * @return javax.swing.JPanel + * @see #initialize () */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setBackground(new Color(250, 240, 230)); + textArea = new JTextArea(); + textArea.setEditable(false); + textArea.setFont(new Font("Verdana", Font.PLAIN, 16)); + textArea.setWrapStyleWord(true); + textArea.setLineWrap(true); + textArea.setBackground(new Color(250, 240, 230)); + /* estimate of the amount of lines in the message */ + int lineQ = dispatch.length() / charsEveryLine + 1 + Mix + .charQ(dispatch, Candies.LINE_FEED); + taHeight = taDowelTop + lineQ * lineFontVerdana16Height; + textArea.setBounds(taMargin, taMargin, taWidth, taHeight); + textArea.setText(dispatch); + jdWidth = taWidth + taMargin * 2 + jdDowelRight; + jdHeight = taHeight + taMargin * 3 + buHeight + jdDowelTop; + this.setSize(jdWidth, jdHeight); + jContentPane.add(textArea); + jContentPane.add(getJButton(), null); + } + return jContentPane; + } + + /** This method initializes jButton + * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButton() { + if (jButton == null) { + jButton = new JButton(); + buttonX = (jdWidth - buWidth) / 2; + buttonY = taMargin * 2 + taHeight; + jButton.setBounds(new Rectangle(buttonX, buttonY, buWidth, + buHeight)); + jButton.setText("OK"); + jButton.setFont(new Font("Arial", Font.PLAIN, 16)); + jButton.addMouseListener(new java.awt.event.MouseAdapter() { + @Override + public void mouseClicked(java.awt.event.MouseEvent e) { + jButton_mouseClicked(); + } + }); + } + return jButton; + } + + /** + *

+ * I close the box. + *

+ * + * @see #getJButton */ + private void jButton_mouseClicked() { + dispose(); + } +} // @jve: decl-index = 0: visual-constraint = "7.10" \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/ProgressBarAccess.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/ProgressBarAccess.java new file mode 100644 index 0000000..81a353d --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/ProgressBarAccess.java @@ -0,0 +1,69 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.graphic; + +import java.awt.Rectangle; + +/** + *

+ * Simple container of 2 auxiliary rectangles for the management of the + * progress bars. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ * 2020-04-09: stabilization on ver. 1.0.0
+ *

+ * + * @author M. Maglioni */ + +public class ProgressBarAccess { + /** rectangle for managing the progress bar */ + public Rectangle bar = new Rectangle(); + /** rectangle for label management */ + public Rectangle sinistra = new Rectangle(); + /** rectangle for label management on the left of the bar */ + public Rectangle testa = new Rectangle(); + + /** useful constructor + * + * @param barx the rectangle for the progress bar + * @param leftx the rectangle for the label + * @param testax the rectangle for the label to the left of the + * bar */ + public ProgressBarAccess(Rectangle barx, Rectangle leftx, + Rectangle testax) { + bar = barx; + sinistra = leftx; + testa = testax; + bar.x = 0; + bar.y = 0; + sinistra.x = 0; + sinistra.y = 0; + testa.x = 0; + testa.y = 0; + } + + /** useful constructor + * + * @param barx the rectangle for the progress bar + * @param leftx the rectangle for the label on the left of the + * bar */ + public ProgressBarAccess(Rectangle barx, Rectangle leftx) { + bar = barx; + sinistra = leftx; + bar.x = 0; + bar.y = 0; + sinistra.x = 0; + sinistra.y = 0; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Remember.java b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Remember.java new file mode 100644 index 0000000..fdf3ec8 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/salad/graphic/Remember.java @@ -0,0 +1,326 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.salad.graphic; + +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Rectangle; + +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; +import javax.swing.JCheckBox; +import javax.swing.event.ChangeListener; +import javax.swing.event.ChangeEvent; + +/** + *

+ * Display class of a message box. It is used simply by calling: new + * Placard (component_owner, message);
+ * or: new Placard (component_owner, message, header); no method needs + * to be invoked. For other details see the constructor. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-10 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +public class Remember extends JDialog { + /** pure formality */ + private static final long serialVersionUID = 1L; + /** the panel containing the whole */ + private JPanel jContentPane = null; + /** the text of the message */ + private final String dispatch; + /** the title to the message */ + private String header = "Message:"; + /* the text-area object */ + private JTextArea textArea; + private int buttonX = 250; + private int buttonY = 250; + private int jdWidth = 607; + private int jdHeight = 350; + private final int taMargin = 18; + private final int taWidth = 565; + private int taHeight = 150; + private final int buWidth = 100; + private final int buHeight = 40; + private final int checkX = 20; + private int checkY = 100; + private final int chWidth = 120; + private final int chHeight = 20; + private final int jdDowelTop = 55; + private final int jdDowelRight = 15; + private final int taDowelTop = 0; + private final int charsEveryLine = 68; + private final int lineFontVerdana16Height = 22; + private final int betweenButtons = 40; + /** the affirmative button */ + private JButton jButtonYes = null; + /** the negative button */ + private JButton jButtonNo = null; + /** says if you need to lock the "yes" button */ + private boolean lockButtonYes; + /** check-box Remember */ + private JCheckBox chckbxNewCheckBox; + // PUBLIC + /** says if I pressed yes (true) or not (false) */ + public boolean[] answer = { false, false }; + + /** + *

+ * Only public property; warns that the message has been + * forwarded. */ + public boolean reduce; + + /** + *

+ * 2 parameter constructor. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s may be the message to be displayed + * @wbp.parser.constructor */ + public Remember(Frame owner, final String s) { + super(owner); + setFont(new Font("Verdana", Font.PLAIN, 15)); + dispatch = s; + initialize(); + } + + /** + *

+ * 3 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Changes:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself is born; + * @param s the message to be displayed + * @param t the header of the message */ + public Remember(Frame owner, String s, String t) { + super(owner); + dispatch = s; + header = t; + initialize(); + } + + /** + *

+ * 1 parameter constructor. In this case, the graphic component from + * which the pop-up of the message originates is indeterminate. + *

+ *

+ * creation: 2020-04-09
+ * last modification: 2020-04-09
+ *

+ * Changes:
+ *

+ * + * @param s the message to display */ + public Remember(String s) { + super(new Frame()); + dispatch = s; + initialize(); + } + + /** ordinary initialization */ + private void initialize() { + this.setSize(jdWidth, jdHeight); + // center on the screen + this.setModal(true); + this.setLocationRelativeTo(null); + this.setTitle(header); + this.setContentPane(getJContentPane()); + jButtonYes.setEnabled(!lockButtonYes); + this.setVisible(true); + reduce = true; + } + + /** + *

+ * 4 parameter constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param owner the graphic component from which the pop-up of the + * message itself originates; it can be null + * @param s the message to be displayed + * @param t the head of the box + * @param lockButtonYes if it is necessary to block the "Yes" button + * for obvious opportunity */ + public Remember(Frame owner, final String s, final String t, + final boolean lockButtonYes) { + + super(owner); + dispatch = s; + header = t; + this.lockButtonYes = lockButtonYes; + initialize(); + } + + /** This method initializes jContentPane + * + * @return javax.swing.JPanel + * @see #initialize () */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.setBackground(new Color(250, 240, 230)); + textArea = new JTextArea(); + textArea.setEditable(false); + textArea.setFont(new Font("Verdana", Font.PLAIN, 16)); + textArea.setWrapStyleWord(true); + textArea.setLineWrap(true); + textArea.setBackground(new Color(250, 240, 230)); + /* estimate of the amount of lines in the message */ + int lineQ = dispatch.length() / charsEveryLine + 1 + Mix + .charQ(dispatch, Candies.LINE_FEED); + taHeight = taDowelTop + lineQ * lineFontVerdana16Height; + textArea.setBounds(taMargin, taMargin, taWidth, taHeight); + textArea.setText(dispatch); + jdWidth = taWidth + taMargin * 2 + jdDowelRight; + jdHeight = taHeight + taMargin * 3 + buHeight + jdDowelTop; + this.setSize(jdWidth, jdHeight); + jContentPane.add(textArea); + jContentPane.add(getJButtonYes(), null); + jContentPane.add(getJButtonNo(), null); + + chckbxNewCheckBox = new JCheckBox("Remember"); + chckbxNewCheckBox.addChangeListener(new ChangeListener() { + public void stateChanged(ChangeEvent e) { + answer[1] = chckbxNewCheckBox.isSelected(); + } + }); + chckbxNewCheckBox.setFont(new Font("Verdana", Font.PLAIN, + 12)); + chckbxNewCheckBox.setToolTipText("Please ask me no more"); + checkY = taMargin * 2 + taHeight + buHeight / 3; + chckbxNewCheckBox.setBounds(checkX, checkY, chWidth, + chHeight); + jContentPane.add(chckbxNewCheckBox); + } + return jContentPane; + } + + /** This method initializes jButton Yes + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButtonYes() { + if (jButtonYes == null) { + jButtonYes = new JButton(); + buttonX = (jdWidth - betweenButtons - buWidth * 2) / 2; + buttonY = taMargin * 2 + taHeight; + jButtonYes.setBounds(new Rectangle(buttonX, buttonY, + buWidth, buHeight)); + jButtonYes.setText("Yes"); + jButtonYes.setEnabled(true); // generated + jButtonYes.setFont(new Font("Tahoma", Font.PLAIN, 14)); + jButtonYes.addMouseListener( + new java.awt.event.MouseAdapter() { + public void mouseClicked( + java.awt.event.MouseEvent e) { + if (jButtonYes.isEnabled()) { + jButtonYes_mouseClicked(); + } + } + }); + } + return jButtonYes; + } + + /** + *

+ * I close my box. + *

+ * + * @see #getJButtonYes () */ + private void jButtonYes_mouseClicked() { + answer[0] = true; + dispose(); + } + + /** + *

+ * I close my box. + *

+ * + * @see #getJButtonNo () */ + private void jButtonNo_mouseClicked() { + answer[0] = false; + dispose(); + } + + /** + *

+ * This method initializes jButtonNo. + *

+ * + * @return javax.swing.JButton + * @see #getJContentPane () */ + private JButton getJButtonNo() { + if (jButtonNo == null) { + // try { + jButtonNo = new JButton(); + buttonX = (jdWidth - betweenButtons - buWidth * 2) / 2 + + buWidth + betweenButtons; + buttonY = taMargin * 2 + taHeight; + jButtonNo.setBounds(new Rectangle(buttonX, buttonY, buWidth, + buHeight)); + jButtonNo.setText("No"); // generated + jButtonNo.setFont(new Font("Tahoma", Font.PLAIN, 14)); // generated + jButtonNo.addMouseListener( + new java.awt.event.MouseAdapter() { + public void mouseClicked( + java.awt.event.MouseEvent e) { + jButtonNo_mouseClicked(); + } + }); + } + return jButtonNo; + } +} // @jve: decl-index = 0: visual-constraint = "7.10" \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/CandyScrew.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/CandyScrew.java new file mode 100644 index 0000000..c77d42b --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/CandyScrew.java @@ -0,0 +1,216 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.StartingOperations; + +/** + *

+ * Treatment of property data. This data is conventionally called + * candies. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-04-09
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class CandyScrew implements Candies { + + /** application name */ + public String appName; + /** ELE file */ + public String ele; + /** input files */ + public File inputG; + /** input directory */ + public String inputYS; + /** input directory */ + public File inputY; + /** output directory */ + public String outputYS; + /** output directory, as a file */ + public File outputY; + /** box directory, contains everything you need to work */ + public String boxYS = "box"; + /** box directory, as a file */ + public File boxY; + /** include directory */ + public String includeYS; + /** include directory, as a file */ + public File includeY; + /** snippets directory */ + public String snippetsYS; + /** snippets directory, as a file */ + public File snippetsY; + /** if I encode the methods already in the .ele file */ + public boolean inside; + /** name of a file that must not be modified at all */ + public String freezeS; + /** the names of the files that must not be changed at all */ + public List freezeE = new ArrayList(); + /** the names of the files that must not be changed at all */ + public List freezeDueE = new ArrayList(); + /** the names of the files that need to be changed, however asking + * for permission */ + // public List bullDozerE = new ArrayList (); + + /** the list of properties */ + public Properties properties; + + /** + *

+ * Reads the properties file. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-24
+ *

+ *

+ * Modifications:
+ *

+ * + * @param fileProperties name of properties file + * + * @throws ExactException objects if the data contained in the + * properties file is incorrect */ + public void readProperties(String fileProperties) + + throws ExactException { + + String prop = fileProperties + ".properties"; + Path pp = new File(prop).toPath(); + if (!Files.exists(pp)) { + throw new ExactException("The file " + Mix.dress_A(prop) + + " does not exist.", 1400, this.getClass() + .getName(), ""); + } else if (Files.isDirectory(pp)) { + throw new ExactException("The file " + Mix.dress_A(prop) + + " is not actually a directory.", 1401, this + .getClass().getName(), ""); + } + properties = StartingOperations.myProperties(prop, true); + inputYS = StartingOperations.whetherPresent(properties, + Cst.DIRE_INPUT); + inputY = new File(inputYS); + if (!inputY.exists()) { + throw new ExactException("The directory «" + inputYS + + "» does not exist.", 1400, this.getClass() + .getName(), ""); + } else if (!inputY.isDirectory()) { + throw new ExactException("The directory «" + inputYS + + "» is not actually a directory.", 1401, this + .getClass().getName(), ""); + } + inputYS = Mix.dress_CU(inputYS); + inputG = new File(inputYS + ele); + if (!inputG.exists()) { + throw new ExactException("The file «" + ele + + "» does not exist.", 1402, this.getClass() + .getName(), ""); + } else if (!inputG.isFile()) { + throw new ExactException("The file «" + appName + + "» non è in realtà un file.", 1403, this + .getClass().getName(), ""); + } + outputYS = StartingOperations.whetherPresent(properties, + Cst.DIR_OUTPUT); + outputY = new File(outputYS); + if (!outputY.exists()) { + throw new ExactException("The directory «" + outputY + + "» does not exist.", 1404, this.getClass() + .getName(), ""); + } else if (!outputY.isDirectory()) { + throw new ExactException("The directory «" + outputYS + + "» is not actually a directory.", 1405, this + .getClass().getName(), ""); + } + outputYS = Mix.dress_CU(outputYS); + boxYS = "box"; + boxY = new File(inputYS + boxYS); + if (!boxY.exists()) { + throw new ExactException("The directory «" + boxY + + "» does not exist.", 1408, this.getClass() + .getName(), ""); + } else if (!boxY.isDirectory()) { + throw new ExactException("The directory «" + boxYS + + "» is not actually a directory.", 1409, this + .getClass().getName(), ""); + } + boxYS = Mix.dress_CU(boxYS); + includeYS = boxYS + "include/"; + includeY = new File(includeYS); + snippetsYS = boxYS + "snippets/"; + snippetsY = new File(snippetsYS); + inside = StartingOperations.propertyPresenteBoolean(properties, + Cst.INSIDE); + freezeS = properties.getProperty(Cst.FREEZE); + if (freezeS != null) { + String[] fE = null; + fE = freezeS.split("\\x2c"); // x2c is the comma + for (int i = 0; i < fE.length; i++) { + freezeE.add(fE[i].trim()); + } + } + } + + /** + *

+ * Reads the properties file. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Modifications:
+ *

+ * + * @return the total string produced */ + @Override + public String toString() { + String s = ""; + s += Candies.LF + Candies.LF; + s += Cst.CUT0; + s += "DATA PRESENT IN PROPERTIES, INCLUDING THE DERIVATIVE ONES" + + Candies.LF; + s += Cst.CUT0; + s += "input file, only the file name: " + appName + Candies.LF; + s += "input file: " + inputG.getPath() + Candies.LF; + ; + s += "input directory: " + inputYS + Candies.LF; + s += "input directory, as file: " + inputY.getPath() + + Candies.LF; + s += "output directory: " + outputYS + Candies.LF; + s += "output directory, as file: " + outputY.getPath() + + Candies.LF; + s += "include directory: " + includeYS + Candies.LF; + s += "include directory, as file: " + includeY.getPath() + + Candies.LF; + s += "snippets directory: " + snippetsYS + Candies.LF; + s += "snippets directory, as file: " + snippetsY.getPath() + + Candies.LF; + s += Candies.LF; + return s; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Cst.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Cst.java new file mode 100644 index 0000000..94c1673 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Cst.java @@ -0,0 +1,112 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * List of constants. + *

+ *

+ * Creation date: 2020-04-09
+ * modification date: 2020-06-03
+ * Company: Rameceraâ„¢ + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class Cst { + /** property label */ + public static final String FILE_INPUT = "input file"; + /** property label */ + public static final String DIRE_INPUT = "input_directory"; + /** property label */ + public static final String DIR_OUTPUT = "output_directory"; + // VARIOUS + /** label for DB tables */ + public static final String RAIL = "rail"; + /** label for DB tables */ + public static final String RAILU = Mix.uppercaseFirstChar(RAIL); + /** label for DB tables */ + public static final String IRAILU = "I" + RAILU; + /** type of JSP */ + public static final int PLAIN = 0; + /** type of JSP */ + public static final String PLAINU = "Plain"; + /** type of JSP */ + public static final String PLAINX = "plain"; + /** type of JSP */ + public static final int MESSAGE = 9; + /** type of JSP */ + public static final int FORM = 1; + /** type of JSP */ + public static final String FORMX = "form"; + /** type of JSP */ + public static final String FORMU = "Form"; + /** type of JSP */ + public static final int MODEL = 2; + /** type of JSP */ + public static final String MODELX = "model"; + /** type of JSP */ + public static final String MODELU = "Model"; + /** control type */ + public static final String TEXT_BOX = "text box"; + /** control type */ + public static final String TEXT_AREA = "text area"; + /** control type */ + public static final String CHECK_BOX = "check box"; + /** control type */ + public static final String LIST_BOX = "list box"; + /** control type */ + public static final String RADIO_BUTTON = "radio button"; + /** control type list */ + public static final String[] controlE = { Cst.TEXT_BOX, + Cst.TEXT_AREA, Cst.CHECK_BOX, Cst.LIST_BOX, + Cst.RADIO_BUTTON }; + /** type of JSP */ + public static final String JX[] = { Cst.PLAINX, Cst.FORMX, + Cst.MODELX }; + /** type of JSP */ + public static final String JU[] = { Cst.PLAINU, Cst.FORMU, + Cst.MODELU }; + /** type of LDAP server */ + public static final String APACHE_DIRECTORY_SERVER = "ApacheDS"; + /** cut n. 0 */ + public static final String CUT0 = "----------------------------------------------------" + + Candies.LF; + /** cut n. 1 */ + public static final String CUT1 = "............................................" + + Candies.LF; + /** cut n. 2 */ + public static final String CUT2 = " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + + Candies.LF; + /** cut n. 2 */ + public static final String CUT3 = " ****************************************************" + + Candies.LF; + /** list of JSP types */ + public static final String[] TIPO_JSPE = { PLAINU, FORMU, MODELU }; + /** if I encode the methods inside the .ele file */ + public static final String INSIDE = "inside"; + /** if I encode the methods inside the .ele file */ + public static final String FREEZE = "freeze"; + // CONSTANTS + /** constant to enter code manually */ + public static final String KNIFE = "screwdriver_knife"; + /** constant to enter code manually */ + public static final String LOWER = "screwdriver_lower"; + /** constant to enter code manually */ + public static final String UPPER = "screwdriver_upper"; + /** magic strings */ + public static final String MAGIC0 = "XXXSCREWXXX"; + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/ElementaryFile.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/ElementaryFile.java new file mode 100644 index 0000000..d00250f --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/ElementaryFile.java @@ -0,0 +1,2397 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Abacus; +import it.ramecera.salad.file.Equipment; +import it.ramecera.salad.file.Folder; +import it.ramecera.salad.file.ReadMyFile; +import it.ramecera.salad.graphic.AskForDelete; +import it.ramecera.screwdriver.component.Base_jsp; +import it.ramecera.screwdriver.component.Bootstrap_css; +import it.ramecera.screwdriver.component.ControllerBelong_java; +import it.ramecera.screwdriver.component.Dispatcher_xml; +import it.ramecera.screwdriver.component.FileComponent; +import it.ramecera.screwdriver.component.GenericModel_java; +import it.ramecera.screwdriver.component.Hoof; +import it.ramecera.screwdriver.component.ImplementTabellaService_java; +import it.ramecera.screwdriver.component.ImplementTableDao_java; +import it.ramecera.screwdriver.component.InterfaceTabellaService_java; +import it.ramecera.screwdriver.component.InterfaceTableDao_java; +import it.ramecera.screwdriver.component.JspFormImpl_java; +import it.ramecera.screwdriver.component.JspForm_java; +import it.ramecera.screwdriver.component.JspPlainImpl_java; +import it.ramecera.screwdriver.component.JspPlain_java; +import it.ramecera.screwdriver.component.Navigation_jsp; +import it.ramecera.screwdriver.component.Orm_xml; +import it.ramecera.screwdriver.component.Pom_properties; +import it.ramecera.screwdriver.component.Pom_xml; +import it.ramecera.screwdriver.component.Quartz_job_xml; +import it.ramecera.screwdriver.component.Screwdriver_css; +import it.ramecera.screwdriver.component.Screwdriver_cssC; +import it.ramecera.screwdriver.component.Service_xml; +import it.ramecera.screwdriver.component.SpringProperties_xml; +import it.ramecera.screwdriver.component.SpringSecurity_xml; +import it.ramecera.screwdriver.component.Tiles_xml; +import it.ramecera.screwdriver.component.UserAuthenticationProvider_java; +import it.ramecera.screwdriver.component.UserContextImpl_java; +import it.ramecera.screwdriver.component.Web_xml; +import it.ramecera.screwdriver.component.Webflow_xml; +import it.ramecera.screwdriver.outfits.ControllerBelong; +import it.ramecera.screwdriver.outfits.DBPlaceKit; +import it.ramecera.screwdriver.outfits.JspBeanElement; +import it.ramecera.screwdriver.outfits.JspKit; +import it.ramecera.screwdriver.outfits.MenuKit; +import it.ramecera.screwdriver.outfits.RequestMap; +import it.ramecera.screwdriver.outfits.TableOutfit; +import it.ramecera.screwdriver.utilities.ValidConstScrew; + +/** + *

+ * The jspType ele file object. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * modification date: 2020-09-15
+ *

+ *

+ * History:
+ * The description of N# is in project plan report
+ * 2020-09-03 implementation of N3
+ * 2020-09-09 implementation of N8
+ *

+ * + * @author M. Maglioni */ + +final public class ElementaryFile { + + // PUBLIC + + /** the list of available markups */ + public HashMap markupE; + /** external properties */ + public CandyScrew candies; + /** list of trains */ + public List trainE = new ArrayList(); + /** application name according to Maven, is also the 3rd qualifier + * of the package after the company's internet domain (e.g. + * it.ramecera) */ + public String appName; + + // PRIVATE + + /** number of lines in the elementary file */ + private int zQ; + /** the stub of the row */ + private String stub = null; + private int posizioneVisiva = 1; + private Train train; + private String securityY = null, newLdap = null, newResolver = null, + newAnnotation = null, recycleBinY = null; + private String new5 = null, new58 = null, new581 = null, + new582 = null, new583 = null, new60 = null, new61 = null, + new62 = null, new63 = null, new71 = null, new72 = null, + new73 = null, new721 = null, new722 = null, new723 = null; + private String new513 = null, brickAuthenticationY = null, + brickAuthenticationAuthorityY = null, new515 = null, + new516 = null, new518 = null, new519 = null, domainY = null; + private Skill skill; + private Train ultimaJsp; + private JspKit kitLastJsp = null; + private Train lastDeclaredMenu; + private String stat = ""; + + // COMPONENTS + + private FileComponent genericRailDaoImpl; + private FileComponent service_xml; + private FileComponent orm_xml; + private FileComponent web_xml; + private FileComponent pom_properties; + private FileComponent quartz_job_xml; + private FileComponent webflow_xml; + private FileComponent pom_xml; + private FileComponent springProps_xml; + private FileComponent springSecurity_xml; + private FileComponent dispatcher_xml; + private FileComponent baseJsp; + private FileComponent headerJsp; + private FileComponent footerJsp; + private FileComponent quartzJob_java; + private FileComponent quartzTask_java; + private FileComponent quartzTaskImpl_java; + private FileComponent tiles_xml; + private FileComponent doorControllerBelong_java; + private FileComponent genericCrud_java; + private FileComponent controllerBelong_java; + private FileComponent jspForm_java; + private FileComponent jspFormImpl_java; + private FileComponent userAuthenticationProvider_java; + private FileComponent jspPlain_java; + private FileComponent jspPlainImpl_java; + private FileComponent genericModel_java; + private FileComponent bootstrap_css; + private FileComponent screwdriver_css; + private FileComponent screwdriver_cssC; + private FileComponent[] navigation_jsps; + private FileComponent springSecurityUserContext; + private FileComponent userAuthorityUtils; + private FileComponent interfacciaUserContext; + private FileComponent king; + private FileComponent kingDao; + private FileComponent kingDaoImpl; + private FileComponent userContextImpl; + + private static final String sep = System.getProperty( + "file.separator"); + /** ordinary logger */ + private static final Logger logger = Logger.getLogger( + ElementaryFile.class); + + // CONSTANTS + + // CONSTRUCTORS + + /** + *

+ * The markups list is forfeited with this constructor. + *

+ * + * @param markupE list of available markup + * @param candies external properties */ + public ElementaryFile(HashMap markupE, + CandyScrew candies) { + this.markupE = markupE; + this.candies = candies; + } + + // PUBLIC METHODS + + /** + *

+ * Reading and accommodation of all markups. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param inputY input directory + * @param inputF input file for conversion + * @param includeY directory containing the files include + * @throws ExactException exception specified by a numeric code */ + final public void trainFactory(final String inputY, + final String inputF, final String includeY) + + throws ExactException { + + List zebra; + ExactException ne = new ExactException(); + try { + zebra = ReadMyFile.zebra_A(inputY + inputF); + int zebraQ = zebra.size(); + if (zebraQ == 0) { + ne.code = 1703; + ne.datum = "The file " + Mix.dress_A(inputF) + + " is empty."; + ne.className = this.getClass().getName(); + throw ne; + } + trainE = composeTrains(zebra, includeY); + logger.trace(trainE_toString(trainE, markupE)); + logger.trace(Hammer.markupE_toString(markupE)); + } catch (IOException e) { + ne.code = 1704; + ne.datum = "Error acceding file " + Mix.dress_A(inputF) + + "."; + ne.className = this.getClass().getName(); + throw ne; + } + } + + /** + *

+ * To convert a train sequence into a maven-spring application. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-15 + *

+ *

+ * History:
+ * The description of N# is in project plan report.
+ * 2020-09-14 implementation of N16.
+ *

+ * + * @throws ExactException exception specified by a numeric code + * @throws FileNotFoundException a standard exception + * @throws IOException a standard exception */ + final public void convert() + + throws ExactException, FileNotFoundException, IOException { + + skill = new Skill(candies); + String initial = candies.outputYS + appName + "/src/main/java"; + File myApp = new File(initial); + if (myApp.exists()) { + Folder folder = new Folder(); + skill.initialDirE = folder.dirImmersion(initial, ".+"); + } + logger.trace(Candies.LF + "INITIAL DIRECTORIES"); + for (String s : skill.initialDirE) { + logger.debug(s); + } + /* FUTURE RELEASE N6 */ + // if (markupE.get("hddl").occorrenzaE.size() == 1) { + // skill.ddl = (String[]) markupE.get("hddl").occorrenzaE.get( + // 0).locomotor.substance; + // } + @SuppressWarnings("unused") + boolean done = false; + skill.factory_A(markupE, trainE, candies); + recycleBinY = candies.boxYS + "recycleBin"; + File recycleBin = new File(recycleBinY); + directoriesFactory_B(); + componentsInstanceExecution(); + pom_xml.directory(markupE); + fileModelPositions(); + + /* THE NECESSARY DIRECTORIES */ + genericModel_java.directory(markupE); + webflow_xml.directory(markupE); + controllerBelong_java.directory(markupE); + /* add Notice.java */ + FileComponent.addClass("Notice.java", + skill.javaWebModelUtilityY, "Notice.java", candies, + recycleBinY, skill, -1, markupE, "java"); + if (skill.antiSamy) { + FileComponent.addClass("CrossSiteScriptingFilter.java", + new513, "CrossSiteScriptingFilter.java", candies, + recycleBinY, skill, -1, markupE, "java"); + FileComponent.addClass("JsessionIdRemoveFilter.java", + new513, "JsessionIdRemoveFilter.java", candies, + recycleBinY, skill, -1, markupE, "java"); + FileComponent.addClass("HttpRequestWrapper.java", new519, + "HttpRequestWrapper.java", candies, recycleBinY, + skill, -1, markupE, "java"); + FileComponent.addClass("AntiSamyListener.java", new515, + "AntiSamyListener.java", candies, recycleBinY, + skill, -1, markupE, "java"); + FileComponent.addClass("XssSanitizer.java", new518, + "XssSanitizer.java", candies, recycleBinY, skill, + -1, markupE, "java"); + FileComponent.addFile("policy.xml", "policy.xml", new518, + candies, recycleBinY, skill); + } else { + new File(new513 + "/" + "CrossSiteScriptingFilter.java") + .delete(); + new File(new513 + "/" + "JsessionIdRemoveFilter.java") + .delete(); + new File(new519 + "/" + "HttpRequestWrapper.java").delete(); + new File(new515 + "/" + "AntiSamyListener.java").delete(); + /* I don't want antisamy, so the web / sanitizer directory + * should be deleted */ + if (new File(new518).exists()) { + Abacus.destroyDirectory(new518); + done = new File(new518).delete(); + } + } + if (skill.ldap) { + FileComponent.addFile("security-ldap-explicitly.xml", + "security-ldap-explicitly.xml", new71, candies, + recycleBinY, skill); + } else { + new File(new71 + "/" + "security-ldap-explicitly.xml") + .delete(); + } + + /* THE SUMMARY */ + + // BASEJSP - 1st LOOP ON JSP + + logger.trace(Candies.LF + Cst.CUT0 + "1° LOOP OVER JSP" + + Candies.LF + Cst.CUT0); + for (int i = 0; i < markupE.get("jsp").recurrenceE + .size(); i++) { + Train f = markupE.get("jsp").recurrenceE.get(i); + baseJsp.jspKit = ((JspKit) f.locomotor.substance); + baseJsp.jspKit.classeCss = f.wagonE.get("cssclass").text; + logger.trace(baseJsp.jspKit.toString()); + + // FORM + /* if there are graphic controls the JSP type is 1 (form), + * otherwise it takes the type of the first request map */ + if (baseJsp.jspKit.controlE.size() > 0) { + baseJsp.jspKit.jspType = Cst.FORM; + } else if (baseJsp.jspKit.requestMapE.size() == 0) { + baseJsp.jspKit.jspType = Cst.MESSAGE; + } else { + baseJsp.jspKit.jspType = baseJsp.jspKit.requestMapE.get( + 0).tipo; + } + if (baseJsp.jspKit.crud + & baseJsp.jspKit.jspType != Cst.FORM) { + ExactException ne = new ExactException(); + String messaggio = "Per la JSP «" + f.locomotor.text + + "» si dichiara il CRUD, ma non è un form;" + + " occorre specificare i tag formX+."; + ne.code = 1709; + ne.datum = messaggio; + ne.className = this.getClass().getName(); + throw ne; + } + // BELONG + Wagon v = f.wagonE.get("belong"); + if (v != null) { + // x2c is the comma + String[] partecipaE = v.text.split("\\x2c"); + for (String p : partecipaE) { + int m = 0; + p = p.trim(); + List propertyE = baseJsp.jspKit.stringPropertyE; + for (; m < propertyE.size(); m++) { + if (p.equals(propertyE.get(m).name)) { + break; + } + } + if (m == propertyE.size()) { + /* if I haven't found it among the ordinary + * properties, then I look for it among the + * array properties */ + List propertiesArrayE = baseJsp.jspKit.arrayStringPropertyE; + int mm = 0; + for (; mm < propertiesArrayE.size(); mm++) { + if (p.equals(propertiesArrayE.get( + mm).name)) { + break; + } + } + if (mm == propertiesArrayE.size()) { + ExactException ne = new ExactException(); + String messaggio = "For the JSP «" + Mix + .dress_A(f.locomotor.text) + + " is declared a value of belong " + + Mix.dress_A(v.text) + + " not present in its bean properties."; + ne.code = 1740; + ne.datum = messaggio; + ne.className = this.getClass().getName(); + throw ne; + } else { + propertiesArrayE.get(mm).participate = true; + } + } else { + propertyE.get(m).participate = true; + } + } + } + // BMENU + if (f.wagonE.get("bmenu") != null) { + baseJsp.jspKit.navigationBar = f.wagonE.get( + "bmenu").text; + int j = 0; + for (; j < markupE.get("bdefmenu").recurrenceE + .size(); j++) { + if (markupE.get("bdefmenu").recurrenceE.get( + j).locomotor.text.equals(f.wagonE.get( + "bmenu").text)) { + break; + } + } + if (j == markupE.get("bdefmenu").recurrenceE.size()) { + ExactException ce = new ExactException(); + String messaggio = "The data " + Mix.dress_A( + f.wagonE.get("bmenu").text) + + " in markup «bmenu» does not " + + "correspond to any menu definition"; + ce.code = 1711; + ce.datum = messaggio; + ce.className = this.getClass().getName(); + } else { + baseJsp.jspKit.menuKit = (MenuKit) markupE.get( + "bdefmenu").recurrenceE.get( + j).locomotor.substance; + } + } + } + + // BASEJSP - 2nd LOOP ON JSP + + /* fundamental loop, it contains sitesi and write for each of + * the jsp */ + logger.trace(Candies.LF + Cst.CUT0 + "2° LOOP SULLE JSP" + + Candies.LF + Cst.CUT0); + for (int i = 0; i < markupE.get("jsp").recurrenceE + .size(); i++) { + Train f = markupE.get("jsp").recurrenceE.get(i); + baseJsp.jspKit = (JspKit) f.locomotor.substance; + logger.trace(baseJsp.jspKit.toString()); + if (baseJsp.jspKit.fileName.equalsIgnoreCase("login") + & skill.springSecurity) { + ExactException ne = new ExactException("The JSP «" + + baseJsp.jspKit.fileName + + "» does not have to be declared with the" + + " jsp+ markup, because it is implicit in" + + " the use of Spring Security."); + ne.code = 1700; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } + /* no duplication check */ + int d = 0; + for (; d < i; d++) { + Train trainD = markupE.get("jsp").recurrenceE.get(d); + if (baseJsp.jspKit.fileName.equals( + ((JspKit) trainD.locomotor.substance).fileName)) { + break; + } + } + if (d < i) { + ExactException ne = new ExactException("The JSP «" + + baseJsp.jspKit.fileName + + "» is present more than once, a different" + + " name must be chosen."); + ne.code = 1701; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } + String ospiteY = new72; + if (baseJsp.jspKit.path.length() > 0) { + ospiteY += "/" + baseJsp.jspKit.path; + skill.buildDirectory(ospiteY); + } + baseJsp.synthesis(markupE, trainE, candies); + if (!baseJsp.jspKit.fileName.equals("login")) { + baseJsp.write(ospiteY, baseJsp.jspKit.fileName + "." + + baseJsp.jspKit.extension, + baseJsp.jspKit.fileName + "." + + baseJsp.jspKit.extension, "jsp", + candies, recycleBinY); + } + for (int k = 0; k < baseJsp.jspKit.requestMapE + .size(); k++) { + RequestMap requestMap = baseJsp.jspKit.requestMapE.get( + k); + // LOOP ON THE REQUEST MAP + if (!requestMap.pathRedirect.isEmpty()) { + Train train0 = null; + int n = 0; + for (; n < markupE.get("requmap").recurrenceE + .size(); n++) { + train0 = markupE.get("requmap").recurrenceE.get( + n); + if (train0.locomotor.text.equals( + requestMap.pathRedirect)) { + break; + } + } + if (n == markupE.get("requmap").recurrenceE + .size()) { + ExactException ne = new ExactException(); + String message = "For the «requmap+" + + requestMap.firstSegmentPath + "/" + + requestMap.jsp + "» with «redirect+" + + requestMap.pathRedirect + + "» there is no match in the " + + "request maps list."; + ne.code = 1631; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + } + requestMap.tipo = baseJsp.jspKit.jspType; + int j = 0; + for (; j < skill.correlationE.size(); j++) { + ControllerBelong correlazione = skill.correlationE + .get(j); + if (requestMap.firstSegmentPath.equals( + correlazione.gruppo)) { + correlazione.rmE.add(requestMap); + break; + } + } + if (j == skill.correlationE.size()) { + List zE = new ArrayList(); + zE.add(requestMap); + logger.trace(Candies.LF + Cst.CUT3 + + " * Not having found the first segment of path «" + + requestMap.firstSegmentPath + "»," + + Candies.LF + " * I insert my new" + + " request map:" + Candies.LF + + " * " + requestMap.toString() + + Cst.CUT3); + skill.correlationE.add(new ControllerBelong( + requestMap.firstSegmentPath, zE)); + } + } + } + + // JSPFORM - 3rd LOOP ON JSP + + logger.trace(Candies.LF + Cst.CUT0 + "3° LOOP SULLE JSP" + + Candies.LF + Cst.CUT0); + skill.tableDBE = new ArrayList(); + for (int i = 0; i < markupE.get("hdefrail").recurrenceE + .size(); i++) { + railFactory(i); + } + + skill.factory_B(markupE, trainE); + + // DB TABLES + + for (int j = 0; j < skill.tableDBE.size(); j++) { + dbTablesComponents(j); + } + skill.methodsFactory(markupE, trainE); + for (int i = 0; i < markupE.get("jsp").recurrenceE + .size(); i++) { + jspComponents(i); + } + genericModel_java.synthesis(markupE, trainE, candies); + genericModel_java.write(skill.javaWebModelY, + "GenericModel.java", "GenericModel.java", "java", + candies, recycleBinY); + if (skill.indexJsp) { + baseJsp.jspKit = (JspKit) markupE.get( + "indexjsp").recurrenceE.get(0).locomotor.substance; + baseJsp.jspKit.fileName = "index"; + if (markupE.get("indexjsp").recurrenceE.get(0).wagonE.get( + "bmenu").text != null) { + baseJsp.jspKit.navigationBar = markupE.get( + "indexjsp").recurrenceE.get(0).wagonE.get( + "bmenu").text; + } + baseJsp.synthesis(markupE, trainE, candies); + } + bootstrap_css.synthesis(markupE, trainE, candies); + screwdriver_css.synthesis(markupE, trainE, candies); + screwdriver_cssC.synthesis(markupE, trainE, candies); + for (int m = 0; m < markupE.get("bdefmenu").recurrenceE + .size(); m++) { + navigation_jsps[m].menuKit = (MenuKit) markupE.get( + "bdefmenu").recurrenceE.get(m).locomotor.substance; + navigation_jsps[m].synthesis(markupE, trainE, candies); + } + if (skill.quartzVers != null) { + quartz_job_xml.synthesis(markupE, trainE, candies); + } + web_xml.synthesis(markupE, trainE, candies); + pom_properties.synthesis(markupE, trainE, candies); + doorControllerBelong_java.synthesis(markupE, trainE, candies); + genericCrud_java.synthesis(markupE, trainE, candies); + if (skill.internalProperties) { + springProps_xml.synthesis(markupE, trainE, candies); + } + if (skill.webFlow) { + webflow_xml.synthesis(markupE, trainE, candies); + } + if (skill.spring) { + dispatcher_xml.synthesis(markupE, trainE, candies); + } + if (skill.tiles) { + tiles_xml.synthesis(markupE, trainE, candies); + } else { + headerJsp.synthesis(markupE, trainE, candies); + footerJsp.synthesis(markupE, trainE, candies); + } + if (skill.quartzVers != null) { + quartzJob_java.synthesis(markupE, trainE, candies); + quartzTask_java.synthesis(markupE, trainE, candies); + quartzTaskImpl_java.synthesis(markupE, trainE, candies); + } + if (skill.springSecurity) { + springSecurity_xml.synthesis(markupE, trainE, candies); + } + pom_xml.synthesis(markupE, trainE, candies); + if (skill.hasUseridPassword) { + if (skill.authenticationMode.equals("trivial")) { + king.synthesis(markupE, trainE, candies); + kingDao.synthesis(markupE, trainE, candies); + kingDaoImpl.synthesis(markupE, trainE, candies); + } else { + springSecurityUserContext.synthesis(markupE, trainE, + candies); + userAuthorityUtils.synthesis(markupE, trainE, candies); + } + interfacciaUserContext.synthesis(markupE, trainE, candies); + userContextImpl.synthesis(markupE, trainE, candies); + } + + /* THE SCRIPTURES */ + + if (skill.indexJsp) { + baseJsp.write(new722, "index.jsp", "index.jsp", "jsp", + candies, recycleBinY); + } + pom_xml.write(skill.eclipseProjectY, "pom.xml", "pom.xml", + "xml", candies, recycleBinY); + web_xml.write(skill.webInfY, "web.xml", "web.xml", "xml", + candies, recycleBinY); + pom_properties.write(skill.eclipseProjectY, "pom.properties", + "pom.properties", "properties", candies, recycleBinY); + if (skill.quartzVers != null) { + quartz_job_xml.write(new71, skill.applicationNameLower + + "-quartz-job.xml", skill.applicationNameLower + + "-quartz-job.xml", "xml", candies, + recycleBinY); + } + doorControllerBelong_java.write(skill.javaWebController, + "DoorControllerBelong.java", + "DoorControllerBelong.java", "java", candies, + recycleBinY); + if (skill.hibernate) { + genericCrud_java.write(new58, "GenericCrud.java", + "GenericCrud.java", "java", candies, recycleBinY); + } else { + done = FileComponent.deleteComponent(new58, + "GenericCrud.java", recycleBin, skill); + } + if (skill.internalProperties) { + springProps_xml.write(new71, skill.applicationNameLower + + "-props.xml", skill.applicationNameLower + + "-props.xml", "xml", candies, + recycleBinY); + } else { + done = FileComponent.deleteComponent(new71, + skill.applicationNameLower + "-props.xml", + recycleBin, skill); + } + if (skill.springSecurity) { + springSecurity_xml.write(new71, skill.applicationNameLower + + "-security.xml", skill.applicationNameLower + + "-security.xml", "xml", candies, + recycleBinY); + } else { + done = FileComponent.deleteComponent(new71, + skill.applicationNameLower + "-security.xml", + recycleBin, skill); + } + if (skill.spring) { + dispatcher_xml.write(new71, "DispatcherServlet.xml", + "DispatcherServlet.xml", "xml", candies, + recycleBinY); + } else { + done = FileComponent.deleteComponent(new71, + "DispatcherServlet.xml", recycleBin, skill); + } + if (skill.webFlow) { + for (int i = 0; i < markupE.get("wparams").recurrenceE + .size(); i++) { + Train f = markupE.get("wparams").recurrenceE.get(i); + String nome = f.locomotor.text; + String newF1 = skill.webFlowY + "/" + nome; + skill.buildDirectory(newF1); + webflow_xml.write(newF1, nome + "-flow.xml", nome + + "-flow.xml", "xml", candies, recycleBinY); + } + } + if (skill.tiles) { + tiles_xml.write(new73, "tiles.xml", "tiles.xml", "xml", + candies, recycleBinY); + } else { + headerJsp.write(new721, "header.jsp", "header.jsp", "jsp", + candies, recycleBinY); + footerJsp.write(new721, "footer.jsp", "footer.jsp", "jsp", + candies, recycleBinY); + } + if (skill.quartzVers != null) { + quartzJob_java.write(new63, skill.clockHands.jobNameU + + ".java", skill.clockHands.jobNameU + ".java", + "java", candies, recycleBinY); + quartzTask_java.write(new60, skill.clockHands.jobNameU + + "Task.java", skill.clockHands.jobNameU + + "Task.java", "java", candies, + recycleBinY); + quartzTaskImpl_java.write(new61, skill.clockHands.jobNameU + + "TaskImpl.java", skill.clockHands.jobNameU + + "TaskImpl.java", "java", candies, + recycleBinY); + } + bootstrap_css.write(new62, "bootstrap.css", "bootstrap.css", + "css", candies, recycleBinY); + screwdriver_css.write(new62, "screwdriver.css", + "screwdriver.css", "css", candies, recycleBinY); + // screwdriver_cssC.write(new62, "screwdriverC.css", + // "screwdriverC.css", "css", candies, recycleBinY); + for (int m = 0; m < markupE.get("bdefmenu").recurrenceE + .size(); m++) { + Train train = markupE.get("bdefmenu").recurrenceE.get(m); + navigation_jsps[m].write(new721, "navigation_" + + train.locomotor.text + ".jsp", "navigation_" + + train.locomotor.text + ".jsp", "jsp", + candies, recycleBinY); + } + FileComponent.addFile("root-context.xml", "root-context.xml", + new71, candies, recycleBinY, skill); + FileComponent.addFile("ok_jsp.txt", "ok.jsp", new723, candies, + recycleBinY, skill); + FileComponent.addFile("warning_jsp.txt", "warning.jsp", new723, + candies, recycleBinY, skill); + + // CONTROLLERS CREATION + for (int i = 0; i < skill.correlationE.size(); i++) { + ControllerBelong cnt = skill.correlationE.get(i); + skill.cntK = i; + skill.groupControllerF = cnt.gruppoMaius + + "GroupController"; + logger.info("CONTROLLER: skill.groupControllerF=" + + skill.groupControllerF); + controllerBelong_java = new ControllerBelong_java(skill, + "java/ControllerBelong.java"); + controllerBelong_java.synthesis(markupE, trainE, candies); + controllerBelong_java.write(skill.javaWebController, + skill.groupControllerF + ".java", + skill.groupControllerF + ".java", "java", candies, + recycleBinY); + } + if (skill.springSecurity) { + securityWrite(); + } else { + securityClean(); + } + if (skill.initialDirE.size() > 0 & skill.proposedDirE + .size() > 0) { + String[] iE = new String[skill.initialDirE.size()]; + for (int ij = 0; ij < skill.initialDirE.size(); ij++) { + iE[ij] = skill.initialDirE.get(ij).replace(Candies.H92, + Candies.H47); + } + String[] pE = new String[skill.proposedDirE.size()]; + for (int pj = 0; pj < skill.proposedDirE.size(); pj++) { + pE[pj] = skill.proposedDirE.get(pj).replace(Candies.H92, + Candies.H47); + } + Arrays.sort(iE); + Arrays.sort(pE); + int i = 0; + int p = 0; + while (i < iE.length) { + /* with this if I exclude every subdirectory because the + * comparison has already been done with the parent + * directory */ + int x = iE[i].compareTo(pE[p]); + if (x == 0) { + i++; + p++; + } else if (x > 0) { + p++; + } else { // < 0 + int iW = i; + do { + i++; + } while (i < iE.length && iE[i].startsWith(iE[i - 1] + + "/")); + iE[iW] = Cst.MAGIC0 + iE[iW]; + } + } + int z = 0; + for (int ij = 0; ij < iE.length; ij++) { + if (iE[ij].startsWith(Cst.MAGIC0)) { + z++; + } + } + if (z > 0) { + String question = null; + if (z == 1) { + question = "I am about to delete " + z + + " directory, because it has become useless:" + + " can I execute?"; + } else { + question = "I am about to delete " + z + + " directories, because they have become" + + " useless: can I execute?"; + } + AskForDelete askForDelete = new AskForDelete(null, + question, "Question", false); + logger.info(question); + logger.info(askForDelete.answer ? "Yes" : "No"); + if (askForDelete.answer) { + String x = Skill.datePosition(recycleBinY); + for (int ij = 0; ij < iE.length; ij++) { + if (iE[ij].startsWith(Cst.MAGIC0)) { + File f = new File(iE[ij].substring( + Cst.MAGIC0.length())); + String[] sectionE = iE[ij].split("/"); + String y = x + sectionE[sectionE.length + - 1]; + new File(y).mkdir(); + Abacus.copyDirectoryRecursion(f, new File( + y), true); + Abacus.deleteDirectoryRecursion(f); + } + } + } + } + } + + // STATISTICS + File logF = new File(candies.inputYS + "logs"); + File statF = new File(candies.inputYS + "logs" + sep + + "statistics.log"); + Path log = logF.toPath(); + if (Files.exists(log) && !Files.isDirectory(log)) { + Files.delete(log); + } + if (!Files.exists(log)) { + Files.createDirectory(log); + } + SimpleDateFormat df = new SimpleDateFormat( + "yyyy-MM-dd hh:mm:ss"); + String s = df.format(new Date()); + stat += "Application " + appName + " - Markups statistics on " + + s + Candies.LF + Candies.LF; + markupE.forEach((key, value) -> { + if (markupE.get(key).recurrenceE.size() > 0) { + int i = markupE.get(key).recurrenceE.size(); + stat += key + ": " + i + " " + (i == 1 ? "time" + : "times") + Candies.LF; + } + }); + Equipment.writeFileFromOneString_economy(statF, stat); + } + + /** + *

+ * Checks on markups. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @throws ExactException error checking the contents of the file */ + final public void substantialChecks() + + throws ExactException { + + ExactException ne = new ExactException(); + for (int i = 0; i < trainE.size(); i++) { + Markup m = markupE.get(trainE.get(i).locomotor.stub); + + // CHECKING THE VALUE OF THE PRESUMED MARKUP + if (m.implyE != null) { + for (int n = 0; n < m.implyE.length; n++) { + if (!m.implyE[n].stub.equals("")) { + String ps = m.implyE[n].stub; + String pv = m.implyE[n].value; + boolean pd = m.implyE[n].direct; + int j = 0; + for (; j < trainE.size(); j++) { + if (trainE.get(j).locomotor.stub.equals( + ps)) { + break; + } + } + if (j == trainE.size() & pd) { + ne.datum = "The markup " + Mix.dress_A(ps) + + " presupposto da «" + trainE.get( + i).locomotor.stub + + "» non è presente tra i treni!"; + ne.code = 1705; + ne.className = this.getClass().getName(); + throw ne; + } else if (j < trainE.size() & !pd) { + ne.datum = "The markup " + Mix.dress_A(ps) + + ", recalled by " + Mix.dress_A( + trainE.get( + i).locomotor.stub) + + ", was not to be present among the trains!"; + ne.code = 1706; + ne.className = this.getClass().getName(); + throw ne; + } else if (!pv.isEmpty() && m.p == 5) { + if (((Integer) trainE.get( + i).locomotor.substance) + .intValue() > ((Integer) trainE + .get(j).locomotor.substance) + .intValue()) { + ne.datum = "The markup " + Mix.dress_A( + ps) + " implied by " + Mix + .dress_A(trainE.get( + i).locomotor.stub) + + " has version " + trainE.get( + j).locomotor.text + + ", less than required by " + + trainE.get(i).locomotor.stub + + ", which is " + Mix.dress_A( + trainE.get( + i).locomotor.text) + + "."; + ne.code = 1707; + ne.className = this.getClass() + .getName(); + throw ne; + } + } else if (j < trainE.size() && !pv.isEmpty() + && !trainE.get(j).locomotor.text.equals( + pv)) { + ne.datum = "The markup " + Mix.dress_A(ps) + + ", connected to " + Mix.dress_A( + trainE.get( + i).locomotor.stub) + + ", has value " + Mix.dress_A( + trainE.get( + j).locomotor.text) + + ", not conforming to that necessary for the presence of " + + Mix.dress_A(trainE.get( + i).locomotor.stub) + + ", which would like " + Mix + .dress_A(pv) + "."; + ne.code = 1708; + ne.className = this.getClass().getName(); + throw ne; + } + } + } + } + } + } + + // PRIVATE METHODS + + private void componentsInstanceExecution() { + web_xml = new Web_xml(skill, null); + pom_properties = new Pom_properties(skill, null); + quartz_job_xml = new Quartz_job_xml(skill, "testaOrm_" + + skill.springVersion + ".txt"); + webflow_xml = new Webflow_xml(skill, "xml/webflow.xml"); + pom_xml = new Pom_xml(skill, null); + springProps_xml = new SpringProperties_xml(skill, + "testaSpringProperties_" + skill.springVersion + + ".txt"); + springSecurity_xml = new SpringSecurity_xml(skill, + "testaSpringSecurity_" + + skill.springSecurityReductVersion + ".txt"); + dispatcher_xml = new Dispatcher_xml(skill, "testaDispatcher_" + + skill.springVersion + ".txt"); + baseJsp = new Base_jsp(skill, "jsp/base_jsp.txt"); + headerJsp = new Hoof(skill, "jsp/header_jsp.txt"); + footerJsp = new Hoof(skill, "jsp/footer_jsp.txt"); + quartzJob_java = new Hoof(skill, "java/QuartzJob.java"); + quartzTask_java = new Hoof(skill, "java/QuartzTask.java"); + quartzTaskImpl_java = new Hoof(skill, + "java/QuartzTaskImpl.java"); + if (skill.jpaVersion == 1) { + genericRailDaoImpl = new Hoof(skill, + "java/GenericRailDaoImplJPA1.java"); + } else { + genericRailDaoImpl = new Hoof(skill, + "java/GenericRailDaoImplJPA2.java"); + } + tiles_xml = new Tiles_xml(skill, null); + service_xml = new Service_xml(skill, "testaService_" + + skill.springVersion + ".txt"); + orm_xml = new Orm_xml(skill, "testaOrm_" + skill.springVersion + + ".txt"); + doorControllerBelong_java = new Hoof(skill, + "java/DoorControllerBelong.java"); + genericCrud_java = new Hoof(skill, "java/GenericCrud.java"); + controllerBelong_java = new ControllerBelong_java(skill, + "java/ControllerBelong.java"); + jspForm_java = new JspForm_java(skill, null); + jspFormImpl_java = new JspFormImpl_java(skill, null); + jspPlain_java = new JspPlain_java(skill, null); + jspPlainImpl_java = new JspPlainImpl_java(skill, null); + genericModel_java = new GenericModel_java(skill, + "java/GenericModel.java", candies); + userAuthenticationProvider_java = new UserAuthenticationProvider_java( + skill, "java/ApplicUserAuthenticationProvider.java"); + userContextImpl = new UserContextImpl_java(skill, null); + bootstrap_css = new Bootstrap_css(skill, "css/bootstrap.css"); + screwdriver_css = new Screwdriver_css(skill, + "css/screwdriver.css"); + screwdriver_cssC = new Screwdriver_cssC(skill, + "css/screwdriver.css"); + navigation_jsps = new Navigation_jsp[markupE.get( + "bdefmenu").recurrenceE.size()]; + for (int m = 0; m < markupE.get("bdefmenu").recurrenceE + .size(); m++) { + navigation_jsps[m] = new Navigation_jsp(skill, ""); + } + king = new Hoof(skill, "java/King.java"); + kingDao = new Hoof(skill, "java/KingDao.java"); + kingDaoImpl = new Hoof(skill, "java/KingDaoImpl.java"); + springSecurityUserContext = new Hoof(skill, "java/" + Mix + .uppercaseFirstChar(skill.authenticationMode) + + "SpringSecurityUserContext.java"); + userAuthorityUtils = new Hoof(skill, + "java/UserAuthorityUtils.java"); + interfacciaUserContext = new Hoof(skill, + "java/UserContext.java"); + } + + private void jspComponents(final int i) + + throws ExactException, FileNotFoundException, IOException { + + Train f = markupE.get("jsp").recurrenceE.get(i); + baseJsp.jspKit = ((JspKit) f.locomotor.substance); + logger.trace(baseJsp.jspKit.toString()); + /* if it is a form jsp ... */ + if (baseJsp.jspKit.jspType == 1) { + jspForm_java.jspKit = baseJsp.jspKit; + jspFormImpl_java.jspKit = baseJsp.jspKit; + jspForm_java.directory(markupE); + jspFormImpl_java.directory(markupE); + jspForm_java.synthesis(markupE, trainE, candies); + jspFormImpl_java.synthesis(markupE, trainE, candies); + String formName = baseJsp.jspKit.nomeFileU + Cst.FORMU + + ".java"; + jspForm_java.write(skill.javaWebModelBodyY, formName, + formName, "java", candies, recycleBinY); + formName = baseJsp.jspKit.nomeFileU + Cst.FORMU + + "Impl.java"; + /* here I add to the freeze list two classes that end with + * the string "Impl" */ + if (!candies.inside) { + candies.freezeDueE.add(formName); + } + jspFormImpl_java.write(skill.javaWebModelBodyY, formName, + formName, "java", candies, recycleBinY); + new File(skill.javaWebModelBodyY + "/" + + baseJsp.jspKit.nomeFileU + "Plain.java").delete(); + new File(skill.javaWebModelBodyY + "/" + + baseJsp.jspKit.nomeFileU + "PlainImpl.java") + .delete(); + } else if (baseJsp.jspKit.jspType == 0) { + /* ... then it is of the plain type */ + jspPlain_java.jspKit = baseJsp.jspKit; + jspPlainImpl_java.jspKit = baseJsp.jspKit; + jspPlain_java.directory(markupE); + jspPlainImpl_java.directory(markupE); + jspPlain_java.synthesis(markupE, trainE, candies); + jspPlainImpl_java.synthesis(markupE, trainE, candies); + String modelName = baseJsp.jspKit.nomeFileU + Cst.PLAINU + + ".java"; + jspPlain_java.write(skill.javaWebModelBodyY, modelName, + modelName, "java", candies, recycleBinY); + modelName = baseJsp.jspKit.nomeFileU + Cst.PLAINU + + "Impl.java"; + /* here I add to the freeze list two classes that end with + * the string "Impl" */ + if (!candies.inside) { + candies.freezeDueE.add(modelName); + } + jspPlainImpl_java.write(skill.javaWebModelBodyY, modelName, + modelName, "java", candies, recycleBinY); + new File(skill.javaWebModelBodyY + "/" + + baseJsp.jspKit.nomeFileU + "Form.java").delete(); + new File(skill.javaWebModelBodyY + "/" + + baseJsp.jspKit.nomeFileU + "FormImpl.java") + .delete(); + } + } + + private void dbTablesComponents(final int j) + + throws FileNotFoundException, ExactException, IOException, + ExactException { + + skill.tK = j; + TableOutfit ct = skill.tableDBE.get(skill.tK); + FileComponent interfacciaTabellaDao_java = new InterfaceTableDao_java( + skill, null, candies); + FileComponent interfacciaTabellaService_java = new InterfaceTabellaService_java( + skill, null, candies); + FileComponent tabellaDaoImpl_java = new ImplementTableDao_java( + skill, null, candies); + FileComponent tabellaServiceImpl_java = new ImplementTabellaService_java( + skill, null, candies); + interfacciaTabellaDao_java.synthesis(markupE, trainE, candies); + interfacciaTabellaDao_java.write(new5 + "/" + ct.railLowercase + + "/dao", "I" + ct.railUppercase + ct.entityName + + "Dao.java", "I" + ct.railUppercase + + ct.entityName + "Dao.java", "java", + candies, recycleBinY); + interfacciaTabellaService_java.synthesis(markupE, trainE, + candies); + interfacciaTabellaService_java.write(new5 + "/" + + ct.railLowercase + "/service", "I" + ct.railUppercase + + ct.entityName + "Service.java", "I" + + ct.railUppercase + ct.entityName + + "Service.java", "java", candies, + recycleBinY); + tabellaDaoImpl_java.synthesis(markupE, trainE, candies); + tabellaDaoImpl_java.write(new5 + "/" + skill.tableDBE.get( + j).railLowercase + "/dao/impl", ct.railUppercase + + ct.entityName + "Dao.java", ct.railUppercase + + ct.entityName + "Dao.java", "java", + candies, recycleBinY); + tabellaServiceImpl_java.synthesis(markupE, trainE, candies); + tabellaServiceImpl_java.write(new5 + "/" + ct.railLowercase + + "/service/impl", ct.railUppercase + skill.tableDBE + .get(j).entityName + "Service.java", + ct.railUppercase + ct.entityName + "Service.java", + "java", candies, recycleBinY); + } + + private static String trainE_toString(List fE, + HashMap mE) { + String s = ""; + s += Candies.LF + Candies.LF + Candies.LF; + s += Cst.CUT0; + s += "ELENCO DEI TRENI" + Candies.LF; + for (int i = 0; i < fE.size(); i++) { + s += Cst.CUT0; + Train f = fE.get(i); + Wagon v0 = f.locomotor; + s += v0.toString(0, mE); + if (f.wagonE.size() > 1) { + s += Cst.CUT1; + } + Collection valueE = f.wagonE.values(); + Iterator iterator = valueE.iterator(); + int j = 0; + while (iterator.hasNext()) { + Wagon v = iterator.next(); + s += v.toString(j, mE); + j++; + } + } + s += Candies.LF; + return s; + } + + /* i is the index of the occurrence of the markup rail */ + final private void railFactory(final int i) + + throws IOException, ExactException { + + Train t = markupE.get("hdefrail").recurrenceE.get(i); + if (t.wagonE.get("hjndi") != null) { + skill.jndi = t.wagonE.get("hjndi").text; + } + if (t.wagonE.get("hdbschema") == null) { + ExactException ne = new ExactException("Il luogo-DB «rail+" + + t.locomotor.text + + "» non è accompagnato dal markup «hdbschema»."); + ne.code = 1732; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } else { + skill.dbSchema = t.wagonE.get("hdbschema").text; + } + // skill.dbms = null; + if (t.wagonE.get("hdbms") == null) { + ExactException ne = new ExactException( + "The rail (pir datasource-DBschema «rail+" + + t.locomotor.text + + "» is not accompanied by markup «hdbms»."); + ne.code = 1710; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } else { + skill.dbms = t.wagonE.get("hdbms").text; + /* FUTURE RELEASE N6 */ + // skill.dbmsE.add(dbmsW); + } + if (t.wagonE.get("hjarv") != null) { + skill.versioneArtifactJPA = t.wagonE.get("hjarv").text; + } + t.locomotor.substance = new DBPlaceKit(skill.dbSchema, + skill.jndi, skill.dbms); + if (skill.hibernateVersion != null & markupE.get( + "hv").recurrenceE.get(0).wagonE.get("hjpav").text + .equals("2")) { + FileComponent.addClass("GenericController.java", + skill.javaWebController, "GenericController.java", + candies, recycleBinY, skill, -1, markupE, "java"); + FileComponent.addClass("GenericComponent.java", + skill.javaWebController, "GenericComponent.java", + candies, recycleBinY, skill, -1, markupE, "java"); + FileComponent.addClass("Filter.java", new581, "Filter.java", + candies, recycleBinY, skill, -1, markupE, + "java/jpa2"); + FileComponent.addClass("Order.java", new581, "Order.java", + candies, recycleBinY, skill, -1, markupE, + "java/jpa2"); + FileComponent.addClass("OrderBuilder.java", new581, + "OrderBuilder.java", candies, recycleBinY, skill, + -1, markupE, "java/jpa2"); + FileComponent.addClass("PaginatedFilter.java", new581, + "PaginatedFilter.java", candies, recycleBinY, skill, + -1, markupE, "java/jpa2"); + FileComponent.addClass("SearchParameter.java", new581, + "SearchParameter.java", candies, recycleBinY, skill, + -1, markupE, "java/jpa2"); + FileComponent.addClass("SingularParameter.java", new581, + "SingularParameter.java", candies, recycleBinY, + skill, -1, markupE, "java/jpa2"); + FileComponent.addClass("StringParameter.java", new581, + "StringParameter.java", candies, recycleBinY, skill, + -1, markupE, "java/jpa2"); + FileComponent.addClass("GenericDao.java", new582, + "GenericDao.java", candies, recycleBinY, skill, -1, + markupE, "java/jpa2"); + } + /* the double id is the sequence of java naming and DB schema */ + String doppioId = skill.jndi.toLowerCase() + "-" + + skill.dbSchema; + String new6 = new5 + "/" + Cst.RAIL + t.locomotor.text; + hibernateDirectoriesFactory(new6, new5, t); + File progettoJpa = new File(candies.outputYS + doppioId); + File persistence = new File(candies.outputYS + doppioId + + "/src/META-INF/persistence.xml"); + if (!progettoJpa.exists()) { + String messaggio = "The project JPA " + Mix.dress_A( + doppioId) + + " does not exist, it's impossible to continue."; + ExactException ce = new ExactException(messaggio); + ce.code = 1733; + ce.datum = ce.getMessage(); + ce.className = this.getClass().getName(); + throw ce; + } else if (!persistence.exists()) { + String message = "The file" + + " persistence.xml does not exist in directory «" + + "src/META-INF» of the JPA project " + Mix.dress_A( + doppioId); + Mix.discloseInfo(message, "Alarm", logger); + } else { + Document document = null; + NodeList nodeList0, nodeList1; + DocumentBuilderFactory factory = DocumentBuilderFactory + .newInstance(); + Node nodeDoc0, nodeDoc1; + // I create the document of the "persistence" file + DocumentBuilder builder; + try { + builder = factory.newDocumentBuilder(); + document = builder.parse(persistence); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } catch (SAXException e) { + e.printStackTrace(); + } + logger.trace( + "I've created the DOM document of persistence.xml" + + " for the DB-place " + Mix.dress_A( + doppioId)); + nodeList0 = document.getChildNodes(); + nodeDoc0 = nodeList0.item(0); + nodeList1 = nodeDoc0.getChildNodes(); + nodeDoc1 = nodeList1.item(1); + String[] rigaE = Strings.compact_A(nodeDoc1 + .getTextContent()).split("\\x20"); + for (String riga : rigaE) { + if (!riga.endsWith("PK")) { + riga += "+"; // trick to avoid exception, then + // I take off + String[] z = riga.split("\\x2e"); // x2e is the + // dot + if (z.length < 4) { + ExactException ne = new ExactException( + "The line of the file persistence.xml in the JPA project «" + + doppioId + "» is «" + riga + + "», but it is wrong."); + ne.code = 1712; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } + String ultimo = z[z.length - 1]; + String path = riga.substring(0, riga.indexOf(ultimo) + - 1); + ultimo = ultimo.substring(0, ultimo.length() - 1); + TableOutfit kit = new TableOutfit(ultimo, path, + z[z.length - 2], candies, z[z.length - 3], + Cst.RAIL, t.locomotor.text); + logger.debug(kit); + skill.tableDBE.add(kit); + } + } + } + skill.railK = i; + service_xml.synthesis(markupE, trainE, candies); + service_xml.write(new71, Cst.RAIL + t.locomotor.text + + "-service.xml", Cst.RAIL + t.locomotor.text + + "-service.xml", "xml", candies, recycleBinY); + orm_xml.synthesis(markupE, trainE, candies); + orm_xml.write(new71, Cst.RAIL + t.locomotor.text + "-orm.xml", + Cst.RAIL + t.locomotor.text + "-orm.xml", "xml", + candies, recycleBinY); + genericRailDaoImpl.synthesis(markupE, trainE, candies); + genericRailDaoImpl.write(new5 + "/" + Cst.RAIL + + t.locomotor.text, "Generic" + Cst.RAILU + + t.locomotor.text + "DaoImpl.java", "Generic" + + Cst.RAILU + t.locomotor.text + + "DaoImpl.java", "java", candies, + recycleBinY); + + } + + /* the directory to be created does not exist, but there was one, + * with a different name, which was really our application */ + final private void scruple(final String corrente, + final String superiore) { + File y = new File(corrente); + /* first I deal with the case that a file corresponds to that + * name, in which case I delete it */ + if (y.exists() & !y.isDirectory()) { + y.delete(); + } else if (!y.exists()) { + /* if it does not exist, I list the files and directories */ + Folder folder = new Folder(); + /* this is the list of what is contained in the parent, or + * parent, directory */ + File[] parentE = folder.fileObjects(".+", superiore); + /* this list is empty ... */ + if (parentE.length == 0) { + /* .. create the directory */ + skill.buildDirectory(y); + } else { /* if instead there is a list */ + int i = 0; + /* ... check if there is at least one directory */ + for (; i < parentE.length; i++) { + /* if you found it ... */ + if (parentE[i].isDirectory()) { + parentE[i].renameTo(y); + break; + } + } + /* if there is not even a directory, create it */ + if (i == parentE.length) { + skill.buildDirectory(y); + } + } + } else { + skill.proposedDirE.add(corrente); + } + } + + /* this method adds the creation of the typical Hibernate + * directories to the previous one */ + final private void hibernateDirectoriesFactory( + final String levelRail, final String superiore, Train t) { + + skill.buildDirectory(levelRail); + String brickServiceY = levelRail + "/service"; + skill.buildDirectory(brickServiceY); + String brickServiceImplY = brickServiceY + "/impl"; + skill.buildDirectory(brickServiceImplY); + String brickDaoY = levelRail + "/dao"; + skill.buildDirectory(brickDaoY); + String brickDaoImplY = brickDaoY + "/impl"; + skill.buildDirectory(brickDaoImplY); + } + + final private void directoriesFactory_B() + + throws ExactException, IOException { + + @SuppressWarnings("unused") + boolean done = false; + File f = null; + FileComponent.addFile("config.properties", "config.properties", + skill.mainResources, candies, recycleBinY, skill); + /* FUTURE RELEASE N6 */ + // if (skill.embedded) { + // f = new File(skill.mainResources + "/database"); + // skill.buildDirectory(f); + // Iterator iterator = skill.dbmsE.iterator(); + // while (iterator.hasNext()) { + // f = new File(skill.mainResources + "/database/" + Mix + // .inizialeMinuscola((String) (iterator.next()))); + // skill.buildDirectory(f); + // } + // } + String new520 = skill.mainResources + "/ldif"; + f = new File(new520); + if (skill.ldap) { + skill.buildDirectory(f); + File newFile = new File(new520 + "/" + + skill.applicationNameLower + ".ldif"); + done = newFile.createNewFile(); + Markup mFile = markupE.get("file"); + + int i = 0; + for (; i < mFile.recurrenceE.size(); i++) { + if (mFile.recurrenceE.get(i).locomotor.text.equals( + skill.applicationNameLower + ".ldif")) { + break; + } + } + if (i < mFile.recurrenceE.size()) { + Equipment.scriviFileDaStringa(newFile, + (String) mFile.recurrenceE.get( + i).locomotor.substance); + } + } else if (f.exists()) { + Abacus.destroyDirectory(new520); + done = f.delete(); + } + skill.webAppG = skill.mainY + "/webapp"; + String newMetaInf = skill.webAppG + "/META-INF"; + skill.webAppResourcesY = skill.webAppG + "/resources"; + new62 = skill.webAppResourcesY + "/css"; + String new64 = skill.webAppResourcesY + "/fonts"; + String new65 = skill.webAppResourcesY + "/images"; + String new66 = skill.webAppResourcesY + "/js"; + skill.webInfY = skill.webAppG + "/WEB-INF"; + new71 = skill.webInfY + "/spring"; + new72 = skill.webInfY + "/views"; + new721 = new72 + "/includes"; + new723 = new72 + "/answers"; + new722 = new72 + "/home"; + new73 = skill.webInfY + "/tiles"; + String newLib = skill.webInfY + "/lib"; + String newT0 = skill.eclipseProjectY + "src/test"; + String newT1 = newT0 + "/java"; + String newT2 = newT0 + "/resources"; + skill.buildDirectory(skill.mainY); + skill.buildDirectory(newT0); + skill.buildDirectory(skill.mainJavaY); + skill.buildDirectory(skill.webAppG); + skill.buildDirectory(skill.webInfY); + skill.buildDirectory(newMetaInf); + skill.buildDirectory(newLib); + skill.buildDirectory(new72); + if (!skill.tiles) { + skill.buildDirectory(new721); + } + skill.buildDirectory(new722); + skill.buildDirectory(new723); + f = new File(new73); + if (skill.tiles) { + skill.buildDirectory(f); + } else if (f.exists()) { + done = new File(new73).renameTo(new File(recycleBinY + + "/tiles")); + } + skill.buildDirectory(skill.webAppResourcesY); + skill.buildDirectory(new62); + skill.buildDirectory(new64); + skill.buildDirectory(new65); + skill.buildDirectory(new66); + if (skill.spring) { + skill.buildDirectory(new71); + /* I don't want spring, so the WEB-INF / spring directory + * must be deleted */ + } else if (new File(new71).exists()) { + Abacus.destroyDirectory(new71); + done = new File(new71).delete(); + } + skill.buildDirectory(newT1); + skill.buildDirectory(newT2); + String new4 = skill.mainJavaY; + String[] u = null; + u = skill.networkDomain.split("\\x2e"); + skill.pckg = skill.networkDomain; + for (int i = 0; i < u.length; i++) { + new4 += "/" + u[i]; + skill.buildDirectory(new4); + } + new5 = new4 + "/" + skill.applicationNameLower; + skill.pckg += "." + skill.applicationNameLower; + scruple(new5, new4); + skill.javaWebY = new5 + "/web"; + skill.javaUtilY = new5 + "/utilities"; + skill.buildDirectory(skill.javaWebY); + skill.buildDirectory(skill.javaUtilY); + String new53 = new5 + "/exception"; + skill.buildDirectory(new53); + new58 = new5 + "/generic"; + skill.buildDirectory(new58); + new581 = new5 + "/jpa"; + skill.buildDirectory(new581); + new582 = new581 + "/dao"; + skill.buildDirectory(new582); + new583 = new582 + "/impl"; + skill.buildDirectory(new583); + new60 = new5 + "/task"; + new61 = new60 + "/impl"; + new63 = new5 + "/job"; + if (skill.quartzVers == null) { + if (new File(new60).exists()) { + Abacus.destroyDirectory(new60); + done = new File(new60).delete(); + } + if (new File(new63).exists()) { + Abacus.destroyDirectory(new63); + done = new File(new63).delete(); + } + } else { + skill.buildDirectory(new60); + skill.buildDirectory(new63); + } + skill.buildDirectory(new60); + skill.buildDirectory(new61); + String new59 = new5 + "/mail"; + skill.buildDirectory(new59); + domainY = new5 + "/domain"; + skill.buildDirectory(domainY); + securityY = new5 + "/security"; + if (skill.springSecurity) { + skill.buildDirectory(securityY); + } + if (skill.ldap) { + newLdap = securityY + "/ldap"; + skill.buildDirectory(newLdap); + newLdap += "/userdetails"; + skill.buildDirectory(newLdap); + newLdap += "/ad"; + skill.buildDirectory(newLdap); + FileComponent.addClass( + "ActiveDirectoryLdapAuthoritiesPopulator.java", + newLdap, + "ActiveDirectoryLdapAuthoritiesPopulator.java", + candies, recycleBinY, skill, -1, markupE, "java"); + } + newAnnotation = skill.javaWebY + "/annotation"; + skill.buildDirectory(newAnnotation); + new513 = skill.javaWebY + "/filter"; + if (skill.filter) { + skill.buildDirectory(new513); + /* I don't want filters, so the directory needs to be + * cleared */ + } else if (new File(new513).exists()) { + Abacus.destroyDirectory(new513); + done = new File(new513).delete(); + } + brickAuthenticationY = skill.javaWebY + "/authentication"; + if (skill.authenticationProvider != null + && !skill.authenticationProvider.equals("ldap")) { + skill.buildDirectory(brickAuthenticationY); + /* ... then it means that I don't want filters, so the + * directory must be deleted */ + } else if (new File(brickAuthenticationY).exists()) { + Abacus.destroyDirectory(brickAuthenticationY); + done = new File(brickAuthenticationY).delete(); + } + if (skill.hasUseridPassword) { + brickAuthenticationAuthorityY = brickAuthenticationY + + "/authority"; + skill.buildDirectory(brickAuthenticationAuthorityY); + } + new515 = skill.javaWebY + "/listener"; + skill.buildDirectory(new515); + new516 = skill.javaWebY + "/mapping"; + skill.buildDirectory(new516); + newResolver = skill.javaWebY + "/resolver"; + skill.buildDirectory(newResolver); + new518 = skill.javaWebY + "/sanitizer"; + skill.buildDirectory(new518); + new519 = skill.javaWebY + "/servlet"; + skill.buildDirectory(new519); + String new51a = skill.javaWebY + "/validator"; + skill.buildDirectory(new51a); + } + + /* treatment of the links between markups that are significant for + * their position; es. formt, valconst */ + final private void eachTrainHooks(Train train, + final int posizioneVisiva) + + throws ExactException { + + List vcE = new ArrayList(); + /* the first time the markup file appears, I prepare the + * substance that will accept the text of the file */ + if (train.locomotor.stub.equals("file")) { + train.locomotor.substance = ""; + } + /* trattasiIndexJsp would seem useless, for now I leave it */ + if (train.locomotor.stub.equals("jsp")) { + // questionIndexJsp = false; + ultimaJsp = train; + } else if (train.locomotor.stub.equals("indexjsp")) { + ultimaJsp = train; + ultimaJsp.locomotor.substance = new JspKit(); + } + String ultimaFormLabel = ""; + if (train.wagonE.get("flabel") != null) { + ultimaFormLabel = train.wagonE.get("flabel").text; + } + if (train.locomotor.stub.length() > 4 + && train.locomotor.text != null && train.locomotor.text + .length() > 1 && train.locomotor.stub.substring( + 0, 4).equals("form")) { + String secondaLettera = train.locomotor.text.substring(1, + 2); + if (secondaLettera.toUpperCase().equals(secondaLettera)) { + ExactException ce = new ExactException( + "In un tag «formt+» la seconda lettera del name «" + + train.locomotor.text + + "» è maiuscola, is incorrect."); + ce.code = 1730; + ce.datum = ce.getMessage(); + ce.className = this.getClass().getName(); + throw ce; + } + } + JspBeanElement jbe = null; + if (train.locomotor.stub.equals("formt")) { + kitLastJsp = (JspKit) ultimaJsp.locomotor.substance; + jbe = new JspBeanElement(Mix.lowercaseFirstChar( + train.locomotor.text), null, true, ultimaFormLabel, + train.wagonE.get("mybutton"), vcE, Cst.TEXT_BOX); + kitLastJsp.controlE.add(jbe); + } else if (train.locomotor.stub.equals("forma")) { + kitLastJsp = (JspKit) ultimaJsp.locomotor.substance; + jbe = new JspBeanElement(Mix.lowercaseFirstChar( + train.locomotor.text), null, true, ultimaFormLabel, + train.wagonE.get("mybutton"), vcE, Cst.TEXT_AREA); + kitLastJsp.controlE.add(jbe); + } else if (train.locomotor.stub.equals("formc")) { + kitLastJsp = (JspKit) ultimaJsp.locomotor.substance; + jbe = new JspBeanElement(Mix.lowercaseFirstChar( + train.locomotor.text), null, true, ultimaFormLabel, + train.wagonE.get("mybutton"), vcE, Cst.CHECK_BOX); + kitLastJsp.controlE.add(jbe); + } else if (train.locomotor.stub.equals("formr")) { + kitLastJsp = (JspKit) ultimaJsp.locomotor.substance; + int start = 0; + if (train.wagonE.get("fstart") != null) { + start = Integer.valueOf(train.wagonE.get( + "fstart").text); + } + jbe = new JspBeanElement(Mix.lowercaseFirstChar( + train.locomotor.text), null, true, ultimaFormLabel, + null, train.wagonE.get("mybutton"), null, null, + Cst.RADIO_BUTTON, train.wagonE.get("ftokens"), + start); + kitLastJsp.controlE.add(jbe); + } else if (train.locomotor.stub.equals("formn")) { + kitLastJsp = (JspKit) ultimaJsp.locomotor.substance; + jbe = new JspBeanElement(Mix.lowercaseFirstChar( + train.locomotor.text), null, true, ultimaFormLabel, + train.wagonE.get("fcartel"), train.wagonE.get( + "mybutton"), train.wagonE.get("dao"), + train.wagonE.get("hsqln"), Cst.LIST_BOX, + train.wagonE.get("ftokens"), 0); + kitLastJsp.controlE.add(jbe); + } + if (train.locomotor.stub.equals("valcons")) { + jbe = kitLastJsp.controlE.get(kitLastJsp.controlE.size() + - 1); + ValidConstScrew vc = new ValidConstScrew(train.locomotor, + train.wagonE.get("valparams"), train.wagonE.get( + "valtag")); + jbe.validConstE.add(vc); + } + if (train.locomotor.stub.equals("bdefmenu")) { + lastDeclaredMenu = (markupE.get("bdefmenu").recurrenceE.get( + markupE.get("bdefmenu").recurrenceE.size() - 1)); + lastDeclaredMenu.locomotor.substance = new MenuKit(); + ((MenuKit) lastDeclaredMenu.locomotor.substance).navbarFixedTop = lastDeclaredMenu.wagonE + .containsKey("bfixedtop"); + } + if (train.locomotor.stub.equals("blabel") + & lastDeclaredMenu != null) { + String[] clic = new String[2]; + clic[0] = train.locomotor.text; + clic[1] = train.wagonE.get("burl").text; + ((MenuKit) lastDeclaredMenu.locomotor.substance).clicE.add( + clic); + } + if (train.locomotor.stub.equals("pragma") & ultimaJsp == null) { + String message = "The markup " + Mix.dress_A( + train.locomotor.stub) + " at the row " + + posizioneVisiva + + " must be preceded (even not immediately)" + + " by markup «jsp+»."; + ExactException ce = new ExactException(); + ce.code = 1713; + ce.datum = message; + ce.className = this.getClass().getName(); + throw ce; + } else if (train.locomotor.stub.equals("pragma")) { + /* I take the train of the last jsp */ + ((JspKit) (ultimaJsp.locomotor.substance)).pragma = true; + } + } + + /** + *

+ * Checking the presence of markups. + *

+ * + * @throws ExactException standard exception */ + final public void controlloPresenze() + + throws ExactException { + + ExactException ce = new ExactException(); + Collection valueE = markupE.values(); + Iterator iterator = valueE.iterator(); + while (iterator.hasNext()) { + Markup markup = iterator.next(); + /* I check the markups that must always be present at least + * once, but only if they are locomotives; to verify that + * they are locomotives */ + if (markup.presenza == 1 && (markup.implyE == null + || !markup.implyE[0].isWagon) && markup.recurrenceE + .size() != 1) { + // if (markup.presence == 1 && markup.occurrenceE + // .size ()! = 1) { + ce.code = 1714; + ce.datum = "The markup " + Mix.dress_A(markup.stub) + + " has to be present once and only once."; + ce.className = this.getClass().getName(); + throw ce; + } + if (markup.recurrenceE.size() == 0) { + continue; + } + if (markup.presenza == 2 & markup.recurrenceE.size() > 1) { + ce.code = 1715; + ce.datum = "The markup " + Mix.dress_A(markup.stub) + + " has to be present no more than once."; + ce.className = this.getClass().getName(); + throw ce; + } + if (markup.presenza == 3 | markup.presenza == 5 + & markup.recurrenceE.size() == 0) { + ce.code = 1716; + ce.datum = "The markup " + Mix.dress_A(markup.stub) + + " has to be present at least once."; + ce.className = this.getClass().getName(); + throw ce; + } + if (markup.implyE != null) { + /* the algorithm is based on a series of hours because, + * if I speak of "it presupposes a locomotive", there + * can be a range of possible locomotives, therefore the + * test must be satisfied at least once. Unfortunately, + * the algorithm is not adequate when other markups are + * assumed, which are not locomotives of the markup we + * are checking, but which must still be present */ + /* a column should be added in the Hammer class table: + * the current one becomes "presupposes locomotor", the + * new "presupposes markup" */ + boolean presente = false; + boolean assente = false; + String totalPresent = ""; + String totalAbsent = ""; + int totalPresentOnesQ = 0; + int totalAbsentOnesQ = 0; + for (int n = 0; n < markup.implyE.length; n++) { + if (markup.implyE[n].direct) { + presente |= markupE.get( + markup.implyE[n].stub).recurrenceE + .size() > 0; + totalPresent += markup.implyE[n].stub + " "; + totalPresentOnesQ++; + } else { + assente |= markupE.get( + markup.implyE[n].stub).recurrenceE + .size() == 0; + totalAbsent += markup.implyE[n].stub + " "; + totalAbsentOnesQ++; + } + } + /* if there is, remove the final space) */ + if (totalPresent.endsWith(Candies.SPACE)) { + totalPresent = totalPresent.substring(0, + totalPresent.length() - 1); + } + if (totalAbsent.endsWith(Candies.SPACE)) { + totalAbsent = totalAbsent.substring(0, totalAbsent + .length() - 1); + } + if (totalPresentOnesQ > 0 & !presente) { + ce.code = 1717; + if (totalPresentOnesQ == 1) { + ce.datum = "The markup " + Mix.dress_A( + totalPresent) + + " has to be present at least once," + + " it is required by the presence of " + + Mix.dress_A(markup.stub) + "."; + } else { + ce.datum = "The markup " + Mix.dress_A( + totalPresent) + + " has to be present at least once," + + " they are required by the presence of " + + Mix.dress_A(markup.stub) + "."; + + } + ce.className = this.getClass().getName(); + throw ce; + } + if (totalAbsentOnesQ > 0 & !assente) { + ce.code = 1736; + if (totalAbsentOnesQ == 1) { + ce.datum = "The markup " + Mix.dress_A( + totalAbsent) + + " it should not be present," + + " as determined by the configuration of " + + Mix.dress_A(markup.stub) + "."; + } else { + ce.datum = "None of the markups " + Mix.dress_A( + totalAbsent) + + " it should not be present," + + " as determined by the configuration of " + + Mix.dress_A(markup.stub) + "."; + } + ce.className = this.getClass().getName(); + throw ce; + } + } + if (markup.mandatoryWagE != null) { + for (int m = 0; m < markup.mandatoryWagE.length; m++) { + for (int n = 0; n < markup.recurrenceE + .size(); n++) { + Train train = markup.recurrenceE.get(n); + if (train.wagonE.get( + markup.mandatoryWagE[m]) == null) { + ce.code = 1718; + ce.datum = "The markup " + Mix.dress_A( + markup.mandatoryWagE[m]) + + " is missing after the markup " + + Mix.dress_A(markup.stub + "+" + + train.locomotor.text) + + "."; + ce.className = this.getClass().getName(); + throw ce; + } + } + } + } + if (markup.optionalWagE != null) { + for (int n = 0; n < markup.recurrenceE.size(); n++) { + Train train = markup.recurrenceE.get(n); + + Collection valueWagonE = train.wagonE + .values(); + Iterator iteratorWagon = valueWagonE + .iterator(); + while (iteratorWagon.hasNext()) { + Wagon wagon = iteratorWagon.next(); + int m = 0; + for (; m < markup.unioneE.length; m++) { + if (wagon.stub.equals(markup.unioneE[m])) { + break; + } + } + if (m == markup.unioneE.length) { + ce.code = 1731; + ce.datum = "The markup " + Mix.dress_A( + wagon.stub + "+" + wagon.text) + + " following " + Mix.dress_A( + train.locomotor.stub + "+" + + train.locomotor.text) + + " it is not expected in optional" + + " wagons nor in mandatory ones."; + ce.className = this.getClass().getName(); + throw ce; + } + } + } + } + } + int i = 0; + for (; i < markupE.get("blabel").recurrenceE.size(); i++) { + Train blabelTrain = markupE.get("blabel").recurrenceE.get( + i); + Wagon burlWagon = blabelTrain.wagonE.get("burl"); + int j = 0; + for (; j < markupE.get("requmap").recurrenceE.size(); j++) { + Train rmTrain = markupE.get("requmap").recurrenceE.get( + j); + if (rmTrain.locomotor.substance.equals( + burlWagon.substance)) { + break; + } + } + if (j == markupE.get("requmap").recurrenceE.size() + & !burlWagon.text.equals("/")) { + ce.code = 1738; + ce.datum = "The markup " + Mix.dress_A("blabel+" + + blabelTrain.locomotor.text) + + " calls an inexistent Request Map: " + Mix + .dress_A(burlWagon.text) + "."; + ce.className = this.getClass().getName(); + throw ce; + } + } + } + + final private List composeTrains(List zebra, + final String includeY) + + throws ExactException { + + String s = null; + int p = 0; + int rigaJ = 0; + String[] complessoE; + ExactException ne = new ExactException(); + for (rigaJ = 0; rigaJ < zebra.size(); rigaJ++) { + // here I trim the text, but only here + s = zebra.get(rigaJ).replaceAll("\\t", " ").trim(); + if (s.endsWith(Markup.PIU)) { + s += " "; + complessoE = s.split("\\x" + Markup.PIUX); + complessoE[complessoE.length - 1] = ""; + } else { + complessoE = s.split("\\x" + Markup.PIUX); + } + int complessoL = complessoE.length; + p = s.indexOf(Markup.PIUC); + /* if there is a + sign, and it is a file, and there are too + * many + signs ... */ + if (p > -1 && stub != null && stub.equals("file") + && complessoE.length != 2) { + ne.datum = "Nel markup " + Mix.dress_A(stub) + + " at line " + posizioneVisiva + + " the file name cannot contain the sign +."; + ne.code = 1719; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else if (s == null || s.length() == 0 || s.startsWith( + "#")) { + /* if a line starts with a pound sign, it is a + * comment */ + posizioneVisiva++; + continue; + /* if the + sign is not there, or is in such a position + * that it cannot be a markup, we have a file markup, + * and it is not the first line (stub! = null) and the + * last valid stub is "file "... */ + } else if (s.length() > 0 && stub != null && markupE.get( + train.locomotor.stub).p == 20 && (p == -1 + || p < Markup.MAR_LP || p > Markup.MAR_LM + - 1 || !markupE.containsKey(s + .substring(0, p) + .toLowerCase()))) { + /* ... then accumulates the line as file content */ + String z = (String) train.locomotor.substance; + z += zebra.get(rigaJ) + Candies.LINE_FEED; + train.locomotor.substance = z; + /* if a line is null, empty or comment, skip it, but + * count it with indication */ + } else if (p > -1 && s.length() > 1 && p < s.length() + && complessoL > 2 // that is, it has more than 1 + + // sign + && markupE.containsKey(s.substring(0, p) + .toLowerCase()) && markupE.get(s.substring( + 0, p).toLowerCase()).wagon) { + ne.datum = "The markup " + Mix.dress_A(stub) + + " at line " + posizioneVisiva + + " must have one + sign, being a" + + " \"wagon\" type."; + ne.code = 1720; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else if (p > -1 && s.length() > 1 && p < s.length() + && complessoL % 2 == 1 && markupE.containsKey(s + .substring(0, p).toLowerCase()) && !markupE + .get(s.substring(0, p) + .toLowerCase()).wagon) { + ne.datum = "The markup «" + s.substring(0, p) + + "+» in the row " + posizioneVisiva + + " must have an odd number of symbols +."; + ne.code = 1721; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else if (p > -1 & s.length() > 1 && p < s.length()) { + String[] pezzoE = new String[complessoE.length / 2]; + for (int j = 0; j < pezzoE.length; j++) { + pezzoE[j] = complessoE[j * 2] + Markup.PIU + + complessoE[j * 2 + 1]; + pezzoE[j] = pezzoE[j].trim(); + eValido(pezzoE[j], rigaJ, includeY, zebra, j); + } + eachTrainHooks(train, posizioneVisiva); + trainE.add(train); + /* if instead the markup is not present, there is a text + * and we are on the first train ... */ + } else if (s.length() > 0 & zQ == 0) { + ne.datum = "The file \"ele\" must begin with a valid" + + " markup, not with a text: " + s; + ne.code = 1722; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else if (s.length() > 0 & p > -1) { + + // NOT CREATION OF A NEW TRAIN, BUT ANYWAY INSTANTIATION + Wagon seg = new Wagon(markupE, stub, s, rigaJ, zQ, + train, posizioneVisiva); + Train f = new Train(seg, rigaJ); + eachTrainHooks(f, posizioneVisiva); + } + posizioneVisiva++; + } + return trainE; + } + + private void eValido(final String s, final int rigaJ, + final String includeY, List zebra, final int m) + + throws ExactException { + + File include = null; + ExactException ne = new ExactException(); + Wagon wagon = null; + try { + int p = s.indexOf(Markup.PIUC); + stub = s.substring(0, p).toLowerCase(); + String dato = s.substring(p + 1); + if (!markupE.containsKey(stub)) { + ne.datum = "The markup " + Mix.dress_A(stub + "+") + + " at line " + posizioneVisiva + + " it is not present among those expected."; + ne.code = 1723; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else { + + // sigh of relief, CREATION OF A NEW TRAIN + + /* if it is the first train (undead, i.e. not of type + * 0) */ + if (zQ == 0) { + wagon = new Wagon(markupE, stub, dato, rigaJ, zQ, + null, posizioneVisiva); + } else { // otherwise write down the previous one + wagon = new Wagon(markupE, stub, dato, rigaJ, zQ, + train, posizioneVisiva); + } + if (m == 0) { + train = new Train(); + } + if (train.locomotor == null) { + train.locomotor = wagon; + } else if (train.wagonE.get(wagon.stub) != null) { + ne.datum = "The markup " + Mix.dress_A(wagon.stub) + + " is repeated at line " + posizioneVisiva + + " following " + Mix.dress_A( + train.locomotor.stub + "+" + + train.locomotor.text) + + ", " + "it is not acceptable."; + ne.code = 1734; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else if (!markupE.get(wagon.stub).wagon) { + ne.datum = "The markup " + Mix.dress_A(wagon.stub) + + " is a locomotor, it cannot stay in a" + + " wagon position after " + Mix.dress_A( + train.locomotor.stub) + "."; + ne.code = 1735; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } else { // ... finally okay, I create the train + train.wagonE.put(wagon.stub, wagon); + int j = 0; + for (; j < markupE.get( + wagon.stub).implyE.length; j++) { + if (markupE.get(wagon.stub).implyE[j].isWagon + & markupE.get(wagon.stub).implyE[j].stub + .equals(train.locomotor.stub)) { + break; + } + } + if (j == markupE.get(wagon.stub).implyE.length) { + ne.datum = "The markup " + Mix.dress_A( + wagon.stub) + " is found after " + Mix + .dress_A(train.locomotor.stub) + + ", " + "it is not acceptable."; + ne.code = 1728; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } + } + if (m == 0) { + markupE.get(stub).recurrenceE.add(train); + } + /* when p calls an include (.eli) */ + if (m == 0 & (markupE.get(train.locomotor.stub).p == 9 + | markupE.get(train.locomotor.stub).p == 10 + | markupE.get(train.locomotor.stub).p == 11 + | markupE.get(train.locomotor.stub).p == 21)) { + train.locomotor.positionJ = trainE.size(); + Collection valueE = train.wagonE.values(); + Iterator iterator = valueE.iterator(); + while (iterator.hasNext()) { + Wagon v = iterator.next(); + v.positionJ = trainE.size(); + } + zQ++; + include = new File(includeY + train.locomotor.stub + + "_" + train.locomotor.substance + ".eli"); + if (include.exists()) { + List includeZ = ReadMyFile.zebra_A( + include.getPath()); + zebra.addAll(rigaJ + 1, includeZ); + posizioneVisiva -= includeZ.size(); + } else { + ne.datum = "The file " + Mix.dress_A(include + .getName()) + " does not exist."; + ne.code = 1724; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } + /* only if he's not follower ... */ + } else if (!train.locomotor.follower) { + train.locomotor.positionJ = trainE.size(); + Collection valueE = train.wagonE.values(); + Iterator iterator = valueE.iterator(); + while (iterator.hasNext()) { + Wagon v = iterator.next(); + v.positionJ = trainE.size(); + } + zQ++; + } + } + } catch (FileNotFoundException e) { + ne.code = 1726; + ne.datum = "The file " + include.getPath() + + " does not exist."; + ne.className = this.getClass().getName(); + throw ne; + } catch (IOException e) { + ne.code = 1727; + ne.datum = "Error in acceding file «" + include.getPath() + + "»."; + ne.className = this.getClass().getName(); + throw ne; + } + } + + private void fileModelPositions() { + + if (skill.hibernate) { + skill.hibernateVersion = markupE.get("hv").recurrenceE.get( + 0).locomotor.text; + String depenHiberF = "hv_" + skill.hibernateVersion + + ".txt"; + skill.depenHiberG = candies.snippetsYS + depenHiberF; + } + if (skill.jackson) { + String depenJacksonF = "depen_jackson.txt"; + skill.depenJacksonG = candies.snippetsYS + depenJacksonF; + } + if (skill.hiberValid) { + String depenHValidF = "depen_hvalid.txt"; + skill.depenHValidG = candies.snippetsYS + depenHValidF; + } + if (skill.springValid) { + String depenValidatorF = "depen_validator.txt"; + skill.depenValidatorG = candies.snippetsYS + + depenValidatorF; + } + } + + private void securityWrite() + + throws FileNotFoundException, ExactException, IOException { + + FileComponent.addClass("LoggedUser.java", newAnnotation, + "LoggedUser.java", candies, recycleBinY, skill, -1, + markupE, "java"); + FileComponent.addClass("LoggedUserMethodArgumentResolver.java", + newResolver, "LoggedUserMethodArgumentResolver.java", + candies, recycleBinY, skill, -1, markupE, "java"); + FileComponent.addClass("Belonger.java", securityY, + "Belonger.java", candies, recycleBinY, skill, -1, + markupE, "java"); + if (skill.authenticationProvider.equals("class") + && skill.authenticationMode != null + && !skill.authenticationMode.endsWith("trivial")) { + userAuthenticationProvider_java.synthesis(markupE, trainE, + candies); + userAuthenticationProvider_java.write(brickAuthenticationY, + Mix.uppercaseFirstChar(skill.applicationNameLower) + + "UserAuthenticationProvider.java", + "ApplicUserAuthenticationProvider.java", "java", + candies, recycleBinY); + } + FileComponent.addFile("error_jsp.txt", "error.jsp", new723, + candies, recycleBinY, skill); + if (skill.hasUseridPassword) { + FileComponent.addFile("login_jsp.txt", "login.jsp", new722, + candies, recycleBinY, skill); + if (skill.authenticationMode.equals("trivial")) { + king.write(domainY, "King.java", "King.java", "java", + candies, recycleBinY); + kingDao.write(brickAuthenticationY, "KingDao.java", + "KingDao.java", "java", candies, recycleBinY); + kingDaoImpl.write(brickAuthenticationY, + "KingDaoImpl.java", "KingDaoImpl.java", "java", + candies, recycleBinY); + } else { + userAuthorityUtils.write(brickAuthenticationAuthorityY, + "UserAuthorityUtils.java", + "UserAuthorityUtils.java", "java", candies, + recycleBinY); + springSecurityUserContext.write(brickAuthenticationY, + "springSecurityUserContext.java", + "springSecurityUserContext.java", "java", + candies, recycleBinY); + } + interfacciaUserContext.write(brickAuthenticationY, + "UserContext.java", "UserContext.java", "java", + candies, recycleBinY); + userContextImpl.write(brickAuthenticationY, + "UserContextStub.java", "UserContextImpl.java", + "java", candies, recycleBinY); + } + if (skill.hasUseridPassword) { + if (!new File(brickAuthenticationY).exists()) { + ExactException ne = new ExactException( + "You declared the \"userpass\" markup, but" + + " you did not declare an authentication " + + "provider with the \"xprovider\" markups," + + " or you declared \"ldap\"."); + ne.code = 1725; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } + if (skill.tableDBE.size() == 0 & !skill.authenticationMode + .equals("trivial")) { + ExactException ne = new ExactException( + "You have declared the \"userpass\" markup," + + " but you have not declared any group" + + " of tables using the \"hdefrail\" markup."); + ne.code = 1729; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } else if (skill.tableDBE.size() > 0 & markupE.get( + "utabuser").recurrenceE.size() > 0) { + int j = 0; + for (; j < skill.tableDBE.size(); j++) { + if (skill.tableDBE.get(j).dbSchema.equalsIgnoreCase( + skill.tabUser[3]) & skill.tableDBE.get( + j).railLowercase.equalsIgnoreCase( + Cst.RAIL + skill.tabUser[1]) + & skill.tableDBE.get(j).entityName + .equalsIgnoreCase( + skill.tabUser[0])) { + break; + } + } + if (j == skill.tableDBE.size()) { + ExactException ne = new ExactException( + "The \"utabuser\" markup value indicates a non-existent table name: «" + + skill.tabUser[0] + + "», or a non-existent code «rail» : «" + + skill.tabUser[1] + + "», or a non-existent DB schema: «" + + skill.tabUser[2] + "»"); + ne.code = 1702; + ne.datum = ne.getMessage(); + ne.className = this.getClass().getName(); + throw ne; + } else { + skill.tabUserJ = j; + } + } + } + if (skill.authenticationMode == null) { + /* do nothing */ + } else if (skill.authenticationMode.equals("domain")) { + FileComponent.deleteComponent(brickAuthenticationY, + "SimpleUsernamePasswordAuthenticationToken.java", + recycleBinY, skill); + FileComponent.deleteComponent(brickAuthenticationY, + "SimpleUsernamePasswordAuthenticationFilter.java", + recycleBinY, skill); + FileComponent.addClass( + "DomainUsernamePasswordAuthenticationFilter.java", + brickAuthenticationY, + "DomainUsernamePasswordAuthenticationFilter.java", + candies, recycleBinY, skill, -1, markupE, "java"); + /* for the token class, the index of the users table must be + * provided */ + FileComponent.addClass( + "DomainUsernamePasswordAuthenticationToken.java", + brickAuthenticationY, + "DomainUsernamePasswordAuthenticationToken.java", + candies, recycleBinY, skill, skill.tabUserJ, + markupE, "java"); + } else if (skill.authenticationMode.equals("simple")) { + FileComponent.deleteComponent(brickAuthenticationY, + "DomainUsernamePasswordAuthenticationToken.java", + recycleBinY, skill); + FileComponent.deleteComponent(brickAuthenticationY, + "DomainUsernamePasswordAuthenticationFilter.java", + recycleBinY, skill); + FileComponent.addClass( + "SimpleUsernamePasswordAuthenticationFilter.java", + brickAuthenticationY, + "SimpleUsernamePasswordAuthenticationFilter.java", + candies, recycleBinY, skill, -1, markupE, "java"); + /* for the token class, the index of the users table must be + * provided */ + FileComponent.addClass( + "SimpleUsernamePasswordAuthenticationToken.java", + brickAuthenticationY, + "SimpleUsernamePasswordAuthenticationToken.java", + candies, recycleBinY, skill, skill.tabUserJ, + markupE, "java"); + } + } + + private void securityClean() { + File dest = new File(recycleBinY + "/LoggedUser.java"); + dest.delete(); + new File(newAnnotation + "/LoggedUser.java").renameTo(dest); + dest = new File(recycleBinY + "/Belonger.java"); + dest.delete(); + new File(securityY + "/Belonger.java").renameTo(dest); + dest = new File(recycleBinY + + "/LoggedUserMethodArgumentResolver.java"); + dest.delete(); + new File(newResolver + "/LoggedUserMethodArgumentResolver.java") + .renameTo(dest); + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Hammer.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Hammer.java new file mode 100644 index 0000000..820e9e9 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Hammer.java @@ -0,0 +1,568 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.graphic.Placard; + +/** + *

+ * Application to automatically generate skeletons of a Maven + * application. + *

+ * + * @author M. Maglioni + *

+ * ​​Company: Ramecera™
+ * Creation date: 2020-04-09
+ * Last updated: 2020-08-20
+ *

+ */ +final public class Hammer { + + private static ExactException ne = new ExactException(); + + // CONSTANTS + + static boolean allRight; + + /** ordinary logger */ + private static final Logger logger = Logger.getLogger(Hammer.class); + + /** + *

+ * Simple main method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-08-20
+ *

+ *

+ * History: 2020-08-02 implementation of N13 (see + * martoraProject.ods) + *

+ * + * @param args null + * @throws ExactException exception specified by a numerical code */ + public static void main(String[] args) + + throws ExactException { + + /** the types of markups are:
+ * 1 = a date, mandatory
+ * 2 = an unsigned non-negative integer, mandatory
+ * 3 = a string of at least 1 character, mandatory
+ * 4 = no parameters
+ * 5 = a version of a software, for example 1.3.13.RELEASE + * N6
+ * 6 = a string, optional
+ * 7 = a CSS color, of the type #ffffff or rgb ( 255,255,255) or + * white
+ * 8 = like 12, and automatically converted to lower case
+ * 9 = like 4, but to look for among it includes
+ * 10 = like 3, but to look for among includes
+ * 11 = like 5, but to be found among the includes
+ * 12 = like 3 but composed of a single word
+ * 13 = like 12 but with no more than one slash: example : + * "security / user.jsp", and at least one character after the + * slash
+ * 14 = like 13 but optional, and if there is no data, the one + * of the previous markup is taken
+ * 15 = an integer with or without sign, mandatory
+ * 16 = like 12 but optional
+ * occurrences are:
+ * 17 = a string composed of words separated by commas, + * mandatory
+ * 18 = a string consisting of a select SQL, mandatory
+ * 19 = a string, mandatory one of the values ​​declared in the + * "domain" column
+ * 20 = precedes the text of a file or of a source code
+ * 21 = like 19, but to be searched among the includes
+ * 22 = like 17, but optional
+ * 23 = a language code , ISO 639-1
+ * 24 = like 17, but substrings must be composed by one word * + * presence = 0: none or as many as you want
+ * presence = 1: one and only one
+ * presence = 2: 1 or none
+ * presence = 3: at least 1
+ * presence = 4: none or as many as you want, but without + * identical repetitions
+ * presence = 5: at least 1, but without identical repetitions + *
+ * Atoms, taken at 5 to 5, they go to form the markups. */ + /* @formatter:off */ + String[][] atomi = { + { "antisamy", "4", "2", "", "", "", "", "" }, + { "appse", "3", "1", "", "", "", "", "" }, + { "arraystring", "3", "3", "+jsp", "", "", "", "" }, + { "bdefmenu", "8", "4", "indexjsp", "", "bfixedtop", "", "" }, + { "belong", "3", "0", "+jsp", "", "", "", "" }, + { "bfixedtop", "4", "0", "+bdefmenu", "", "", "", "" }, + { "blabel", "3", "0", "bdefmenu", "burl", "", "", "" }, + { "blank", "4", "0", "+jsp", "", "", "", "" }, + { "bmenu", "8", "0", "+jsp, +indexjsp, +userpass", "", "", "", "" }, + { "boolean", "3", "3", "+jsp", "", "", "", "" }, + { "burl", "12", "3", "+blabel", "", "", "", "" }, + { "captc", "3", "2", "", "", "", "", "" }, + { "charset", "3", "2", "", "", "", "", "" }, + { "colorform", "7", "2", "userpass", "", "", "", "" }, + { "crud", "4", "0", "+jsp", "", "", "", "" }, + { "cssclass", "12", "4", "+text,+jsp", "", "", "", "" }, + { "dao", "24", "0", "+method, +formn", "", "", "", "" }, + { "defaulan", "23", "2", "", "", "", "", "" }, + { "depen", "2", "1", "", "", "", "", "" }, + { "dress", "12", "0", "+jsp", "", "", "", "" }, + { "edefn", "14", "0", "", "", "", "", "" }, + { "ev", "5", "2", "", "", "", "", "" }, + { "fcartel", "3", "0", "+formn", "", "", "", "" }, + { "file", "20", "4", "", "", "", "", "" }, + { "filte", "4", "2", "", "", "", "", "" }, + { "company", "3", "1", "", "", "", "", "" }, + { "flabel", "3", "0", "+formt,+formn,+forma,+formc,+formr", "", "", "", "" }, + { "forma", "3", "0", "jsp", "flabel", "", "", "forma, formc, formt, formn, formr, jsp, valcons" }, + { "formc", "3", "0", "jsp", "flabel", "", "", "forma, formc, formt, formn, formr, jsp, valcons" }, + { "formn", "3", "0", "jsp", "flabel, fcartel", "mybutton, dao, hsqln, ftokens", "", "forma, formc, formt, formn, formr, jsp, valcons" }, + { "formr", "3", "0", "jsp", "ftokens", "flabel, fstart", "", "forma, formc, formt,formn, formr, jsp, valcons" }, + { "formt", "3", "0", "jsp", "flabel", "", "", "forma, formc, formt,formn, formr, jsp, valcons" }, + { "fstart", "3", "0", "+formr", "", "", "", "" }, + { "ftokens", "17", "0", "+formn,+formr", "", "", "", "" }, + { "goal", "13", "3", "+requmap", "", "", "", "" }, + { "hdbms", "19", "0", "+hdefrail", "", "", "DB2, MySQL, Oracle, Oracle8i, Postgres", "" }, + { "hdbschema", "8", "4", "+hdefrail", "", "", "", "" }, + { "hdefrail", "19", "0", "", "hdbschema, hdbms", + "hjndi, hjarv", "0,1,2,3,4,5,6,7,8,9", "" }, + /* FUTURE RELEASE N6 */ +// { "hddl", "17", "2", "", "", "", "", "" }, +// { "hembedded", "4", "2", "", "", "", "", "" }, + { "hjarv", "5", "3", "+hdefrail", "", "", "", "" }, + { "hjndi", "12", "0", "+hdefrail", "", "", "", "" }, + { "hjpav", "19", "1", "+hv", "", "", "1,2", "", "" }, + { "hrail", "2", "0", "+utabuser, +qjobname", "", "", "", "" }, + { "hsqln", "18", "0", "+formn", "", "", "", "" }, + { "hv", "5", "2", "", "hjpav", "", "", "" }, + { "hvalid", "5", "2", "!svalid", "", "", "", "" }, + { "i18n", "3", "2", "sinterce", "", "", "", "" }, + { "indexjsp", "4", "2", "", "", "bmenu, ooptioncolor, ooptionhover, ooptbackcol1, ooptbackcol2", "", "" }, + { "integer", "3", "3", "+jsp", "", "", "", "" }, + { "jacksonver", "3", "2", "", "", "", "", "" }, + { "jeev", "5", "2", "", "", "", "", "" }, + { "jsp", "13", "4", "", "belong", + "bmenu, string, arraystring, integer, long, boolean, dress, cssclass, refresh, pagetitle, crud, blank, legend", "", "" }, + { "language", "23", "0", "i18n", "", "", "", "" }, + { "legend", "3", "0", "+jsp", "", "", "", "" }, + { "log4j", "5", "2", "", "", "", "", "" }, + { "long", "3", "3", "+jsp", "", "", "", "" }, + { "matrix", "4", "2", "", "", "", "", "" }, + { "mavbu", "4", "2", "mavcl, mavwa, mavcp", "", "", "", "" }, + { "mavcl", "5", "2", "mavbu, mavwa, mavcp", "", "", "", "" }, + { "mavco", "5", "1", "", "", "", "", "" }, + { "mavcp", "5", "2", "mavbu, mavwa, mavcl", "", "", "", "" }, + { "mavgr", "3", "1", "", "", "", "", "" }, + { "mavmo", "5", "1", "", "", "", "", "" }, + { "mavwa", "5", "2", "mavbu, mavcp, mavcl", "", "", "", "" }, + { "method", "20", "4", "", "", "", "", "" }, + { "model", "4", "3", "+requmap", "", "", "", "" }, + { "mv", "5", "1", "", "", "", "", "" }, + { "mybutton", "3", "0", "+formn, +formt, +forma", "", "", "", "" }, + { "oalign", "19", "3", "+odefcss", "", "", "left, center, right", "" }, + { "odefcss", "12", "4", "", "", "", "", "" }, + { "ooptbackcol1", "7", "0", "+indexjsp", "", "", "", "" }, + { "ooptbackcol2", "7", "0", "+indexjsp", "", "", "", "" }, + { "obackcolor", "7", "3", "+odefcss", "", "", "", "" }, + { "ocolor", "7", "3", "+odefcss", "", "", "", "" }, + { "ofontsize", "15", "3", "+odefcss", "", "", "", "" }, + { "omargin", "15", "3", "+odefcss", "", "", "", "" }, + { "ooptioncolor", "7", "0", "+indexjsp", "", "", "", "" }, + { "ooptionhover", "7", "0", "+indexjsp", "", "", "", "" }, + { "opadding", "15", "3", "+odefcss", "", "", "", "" }, + { "others", "24", "0", "+method", "", "", "", "" }, + { "pagetitle", "3", "0", "+jsp", "", "", "", "" }, + { "permit", "19", "0", "+requmap", "", "", "all, user, admin", "" }, + { "pompr", "2", "2", "", "", "", "", "" }, + { "pragma", "4", "2", "jsp", "", "", "", "" }, + { "pretprint", "4", "2", "sv+3.2.0", "", "", "", "" }, + { "primary", "10", "2", "", "", "", "", "" }, + { "qcron", "3", "2", "+qjobname", "", "", "", "" }, + { "qjobname", "12", "0", "quartz", "hrail", "qcron, qsimple", "", "" }, + { "quartz", "5", "2", "qjobname", "", "", "", "" }, + { "qsimple", "3", "2", "+qjobname", "", "", "", "" }, + { "redirect", "3", "0", "+requmap", "", "", "", "" }, + { "refresh", "2", "0", "+jsp", "", "", "", "" }, + { "requmap", "12", "0", "jsp", "", "model, permit, goal, redirect", "", "" }, + { "sdefauto", "19", "2", "", "", "", "no, byname, bytype, autodetect, constructor", "" }, + { "sieco", "14", "0", "", "", "", "", "" }, + { "sinterce", "12", "0", "", "", "", "", "" }, + { "uintp", "12", "0", "uv", "", "", "", "" }, + { "sreso", "16", "4", "", "", "", "", "" }, + { "srobo", "4", "2", "", "", "", "", "" }, + { "string", "3", "3", "+jsp", "", "", "", "" }, + { "sv", "5", "1", "primary", "", "", "", "" }, + { "svalid", "4", "2", "!hvalid", "", "", "", "" }, + { "text", "3", "2", "indexjsp", "cssclass", "", "", "" }, + { "upassword", "12", "2", "+utabuser", "", "", "", "" }, + { "userpass", "21", "2", "uv", "", "bmenu", + "simple, domain, trivial", "" }, + { "uspaformadmin", "3", "2", "userpass+trivial", "", "", "", "" }, + { "uspaformuser", "3", "2", "userpass+trivial", "", "", "", "" }, + { "usignup", "4", "2", "userpass", "", "", "", "" }, + { "utabuser", "12", "2", "userpass", + "hrail, uwelcome, upassword", "", "", "" }, + { "uv", "5", "2", "sv, xprovider", "", "", "", "" }, + { "uwelcome", "12", "2", "+utabuser", "", "", "", "" }, + { "valcons", "19", "0", "defaulan", "valtag", "valparams", "@AssertFalse, @AssertFalse.List, @AssertTrue, @AssertTrue.List, @DecimalMax, @DecimalMax.List, @DecimalMin, @DecimalMin.List, @Digits, @Digits.List, @Future, @Future.List, @Max, @Max.List, @Min, @Min.List, @NotEmpty, @NotNull, @NotNull.List, @Null, @Null.List, @Past, @Past.List, @Pattern, @Pattern.List, @Size, @Size.List", "formt, forma, formc, valcons" }, + { "vallabel", "3", "0", "defaulan", "valmess", "vallang", "", "" }, + { "vallang", "23", "0", "+vallabel", "", "", "", "" }, + { "valmess", "3", "0", "+vallabel", "", "", "", "" }, + { "valparams", "3", "0", "+valcons", "", "", "", "" }, + { "valtag", "3", "0", "+valcons", "", "", "", "" }, + { "weberror", "4", "2", "", "", "", "", "" }, + { "webmime", "4", "2", "", "", "", "", "" }, + { "wparams", "3", "0", "", "", "", "", "" }, + { "wv", "5", "2", "", "", "", "", "" }, + { "xauth", "18", "2", "xprovider+jdbc, !xgbac", "", "", "", "" }, + { "xencoder", "19", "2", "uv", "", "", "useridmd5, saltedsha256", "" }, + { "xlbase", "12", "2", "xprovider+ldap", "", "", "", "" }, + { "xgbac", "18", "2", "xprovider+jdbc, !xauth, !xusers", "", + "", "", "" }, + { "xlpass", "12", "2", "xprovider+ldap", "", "", "", "" }, + { "xlclass", "3", "2", "xprovider+ldap", "", "", "", "" }, + { "xlservice", "4", "2", "xprovider", "", "", "", "" }, + { "xprovider", "19", "2", "uv", "", "", + "user-service, class, jdbc, ldap", "" }, + { "xusers", "18", "2", "xprovider+jdbc, !xgbac", "", "", "", "" } }; + + /* @formatter:on */ + PropertyConfigurator.configure("log4j.properties"); + + // READING PROPERTIES + + if (args.length == 0) { + new Placard(null, "An argument is missing at the" + + " start of the main method."); + return; + } + String message = "Start of process"; + logger.info(Candies.LF + Candies.LF + + "===========================================" + + Candies.LF + message + Candies.LF + + "==========================================="); + CandyScrew candyScrew = new CandyScrew(); + candyScrew.appName = args[0]; + if (!candyScrew.appName.matches("\\p{Alpha}\\p{Graph}*")) { + Mix.discloseError("The application name " + Mix.dress_A( + candyScrew.appName) + " is incorrect.", "Stop", + logger); + return; + } + candyScrew.ele = candyScrew.appName + ".ele"; + try { + candyScrew.readProperties(candyScrew.appName); + logger.trace(candyScrew.toString()); + logger.info(Candies.LF + Cst.CUT0 + "ELEMENTARY FILE: " + + candyScrew.appName + Candies.LF + Cst.CUT0); + } catch (ExactException e) { + Mix.discloseError( + "Reading the properties, an error was found." + e + .getMessage(), "Stop", logger); + return; + } + + // IMPLEMENTATION OF THE LIST OF MARKUPS + + try { + // I instantiate the markups array + HashMap markupE = markupFactory(atomi); + Collection valueMarkupE = markupE.values(); + supposedMarkupsCheck(valueMarkupE.iterator(), markupE); + precedingOnesControl(valueMarkupE.iterator(), markupE); + logger.trace(markupE_toString(markupE)); + ElementaryFile elementaryFile = new ElementaryFile(markupE, + candyScrew); + elementaryFile.appName = candyScrew.appName; + /* we perform the transformation from ELE file to the trains + * structure */ + elementaryFile.trainFactory(candyScrew.inputYS, + candyScrew.ele, candyScrew.includeYS); + /* now I have the list of markups (and trains, therefore of + * occurrence), I scroll it to check the attendance */ + elementaryFile.controlloPresenze(); + /* checking the validity of a tape based on the version of a + * certain software */ + elementaryFile.substantialChecks(); + + // CONVERT + + /* the "convert" method turns trains into a maven / spring + * web app; remember that the elementary object is the input + * file */ + + elementaryFile.convert(); + + allRight = true; + message = "Process ending."; + } catch (ExactException e) { + message = ""; + if (e.className != null) { + message += "Class: " + e.className + Candies.LF; + } + if (e.method != null) { + message += "Method: " + e.method + Candies.LF; + } + if (e.datum != null) { + message += Candies.LF + e.datum; + } + logger.error(message); + new Placard(null, message, "Error code " + e.code); + message = "Process ending NO OK."; + } catch (FileNotFoundException e) { + ExactException ne = new ExactException(); + ne.datum = e.getMessage(); + ne.code = 1500; + logger.error(ne.datum); + new Placard(null, ne.datum, "Error code " + ne.code); + message = "Process ending NO OK."; + } catch (IOException e) { + e.printStackTrace(); + } + Mix.discloseInfo(message, "Notice", logger); + } + + /** + *

+ * Classic toString method, other than the fact that it is static. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param mE list of markups + * @return the compound string */ + public static String markupE_toString(HashMap mE) { + String s = ""; + s += Candies.LF + Candies.LF + Candies.LF + Candies.LF; + s += Cst.CUT0; + s += "ELENCO DEI MARKUP E DEI LORO PRESUPPOSTI" + Candies.LF; + s += Cst.CUT0; + Collection valueMarkupE = mE.values(); + Iterator iteratorMarkup = valueMarkupE.iterator(); + while (iteratorMarkup.hasNext()) { + Markup m = iteratorMarkup.next(); + s += Cst.CUT0; + s += "stub = " + m.stub; + s += "; p = " + m.p; + s += "; presenza = " + m.presenza; + if (m.mandatoryWagE != null) { + s += "; obbligatori = "; + for (String t : m.mandatoryWagE) { + s += t + ", "; + } + /* I cut the last 2 characters: "," */ + s = s.substring(0, s.length() - 2); + } + if (m.optionalWagE != null) { + s += "; facoltativi = "; + for (String t : m.optionalWagE) { + s += t + ", "; + } + /* I cut the last 2 characters: "," */ + s = s.substring(0, s.length() - 2); + } + if (m.wagon) { + s += "; it is a wagon" + Candies.LF; + } + s += Candies.LF; + if (m.implyE != null && m.implyE.length > 0) { + for (int i = 0; i < m.implyE.length; i++) { + Imply p = m.implyE[i]; + s += p.toString(i); + } + } + if (m.recurrenceE.size() > 0) { + s += " reciurrences list, quantity " + + m.recurrenceE.size() + Candies.LF; + for (int i = 0; i < m.recurrenceE.size(); i++) { + s += Cst.CUT2; + s += " Recurrence " + i + Candies.LF; + s += " " + m.recurrenceE.get(i).locomotor + .toString(0, mE); + Collection valueWagonE = m.recurrenceE.get( + i).wagonE.values(); + Iterator iteratorWagon = valueWagonE + .iterator(); + int j = 1; + while (iteratorWagon.hasNext()) { + Wagon wagon = iteratorWagon.next(); + s += " " + wagon.toString(j, mE); + j++; + } + } + } + } + s += Candies.LF; + return s; + } + + private static HashMap markupFactory( + String[][] atomi) + + throws ExactException { + + HashMap markupE = new HashMap(); + for (int i = 0; i < atomi.length; i++) { + Markup markup = new Markup(); + markup.markupFactory(atomi, i); + if (markupE.containsKey(markup.stub)) { + ne.datum = "The markup " + Mix.dress_A(markup.stub) + + " it is repeated in the markup definition table."; + ne.code = 1502; + throw ne; + } + markupE.put(markup.stub, markup); + } + return markupE; + } + + private static void supposedMarkupsCheck(Iterator iterator, + HashMap markupE) + + throws ExactException { + + while (iterator.hasNext()) { + Markup m = iterator.next(); + /* if the assumption markup declaration is present ... */ + if (m.implyE != null) { + for (int n = 0; n < m.implyE.length; n++) { + if (!m.implyE[n].stub.equals("")) { + if (!markupE.containsKey(m.implyE[n].stub)) { + ne.datum = "The markup " + Mix.dress_A( + m.implyE[n].stub) + ", supposed by " + + Mix.dress_A(m.stub) + + ", does not exist."; + ne.code = 1501; + throw ne; + } else if (m.implyE[n].isWagon) { + markupE.get(m.implyE[n].stub).wagon = false; + markupE.get(m.stub).wagon = true; + } + } + } + } + /* the following 2 checks verify the accuracy of the + * definition of the atoms, and regardless of what will then + * be written in the .ele file */ + if (m.mandatoryWagE != null) { + controlloObbligatori(markupE, m); + } + if (m.optionalWagE != null) { + controlloFacoltativi(markupE, m); + } + } + } + + /** + *

+ * Check the validity of the list of previous markups. + *

+ * + * @author M. Maglioni + *

+ * ​​Company: Ramecera™
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ */ + + private static void precedingOnesControl(Iterator iterator, + HashMap markupE) + + throws ExactException { + + while (iterator.hasNext()) { + Markup m = iterator.next(); + /* if the assumption markup declaration is present ... */ + if (m.precedingE != null) { + for (int n = 0; n < m.precedingE.length; n++) { + if (!markupE.containsKey(m.precedingE[n])) { + ne.datum = "The markup " + Mix.dress_A( + m.precedingE[n]) + + ", declared as previous by «" + Mix + .dress_A(m.stub) + + ", does not exist."; + ne.code = 1506; + throw ne; + } + } + } + } + } + + private static void controlloFacoltativi( + HashMap markupE, Markup m) + + throws ExactException { + + for (int j = 0; j < m.optionalWagE.length; j++) { + if (!markupE.containsKey(m.optionalWagE[j])) { + ne.datum = "The markup " + Mix.dress_A( + m.optionalWagE[j]) + ", optional for " + Mix + .dress_A(m.stub) + ", does not exist."; + ne.code = 1504; + throw ne; + } else if (m.mandatoryWagE != null) { + for (int j1 = 0; j1 < m.mandatoryWagE.length; j1++) { + if (m.optionalWagE[j].equals(m.mandatoryWagE[j1])) { + ne.datum = "The markup " + Mix.dress_A( + m.optionalWagE[j]) + + ", cannot be both optional and mandatory."; + ne.code = 1505; + throw ne; + } + } + } + } + } + + private static void controlloObbligatori( + HashMap markupE, Markup m) + + throws ExactException { + + for (int j = 0; j < m.mandatoryWagE.length; j++) { + if (!markupE.containsKey(m.mandatoryWagE[j])) { + ne.datum = "The markup " + Mix.dress_A( + m.mandatoryWagE[j]) + ", obbligatorio per " + + Mix.dress_A(m.stub) + ", does not exist."; + ne.code = 1503; + throw ne; + } else if (m.optionalWagE != null) { + for (int j1 = 0; j1 < m.optionalWagE.length; j1++) { + if (m.mandatoryWagE[j].equals(m.optionalWagE[j1])) { + ne.datum = "The markup " + Mix.dress_A( + m.mandatoryWagE[j]) + + ", cannot be both optional and mandatory."; + ne.code = 1504; + throw ne; + } + } + } + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Imply.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Imply.java new file mode 100644 index 0000000..5b0bfb1 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Imply.java @@ -0,0 +1,113 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import it.ramecera.salad.everyday.Candies; + +/** + *

+ * The assumed tags, i.e. the ones that must be present or absent in the + * .ele file, with their possible values. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class Imply { + + /** the name of the markup */ + public String stub; + /** the markup value */ + public String value; + /** if it must be present (true) or if it must be absent (false) */ + public boolean direct = true; + /** if it is a wagon type markup, i.e. subsequent, on the same + * line */ + public boolean isWagon; + + /** + *

+ * Ordinary constructor. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param stub the name of the markup + * @param value the value of the markup + * @param direct if it must be present (true) or if it must be + * absent (false) + * @param isWagon if it is a tab of type wagon , that is to say that + * it is found in tow with another, which is called the + * head */ + public Imply(final String stub, final String value, + final boolean direct, final boolean isWagon) { + super(); + this.stub = stub; + this.value = value; + this.direct = direct; + this.isWagon = isWagon; + } + + /** + *

+ * Default constructor. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ */ + public Imply() { + } + + /** + *

+ * Classic toString method. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param i index of the assumption + * @return the compound string */ + public String toString(final int i) { + String s = ""; + s += " implied " + i + "): stub = " + stub; + if (value != null && !value.isEmpty()) { + s += "; value = " + value; + } + s += "; direct = " + direct; + if (isWagon) { + s += "; FOLLOWED BY = " + isWagon; + } + s += ";" + Candies.LF; + return s; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Markup.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Markup.java new file mode 100644 index 0000000..1af7fb1 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Markup.java @@ -0,0 +1,286 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Universal; + +/** + *

+ * Markup objects are simply 5-character words, called stub (stub + * = "mother" in a bank check book) placed at the beginning of each + * line; in the public properties we also have the type of markup, + * indicated for each of them, and the list of occurrencesE, used + * only later, after reading the ele file. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ + +final public class Markup { + + // + // PUBLIC PROPERTIES + // + + /** the type of markup, according to their use */ + public int p; + /** the prescription of its frequency */ + public int presenza; + /** the name of the markup, of 5 lowercase alphabetic characters */ + public String stub; + /** the name of the other markups that must be present or not + * present when there is this, and any allowed or necessary + * values */ + public Imply[] implyE; + /** in reference to the directly preceding markups, the list of the + * possible ones */ + public String[] precedingE; + /** if the markup can only be a wagon */ + public boolean wagon; + /** list of mandatory wagons that must follow */ + public String[] mandatoryWagE; + /** list of optional wagons that may follow */ + public String[] optionalWagE; + /** list of compulsory and optional wagons that can follow + * together */ + public String[] unioneE; + /** list of possible data values */ + public String[] expectedValueE; + /** the various points where the recurrence of this markup was found + * in trains; these numbers are the progressive in the train file, + * not in the input file, which in general is longer */ + public List recurrenceE = new ArrayList(); + + /** ordinary logger */ + private static final Logger logger = Logger.getLogger(Markup.class); + + // CONSTANT + + /** minimum length of a markup */ + final public static int MAR_LP = 2; + /** maximum length of a markup */ + final public static int MAR_LM = 16; + /** sign +, as a string */ + final public static String PIU = "+"; + /** sign +, as hexadecimal */ + final public static String PIUX = "2b"; + /** sign +, as char */ + final public static char PIUC = PIU.charAt(0); + + // + // PUBLIC METHODS + // + + /** + *

+ * This constructor is used to acquire the list of available + * markups. The atom array in question receives the data defined at + * the beginning of the Screwdriver class. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param atomi the array of strings to load both the names of the + * markups, and each type + * @param k the index of the pair to be used + * @throws ExactException standard error */ + final public void markupFactory(String[][] atomi, int k) + + throws ExactException { + + // maximum value the markup type can take + final int TIPO_M = 24; + // maximum value the presence code can take + final int PRESENCE_M = 5; + ExactException ce = new ExactException(); + stub = atomi[k][0].toLowerCase(); + String r = atomi[k][1]; + if (!Pattern.matches("\\d+", r)) { + ce.datum = "The 2nd element of the markup definition «" + + stub + "» is not a number, it is «" + r + "»."; + ce.className = this.getClass().getName(); + ce.code = 2300; + throw ce; + } + String q = atomi[k][2]; + if (!q.matches("\\d")) { + ce.datum = "The 3rd element of the markup definition «" + + stub + "» is not a number, it is «" + q + "»."; + ce.className = this.getClass().getName(); + ce.code = 2301; + throw ce; + } else { + presenza = Integer.valueOf(q).intValue(); + } + if (presenza > PRESENCE_M) { + ce.datum = "The 3rd element of the markup «" + stub + + "» is greater than " + PRESENCE_M + "."; + ce.className = this.getClass().getName(); + ce.code = 2301; + throw ce; + } + p = Integer.valueOf(r); + /* check that the type takes a value between 0 and the value + * defined as maximum */ + if (p < 0 | p > TIPO_M) { + ce.code = 2303; + ce.datum = "Markup: the number «" + p + "» in the " + k + + "th markup definition is incorrect."; + ce.className = this.getClass().getName(); + throw ce; + } + if (!stub.matches("\\p{Alnum}{" + MAR_LP + "," + MAR_LM + + "}")) { + ce.code = 2304; + ce.datum = "The markup " + Mix.dress_A(stub) + + " is incorrect, it must be from " + MAR_LP + + " to " + MAR_LM + " alphanumeric characters."; + ce.className = this.getClass().getName(); + throw ce; + } + /* checks on presupposeE must be postponed until after the + * acquisition of all markups */ + if (!atomi[k][3].equals("")) { // x2c is the comma + String[] s = atomi[k][3].toLowerCase().split("\\x2c"); + implyE = new Imply[s.length]; + for (int j = 0; j < implyE.length; j++) { + implyE[j] = new Imply(); + implyE[j].stub = s[j].trim(); + implyE[j].direct = !implyE[j].stub.startsWith("!"); + if (!implyE[j].direct) { + implyE[j].stub = implyE[j].stub.substring(1); + } + implyE[j].isWagon = implyE[j].stub.startsWith( + Markup.PIU); + if (implyE[j].isWagon) { + /* I remove the initial + */ + implyE[j].stub = implyE[j].stub.substring(1); + } + String h[] = implyE[j].stub.split("\\x" + Markup.PIUX); + if (h.length == 1) { + implyE[j].value = ""; + } else { + implyE[j].stub = h[0]; + implyE[j].value = h[1]; + } + if (implyE[j].stub.equals(stub)) { + ce.code = 2305; + ce.datum = "The markup " + Mix.dress_A( + implyE[j].stub) + + "» (supposed) cannot be equal to markup " + + Mix.dress_A(stub) + " (main)."; + ce.className = this.getClass().getName(); + throw ce; + } + } + } + /* in position [4] we find the compulsory wagons */ + int totale = 0; + String s = atomi[k][4].trim(); + if (s.isEmpty()) { + mandatoryWagE = null; + } else { + mandatoryWagE = s.split("\\x2c"); + totale += mandatoryWagE.length; + for (int i = 0; i < mandatoryWagE.length; i++) { + mandatoryWagE[i] = mandatoryWagE[i].trim() + .toLowerCase(); + if (!Pattern.matches("\\p{Alnum}+", mandatoryWagE[i])) { + Mix.discloseError("In the definition of " + Mix + .dress_A(stub) + " the mandatory wagon " + + Mix.dress_A(mandatoryWagE[i]) + + " is incorrect.", "Alarm", logger); + } + } + } + /* in position [5] we find the optional wagons */ + s = atomi[k][5].trim(); + if (s.isEmpty()) { + optionalWagE = null; + } else { + optionalWagE = s.split("\\x2c"); + totale += optionalWagE.length; + for (int i = 0; i < optionalWagE.length; i++) { + optionalWagE[i] = optionalWagE[i].trim().toLowerCase(); + if (!Pattern.matches("\\p{Alnum}+", optionalWagE[i])) { + Mix.discloseError("In the definition of " + Mix + .dress_A(stub) + " the optional wagon " + + Mix.dress_A(optionalWagE[i]) + + " is incorrect.", "Alarm", logger); + } + } + } + if (totale > 0) { + unioneE = new String[totale]; + if (mandatoryWagE != null) { + for (int i = 0; i < mandatoryWagE.length; i++) { + unioneE[i] = mandatoryWagE[i]; + } + } + if (optionalWagE != null) { + for (int i = 0; i < optionalWagE.length; i++) { + unioneE[i + totale + - optionalWagE.length] = optionalWagE[i]; + } + } + } + /* in position [7] we find the possible previous locomotives */ + s = atomi[k][7].trim(); + if (s.isEmpty()) { + precedingE = null; + } else { + // x2c is the comma + precedingE = s.split("\\x2c"); + for (int i = 0; i < precedingE.length; i++) { + precedingE[i] = precedingE[i].trim().toLowerCase(); + if (!Pattern.matches("\\p{Alnum}+", precedingE[i])) { + Mix.discloseError("In the definition of " + Mix + .dress_A(stub) + " the preceding locomotor " + + Mix.dress_A(precedingE[i]) + + " is incorrect.", "Alarm", logger); + } + } + } + /* position 6 is dominion, a list of strings delimited by + * commas */ + String w = atomi[k][6].trim(); + String tipo = atomi[k][1].trim(); + if (tipo.equals("23")) { + expectedValueE = new String[Universal.languageE.length]; + for (int i = 0; i < Universal.languageE.length; i++) { + expectedValueE[i] = Universal.languageE[i][1]; + } + } else if (w.isEmpty()) { + expectedValueE = null; + } else { + expectedValueE = w.split("\\x2c"); // x2c is comma + for (int i = 0; i < expectedValueE.length; i++) { + expectedValueE[i] = expectedValueE[i].trim(); + } + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Skill.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Skill.java new file mode 100644 index 0000000..09f58c4 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Skill.java @@ -0,0 +1,2192 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.StringInt; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.everyday.Universal; +import it.ramecera.salad.file.Equipment; +import it.ramecera.salad.file.ReadMyFile; +import it.ramecera.salad.graphic.Remember; +import it.ramecera.screwdriver.component.FileComponent; +import it.ramecera.screwdriver.outfits.ClockHands; +import it.ramecera.screwdriver.outfits.ControllerBelong; +import it.ramecera.screwdriver.outfits.Costume; +import it.ramecera.screwdriver.outfits.ELEMethod; +import it.ramecera.screwdriver.outfits.JspBeanElement; +import it.ramecera.screwdriver.outfits.JspKit; +import it.ramecera.screwdriver.outfits.RequestMap; +import it.ramecera.screwdriver.outfits.TableOutfit; +import it.ramecera.screwdriver.utilities.ValidationLabelScrew; +import it.ramecera.screwdriver.utilities.ValidationMessageScrew; + +/** + *

+ * Class of characteristic elements of the application to be created. + *

+ * + * @author M. Maglioni + *

+ * ​​Company: Ramecera™
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-09
+ *

+ *

+ * History:
+ * The description of N# is in project plan report
+ * 2020-09-03 implementation of N3
+ * 2020-09-09 implementation of N8
+ *

+ */ +final public class Skill { + + private static final String sep = System.getProperty( + "file.separator"); + private static final String SCREW_MAVEN = ".screwMaven"; + // BOOLEAN CHARACTERISTICS + /** Boolean characteristic */ + public boolean spring = false; + /** Boolean characteristic */ + public boolean springSecurity = false; + /** Boolean characteristic */ + public boolean tiles = false; + /** Boolean characteristic */ + public boolean filter = false; + /** Boolean characteristic */ + public boolean antiSamy = false; + /** Boolean characteristic */ + public boolean captcha = false; + /** Boolean characteristic */ + public boolean ldap = false; + /** Boolean characteristic */ + public boolean webFlow = false; + /** Boolean characteristic */ + public boolean internalProperties = false; + /** Boolean characteristic */ + public boolean pomProperties = false; + /** Boolean characteristic */ + public boolean mavenBuild = false; + /** Boolean characteristic */ + public boolean mavenCompiler = false; + /** Boolean characteristic */ + public boolean mavenCompilerPlugin = false; + /** Boolean characteristic */ + public boolean mavenWarPlugin = false; + /** Boolean characteristic */ + public boolean mavenCleanPlugin = false; + /** Boolean characteristic */ + public boolean springValid = false; + /** Boolean characteristic */ + public boolean robots = false; + /** Boolean characteristic */ + public boolean i18n = false; + /** Boolean characteristic */ + public boolean viewController = false; + /** Boolean characteristic */ + public boolean defaultAutowire = false; + /** Boolean characteristic */ + public boolean interceptor = false; + /** Boolean characteristic */ + public boolean matrixVariables = false; + /** Boolean characteristic */ + public boolean hibernate = false; + /** Boolean characteristic */ + public boolean dependencies = false; + /** Boolean characteristic */ + public boolean jackson; + /** Boolean characteristic */ + public boolean prettyPrint; + /** Boolean characteristic */ + public boolean hiberValid; + /** Boolean characteristic */ + public boolean mimeMapping; + /** Boolean characteristic */ + public boolean errorPage; + /** Boolean characteristic */ + public boolean indexJsp; + /** Boolean characteristic */ + public boolean hasJsp; + /** Boolean characteristic */ + public boolean hasForm; + /** Boolean feature, reveals the presence of the "userpass" + * markup */ + public boolean hasUseridPassword; + /** Boolean characteristic */ + /* FUTURE RELEASE N6 */ + // public boolean embedded; + /** Boolean characteristic */ + public boolean ldapService; + /** Boolean characteristic */ + public boolean signup; + /** Boolean characteristic */ + private boolean remember; + private boolean wellIPermit; + + // SOFTWARE VERSIONS + /** software version */ + public String applicationServer; + /** software version */ + public String jeeVersion; + /** software version */ + public String springVersion; + /** 1st parameter (macro) of the software version */ + public int springVersion1m; + /** software version */ + public String tilesVersion; + /** software version */ + public String mavenCompilerVersion; + /** software version */ + public String mavenCompilerPluginVersion; + /** software version */ + public String mavenWarPluginVersion; + /** software version */ + public String mavenCleanPluginVersion; + /** software version */ + public String captchaVersion; + /** software version */ + public String webflowVersion; + /** software version */ + public String springSecurityReductVersion; + /** software version */ + public String springSecurityVersion; + /** software version */ + public String jacksonVersion; + /** software version */ + public String log4jVers; + /** software version */ + public String quartzVers; + /** software version */ + public String hiberValidVersion; + /** software version */ + public String hibernateVersion; + /** 1st parameter (macro) of the software version */ + public int hibernateVersion1m; + /** software version */ + public int jpaVersion; + /** software version */ + public String hibernateReductVersion; + + // PATHS AND FILES NAMES + + /** path of Java sources */ + public String sorgentiY; + /** path to Maven main directory */ + public String mainY; + /** path to Maven's main / java directory */ + public String mainJavaY; + /** project Eclipse name */ + public String eclipseProjectY; + /** resource path in webapp */ + public String webAppResourcesY; + /** webflow path */ + public String webFlowY; + /** webinf path */ + public String webInfY; + /** path for utilities for use in java classes */ + public String javaUtilY; + /** web path for use in java classes */ + public String javaWebY; + /** web / model path for use in java classes */ + public String javaWebModelY; + /** web / model / body path for use in java classes, body means the + * JSP directory */ + public String javaWebModelBodyY; + /** web / model / utility path for use in java classes */ + public String javaWebModelUtilityY; + /** web / controller path for use in java classes */ + public String javaWebController; + /** path and file name */ + public String webAppG; + /** path and file name */ + public String dependenciesG; + /** path and file name */ + public String depenHiberG; + /** path and file name */ + public String pomPropertiesG; + /** path and file name */ + public String springPropertiesG; + /** path and file name */ + public String applicUserAuthenticationProviderG; + /** path and file name */ + public String depenJacksonG; + /** path and file name */ + public String depenHValidG; + /** path and file name */ + public String depenValidatorG; + + // MAVEN + /** element of Maven */ + public String mavenModel; + /** element of Maven */ + public String mavenGroupId; + /** element of Maven */ + public String mavenVersion; + /** element of Maven */ + public String mavenPackage = "war"; + + // VARIOUS + /** the first part of the package, that is the network domain (2 + * elements) + the application (1 element) */ + public String pckg; + /** version of the artifact jar of the JPA project relating to the + * schema DB adopted */ + public String versioneArtifactJPA; + /** Maven src/main/resources directory */ + public String mainResources; + /** network domain of the company */ + public String networkDomain; + /** list of files containing DDL, in lowercase, without extension + * .sql */ + public String[] ddl; + /** name of the current controller file */ + public String groupControllerF; + /** background color of the field containing the button */ + /* # f5f5f5 is a gray color, the default color */ + public String backColorFormAction = "#f5f5f5"; + /** Unicode character set */ + public String charset = "UTF-8"; + /** Unicode character set */ + public String charsetSenzaTrattino = "UTF8"; + /** application name in lowercase */ + public String applicationNameLower; + /** name of the application */ + public String applicationName; + /** webflow parameter */ + public String paramWebflow; + /** xlbase parameter, the user group is specified, through + * group-search-base */ + public String searchBase; + /** name of the column of the users table which must appear after + * the logon with the welcome */ + public String welcome; + /** name of the column of the users table indicating the password */ + public String password; + + // QUARTZ + /** elements of a quartz trigger */ + public ClockHands clockHands; + /** list of triggers */ + public List handE = new ArrayList(); + + // SECURITY + /** if you qualify through userid / password, or in other ways + * (userpass markup value) */ + public String authenticationMode; + /** menu to be displayed on the JSP error .jsp, by mistake during an + * authentication */ + public String authenticationErrorMenu; + /** Authentication Provider methodology */ + public String authenticationProvider; + /** password verification methodology */ + public String ldapPasswordMethod; + /** Authentication Provider methodology */ + public String userDetailsClass; + /** select SQL for the case of Authentication Provider = + * jdbc-UserDetailsManager; selection of groups */ + public String groupAuthentication; + /** select SQL for the case of Authentication Provider = + * jdbc-UserDetailsManager; selection of users */ + public String usersByUserName; + /** select SQL for the case of Authentication Provider = + * jdbc-UserDetailsManager; selection of authorizations */ + public String authByUserName; + /** type of encoding and salt of the user's password */ + public String passEncoder; + /** DB table containing the list of users; the array contains: 0) + * the name of the table, 1) the rail code, 2) the jndi, 3) the DB + * scheme, 4) the welcome column, 5) the column containing the + * password */ + public String[] tabUser = new String[6]; + /** index, in the general list of DB tables, of the users table */ + public int tabUserJ = -1; + /** userid in the trivial case userid and password carved in the + * code, ROLE_USER case */ + public String userTrivialUSER; + /** userid in the trivial case userid and password carved in the + * code, case ROLE_ADMIN */ + public String userTrivialADMIN; + /** password in the trivial case userid and password carved in the + * code, ROLE_USER case */ + public String passTrivialUSER; + /** password in the trivial case userid and password carved in the + * code, case ROLE_ADMIN */ + public String passTrivialADMIN; + + /** types of DBMS */ + /* FUTURE RELEASE N6 */ + // public Set dbmsE = new HashSet(); + /** current DBMS */ + public String dbms; + /** DB current scheme */ + public String dbSchema; + /** Current JNDI */ + public String jndi; + + // PROPERTIES + /** properties */ + public CandyScrew candies; + + // INDICES + /** index of the default (local) language, linked to markup defaulan + * + */ + public int defaulan; + /** DB sites index */ + public int railK; + /** index of the DB table */ + public int tK; + /** index of the DB table containing the users */ + public int uK; + /** index of the groups of controllers; controllers are grouped by + * prefix; the prefix is ​​the first segment of the path */ + public int cntK; + + // COLLECTIONS + /** list of methods present as java source */ + public HashMap methodE = new HashMap(); + /** language codes, 2 characters */ + public List screwLanguageE = new ArrayList(); + /** validation messages map */ + public Map validationMessageE = new HashMap(); + /** languages ​​statistics map */ + public Map> languagesStatisticE = new HashMap>(); + /** list of DB tables */ + public List tableDBE = new ArrayList(); + /** list of correlations RequestMapping-JSP */ + public List correlationE = new ArrayList(); + /** list of CSS classes */ + public List costumeE = new ArrayList(); + /** list of KNIFE delimiters */ + public Map knifeE = new HashMap(); + /** list of KNIFE delimiters */ + public Map upperE = new HashMap(); + /** list of KNIFE delimiters */ + public Map lowerE = new HashMap(); + /** list of KNIFE delimiters */ + public Map knifeXE = new HashMap(); + /** list of KNIFE delimiters */ + public Map upperXE = new HashMap(); + /** list of KNIFE delimiters */ + public Map lowerXE = new HashMap(); + /** list of current initial directories (N3) */ + public List initialDirE = new ArrayList(); + /** list of created or proposed directories (N3) */ + public List proposedDirE = new ArrayList(); + + /** ORDINARY LOGGER */ + private static final Logger logger = Logger.getLogger(Skill.class); + + /** default constructor */ + public Skill() { + super(); + } + + /** helpful builder + * + * @param candies various constants */ + public Skill(CandyScrew candies) { + super(); + this.candies = candies; + knifeE.put("java", "/* " + Cst.KNIFE + " */"); + knifeE.put("css", "/* " + Cst.KNIFE + " */"); + knifeE.put("properties", "# " + Cst.KNIFE + ""); + knifeE.put("xml", ""); + knifeE.put("jsp", ""); + upperE.put("java", "/* " + Cst.UPPER + " */"); + upperE.put("css", "/* " + Cst.UPPER + " */"); + upperE.put("properties", "# " + Cst.UPPER + ""); + upperE.put("xml", ""); + upperE.put("jsp", ""); + lowerE.put("java", "/* " + Cst.LOWER + " */"); + lowerE.put("css", "/* " + Cst.LOWER + " */"); + lowerE.put("properties", "# " + Cst.LOWER + ""); + lowerE.put("xml", ""); + lowerE.put("jsp", ""); + knifeXE.put("java", "/\\x2a " + Cst.KNIFE + " \\x2a/"); + knifeXE.put("css", "/\\x2a " + Cst.KNIFE + " \\x2a/"); + knifeXE.put("properties", "# " + Cst.KNIFE + ""); + knifeXE.put("xml", ""); + knifeXE.put("jsp", ""); + upperXE.put("java", "/\\x2a " + Cst.UPPER + " \\x2a/"); + upperXE.put("css", "/\\x2a " + Cst.UPPER + " \\x2a/"); + upperXE.put("properties", "# " + Cst.UPPER + ""); + upperXE.put("xml", ""); + upperXE.put("jsp", ""); + lowerXE.put("java", "/\\x2a " + Cst.LOWER + " \\x2a/"); + lowerXE.put("css", "/\\x2a " + Cst.LOWER + " \\x2a/"); + lowerXE.put("properties", "# " + Cst.LOWER + ""); + lowerXE.put("xml", ""); + lowerXE.put("jsp", ""); + } + + /** + *

+ * Skill construction (part A). + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param markupE the list of markups + * @param trainE the list of trains + * @param candies the initial properties of the application + * @throws ExactException standard exception */ + public void factory_A(HashMap markupE, + List trainE, CandyScrew candies) + + throws ExactException { + + applicationName = candies.appName; + File f = new File(candies.outputYS + applicationName); + if (f.exists() & !f.isDirectory()) { + ExactException ce = new ExactException(); + ce.code = 1801; + ce.datum = "The value of given application name+: «" + + applicationName + + "» does not correspond to a real directory."; + ce.className = this.getClass().getName(); + throw ce; + } else { + buildDirectory(f); + } + applicationNameLower = applicationName.toLowerCase(); + spring = markupE.get("sv").recurrenceE.size() > 0; + springSecurity = markupE.get("uv").recurrenceE.size() > 0; + captcha = markupE.get("captc").recurrenceE.size() > 0; + webFlow = markupE.get("wparams").recurrenceE.size() > 0; + springValid = markupE.get("svalid").recurrenceE.size() > 0; + robots = markupE.get("srobo").recurrenceE.size() > 0; + viewController = markupE.get("sieco").recurrenceE.size() > 0; + tiles = markupE.get("ev").recurrenceE.size() > 0; + hibernate = markupE.get("hv").recurrenceE.size() > 0; + jackson = markupE.get("jacksonver").recurrenceE.size() > 0; + prettyPrint = markupE.get("pretprint").recurrenceE.size() > 0; + hiberValid = markupE.get("hvalid").recurrenceE.size() > 0; + i18n = markupE.get("i18n").recurrenceE.size() > 0; + pomProperties = markupE.get("pompr").recurrenceE.size() > 0; + dependencies = markupE.get("depen").recurrenceE.size() > 0; + defaultAutowire = markupE.get("sdefauto").recurrenceE + .size() > 0; + interceptor = markupE.get("sinterce").recurrenceE.size() > 0; + mavenBuild = markupE.get("mavbu").recurrenceE.size() > 0; + mavenCompiler = markupE.get("mavco").recurrenceE.size() > 0; + mavenCompilerPlugin = markupE.get("mavcp").recurrenceE + .size() > 0; + mavenWarPlugin = markupE.get("mavwa").recurrenceE.size() > 0; + mavenCleanPlugin = markupE.get("mavcl").recurrenceE.size() > 0; + matrixVariables = markupE.get("matrix").recurrenceE.size() > 0; + mimeMapping = markupE.get("webmime").recurrenceE.size() > 0; + errorPage = markupE.get("weberror").recurrenceE.size() > 0; + indexJsp = markupE.get("indexjsp").recurrenceE.size() > 0; + /* FUTURE RELEASE N6 */ + // embedded = markupE.get("hembedded").occorrenzaE.size() > 0; + ldapService = markupE.get("xlservice").recurrenceE.size() > 0; + signup = markupE.get("usignup").recurrenceE.size() > 0; + hasJsp = markupE.get("jsp").recurrenceE.size() > 0; + if (markupE.get("defaulan").recurrenceE.size() > 0) { + defaulan = (Integer) markupE.get("defaulan").recurrenceE + .get(0).locomotor.substance; + } else { + defaulan = -1; + } + if (markupE.get("xprovider").recurrenceE.size() > 0) { + authenticationProvider = markupE.get( + "xprovider").recurrenceE.get(0).locomotor.text + .toLowerCase(); + } + if (markupE.get("xlclass").recurrenceE.size() > 0) { + userDetailsClass = markupE.get("xlclass").recurrenceE.get( + 0).locomotor.text; + } + if (markupE.get("xlpass").recurrenceE.size() > 0) { + ldapPasswordMethod = markupE.get("xlpass").recurrenceE.get( + 0).locomotor.text; + } + if (authenticationProvider != null) { + ldap = authenticationProvider.equals("ldap"); + } + if (markupE.get("xgbac").recurrenceE.size() > 0) { + groupAuthentication = markupE.get("xgbac").recurrenceE.get( + 0).locomotor.text; + } + if (markupE.get("xusers").recurrenceE.size() > 0) { + usersByUserName = markupE.get("xusers").recurrenceE.get( + 0).locomotor.text; + } + if (markupE.get("xauth").recurrenceE.size() > 0) { + authByUserName = markupE.get("xauth").recurrenceE.get( + 0).locomotor.text; + } + if (markupE.get("xencoder").recurrenceE.size() > 0) { + passEncoder = markupE.get("xencoder").recurrenceE.get( + 0).locomotor.text; + } + if (markupE.get("uspaformadmin").recurrenceE.size() > 0) { + String[] up = markupE.get("uspaformadmin").recurrenceE.get( + 0).locomotor.text.split("\\x2c"); // x2c is the + // comma + if (up.length != 2) { + ExactException ne = new ExactException(); + ne.code = 1815; + ne.datum = "The markup uspaformadmin must have 2" + + " parameters, separated by a comma."; + ne.className = this.getClass().getName(); + throw ne; + } else { + userTrivialADMIN = up[0].trim(); + passTrivialADMIN = up[1].trim(); + } + } + if (markupE.get("uspaformuser").recurrenceE.size() > 0) { + String[] up = markupE.get("uspaformuser").recurrenceE.get( + 0).locomotor.text.split(","); + if (up.length != 2) { + ExactException ne = new ExactException(); + ne.code = 1825; + ne.datum = "The markup uspaformuser must have 2" + + " parameters, separated by a comma."; + ne.className = this.getClass().getName(); + throw ne; + } else { + userTrivialUSER = up[0].trim(); + passTrivialUSER = up[1].trim(); + } + } + for (Train t : markupE.get("odefcss").recurrenceE) { + Costume costume = new Costume(t); + costumeE.add(costume); + } + for (Train t : markupE.get("qjobname").recurrenceE) { + clockHands = new ClockHands(t.wagonE.get("qsimple"), + t.wagonE.get("qcron"), t.locomotor, t.locomotor, + t.wagonE.get("hrail")); + String r = t.wagonE.get("hrail").text; + int rJ = 0; + for (; rJ < markupE.get("hdefrail").recurrenceE + .size(); rJ++) { + if (r.equals(markupE.get("hdefrail").recurrenceE.get( + rJ).locomotor.text)) { + break; + } + } + if (rJ == markupE.get("hdefrail").recurrenceE.size()) { + ExactException ne = new ExactException(); + ne.code = 1812; + ne.datum = "The markup «hrail» of «quartz»" + + " presents a value " + r + + ", but it does not exist" + + " among the «hdefrail» definitions."; + ne.className = this.getClass().getName(); + throw ne; + } + handE.add(clockHands); + } + hasUseridPassword = markupE.get("userpass").recurrenceE + .size() > 0; + if (hasUseridPassword) { + authenticationMode = markupE.get("userpass").recurrenceE + .get(0).locomotor.text; + if (markupE.get("userpass").recurrenceE.get(0).wagonE + .containsKey("bmenu")) { + authenticationErrorMenu = markupE.get( + "userpass").recurrenceE.get(0).wagonE.get( + "bmenu").text; + } + } + internalProperties = markupE.get("uintp").recurrenceE + .size() > 0; + if (springSecurity & !spring) { + ExactException ne = new ExactException(); + ne.code = 1800; + ne.datum = "Spring Security cannot be applied for" + + " without having first declared Spring by means " + + "of sv markup."; + ne.className = this.getClass().getName(); + throw ne; + } + for (int i = 0; i < trainE.size(); i++) { + hasForm = false; + Train train = trainE.get(i); + if (train.locomotor.stub.equals("sv")) { + springVersion = train.locomotor.text; + String[] x = springVersion.split("\\x2e"); + springVersion1m = Integer.valueOf(x[0].trim()); + } else if (train.locomotor.stub.equals("appse")) { + applicationServer = train.locomotor.text; + } else if (train.locomotor.stub.equals("jeev")) { + jeeVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("uv")) { + int v = ((Integer) (train.locomotor.substance)) + .intValue() / 1000; + springSecurityReductVersion = (v / 1000) + "." + v + % 1000; + springSecurityVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("hv")) { + int v = ((Integer) (train.locomotor.substance)) + .intValue() / 1000; + hibernateReductVersion = String.valueOf(v / 1000); + hibernateVersion = train.locomotor.text; + String[] x = hibernateVersion.split("\\x2e"); + hibernateVersion1m = Integer.valueOf(x[0].trim()); + jpaVersion = Integer.valueOf(train.wagonE.get( + "hjpav").text); + } else if (train.locomotor.stub.equals("jacksonver")) { + jacksonVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("hvalid")) { + hiberValidVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("charset")) { + int j = 0; + String maiu = train.locomotor.text.toUpperCase(); + for (; j < Universal.charsetE.length; j++) { + if (Universal.charsetE[j].equals(maiu)) { + break; + } + } + if (j == Universal.charsetE.length) { + ExactException ce = new ExactException(); + ce.code = 1840; + ce.datum = "The value of the charset markup is wrong," + + " it isn't present in the list: " + trainE + .get(i).locomotor.text; + ce.className = this.getClass().getName(); + throw ce; + } else { + train.locomotor.text = maiu.toUpperCase(); + } + charset = train.locomotor.text; + charsetSenzaTrattino = Strings.replaceFirst(charset, + "-", ""); + } else if (train.locomotor.stub.equals("ev")) { + tilesVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("colorform")) { + backColorFormAction = train.locomotor.text; + } else if (train.locomotor.stub.equals("mavco")) { + mavenCompilerVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("mavcp")) { + mavenCompilerPluginVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("mavwa")) { + mavenWarPluginVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("mavcl")) { + mavenCleanPluginVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("captc")) { + captchaVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("mavmo")) { + mavenModel = train.locomotor.text; + } else if (train.locomotor.stub.equals("mavgr")) { + mavenGroupId = train.locomotor.text; + } else if (train.locomotor.stub.equals("mv")) { + mavenVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("filte")) { + filter = true; + } else if (train.locomotor.stub.equals("antisamy")) { + antiSamy = true; + } else if (train.locomotor.stub.equals("log4j")) { + log4jVers = train.locomotor.text; + } else if (train.locomotor.stub.equals("quartz")) { + quartzVers = train.locomotor.text; + } else if (train.locomotor.stub.equals("wv")) { + webflowVersion = train.locomotor.text; + } else if (train.locomotor.stub.equals("wparams")) { + paramWebflow = train.locomotor.text; + } else if (train.locomotor.stub.equals("xlbase")) { + searchBase = train.locomotor.text; + } else if (train.locomotor.stub.equals("requmap")) { + Map wE = train.wagonE; + int jspJ = 0; + List jspE = markupE.get("jsp").recurrenceE; + String pathJsp = ""; + /* if I have not specified the goal, it means that the + * request mapping oil path and the JSP path coincide */ + if (wE.get("goal") == null) { + pathJsp = train.locomotor.text; + } else { + pathJsp = wE.get("goal").text; + } + /* identification of the destination JSP */ + for (jspJ = 0; jspJ < jspE.size(); jspJ++) { + if (jspE.get(jspJ).locomotor.text.equals(pathJsp)) { + break; + } + } + JspKit jspKit = null; + /* for the "not found" case I make 2 different messages + * depending on whether the goal has been specified or + * not */ + if (jspJ == jspE.size() & wE.get("goal") == null) { + ExactException ne = new ExactException(); + ne.code = 1809; + ne.datum = "For the «requmap+" + trainE.get( + i).locomotor.text + + "» I assume an identical JSP path; but it" + + " does not exist in the JSPs list."; + ne.className = this.getClass().getName(); + throw ne; + } else if (jspJ == jspE.size()) { + ExactException ne = new ExactException(); + ne.code = 1841; + ne.datum = "The JSP indicated in goal+" + pathJsp + + " for the «requmap+" + trainE.get( + i).locomotor.text + + "» does not exist."; + ne.className = this.getClass().getName(); + throw ne; + } else { + jspKit = (JspKit) jspE.get( + jspJ).locomotor.substance; + } + String pathRedirect = wE.get("redirect") == null ? "" + : wE.get("redirect").text; + /* only after I have processed all the request maps can + * I verify that the redirect request map really + * exists */ + + RequestMap rm = null; + if (train.locomotor.text.equals(jspKit.path + "/" + + jspKit.fileName)) { + ExactException ne = new ExactException(); + ne.code = 1804; + ne.datum = "The path indicated in goal+" + wE.get( + "goal").text + + " è inutile, si prega di cancellarlo." + + " In fact, it is already adopted by default."; + ne.className = this.getClass().getName(); + throw ne; + } else if (wE.get("model") != null) { + jspKit.requestMapE.get(0).tipo = 2; + rm = new RequestMap(trainE.get(i).locomotor.text, + jspKit.path + "/" + jspKit.fileName, + pathRedirect, 2); + jspKit.requestMapE.add(rm); + } else { + if (jspKit.controlE.size() > 0) { + jspKit.jspType = Cst.FORM; + } else if (jspKit.requestMapE.size() == 0) { + jspKit.jspType = Cst.PLAIN; + } else { + jspKit.jspType = jspKit.requestMapE.get(0).tipo; + } + rm = new RequestMap(trainE.get(i).locomotor.text, + jspKit.path + "/" + jspKit.fileName, + pathRedirect, jspKit.jspType); + jspKit.requestMapE.add(rm); + } + } else if (train.locomotor.stub.equals("language")) { + int j = 0; + String minus = train.locomotor.text.toLowerCase(); + for (; j < Universal.languageE.length; j++) { + if (Universal.languageE[j][1].equalsIgnoreCase( + minus)) { + break; + } + } + if (j == Universal.languageE.length) { + ExactException ne = new ExactException(); + ne.code = 1802; + ne.datum = "The value of the markup \"language\" is wrong," + + " it isn't present in the list of language codes" + + " ISO 639-1: " + trainE.get( + i).locomotor.text + "."; + ne.className = this.getClass().getName(); + throw ne; + } else { + train.locomotor.text = minus; + screwLanguageE.add(new StringInt( + train.locomotor.text, j)); + } + + // END OF REQUMAP PROCESSING + + // PROCESS OF THE MARKUP VALLABEL + + + } else if (train.locomotor.stub.equals("vallabel")) { + /* ccJ is the numeric code of the language; the value -1 + * is used when I have not declared a language code, + * then I want the default value */ + int lcJ = -1; + if (train.wagonE.get("vallang") != null) { + int j = 0; + for (; j < Universal.languageE.length; j++) { + if (train.wagonE.get("vallang").text + .equalsIgnoreCase( + Universal.languageE[j][1])) { + break; + } + } + lcJ = j; + if (lcJ == defaulan) { + ExactException ce = new ExactException(); + ce.code = 1833; + ce.datum = "A vallang+ markup defines «" + + train.wagonE.get("vallang").text + + "», but this value is declared as" + + " default by defaulan+ markup." + + " Please omit this vallang+" + + train.wagonE.get("vallang").text + + "."; + ce.className = this.getClass().getName(); + throw ce; + } + } + /* the validation label is the couple label-code of + * language */ + ValidationLabelScrew vl = new ValidationLabelScrew( + train.locomotor.text, lcJ); + /* this couple must not appear two times */ + if (validationMessageE.containsKey(vl)) { + ExactException ne = new ExactException(); + ne.code = 1829; + ValidationMessageScrew vs = validationMessageE.get( + vl); + if (lcJ == -1) { + ne.datum = "Duplicated couple label-language in a" + + " validation message: " + vs.vl.label + + " (default value for language code)."; + } else { + ne.datum = "Duplicated couple label-language in a" + + " validation message: " + vs.vl.label + + "/" + + Universal.languageE[vs.vl.languageCodeIndex]; + } + + ne.className = this.getClass().getName(); + throw ne; + } else { + /* finally, the object vl is valid */ + validationMessageE.put(vl, + new ValidationMessageScrew(vl, train.wagonE + .get("valmess").text)); + List lsE = languagesStatisticE.get(lcJ); + /* if the ccJ code has not yet been entered ... */ + if (lsE == null) { + /* .. then enter it */ + ArrayList mE = new ArrayList(); + mE.add(train.locomotor.text + "=" + train.wagonE + .get("valmess").text); + languagesStatisticE.put(lcJ, mE); + } else { + /* ... otherwise record its message */ + lsE.add(train.locomotor.text + "=" + + train.wagonE.get("valmess").text); + languagesStatisticE.replace(lcJ, lsE); + } + } + + // END OF THE PROCESS OF THE MARKUP VALLABEL + + + } else if (train.locomotor.stub.equals("company")) { + networkDomain = train.locomotor.text; + if (networkDomain.startsWith(".") | networkDomain + .endsWith(".")) { + ExactException ne = new ExactException(); + ne.code = 1803; + ne.datum = "The value of markup «company» is wrong: " + + networkDomain; + ne.className = this.getClass().getName(); + throw ne; + } + } else if (train.locomotor.stub.equals("jsp")) { + JspKit jspKit = (JspKit) trainE.get( + i).locomotor.substance; + logger.trace(Candies.LF + Cst.CUT0 + + "I am processing the JSP " + jspKit.path + "/" + + jspKit.fileName + "." + jspKit.extension); + if (jspKit.controlE.size() > 0) { + hasForm = true; + } + if (train.wagonE.get("string") != null) { + String[] wE = train.wagonE.get("string").text.split( + "\\x2c"); + for (String w : wE) { + jspKit.stringPropertyE.add(new JspBeanElement(w + .trim(), "String", false, "", null, + null, null)); + } + } + if (train.wagonE.get("arraystring") != null) { + String[] wE = train.wagonE.get("arraystring").text + .split("\\x2c"); + for (String w : wE) { + jspKit.arrayStringPropertyE.add( + new JspBeanElement(w.trim(), + "ArrayList", false, "", + null, null, null)); + } + } + if (train.wagonE.get("integer") != null) { + String[] wE = train.wagonE.get("integer").text + .split("\\x2c"); + for (String w : wE) { + jspKit.integerPropertyE.add(new JspBeanElement(w + .trim(), "Integer", false, "", null, + null, null)); + } + } + if (train.wagonE.get("long") != null) { + String[] wE = train.wagonE.get("long").text.split( + "\\x2c"); + for (String w : wE) { + jspKit.longPropertyE.add(new JspBeanElement(w + .trim(), "Long", false, "", null, null, + null)); + } + } + if (train.wagonE.get("boolean") != null) { + String[] wE = train.wagonE.get("boolean").text + .split("\\x2c"); + for (String w : wE) { + jspKit.booleanPropertyE.add(new JspBeanElement(w + .trim(), "Boolean", false, "", null, + null, null)); + } + } + Wagon v = train.wagonE.get("dress"); + if (v != null) { + int m = 0; + List fE = markupE.get("method").recurrenceE; + for (; m < fE.size(); m++) { + if (fE.get(m).locomotor.text.equals(v.text)) { + break; + } + } + if (m == fE.size()) { + ExactException ne = new ExactException(); + ne.code = 1816; + ne.datum = "For JSP «" + trainE.get( + i).locomotor.text + + "», the indication of «dress+" + + v.text + "» does not exist among" + + " the declared methods."; + ne.className = this.getClass().getName(); + throw ne; + } + jspKit.methodE.add(v); + } + Wagon rv = train.wagonE.get("refresh"); + if (rv != null) { + jspKit.refresh = Integer.valueOf(rv.text); + } + Wagon ptv = train.wagonE.get("pagetitle"); + if (ptv != null) { + jspKit.pageTitle = ptv.text; + } + Wagon crudv = train.wagonE.get("crud"); + if (crudv != null) { + jspKit.crud = true; + } + } + } + + projectFactory(); + File dotClasspath = new File(SCREW_MAVEN + sep + ".classpath"); + int railQ = markupE.get("hdefrail").recurrenceE.size(); + String[] o = new String[railQ]; + for (int i = 0; i < railQ; i++) { + Train train = markupE.get("hdefrail").recurrenceE.get(i); + String jndi = train.wagonE.get("hjndi").text; + String dbschema = train.wagonE.get("hdbschema").text; + o[i] = jndi + "-" + dbschema; + } + correctFile(dotClasspath, "path=\"/", "xxxx-xxxx", + Candies.SURGERY1, o, new File(eclipseProjectY + + ".classpath"), "UTF-8"); + // LATEST CHECKS + for (int i = 0; i < trainE.size(); i++) { + Train train = trainE.get(i); + if (train.locomotor.stub.equals("valcons")) { + for (int lJ : languagesStatisticE.keySet()) { + ValidationLabelScrew vl = new ValidationLabelScrew( + train.wagonE.get("valtag").text, lJ); + if (validationMessageE.get(vl) == null) { + ExactException ce = new ExactException(); + if (lJ == -1) { + ce.datum = "In the list of messages in language «" + + Universal.languageE[defaulan][1] + + "», the label «" + train.wagonE + .get("valtag").text + + "» is missing."; + } else { + ce.datum = "In the list of messages in language «" + + Universal.languageE[lJ][1] + .toLowerCase() + + "», the label «" + train.wagonE + .get("valtag").text + + "» is missing."; + } + ce.code = 1839; + ce.className = this.getClass().getName(); + throw ce; + } + } + } + } + for (int lJ : languagesStatisticE.keySet()) { + String s = ""; + for (ValidationLabelScrew m : validationMessageE.keySet()) { + if (m.languageCodeIndex == lJ) { + s += m.label + "=" + validationMessageE.get( + m).message + Candies.LF; + } + } + s += knifeE.get("properties"); + String y = candies.outputYS + applicationName + + "/src/main/resources/"; + String nomeFileOutput = "messagesScrewValid"; + if (lJ > -1) { + nomeFileOutput += "_" + Universal.languageE[lJ][1] + .toLowerCase(); + } + nomeFileOutput += ".properties"; + try { + toTarget(y, nomeFileOutput, s, nomeFileOutput, + candies.boxYS + "recycleBin", "properties"); + // FileComponent.aggiungiFile (outputfilename, + // outputFileName, y, candies, candies.boxYS + // + "trash", this); + } catch (FileNotFoundException e) { + ExactException ce = new ExactException(); + ce.code = 1837; + ce.datum = "File not found exception."; + ce.className = this.getClass().getName(); + throw ce; + } catch (IOException e) { + ExactException ce = new ExactException(); + ce.code = 1838; + ce.datum = "I/O exception."; + ce.className = this.getClass().getName(); + throw ce; + } + } + + Iterator>> iterator = languagesStatisticE + .entrySet().iterator(); + int k = 0; + int primaFrequenza = 0; + while (iterator.hasNext()) { + Map.Entry> entry = iterator.next(); + if (k == 0) { + primaFrequenza = entry.getValue().size(); + } else if (entry.getValue().size() != primaFrequenza) { + ExactException ce = new ExactException(); + ce.code = 1830; + ce.datum = "The quantity of messages for language «" + + Universal.languageE[entry.getKey() + .intValue()][1] + "» (" + entry + .getValue().size() + + ") is different from the others. " + + "Please count again."; + ce.className = this.getClass().getName(); + throw ce; + } + k++; + } + if (screwLanguageE.size() > 0) { + if (screwLanguageE.size() != primaFrequenza) { + ExactException ce = new ExactException(); + ce.code = 1831; + ce.datum = "The quantity of markup language+ (" + + screwLanguageE.size() + + ") is different from the quantity of languages" + + " declared by vallabel+ (" + primaFrequenza + + "). " + "Please count again."; + ce.className = this.getClass().getName(); + throw ce; + } else { + for (StringInt x : screwLanguageE) { + if (languagesStatisticE.get(x.i) == null) { + ExactException ce = new ExactException(); + ce.code = 1832; + ce.datum = "The markup «language+" + x.s + + "» has no coincidence in the markups" + + " vallabel+."; + ce.className = this.getClass().getName(); + throw ce; + } + } + } + } + if (springVersion1m > 3 & jpaVersion == 1) { + ExactException ce = new ExactException(); + ce.code = 1828; + ce.datum = "If JPA has version 1, you need a version of" + + " Spring < 4; currently Spring is " + + springVersion; + ce.className = this.getClass().getName(); + throw ce; + } + if (hasUseridPassword && tabUser == null + && authenticationProvider != null + && !authenticationProvider.equals("ldap")) { + ExactException ce = new ExactException(); + ce.code = 1806; + ce.datum = "The \"utabuser\" markup must be used specifying" + + " the name of the table."; + ce.className = this.getClass().getName(); + throw ce; + } + if (tabUser[0] != null & authenticationProvider == null) { + ExactException ce = new ExactException(); + ce.code = 1807; + ce.datum = "The \"xprovider\" markup must be used " + + "specifying the authentication method."; + ce.className = this.getClass().getName(); + throw ce; + } + } + + /** + *

+ * Skill construction (part B). + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param markupE the list of markups + * @param trainE the train list + * @throws ExactException standard exception */ + public void factory_B(HashMap markupE, + List trainE) + + throws ExactException { + + for (int i = 0; i < trainE.size(); i++) { + if (trainE.get(i).locomotor.stub.equals("utabuser")) { + tabUser[0] = Mix.uppercaseFirstChar(trainE.get( + i).locomotor.text); + int k = 0; + for (; k < tableDBE.size(); k++) { + if (tabUser[0].equals(tableDBE.get(k).entityName)) { + break; + } + } + if (k == tableDBE.size()) { + ExactException ce = new ExactException(); + ce.code = 1814; + ce.datum = "The markup «utabuser»" + + " presents the value " + tabUser[0] + + ", but it does not exist" + + " amonf the definitions of the DB tables."; + ce.className = this.getClass().getName(); + throw ce; + } + if (trainE.get(i).wagonE.get("hrail") == null) { + ExactException ce = new ExactException(); + ce.code = 1810; + ce.datum = "The markup «utabuser» is not followed" + + " by the markup «hrail»."; + ce.className = this.getClass().getName(); + throw ce; + } else { + tabUser[1] = trainE.get(i).wagonE.get("hrail").text; + k = 0; + for (; k < markupE.get("hdefrail").recurrenceE + .size(); k++) { + if (tabUser[1].equals(markupE.get( + "hdefrail").recurrenceE.get( + k).locomotor.text)) { + break; + } + } + if (k == markupE.get("hdefrail").recurrenceE + .size()) { + ExactException ce = new ExactException(); + ce.code = 1811; + ce.datum = "The markup «hrail» of «utabuser»" + + " presents the value " + tabUser[1] + + ", but it does not exist" + + " among the definitions «hdefrail»."; + ce.className = this.getClass().getName(); + throw ce; + } + tabUser[2] = markupE.get("hdefrail").recurrenceE + .get(k).wagonE.get("hjndi").text; + tabUser[3] = markupE.get("hdefrail").recurrenceE + .get(k).wagonE.get("hdbschema").text; + int j = 0; + for (; j < tableDBE.size(); j++) { + if (tableDBE.get(j).entityName.equalsIgnoreCase( + tabUser[0]) & tableDBE.get(j).jndi + .equalsIgnoreCase(tabUser[2]) + & tableDBE.get(j).dbSchema + .equalsIgnoreCase(tabUser[3])) { + break; + } + } + if (j == tableDBE.size()) { + ExactException ce = new ExactException( + "I have not found the table used to " + + "verify the user's account " + + tabUser[0] + ", jndi=" + + tabUser[2] + ", DB schema=" + + tabUser[3], 2100, this + .getClass().getName(), + ""); + throw ce; + + } else { + uK = j; + } + TableOutfit ct = tableDBE.get(uK); + welcome = trainE.get(i).wagonE.get("uwelcome").text; + boolean presenza = FileComponent.checkColumn(ct, + welcome); + if (!presenza) { + ExactException ce = new ExactException( + "In the file " + ct.entityName + ".java" + + " could not find the DB column «" + + welcome + "»", 2101, this + .getClass().getName(), + "factory_B"); + throw ce; + + } + password = trainE.get(i).wagonE.get( + "upassword").text; + presenza = FileComponent.checkColumn(ct, password); + if (!presenza) { + ExactException ce = new ExactException( + "Nel file " + ct.entityName + ".java" + + " non ho trovato la column di DB «" + + password, 2102, this + .getClass().getName(), + ""); + throw ce; + } + } + } + } + } + + /** + *

+ * Construction of the methods whose source is fully present in the + * ele file, defined with the "method" markup. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param markupE the list of markups + * @param trainE the train list + * @throws ExactException standard exception */ + public void methodsFactory(HashMap markupE, + List trainE) + + throws ExactException { + + ExactException ne = new ExactException(); + for (int i = 0; i < trainE.size(); i++) { + Train t = trainE.get(i); + if (t.locomotor.stub.equals("method")) { + String sorgente = null; + if (candies.inside) { + sorgente = (String) t.locomotor.substance; + } else if (t.locomotor.substance != null + & !((String) (t.locomotor.substance)) + .isEmpty()) { + ne.datum = "The method " + Mix.dress_A( + t.locomotor.text) + + " has a source code declared" + + " in the ELE file," + + " but this is not allowed by " + + "the \"inside\" property."; + ne.code = 1824; + ne.className = this.getClass().getName(); + throw ne; + } + List daoE = new ArrayList(); + if (t.wagonE.get("dao") != null) { + String[][] dE = (String[][]) t.wagonE.get( + "dao").substance; + for (String s : dE[0]) { + if (s.startsWith(Cst.IRAILU) & s.endsWith( + "Dao")) { + s = s.substring(5, s.length() - 3); + int nr = -1; + String tabella = null; + if (s.matches( + "\\d{1}\\p{Alpha}\\p{Graph}*")) { + nr = Integer.valueOf(s.substring(0, 1)); + tabella = s.substring(1); + } else if (s.matches( + "\\d{2}\\p{Alpha}\\p{Graph}*")) { + nr = Integer.valueOf(s.substring(0, 2)); + tabella = s.substring(2); + } + String tab1 = Cst.RAIL + nr + tabella; + int l = 0; + for (; l < tableDBE.size(); l++) { + String entity = tableDBE.get( + l).railLowercase + tableDBE.get( + l).entityNameU; + String tableName = tableDBE.get( + l).railLowercase + tableDBE.get( + l).tableNameU; + if (tab1.equals(entity) | tab1.equals( + tableName)) { + break; + } + } + if (l == tableDBE.size()) { + Mix.discloseInfo("The object " + Mix + .dress_A("I" + Mix + .uppercaseFirstChar( + tab1)) + + " doesn't correspond to any" + + " of the DB tables declared" + + " in the JPA project.", + "Error", logger); + } else { + daoE.add(tableDBE.get(l)); + } + } else { + ne.datum = "The method " + Mix.dress_A( + t.locomotor.text) + + " has a dao+ containing uncorrect" + + " elements."; + ne.code = 1826; + ne.className = this.getClass().getName(); + throw ne; + } + } + } + String argoGrande = "", argoPiccolo = ""; + for (TableOutfit d : daoE) { + if (jpaVersion == 1) { + argoGrande += Candies.LF + Candies.TAB + + Candies.TAB + Candies.TAB + "I" + + d.railUppercase + d.entityNameU + + "Dao " + d.railLowercase + + d.entityName + "Dao" + ", "; + } else { + argoGrande += Candies.LF + Candies.TAB + + Candies.TAB + Candies.TAB + "I" + + d.railUppercase + d.entityNameU + + "Dao<" + d.pathDots + "." + + d.entityNameU + "> " + d.railLowercase + + d.entityName + "Dao" + ", "; + } + argoPiccolo += Candies.LF + Candies.TAB + + Candies.TAB + Candies.TAB + + d.railLowercase + d.entityName + "Dao" + + ", "; + } + /* cut the last 2 characters (comma and space) */ + if (argoGrande.length() > 2) { + argoGrande = argoGrande.substring(0, argoGrande + .length() - 2); + } + if (argoPiccolo.length() > 2) { + argoPiccolo = argoPiccolo.substring(0, argoPiccolo + .length() - 2); + } + List classiE = new ArrayList(); + if (t.wagonE.get("others") != null) { + String[] oE = (String[]) t.wagonE.get( + "others").substance; + for (String s : oE) { + String iniziale = s.substring(0, 1); + if (!iniziale.equals(iniziale.toUpperCase())) { + ne.datum = "The method «" + t.locomotor.text + + "» has an «others» markup " + + "which contains elements" + + " with a non-capital initial."; + ne.code = 1827; + ne.className = this.getClass().getName(); + throw ne; + } + classiE.add(s); + } + } + ELEMethod m = new ELEMethod(t.locomotor.text, sorgente, + argoGrande, argoPiccolo, daoE, classiE); + methodE.put(m.name, m); + } + } + } + + private void projectFactory() + + throws ExactException { + + eclipseProjectY = Mix.dress_CU(candies.outputYS + + applicationNameLower); + buildDirectory(eclipseProjectY); + File screwMaven = new File(SCREW_MAVEN); + if (!screwMaven.exists()) { + throw new ExactException("The directory " + eclipseProjectY + + "screwMaven was not found.", 1101, "Skill", + "projectFactory"); + } + File dotProject = new File(SCREW_MAVEN + sep + ".project"); + String[] o = new String[1]; + o[0] = applicationNameLower; + correctFile(dotProject, "", "XappnameX", Candies.SURGERY1, + o, new File(eclipseProjectY + ".project"), "UTF-8"); + sorgentiY = eclipseProjectY + "src"; + buildDirectory(sorgentiY); + mainY = sorgentiY + "/main"; + buildDirectory(mainY); + mainJavaY = mainY + "/java"; + buildDirectory(mainJavaY); + mainResources = mainY + "/resources"; + buildDirectory(mainResources); + } + + /** + *

+ * Creation date: 2020-09-27
+ * Last updated: 2020-09-27
+ * Class: Skill + * + * @author Massimo Maglioni + *

+ * Description: case SURGERY1: one time, substitution of + * target with the new application name; + *

+ * @param input file to be corrected + * @param prefix string preceding the gtarget to correct + * @param target string to be corrected + * @param op correction mode + * @param objectE string that replaces the target + * @param destination output file + * @param unicode chatacter code Unicode + * @throws ExactException standard exception */ + private void correctFile(File input, final String prefix, + final String target, final int op, final String[] objectE, + File destination, String unicode) + + throws ExactException { + + String s = Equipment.oneStringUnicode_A(input, unicode); + String b = ""; + if (objectE.length == 1) { + if (op == Candies.SURGERY1) { + b = s.replaceFirst(prefix + target, prefix + + objectE[0]); + } + } else { + if (op == Candies.SURGERY1) { + List a = ReadMyFile.zebra_C(input, unicode); + for (int i = 0; i < a.size(); i++) { + int j = a.get(i).indexOf(target); + if (j == -1) { + b += a.get(i) + Candies.LF; + } else { + for (int k = 0; k < objectE.length; k++) { + b += a.get(i).replaceFirst(prefix + target, + prefix + objectE[k]) + Candies.LF; + } + } + } + b = b.substring(0, b.length() - 1); + } + } + Equipment.writeFileFromOneStringUnicode_A(destination, b, + unicode); + } + + /** + *

+ * Create a directory, if it doesn't already exist, after making + * sure it isn't a file.
+ * It can only create one directory at a time.
+ * Example: I have to create directory b in path C:/a;
+ * I must put the string: "C:/a/b" as the argument of the method, + * and I must first verify that C:/a exists.
+ *

+ *

+ * Creation date: 2020-09-03
+ * Last updated: 2020-09-08 + *

+ *

+ * Modifications:
+ *

+ * + * @param path to the directory to be built, complete with path */ + public void buildDirectory(final String path) { + + File cradle = new File(path); + buildDirectory(cradle); + } + + /** + *

+ * Overload of the preceding method. + *

+ *

+ * Creation date: 2020-09-03
+ * Last updated: 2020-09-08 + *

+ *

+ * Modifications:
+ *

+ * + * @param cradle directory to be created */ + public void buildDirectory(File cradle) { + + if (cradle.isFile()) { + cradle.delete(); + } else { + proposedDirE.add(cradle.getPath()); + } + if (!cradle.exists()) { + cradle.mkdir(); + } + } + + /** + *

+ * Creation date: 2020-04-20
+ * Last updated: 2020-06-26
+ * Class: FileComponent + * + * @author Massimo Maglioni + *

+ * Description: This method analyzes the files to be + * written, compares them with the existing ones, then + * writes what is necessary. + *

+ * @param pre_existentPath pre-existent path + * @param pre_existentFilename the name of the output file, that is + * the one where the material is poured + * @param materialeProdottoDaScrewdriver code producted by + * Screwdriver application + * @param nomeFileOrigine this name would not be necessary, because + * the string is all contained in input material; however, + * for the eventual signaling to the user, in the + * "permission" method + * @param recycleBinY the path of the directory with the function of + * trash + * @param type the extension of the output file; only java, + * properties, xml and jsp are allowed + * @throws ExactException standard exception + * @throws FileNotFoundException standard exception + * @throws IOException standard exception */ + public void toTarget(final String pre_existentPath, + String pre_existentFilename, + String materialeProdottoDaScrewdriver, + final String nomeFileOrigine, final String recycleBinY, + final String type) + + throws ExactException, FileNotFoundException, IOException { + + /* the 3 strings, although identical, are repeated: those + * without X are used for simple searches for strings (indexOf, + * endswith, etc.), the one with the X for operations with the + * Pattern class */ + + String knife = knifeE.get(type); + String upper = upperE.get(type); + String lower = lowerE.get(type); + String knifeX = knifeXE.get(type); + String upperX = upperXE.get(type); + String lowerX = lowerXE.get(type); + File preExistent = null; + String outExt = Mix.estraiExtension(pre_existentFilename); + /* the default extension is .java */ + if (outExt == null) { + outExt = "java"; + pre_existentFilename = pre_existentFilename + "." + outExt; + } + /* the extension of the existing file must be one of those + * provided */ + if (!outExt.equals("java") & !outExt.equals("properties") + & !outExt.equals("jsp") & !outExt.equals("xml") + & !outExt.equals("css")) { + throw new ExactException("The file " + pre_existentFilename + + " in directory " + pre_existentPath + + " is declared with an extension not allowed: " + + outExt, 1103, "FileComponent", ""); + } + if (!outExt.equals(type)) { + throw new ExactException("The file " + pre_existentFilename + + " in directory " + pre_existentPath + + " is declared with an extension «" + outExt + + "» not corresponding to the type «" + type + "»", + 1108, "FileComponent", ""); + } + String inExt = Mix.estraiExtension(nomeFileOrigine); + /* the extension of the produced file must be one of those + * provided */ + if (!inExt.equals("java") & !inExt.equals("properties") & !inExt + .equals("jsp") & !inExt.equals("xml") & !inExt.equals( + "txt") & !inExt.equals("css")) { + throw new ExactException("The original file " + + nomeFileOrigine + + " is declared with an extension not allowed: " + + inExt, 1104, "FileComponent", ""); + } + if (!inExt.equals("txt") & !inExt.equals(type)) { + throw new ExactException("The original file " + + nomeFileOrigine + + " it is declared with an extension " + Mix + .dress_A(inExt) + + " not corresponding to the type " + Mix.dress_A( + type) + ".", 1109, "FileComponent", ""); + } + /* check that there is no confusion between the old and the new + * file; the new one can only contain the string "knife" */ + if (materialeProdottoDaScrewdriver.indexOf(upper) > -1 + | materialeProdottoDaScrewdriver.indexOf(lower) > -1) { + throw new ExactException("The original file «" + + nomeFileOrigine + + "» cannot contain either the string " + Mix + .dress_A(upper) + " or the string " + Mix + .dress_A(lower) + ".", 1105, + "FileComponent", ""); + } + preExistent = new File(Mix.dress_C(pre_existentPath) + + pre_existentFilename); + /* if the output file still does not exist, liquidate + * everything */ + if (!preExistent.exists()) { + /* note that the position of knife, that is, the column in + * the row, causes the same position for the upper string; + * originally knife should be after a TAB */ + String doublet = ""; + // if (!outExt.equals("properties")) { + // doublet += Candies.TAB; + // } + doublet += upper + Candies.LF; + if (!outExt.equals("properties")) { + doublet += Candies.TAB; + } + doublet += lower; + String trasformato = materialeProdottoDaScrewdriver + .replaceAll(knifeX, doublet); + Equipment.writeFileFromOneStringUnicode_A(preExistent, + trasformato, "UTF-8"); + return; + } + /* at this point we know that the worked file already existed */ + /* correction necessary to avoid breakdowns during + * construction */ + if (materialeProdottoDaScrewdriver.endsWith(knife)) { + materialeProdottoDaScrewdriver += Candies.LF; + } + materialeProdottoDaScrewdriver = clean( + materialeProdottoDaScrewdriver); + String[] newFileSegmentE = materialeProdottoDaScrewdriver.split( + knifeX); + int howManyKnives = newFileSegmentE.length - 1; + /* all variables with suffix R indicate material transformed + * according to the UTF-8 charset, or possibly that provided by + * the .ele file */ + String materialePreesistenteR = Equipment.oneStringUnicode_A( + preExistent, charset); + String materialePreesistente = Equipment.oneString(preExistent); + /* I use the new material string twice, to create upperSegmentoE + * and lowerSegmentoE respectively */ + /* 1st use */ + String materiale = materialePreesistente; + String materialeR = materialePreesistenteR; + /* I make a convenient correction */ + if (materiale.endsWith(upper)) { + materiale += Candies.LF; + } + if (materialeR.endsWith(upper)) { + materialeR += Candies.LF; + } + String[] upperSegmentoE = materiale.split(upperX); + String[] upperSegmentoRE = materialeR.split(upperX); + /* the amount of upper does not depend on the charset */ + int quantiUpper = upperSegmentoE.length - 1; + /* 2nd use */ + materiale = materialePreesistente; + materialeR = materialePreesistenteR; + /* I make a convenient correction */ + if (materiale.endsWith(lower)) { + materiale += Candies.LF; + } + if (materialeR.endsWith(lower)) { + materialeR += Candies.LF; + } + String[] lowerSegmentoE = materiale.split(lowerX); + @SuppressWarnings("unused") + String[] lowerSegmentoRE = materialeR.split(lowerX); + /* the amount of lower does not depend on the charset */ + int quantiLower = lowerSegmentoE.length - 1; + /* in the same way the following quantities do not depend on the + * charset */ + if (howManyKnives != quantiUpper) { + throw new ExactException( + "The file produced by Screwdriver «" + + nomeFileOrigine + + "» contains a quantity of KNIFE (" + + howManyKnives + ")" + Candies.LF + + "different from the quantity of UPPER (" + + quantiUpper + + ") that are present in the output file «" + + pre_existentFilename + + "», in the directory" + Candies.LF + + pre_existentPath + " .", 1106, + "FileComponent", ""); + } + if (howManyKnives != quantiLower) { + throw new ExactException( + "The file produced by Screwdriver «" + + nomeFileOrigine + + "» contains a quantity of di KNIFE (" + + howManyKnives + ")" + Candies.LF + + "different from the quantity of LOWER (" + + quantiLower + + ") that are present in the pre-existent file «" + + pre_existentFilename + + "» in the directory" + Candies.LF + + pre_existentPath + " .", 1107, + "FileComponent", ""); + } + /* control of lower-upper alternation */ + if (upperSegmentoE[0].indexOf(lower) > -1) { + throw new ExactException("The input file «" + + nomeFileOrigine + + "» contains a wrong alternation " + + "of UPPER and LOWER; it starts with a LOWER.", + 1110, "FileComponent", ""); + } + for (int i = 1; i <= quantiUpper; i++) { + if (upperSegmentoE[i].indexOf(lower) == -1) { + throw new ExactException("The input file «" + + nomeFileOrigine + + "» contains a wrong alternation " + + "of UPPER and LOWER (after the UPPER n. " + i + + ").", 1111, "FileComponent", ""); + } + } + if (lowerSegmentoE[lowerSegmentoE.length - 1].indexOf( + upper) > -1) { + throw new ExactException("The input file «" + + nomeFileOrigine + + "» contains a wrong alternation " + + "of UPPER and LOWER; it ends with an UPPER.", + 1112, "FileComponent", ""); + } + for (int i = 0; i < quantiLower; i++) { + if (lowerSegmentoE[i].indexOf(upper) == -1) { + throw new ExactException("The input file «" + + nomeFileOrigine + + "» contains a wrong alternation " + + "of UPPER and LOWER (before the LOWER n. " + i + + ").", 1113, "FileComponent", ""); + } + } + /* now we are sure that quantiUpper, quantiLower and quantiKnife + * indicate the same quantity */ + String[] oldFileSegmentE = new String[quantiUpper + 1]; + String[] oldFileSegmentRE = new String[quantiUpper + 1]; + /* containedE is the list of texts contained between a UPPER and + * a LOWER, therefore 1 less than the segments that are + * intermediate between the various upper-lower pairs; it is + * necessary to count the first and the last */ + /* remember that upperSegmentoE is the list of segments + * resulting from the split based on the upper only */ + /* for the old content we also refer to the text transformed + * according to the charset, so we calculate both with R and + * without R, but what will be really used is the one with R */ + String[] vecchioContenutoRE = new String[quantiUpper]; + String[] vecchioContenutoE = new String[quantiUpper]; + int k = 0; + for (int j = 0; j < quantiUpper + 1; j++) { + if (j == 0) { + oldFileSegmentE[j] = upperSegmentoE[j]; + oldFileSegmentRE[j] = upperSegmentoRE[j]; + } else { + k = upperSegmentoE[j].indexOf(lower); + oldFileSegmentE[j] = upperSegmentoE[j].substring(k + + lower.length()); + vecchioContenutoE[j - 1] = upperSegmentoE[j].substring( + 0, k); + k = upperSegmentoRE[j].indexOf(lower); + oldFileSegmentRE[j] = upperSegmentoRE[j].substring(k + + lower.length()); + vecchioContenutoRE[j - 1] = upperSegmentoRE[j] + .substring(0, k); + } + oldFileSegmentRE[j] = clean(oldFileSegmentRE[j]); + } + /* I remove any line-feeds in the queue */ + oldFileSegmentE[quantiUpper] = equalize( + oldFileSegmentE[quantiUpper]); + oldFileSegmentRE[quantiUpper] = equalize( + oldFileSegmentRE[quantiUpper]); + /* CURRENT SITUATION OF THE PRE-EXISTING MATERIAL */ + /* I make an example of a file that contains 2 upper-lower + * pairs; we have: oldSegmentE [0], oldContentsE [0], + * oldSegmentE [1], oldContentsE [1], oldSegmentE [2] */ + /* note that the distinction R and not R are not necessary for + * new text */ + newFileSegmentE[quantiUpper] = equalize( + newFileSegmentE[quantiUpper]); + boolean noQuestion = false; + k = 0; + /* now I compare each of the new segments with the old ones; the + * cycle continues until diversity is encountered */ + /* note that the comparison is made exclusively on the R + * version, that is, the text transformed according to the + * charset */ + for (; k < quantiUpper + 1; k++) { + String nuovo = newFileSegmentE[k]; + String vecchio = oldFileSegmentE[k]; + String vecchioR = oldFileSegmentRE[k]; + /* this if is set to save time in case it is not necessary + * to compact; could be removed */ + if (nuovo.equals(vecchioR) | nuovo.equals(vecchio)) { + continue; + } + nuovo = Strings.compatta_B(nuovo); + vecchio = Strings.compatta_B(vecchio); + vecchioR = Strings.compatta_B(vecchioR); + if (nuovo.equals(vecchioR) | nuovo.equals(vecchio)) { + continue; + } + /* it's not a java file, skip all import processing */ + if (!type.equals("java")) { + break; + } + + // 3 SECTORS EACH SEGMENTS + String coda = null; + int fineImport = 0; + /* the 3 sectors are: 1) before imports, i.e. comments line + * and package; 2) import lines; 3) after imports, i.e. + * ordinary java code */ + String[] newFileSectorE = new String[3]; + String[] oldFileSectorE = new String[3]; + String[] oldFileSectorRE = new String[3]; + String[] newFileSectorXE = newFileSegmentE[k].split( + "\\n\\x20*import "); + String[] oldFileSectorXE = oldFileSegmentE[k].split( + "\\n\\x20*import "); + String[] oldFileSectorRXE = oldFileSegmentRE[k].split( + "\\n\\x20*import "); + newFileSectorE[0] = newFileSectorXE[0]; + coda = newFileSectorXE[newFileSectorXE.length - 1]; + /* 59 is the semicolon */ + fineImport = coda.indexOf(59); + /* the +1 is used to go beyond the LINE FEED after the + * semicolon */ + newFileSectorE[2] = coda.substring(fineImport + 1); + + /* without R */ + oldFileSectorE[0] = oldFileSectorXE[0]; + coda = oldFileSectorXE[oldFileSectorXE.length - 1]; + /* 59 is the semicolon */ + fineImport = coda.indexOf(59); + /* the +1 is used to go beyond the LINE FEED after the + * semicolon */ + oldFileSectorE[2] = coda.substring(fineImport + 1); + + /* with R */ + oldFileSectorRE[0] = oldFileSectorRXE[0]; + coda = oldFileSectorRXE[oldFileSectorRXE.length - 1]; + /* 59 is the semicolon */ + fineImport = coda.indexOf(59); + /* the +1 is used to go beyond the LINE FEED after the + * semicolon */ + oldFileSectorRE[2] = coda.substring(fineImport + 1); + + // IMPORT PROCESSING + + /* since no import is assumed to have an ASCII character> + * 127, the distinction between "without R" and "with R" is + * not necessary */ + + List nuovoImportE = new ArrayList(); + // List vecchioImportE = new ArrayList (); + List vecchioImportRE = new ArrayList(); + /* oldImportE and newImportE are real and clean imports from + * the word import and semicolon */ + for (int i = 0; i < newFileSectorXE.length - 1; i++) { + /* 59 is the semicolon */ + /* the +1 is to skip the first line, which declares the + * package */ + int j = newFileSectorXE[i + 1].indexOf(59); + nuovoImportE.add(newFileSectorXE[i + 1].substring(0, j) + .trim()); + } + + /* 2 separate for loops for "without R" and "with R" */ + /* without R */ + // for (int i = 0; i salvatiE = new ArrayList(); + /* now I try if each of the old imports (therefore + * potentially typed by the developer after the first + * creation) is present or not from the source code produced + * by Screwdriver */ + + /* for this for loop, since we are going to read the + * contents of the imports and compare them, I assume that I + * can run only once, with the R mode, and then correctly + * save them. */ + for (int iv = 0; iv < vecchioImportRE.size(); iv++) { + String s = vecchioImportRE.get(iv); + int in = 0; + for (; in < nuovoImportE.size(); in++) { + if (s.equals(nuovoImportE.get(in))) { + break; + } + } + /* if the import is not present among those of this + * processing, this means that it has been entered by + * hand ... */ + if (in == nuovoImportE.size()) { + /* ... therefore I have to save it, and I memorize + * it by writing down w, which is the position of + * the last import that coincides instead */ + /* w could be -1 */ + salvatiE.add(s); + } + } + for (int is = 0; is < salvatiE.size(); is++) { + nuovoImportE.add(salvatiE.get(is)); + } + newFileSectorE[1] = ""; + for (int iv = 0; iv < nuovoImportE.size(); iv++) { + newFileSectorE[1] += "import " + nuovoImportE.get(iv) + + ";" + Candies.LF; + } + /* the 3 sectors are: 1) before imports, i.e. comments line + * and package; 2) import lines; 3) after imports, i.e. + * ordinary java code */ + Boolean[] comparison = new Boolean[3]; + for (int i = 0; i < 3; i++) { + comparison[i] = Strings.compatta_B(newFileSectorE[i]) + .equals(Strings.compatta_B(oldFileSectorRE[i])); + } + /* if the only difference is the added imports, there is no + * need to ask for permission */ + if (comparison[0] & comparison[1] & comparison[2]) { + continue; + } + newFileSegmentE[k] = newFileSectorE[0] + newFileSectorE[1] + + newFileSectorE[2]; + /* no question if only imports are different */ + noQuestion = comparison[0] & comparison[2]; + break; + } + /* if I find one, the k-th segment, different, then I have to + * trigger the request for permission to overwrite */ + if (k < quantiUpper + 1) { + /* I put the first piece ... */ + String cumulo = newFileSegmentE[0]; + /* ... and then the following */ + for (int n = 1; n < quantiUpper + 1; n++) { + cumulo += upper; + cumulo += vecchioContenutoRE[n - 1]; + cumulo += lower; + cumulo += newFileSegmentE[n]; + } + /* I call him arrogant when, despite the need to make a + * replacement, he does not ask for any permission */ + /* he is humble, because he is not arrogant, if the last + * argument is false; for now there are no other uses of + * humble with arrogant = true */ + finishLine(cumulo, pre_existentFilename, nomeFileOrigine, + recycleBinY, preExistent, candies, noQuestion); + } + } + + /** @param noQuestion false if I asks for permission before + * acting */ + private void finishLine(final String materialeOutput, + final String nomeFileOutput, final String nomeFileInput, + final String recycleBinY, File output, CandyScrew candies, + final boolean noQuestion) + + throws ExactException { + + /* freeze files are those that must not be touched at all, they + * are mentioned in the external properties file */ + if (!noQuestion & !remember) { + boolean freeze = false; + boolean freezeDue = false; + wellIPermit = false; + if (candies.freezeE != null) { + int i = 0; + for (; i < candies.freezeE.size(); i++) { + if (candies.freezeE.get(i).equalsIgnoreCase( + nomeFileOutput)) { + break; + } + } + freeze = i < candies.freezeE.size(); + } + /* could become freeze by looking in the other list */ + if (!freeze & candies.freezeDueE != null) { + int j = 0; + for (; j < candies.freezeDueE.size(); j++) { + if (candies.freezeDueE.get(j).equalsIgnoreCase( + nomeFileOutput)) { + break; + } + } + freezeDue = j < candies.freezeDueE.size(); + } + if (!freeze & !freezeDue) { + String question = "The file " + Mix.dress_A( + nomeFileOutput) + + " has changed, can I overwrite it?"; + logger.info(question); + /* the "Yes" button is locked only if I have declared + * some files as "freezeDue" and I have declared that + * the java source is not inside, that is, it is not + * written from java code already present in the ele + * file */ + boolean lockButtonYes = false; + Remember noMore = new Remember(null, question, + "Question", lockButtonYes); + logger.info(noMore.answer[0] ? "Yes" + : freeze ? "Mandatory NO" : "No"); + wellIPermit = noMore.answer[0]; + remember = noMore.answer[1]; + } else if (freezeDue) { + logger.info("So, I do not change the file " + Mix + .dress_A(nomeFileOutput) + "."); + } + } + if (wellIPermit) { + String x = Skill.datePosition(recycleBinY); + File destiny = new File(x + nomeFileInput); + destiny.delete(); + output.renameTo(destiny); + Equipment.writeFileFromOneStringUnicode_A(output, + materialeOutput, "UTF-8"); + } + } + + private static void searchForRepetion(List stringE, + final String fileName, final boolean old) + throws ExactException { + for (int i = 0; i < stringE.size(); i++) { + String s = stringE.get(i); + int j = i + 1; + for (; j < stringE.size(); j++) { + if (s.equals(stringE.get(j))) { + break; + } + } + if (j < stringE.size()) { + ExactException ce = new ExactException( + "There are 2 identical imports in the " + (old + ? "old " + : "new ") + Mix.dress_A(fileName) + ": " + + s, 1116, "FileComponent", ""); + throw ce; + } + } + } + + /* in producing the files within the algorithms of the program, LFs + * can be created more or less at the end of the file, which cause a + * "different" result in the comparison of the sources, and + * therefore a rewriting; to avoid this, I proceed to a draw of the + * LF in the queue */ + private static String equalize(final String s0) { + String s = s0; + /* I remove any line feed in the queue */ + while (s.endsWith(Candies.LF)) { + s = s.substring(0, s.length() - 1); + } + /* I replace only one */ + s += Candies.LF; + s = s.replaceAll("\\r\\n", Candies.LF); + s = s.replaceAll("\\n\\r", Candies.LF); + return s; + } + + private static String clean(final String s0) { + String s = s0; + s = s.replaceAll("\\r", ""); + return s; + } + + /** + *

+ * Creation date: 2020-09-09
+ * Last updated: 2020-09-09
+ * Class: Skill + * + * @author Massimo Maglioni + *

+ * Description: + *

+ * @param y directory name where a date has to be added + * @return the directory name followed by today date */ + public static String datePosition(final String y) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + String x = sdf.format(new Date()); + File d = new File(Mix.dress_C(y) + x); + if (d.exists() & !d.isDirectory()) { + d.delete(); + } + if (!d.exists()) { + d.mkdir(); + } + return d.getPath() + sep; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Train.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Train.java new file mode 100644 index 0000000..369ce19 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Train.java @@ -0,0 +1,93 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.ExactException; + +/** + *

+ * The tape object indicates a line of the ele file, therefore of + * input, consisting of a markup and all the material (called + * substance), which is next to it; if there is no markup in the + * immediately following lines, all these lines are an integral part of + * the substance as if they were a single line.
+ * There are 9 public properties, of which the 2 most important are: + *

+ *
    + *
  • n: the markup, expressed with a number because it indicates the + * position of the markup in the list of markups;
  • + *
  • substance: it is an Object, because, depending on the content of + * the row, it is immediately transformed into a Timestamp , String, or + * Integer;
  • + *
+ * + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-03
+ *

+ *

+ * Modifications:
+ * 2020-04-09: new method corrections
+ *

+ * + * @author M. Maglioni */ + +final public class Train { + + // PUBLIC PROPERTIES + + /** the first segment that makes up the train */ + public Wagon locomotor; + + /** the list of subsequent segments that make up the train */ + public Map wagonE = new HashMap(); + + // CONSTANT + + /** ordinary logger */ + @SuppressWarnings("unused") + private static final Logger logger = Logger.getLogger(Train.class); + + // constructorS + + /** default constructor */ + public Train() { + } + + /** + *

+ * Useful constructor + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param v wagon that makes up the fettuccia + * @param rigaJ the line of the file affected by the exception + * @throws ExactException standard exception */ + public Train(Wagon v, final int rigaJ) throws ExactException { + ExactException ne = new ExactException(); + if (wagonE.put(v.stub, v) != null) { + ne.datum = "Too much times I have declared the markup «" + + v.stub + "» following a «" + locomotor.stub + + "»."; + ne.code = 2200; + ne.n = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Wagon.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Wagon.java new file mode 100644 index 0000000..f47a299 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/Wagon.java @@ -0,0 +1,771 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.regex.Pattern; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.HandleDate; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.outfits.JspKit; +import it.ramecera.screwdriver.outfits.JspBeanElement; + +/** + *

+ * The wagon object indicates a markup with its data. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class Wagon { + + // PUBLIC PROPERTIES + + /** the stub */ + public String stub; + /** the main data */ + public Object substance; + /** the text */ + public String text; + /** the N. in the corresponding text file */ + public int rigaJ; + /** the N. placed in the train list on the corresponding text + * file */ + public int positionJ; + /** amount of words of the substance */ + public int wordQ; + /** technical evaluation of the text (if it is a SQL query of type + * select, how many columns there are; 1 = a single column of + * select; 2 = more columns of select) */ + public int valutazioneColonne; + /** if this segment is to be considered non-existent, remember that + * the default is false; a train is called a "follower" when it is + * the logical continuation of a previous train; it can be a + * continuation line of a text, or it can be a regular train that + * adds information to a previous train (example: formt+ is a + * follower of jsp+) */ + public boolean follower; + + /** ordinary logger */ + private static final Logger logger = Logger.getLogger(Wagon.class); + + /** default constructor */ + public Wagon() { + + } + + /** + *

+ * Creation date: 2020-04-29
+ * Last updated: 2020-06-27
+ * + * @author Massimo Maglioni + *

+ * Description: This constructor is used to completely + * define each markup: a line of text preceded by a label. + *

+ * + * @param markupE the list of markups + * @param stub the name of the markup + * @param substance object containing the data, i.e. a date, string + * or number + * @param rigaJ the line number on the + * @param hole the position that will occupy the strap of this + * segment in the list of trains; it is obtained from the + * account of valid trains obtained with the variable zQ + * @param trainW the previous train object, null if this train is + * the first; is the previous train in a logical sense, + * because there may be follower trains in the middle + * @param position of the markup position in the .ele file, + * corrected for the presence of .eli files with the function + * of include + * @throws ExactException the new segment is incorrect */ + public Wagon(HashMap markupE, final String stub, + Object substance, final int rigaJ, final int hole, + Train trainW, final int position) + + throws ExactException { + + this.stub = stub; + ExactException ne = new ExactException(); + /* I memorize the type of markup */ + int p = markupE.get(stub).p; + this.rigaJ = rigaJ; + this.substance = substance; + /* at this moment the substance can only be a string; only later + * will we qualify it as a date or integer or booelan */ + if (!this.substance.getClass().getName().equals( + "java.lang.String")) { + this.wordQ = 0; + ne.datum = "Attempt to construct a segment by supplying" + + " a substance that is not a string."; + throw ne; + } else if (this.substance.equals("")) { + this.wordQ = 0; + } else { + this.wordQ = ((String) this.substance).split(" ").length; + } + String x = ((String) substance); + logger.trace("stub=" + stub + ", x=" + x); + String message = null; + switch (p) { + /* The follower segment is a continuation segment of the text which + * is called follower because after its use it loses all + * reference */ + case 0: /* a free text; by definition the segment is follower */ + if (trainW == null) { + message = "An \"ele\" file must begin with a regular" + + " markup, not with a text: I have found " + + Mix.dress_A(x) + "."; + ne.code = 1600; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } + // SHE'S DEAD + follower = true; + break; + case 1: // a date + x = Mix.compactingSpaces_A(x); + if (x.length() == 0) { + message = "There should be a date at the markup " + Mix + .dress_A(markupE.get(stub).stub) + " at line " + + position + + ", on the contrary there is nothing."; + ne.code = 1601; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } else if (!HandleDate.eDataValida(x, "d-M-yyyy") + && !HandleDate.eDataValida(x, "d/M/yyyy") + && HandleDate.eLongValidDate(x) == null) { + message = "There should be a date at the markup " + Mix + .dress_A(markupE.get(stub).stub) + " at line " + + position + ", on the contrary I have found " + + Mix.dress_A(x); + ne.code = 1602; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } else if (HandleDate.eDataValida(x, "d-M-yyyy")) { + this.substance = HandleDate.pacco(x); + } else if (HandleDate.eDataValida(x, "d/M/yyyy")) { + this.substance = HandleDate.pacco(x); + } else + this.substance = HandleDate.eLongValidDate(x); + break; + case 7: // a CSS color + x = Mix.compactingSpaces_A(x).toLowerCase(); + if (x.length() == 0) { + message = "There should be a CSS color at the markup " + + Mix.dress_A(markupE.get(stub).stub) + + " at line " + position + + ", on the contrary there is nothing."; + ne.code = 1603; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } else if (!Mix.isCssColor(x) & !x.matches( + "\\x23[0123456789abcdef]{6}") & !x.matches( + "rgb\\x28\\d+\\x2c\\x20*\\d+\\x2c\\x20*\\d+\\x29")) { + message = "There should be a CSS color at the markup " + + Mix.dress_A(markupE.get(stub).stub) + + " at line " + position + + ", on the contrary I have found " + Mix + .dress_A(x); + ne.code = 1604; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else { + this.text = x.trim(); + this.substance = x.trim(); + } + break; + case 2: // an unsigned positive integer, mandatory + x = Mix.compactingSpaces_A(x); + if (x.length() == 0) { + message = "There should be a CSS color at the markup" + + markupE.get(stub).stub + "» at line " + + position + + ", on the contrary there is nothing."; + ne.code = 1605; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (!Pattern.matches("\\d+", x)) { + message = "There should be a number at the markup «" + + markupE.get(stub).stub + " at line " + + position + ", on the contrary I have found " + + Mix.dress_A(x); + ne.code = 1606; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } + this.text = x; + this.substance = Long.valueOf(x); + break; + case 15: // an integer with or without sign, mandatory + x = Mix.compactingSpaces_A(x); + if (x.length() == 0) { + message = "There should be a number at the markup " + + Mix.dress_A(markupE.get(stub).stub) + + " at line " + position + + ", on the contrary there is nothing."; + ne.code = 1607; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (!Pattern.matches("[+-]?\\d+", x)) { + message = "There should be a number at the markup " + + Mix.dress_A(markupE.get(stub).stub) + + " at line " + position + + ", on the contrary I have found " + Mix + .dress_A(x); + ne.code = 1608; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } + this.text = x; + this.substance = Long.valueOf(x); + break; + case 10: /* a string that refers to an include */ + case 6: // a string, optional + x = x.replaceAll("\\s", " "); + x = Mix.compactingSpaces_A(x); + this.text = x; + if (x.length() == 0) { + break; + } + case 20: // a string + if (p == 20) { + this.substance = ""; + } + case 3: // a string + x = Strings.compact_A(x); + if (x.length() == 0) { + message = "After the markup «" + markupE.get(stub).stub + + "» at line " + rigaJ + + " there must be anything, " + + "on the contrary there is nothing."; + ne.code = 1609; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + if (stub.equals("sdefauto")) { + x = x.toLowerCase(); + switch (x) { + case "no": + this.text = "no"; + break; + case "byname": + this.text = "byName"; + break; + case "bytype": + this.text = "byType"; + break; + case "autodetect": + this.text = "autodetect"; + break; + case "constructor": + this.text = "constructor"; + break; + default: + ne.code = 1610; + ne.datum = "The value " + Mix.dress_A(x) + + " for the markup " + Mix.dress_A(markupE + .get(stub).stub) + " at line " + + position + " was not expected."; + throw ne; + } + } else if (stub.startsWith("form") & markupE.get( + "jsp").recurrenceE.size() == 0) { + message = "The markup " + Mix.dress_A(stub) + + " at line " + position + + " must be preceded (even if not immediately) " + + "by the markup «jsp»."; + ne.code = 1612; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (stub.equals("formt")) { + this.text = x; + follower = true; + } else if (stub.equals("forma")) { + this.text = x; + follower = true; + } else if (stub.equals("formc")) { + this.text = x; + follower = true; + } else if (stub.equals("formn")) { + this.text = x; + follower = true; + } else if (stub.equals("formr")) { + this.text = x; + follower = true; + } else if (stub.equals("legend")) { + ((JspKit) trainW.locomotor.substance).legend = x; + } else if (markupE.get(stub).implyE != null && markupE.get( + stub).implyE.length == 1 && markupE.get( + stub).implyE[0].isWagon) { + this.text = x; + follower = true; + } else { + this.text = x; + } + break; + case 21: /* a string that refers to an include */ + case 23: /* a language code */ + case 19: + x = Mix.compactingSpaces_A(x); + int j = 0; + String[] eW = markupE.get(stub).expectedValueE; + for (; j < eW.length; j++) { + if (eW[j].trim().equalsIgnoreCase(x)) { + /* I correct a possible inaccuracy on upper / lower + * case */ + x = eW[j]; + break; + } + } + if (j == eW.length & x.isEmpty()) { + if (p == 23) { + message = "For the markup «" + markupE.get(stub) + + "» the expected values are the language codes ISO 639-1."; + } else { + message = "For the markup «" + markupE.get( + stub).stub + "» the expected values are: "; + for (String u : markupE.get(stub).expectedValueE) { + message += u + ", "; + } + message += "but no value has been declared."; + } + ne.code = 1626; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (j == eW.length) { + if (p == 23) { + message = "For the markup " + Mix.dress_A(markupE + .get(stub).stub) + + " the expected values are according to " + + "language code ISO 639-1, "; + } else { + message = "For the markup «" + stub + + "» the expected values are: "; + for (String u : markupE.get(stub).expectedValueE) { + message += u + ", "; + } + } + message += "but I have found " + Mix.dress_A(x) + "."; + ne.code = 1628; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + if (p == 23) { + this.text = x.toLowerCase(); + } else { + this.text = x; + } + if (p != 21) { + this.substance = Integer.valueOf(j); + } + break; + case 11: /* a string that refers to an include */ + case 5: // a version of software + x = Mix.compactingSpaces_A(x); + message = "The markup " + Mix.dress_A(stub) + " at line " + + rigaJ + " presents a value " + x + + " which on the contrary should be a version" + + " of software."; + this.substance = Mix.absoluteVersion(x, message, 1627); + this.text = x; + case 16: // like 12 but optional + x = x.replaceAll("\\s", " "); + x = Mix.compactingSpaces_A(x); + this.text = x; + if (x.length() == 0) { + break; + } + case 8: // like 12, and automatically converted to lowercase + case 12: // a one-word string + x = Mix.compactingSpaces_A(x); + if (x.length() == 0 | x.indexOf(32) > -1) { + message = "After the markup " + Mix.dress_A(stub) + + " at line " + position + + " there must be something, and it must be one word."; + ne.code = 1613; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (stub.equals("sinterce")) { + /* make sure the initial is capitalized, it's a classse + * java! */ + this.text = x.substring(0, 1).toUpperCase() + x + .substring(1); + } else if (stub.equals("bmenu")) { + this.text = x.toLowerCase(); + follower = true; + } else if (stub.equals("requmap") | stub.equals("burl")) { + if (x.startsWith(Candies.SLASH) & !x.equals( + Candies.SLASH)) { + message = "At line " + position + ", " + stub + "+" + + x + " path starts with a slash," + + " it will be automatically removed."; + logger.debug(message); + this.substance = x.substring(1); + this.text = x; + } else { + this.text = x; + } + } else if (p == 8) { + this.text = x.toLowerCase(); + } else { + this.text = x; + } + break; + case 14: /* a string of a path plus file name, not more than 1 + * slash, but optional */ + if ((stub.equals("edefn") | stub.equals("sieco")) & markupE + .get("jsp").recurrenceE.size() == 0) { + message = "The markup " + Mix.dress_A(stub) + + " at line " + position + + " must be preceded by the markup «jsp»."; + ne.code = 1616; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + x = x.replaceAll("\\t", " "); + x = Mix.compactingSpaces_A(x); + this.text = x; + if (x.length() == 0) { + x = (markupE.get("jsp").recurrenceE.get( + 0)).locomotor.text; + } + + case 13: /* a string of a path plus file name, not more than 1 + * slash */ + x = Mix.compactingSpaces_A(x); + x = x.replaceAll("\\x5c", "/"); // x5c is the backslash + if (Mix.stringheQ(x, "/") > 1 | Mix.stringheQ(x, ".") < 1) { + message = "After the markup " + Mix.dress_A(markupE.get( + stub).stub) + " at line " + position + + " there is an irregular path; it needs" + + " one directory without initial slash" + + " and a file with its extension."; + ne.code = 1617; + ne.datum = message; + ne.className = this.getClass().getName(); + ne.line = rigaJ; + throw ne; + } else { + this.text = x; + if (x.indexOf(47) == -1) { // ASCII 47 is the bar + x = "/" + x; + } + // hexadecimal 2f is the slash + this.substance = Mix.analizzaPath(x); + } + if (stub.equals("jsp")) { + String[] s = Mix.analizzaPath(x); + this.substance = new JspKit(s[0], s[1], s[2], false, + new ArrayList(), "", + new ArrayList(), positionJ, null, 0); + } + break; + + case 9: /* a string that refers to an include */ + case 4: // empty + /* Blank means markup without any parameters. To express a + * Boolean value, true / false is not used, but two distinct + * markups are used */ + if (x.length() > 0) { + message = "After the markup " + Mix.dress_A(markupE.get( + stub).stub) + " at line " + position + + " there must be nothing, on the contrary" + + " I have found " + Mix.dress_A(x) + "."; + ne.code = 1618; + ne.method = "Wagon constructor"; + ne.datum = message; + ne.line = rigaJ; + ne.className = this.getClass().getName(); + throw ne; + } + if (markupE.get(stub).implyE != null) { + for (int n = 0; n < markupE.get( + stub).implyE.length; n++) { + if (!markupE.get(stub).implyE[n].value.equals("")) { + message = "The markup " + Mix.dress_A(stub) + + " at line " + rigaJ + + " presents as supposed the markup " + + Mix.dress_A(markupE.get( + stub).implyE[n].stub + + Markup.PIU + markupE.get( + stub).implyE[n].value) + + " which should be a software version."; + this.substance = Mix.absoluteVersion(markupE + .get(stub).implyE[n].value, message, + 1625); + } + } + } + if (stub.equals("pragma")) { + follower = true; + } else if (stub.equals("blank")) { + ((JspKit) trainW.locomotor.substance).blank = true; + } + break; + + case 17: /* a mandatory string, consisting of substrings + * separated by commas */ + case 24: /* a mandatory string, consisting of words separated by + * commas */ + x = Strings.compact_A(x); + if (x.length() == 0) { + message = "After the markup «" + markupE.get(stub).stub + + "» at line " + rigaJ + + " there must be anything, on the contrary" + + " there is nothing."; + ne.code = 1619; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + String[] z = x.split("\\x2c"); // x2c is the comma + String[][] ss17 = new String[2][z.length]; + for (int i = 0; i < z.length; i++) { + ss17[0][i] = z[i].trim(); + if (ss17[0][i].isEmpty()) { + message = "After the markup " + markupE.get( + stub).stub + " at line " + rigaJ + + " there must be a list, but element n. " + + (i + 1) + " is empty."; + ne.code = 1620; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (ss17[0][i].indexOf(32) > -1 & p == 24) { + message = "At the markup " + markupE.get(stub).stub + + " at line " + rigaJ + + " there must be a list of words, but element n. " + + (i + 1) + " has more than one word."; + ne.code = 1620; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + } + this.substance = ss17; + break; + + case 22: /* an optional string, consisting of substrings + * separated by commas */ + x = x.replaceAll("\\s", " "); + x = Mix.compactingSpaces_A(x); + if (x.length() > 0) { + String[] ss22 = x.split("\\x2c"); // x2c is the comma + for (int i = 0; i < ss22.length; i++) { + ss22[i] = ss22[i].trim(); + } + this.substance = ss22; + this.text = x; + } + break; + + case 18: /* a mandatory string, consisting of a select SQL */ + x = x.trim(); + if (x.length() == 0) { + message = "After the markup «" + markupE.get(stub).stub + + "» at line " + rigaJ + + " there must be anything, on the contrary" + + " there is nothing."; + ne.code = 1622; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else if (!x.toLowerCase().startsWith("select ")) { + message = "The markup " + Mix.dress_A(markupE.get( + stub).stub) + " at line " + rigaJ + + " must start with the word «select»."; + ne.code = 1623; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } else { + String w = x; + w = w.replaceAll("concat([^)]+)", "(dummy"); + int comma = w.indexOf(44); // ASCII 44 is comma + int sqlFrom = w.indexOf(" from "); + if (comma == -1 | comma > sqlFrom) { + this.valutazioneColonne = 1; + } else { + this.valutazioneColonne = 2; + } + this.text = x; + } + break; + default: + ne.code = 1650; + ne.datum = "The value " + p + " for the markup " + Mix + .dress_A(stub) + " at line " + position + + " was not expected."; + throw ne; + } + if (!follower) { + /* identical non-repeat check */ + if (markupE.get(stub).presenza == 4 | markupE.get( + stub).presenza == 5) { + int i = 0; + for (; i < markupE.get(stub).recurrenceE.size(); i++) { + if (markupE.get(stub).recurrenceE.get( + i).locomotor.text.equalsIgnoreCase(x)) { + break; + } + } + if (i < markupE.get(stub).recurrenceE.size()) { + message = "The markup " + Mix.dress_A(stub) + + " at line " + position + + " is a duplicate."; + ne.code = 1621; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + } + } + if (markupE.get(stub).precedingE != null) { + int i = 0; + for (; i < markupE.get(stub).precedingE.length; i++) { + if (markupE.get(stub).precedingE[i].equals( + trainW.locomotor.stub)) { + break; + } + } + if (i == markupE.get(stub).precedingE.length) { + message = "The markup " + Mix.dress_A(stub) + + " at line " + position + + " has as previous train " + Mix.dress_A( + trainW.locomotor.stub) + + ", is incorrect"; + ne.code = 1624; + ne.datum = message; + ne.className = this.getClass().getName(); + throw ne; + } + } + } + + // PUBLIC METHODS + + /** + *

+ * Classic clone method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @return the resulting string */ + final public Wagon clone() { + Wagon f = new Wagon(); + f.follower = follower; + f.wordQ = wordQ; + f.rigaJ = rigaJ; + f.positionJ = positionJ; + f.substance = substance; + f.stub = stub; + f.text = text; + return f; + } + + /** + *

+ * Display of a wagon. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ * + * @param i wagon index + * @param mE the list of markups + * @return the string resultant */ + final public String toString(final int i, + HashMap mE) { + String s = ""; + if (i > 0) { + s += "wagon " + i + ") "; + } + s += "[" + mE.get(stub).stub + "], line = " + rigaJ + + "; place = " + positionJ; + if (text != null) { + s += "; /text/-" + text; + } + s += "; className: " + substance.getClass().getName(); + String x = ""; + if (substance.getClass().getName().equals("java.lang.String") + && text == null && ((String) substance).length() == 0) { + x += "/string/-" + substance; + } + if (substance.getClass().getName().equals("java.util.Date")) { + x += "/data/ " + HandleDate.acconciaData_F( + (Date) substance); + } else if (substance.getClass().getName().equals( + "java.lang.Long")) { + x += "/l/-" + substance; + } else if (stub.equals("indexjsp")) { + x += "/index/-navigation bar=" + + ((JspKit) substance).navigationBar; + /* it is not an error, it is the name of the class + * corresponding to long [] */ + } else if (substance.getClass().getName().equals( + "it.ramecera.screwdriver.outfits.JspKit")) { + x += "/jspKit/-" + ((JspKit) substance).toString(); + /* it is not an error, it is the name of the class + * corresponding to long [] */ + } else if (substance.getClass().getName().equals("[J")) { + long[] d = (long[]) substance; + for (long e : d) { + x += "/tipo/-" + e; + } + } + if (!x.isEmpty()) { + s += "; substance = " + x; + } + s += Candies.LF; + return s; + } + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Base_jsp.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Base_jsp.java new file mode 100644 index 0000000..a3b154c --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Base_jsp.java @@ -0,0 +1,434 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.everyday.Universal; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.JspBeanElement; + +/** @author M. Maglioni */ +final public class Base_jsp extends FileComponent { + + private String[][] buttonsCrud = { { "en", "Create", "Read", + "Update", "Delete" }, { "it", "Crea", "Leggi", "Modifica", + "Cancella" }, { "fr", "Créer", "Lire", "Modifier", + "Supprimer" } }; + + /** + *

+ * I produce the contents of a JSP. + *

+ * + * @author M. Maglioni + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * @param skill set of + * @param snippetG application descriptive data */ + public Base_jsp(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @param markupE markups list + * @param trainE trains list + * @param candyScrew useful application data + * @throws FileNotFoundException obvious + * @throws IOException obvious + * @throws ExactException exception specified by a numeric code */ + final public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String baseG = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(baseG); + String header = ""; + if (jspKit.refresh > 0) { + header += Candies.TABS + + "" + Candies.LF; + } + header += "" + Candies.LF + Candies.TABS + + ""; + String footer = ""; + String navigation = ""; + String p = ""; // collects material for pragma + String s = ""; + String t = ""; + String b = ""; // collects material to belong + if (jspKit.pageTitle != null) { + b += Candies.TABS + "
" + jspKit.pageTitle + "
" + Candies.LF; + } + boolean presenzaDivPrincipale = jspKit.jspType == Cst.FORM + & jspKit.classeCss != null & !skill.hiberValid + & !skill.springValid; + String divPrincipale = "
" + Candies.LF; + if (presenzaDivPrincipale) { + b += Candies.TABS + divPrincipale; + } + if (jspKit.jspType == Cst.FORM) { + b += Candies.TABS + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + "" + + jspKit.legend + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + } + /* for now it is assumed that only the "string" or + * "string array" properties participate */ + for (JspBeanElement jbe : jspKit.stringPropertyE) { + // if (x.partecipa & jspKit.jspType! = Cst.FORM) { + if (jbe.participate) { + b += Candies.TABS + Candies.TABS + Candies.TABS + + divPrincipale + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + Candies.LF + Candies.TABS + + Candies.TABS + Candies.TABS + "
" + + Candies.LF; + } + } + for (JspBeanElement jbe : jspKit.arrayStringPropertyE) { + // if (x.partecipate & jspKit.jspType! = Cst.FORM) { + if (jbe.participate) { + b += Candies.TABS + divPrincipale; + b += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + b += Candies.TABS + Candies.TABS + "
" + + Candies.LF; + b += Candies.TABS + "" + Candies.LF; + } + } + for (JspBeanElement jbe : jspKit.controlE) { + if (jbe.participate) { + switch (jbe.controlType) { + case Cst.TEXT_BOX: + case Cst.TEXT_AREA: + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + if (skill.hiberValid | skill.springValid) { + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + break; + case Cst.LIST_BOX: + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + } + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + break; + case Cst.CHECK_BOX: + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + if (skill.hiberValid | skill.springValid) { + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + break; + case Cst.RADIO_BUTTON: + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + String[][] wE = (String[][]) (jbe.ftokens.substance); + for (int tK = 0; tK < wE[0].length; tK++) { + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + } + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + + wE[0][tK] + Candies.NON_BREAKING + + Candies.NON_BREAKING + + "
" + Candies.LF; + break; + } + } + } + // for (JspBeanElement jbe : jspKit.controlE) { + // if (jbe.participate & (jbe.controlType.equals(Cst.TEXT_BOX) + // | jbe.controlType.equals(Cst.TEXT_AREA))) { + // } + // } + // for (JspBeanElement jbe : jspKit.controlE) { + // if (jbe.participate & jbe.controlType.equals( + // Cst.LIST_BOX)) { + // } + // } + // for (JspBeanElement jbe : jspKit.controlE) { + // if (jbe.participate & jbe.controlType.equals( + // Cst.CHECK_BOX)) { + // } + // } + // for (JspBeanElement jbe : jspKit.controlE) { + // if (jbe.participate & jbe.controlType.equals( + // Cst.RADIO_BUTTON)) { + // } + // } + int lJ = 0; + if (skill.defaulan > -1) { + for (; lJ < buttonsCrud.length; lJ++) { + if (buttonsCrud[lJ][0].equalsIgnoreCase( + Universal.languageE[skill.defaulan][1])) { + break; + } + } + if (lJ == buttonsCrud.length) { + lJ = 0; + } + } + if (jspKit.jspType == Cst.FORM) { + b += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + if (jspKit.crud) { + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + } else { + b += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + } + b += Candies.TABS + Candies.TABS + Candies.TABS + "
" + + Candies.LF; + b += Candies.TABS + Candies.TABS + "" + + Candies.LF; + b += Candies.TABS + "" + Candies.LF; + } + if (presenzaDivPrincipale) { + b += "" + Candies.LF; + } + if (jspKit.pragma) { + p += "<%" + Candies.LF; + p += "response.setHeader(\"Pragma\",\"no-cache\");" + + Candies.LF; + p += "response.setHeader(\"Cache-Control\", \"no-cache\");" + + Candies.LF; + p += "response.setHeader(\"Expires\",\"-1\");" + Candies.LF; + p += "response.setHeader(\"X-UA-Compatible\",\"IE=9, IE=edge\");" + + Candies.LF; + p += "%>" + Candies.LF; + } + if (markupE.get("text").recurrenceE.size() > 0 & jspKit.fileName + .equals("index")) { + for (int m = 0; m < markupE.get("text").recurrenceE + .size(); m++) { + if (markupE.get("text").recurrenceE.get( + m).locomotor.positionJ > jspKit.placeJ) { + t = "
" + markupE + .get("text").recurrenceE + .get(m).locomotor.text + + "
"; + } + } + } + if (skill.springSecurity) { + s += "<%@ taglib prefix=\"sec\"" + + " uri=\"http://www.springframework.org" + + "/security/tags\" %>"; + } + if (skill.tiles) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+header+", ""); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+footer+", ""); + } + if (jspKit.navigationBar == null || jspKit.navigationBar + .isEmpty()) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+navigation+", ""); + } else { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+navigation+", navigation); + } + if (!skill.tiles) { + int h = producedMaterial.indexOf("+header+"); + if (h > -1) { + producedMaterial = producedMaterial.substring(0, h) + + header + producedMaterial.substring(h + 8); + } + int f = producedMaterial.indexOf("+footer+"); + if (f > -1) { + producedMaterial = producedMaterial.substring(0, f) + + footer + producedMaterial.substring(f + 8); + } + } + + /* WE COOK EVERYTHING (x2b è il segno +) */ + producedMaterial = Strings.replaceFirst(producedMaterial, + "+language+", buttonsCrud[lJ][0]); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+belong+", b); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+text+", t); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+pragma+", p); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+sec+", s); + producedMaterial = producedMaterial.replaceAll( + "\\x2bcharset\\x2b", skill.charset); + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + final public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Bootstrap_css.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Bootstrap_css.java new file mode 100644 index 0000000..61027d0 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Bootstrap_css.java @@ -0,0 +1,121 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class Bootstrap_css extends FileComponent { + + /** @param skill set of descriptive data of the application + * @param snippetG position of the fragments */ + public Bootstrap_css(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String g = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(g) + Candies.LF; + + if (skill.pckg != null) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bzoccolo\\x2b", skill.pckg); + } + if (skill.applicationNameLower != null) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+titolo+", skill.applicationNameLower); + } + if (markupE.get("indexjsp").recurrenceE.size() > 0 && markupE + .get("indexjsp").recurrenceE.get(0).wagonE.containsKey( + "ooptioncolor")) { + producedMaterial = producedMaterial.replaceAll( + "\\x2booptioncolor\\x2b", markupE.get( + "indexjsp").recurrenceE.get(0).wagonE.get( + "ooptioncolor").text); + producedMaterial = producedMaterial.replaceAll( + "\\x2booptmaincolor\\x2b", markupE.get( + "indexjsp").recurrenceE.get(0).wagonE.get( + "ooptioncolor").text); + + } else { + producedMaterial = producedMaterial.replaceAll( + "\\x2bmozColor1\\x2b", "black"); + } + if (markupE.get("indexjsp").recurrenceE.size() > 0 && markupE + .get("indexjsp").recurrenceE.get(0).wagonE.containsKey( + "ooptionhover")) { + producedMaterial = producedMaterial.replaceAll( + "\\x2booptionhover\\x2b", markupE.get( + "indexjsp").recurrenceE.get(0).wagonE.get( + "ooptionhover").text); + } else { + producedMaterial = producedMaterial.replaceAll( + "\\x2bmozColor1\\x2b", "white"); + } + if (skill.backColorFormAction != null) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+backformaction+", skill.backColorFormAction); + } + if (markupE.get("indexjsp").recurrenceE.size() > 0 && markupE + .get("indexjsp").recurrenceE.get(0).wagonE.containsKey( + "ooptbackcol1")) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bmozColor1\\x2b", markupE.get( + "indexjsp").recurrenceE.get(0).wagonE.get( + "ooptbackcol1").text); + } else { + producedMaterial = producedMaterial.replaceAll( + "\\x2bmozColor1\\x2b", "black"); + } + if (markupE.get("indexjsp").recurrenceE.size() > 0 && markupE + .get("indexjsp").recurrenceE.get(0).wagonE.containsKey( + "ooptbackcol2")) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bmozColor2\\x2b", markupE.get( + "indexjsp").recurrenceE.get(0).wagonE.get( + "ooptbackcol2").text); + } else { + producedMaterial = producedMaterial.replaceAll( + "\\x2bmozColor1\\x2b", "white"); + } + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ControllerBelong_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ControllerBelong_java.java new file mode 100644 index 0000000..fb97d42 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ControllerBelong_java.java @@ -0,0 +1,741 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.Wagon; +import it.ramecera.screwdriver.outfits.JspBeanElement; +import it.ramecera.screwdriver.outfits.JspKit; +import it.ramecera.screwdriver.outfits.RequestMap; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-03
+ * Company: Rameceraâ„¢
+ *

+ * + *

+ * Description: + *

+ *

+ * History: 2020-08-03 implementation of N13 (see + * martoraProject.ods)
+ * 2020-09-03 implementation of N3 (see martoraProject.ods) + *

+ * + * @author Massimo Maglioni */ +final public class ControllerBelong_java extends FileComponent { + + /* stored materials */ + private String impForm = ""; + private String s = ""; + private String aws = ""; + + /** ordinary logger */ + @SuppressWarnings("unused") + private static final Logger logger = Logger.getLogger( + ControllerBelong_java.class); + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public ControllerBelong_java(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String plainControllerG = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(plainControllerG) + + Candies.LF; + producedMaterial += "import org.springframework.web.servlet.ModelAndView;" + + Candies.LF; + producedMaterial += "import java.util.Map;" + Candies.LF; + producedMaterial += "import java.util.List;" + Candies.LF; + producedMaterial += "import java.util.ArrayList;" + Candies.LF; + producedMaterial += "import org.hibernate.HibernateException;" + + Candies.LF; + producedMaterial += "import javax.servlet.http.HttpServletRequest;" + + Candies.LF; + producedMaterial += "+importModel+"; + producedMaterial += "+importForm+"; + producedMaterial += "+importPlain+"; + String impMod = ""; + impMod += "import org.springframework.ui.Model;" + Candies.LF; + impMod += "import org.springframework.web.bind.annotation.ModelAttribute;" + + Candies.LF; + impForm += "import org.springframework.web.bind.annotation" + + ".RequestMethod;" + Candies.LF; + impForm += "import org.springframework.web.servlet.mvc.support" + + ".RedirectAttributes;" + Candies.LF; + impForm += "import org.springframework.dao.DataAccessException;" + + Candies.LF; + impForm += "import org.springframework.validation.BindingResult;" + + Candies.LF; + if (skill.hiberValid | skill.springValid) { // v 1.10.2 + impForm += "import javax.validation.Valid;" + Candies.LF; + } + impForm += Candies.LF; + impForm += "import java.sql.Types;" + Candies.LF; + impForm += "import java.sql.Timestamp;" + Candies.LF; + impForm += "import java.util.Date;" + Candies.LF; + impForm += "import java.text.SimpleDateFormat;" + Candies.LF; + for (Train t : markupE.get("hdefrail").recurrenceE) { + impForm += "import " + skill.networkDomain + ".screwdriver." + + t.wagonE.get("hjndi").text.toLowerCase() + "." + + t.wagonE.get("hdbschema").text + ".*;" + + Candies.LF; + } + producedMaterial += "+importAutowired+"; + String impAuto = ""; + if (skill.hasUseridPassword) { + impAuto += "import " + skill.networkDomain + "." + + skill.applicationNameLower + + ".web.authentication.UserContext;" + Candies.LF; + if (skill.authenticationMode.equals("trivial")) { + impAuto += "import " + skill.networkDomain + "." + + skill.applicationNameLower + + ".web.authentication.KingDao" + ";" + + Candies.LF; + impAuto += "import org.springframework.beans.factory" + + ".annotation.Autowired;" + Candies.LF; + } else { + impAuto += "import " + skill.networkDomain + "." + + skill.applicationNameLower + "." + Cst.RAIL + + skill.tabUser[1] + ".service.I" + Cst.RAILU + + skill.tabUser[1] + skill.tabUser[0] + + "Service" + ";" + Candies.LF; + } + } + String impPlain = ""; + RequestMap zW = null; + /* the 5 elements of the request mapping: z [0] = + * requestMap.map; z [1] = requestMap.pathJsp; z [2] = + * requestMap.jsp; z [3] = requestMap.type; z [4] = + * requestMap.path; */ + /* JSP type: 0 = plain; 1 = form; 2 = model */ + boolean elencoImport = false; + for (int i = 0; i < skill.correlationE.get(skill.cntK).rmE + .size(); i++) { + RequestMap z = skill.correlationE.get(skill.cntK).rmE.get( + i); + if (z.tipo == Cst.MODEL) { + if (markupE.get("xprovider").recurrenceE.get( + 0).locomotor.text.equalsIgnoreCase("ldap") + & !elencoImport) { + producedMaterial += Equipment.oneString( + candyScrew.snippetsYS + + "java/ControllerBelongLDAP.java"); + elencoImport = true; + } + } else if (zW == null || !equivalente(z, zW)) { + String f = Mix.uppercaseFirstChar(z.jsp) + + Cst.TIPO_JSPE[z.tipo]; + producedMaterial += "import +zoccolo+.web.model." + + z.path + "." + f + ";" + Candies.LF; + producedMaterial += "import +zoccolo+.web.model." + + z.path + "." + f + "Impl;" + Candies.LF; + } + zW = z.clone(); + } + if (skill.ldapService) { + producedMaterial += "import org.springframework.security.core." + + "userdetails.UserDetailsService;" + Candies.LF; + producedMaterial += "import org.springframework.beans.factory." + + "annotation.Autowired;" + Candies.LF; + } + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + + producedMaterial += Candies.LF + "@Controller" + Candies.LF; + producedMaterial += "@RequestMapping(\"/" + skill.correlationE + .get(skill.cntK).gruppo + "\")" + Candies.LF; + producedMaterial += "public class " + skill.groupControllerF + + " {" + Candies.LF + Candies.LF; + producedMaterial += "+autowireds+" + Candies.LF; + if (skill.hasUseridPassword) { + producedMaterial += Candies.TABS + + "private final UserContext userContext;" + + Candies.LF; + if (skill.authenticationMode.equals("trivial")) { + producedMaterial += Candies.TABS + + "private final KingDao holder;" + Candies.LF + + Candies.LF; + } else { + producedMaterial += Candies.TABS + "private final I" + + Cst.RAILU + skill.tabUser[1] + + skill.tabUser[0] + "Service holder;" + + Candies.LF + Candies.LF; + } + } + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + "/** ordinary logger */" + + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static final Logger logger = Logger.getLogger(" + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + skill.groupControllerF + ".class);" + + Candies.LF + Candies.LF; + } + /* for the next for I first accumulate all the material in s, + * then only at the end I transfer s */ + boolean accountController = false; + boolean autowired = false; + if (skill.hasUseridPassword) { + + // constructor + + s += Candies.TABS + "@Autowired" + Candies.LF; + if (skill.authenticationMode.equals("trivial")) { + s += Candies.TABS + "public " + skill.groupControllerF + + "(UserContext userContext," + Candies.LF + + Candies.TABS + Candies.TABS + + "KingDao holder) {" + Candies.LF; + } else { + s += Candies.TABS + "public " + skill.groupControllerF + + "(UserContext userContext," + Candies.LF + + Candies.TABS + Candies.TABS + "I" + Cst.RAILU + + skill.tabUser[1] + skill.tabUser[0] + + "Service holder) {" + Candies.LF; + } + s += Candies.TABS + Candies.TABS + + "if (userContext == null) {" + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "throw new IllegalArgumentException(" + Candies.LF + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "\"userContext cannot be null\");" + + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + Candies.LF; + s += Candies.TABS + Candies.TABS + "if (holder == null) {" + + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "throw new IllegalArgumentException(" + Candies.LF + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "\"holder cannot be null\");" + + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + Candies.LF; + + s += Candies.TABS + Candies.TABS + + "this.userContext = userContext;" + Candies.LF; + s += Candies.TABS + Candies.TABS + "this.holder = holder;" + + Candies.LF; + s += Candies.TABS + "}" + Candies.LF; + } + for (int i = 0; i < skill.correlationE.get(skill.cntK).rmE + .size(); i++) { + RequestMap rm = skill.correlationE.get(skill.cntK).rmE.get( + i); + String idJsp = rm.pathJsp + ".jsp"; + int z = 0; + List tE = markupE.get("jsp").recurrenceE; + for (; z < tE.size(); z++) { + if (tE.get(z).locomotor.text.equals(idJsp)) { + break; + } + } + if (z == tE.size()) { + ExactException ne = new ExactException(); + ne.code = 2100; + ne.datum = "I've not fount the JSP " + Mix.dress_A( + idJsp) + "."; + ne.className = this.getClass().getName(); + throw ne; + } + JspKit jspKit = (JspKit) tE.get(z).locomotor.substance; + if (jspKit.crud & impForm.indexOf(".Notice") == -1) { + impForm += "import " + skill.networkDomain + "." + + skill.applicationNameLower + + ".web.model.utility.Notice;" + Candies.LF; + } + s += Candies.LF; + if (rm.tipo == Cst.PLAIN | rm.tipo == Cst.FORM) { + s += Candies.TABS + "@RequestMapping(value = { "; + for (int k = 0; k < rm.map.length; k++) { + s += "\"" + Strings.replaceFirst(rm.map[k], + skill.correlationE.get(skill.cntK).gruppo, + "") + "\", "; + } + /* I remove the last comma-space pair */ + s = s.substring(0, s.length() - 2); + s += " })" + Candies.LF; + s += Candies.TABS + "public ModelAndView " + + skill.correlationE.get(skill.cntK).gruppoMinus + + "_" + i + "(Map model," + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + "HttpServletRequest request) {" + + Candies.LF + Candies.LF; + s += Candies.TABS + Candies.TABS + rm.jspU + + Cst.JU[rm.tipo] + " " + rm.jsp + + Cst.JU[rm.tipo] + " = new " + rm.jspU + + Cst.JU[rm.tipo] + "Impl();" + Candies.LF; + if (rm.tipo == Cst.FORM) { + s += Candies.TABS + Candies.TABS + "model.put(\"" + + rm.jsp + Cst.JU[rm.tipo] + "\", " + rm.jsp + + Cst.JU[rm.tipo] + ");" + Candies.LF; + /* list-boxes process */ + for (int k = 0; k < jspKit.controlE.size(); k++) { + JspBeanElement jbe = jspKit.controlE.get(k); + /* I reject the others */ + if (!jbe.controlType.equals(Cst.LIST_BOX)) { + continue; + } + if (jbe.dao != null & jbe.hsqln != null) { + tableReading(jbe, rm); + } else if (jbe.ftokens != null) { + tokensReading(jbe, rm); + } + } + } + for (Wagon metodo : jspKit.methodE) { + s += Candies.TABS + Candies.TABS + rm.jsp + + Cst.JU[rm.tipo] + "." + metodo.text + + "(request"; + if (!skill.methodE.get(metodo.text).lowerArguments + .isEmpty()) { + s += ", " + skill.methodE.get( + metodo.text).lowerArguments; + } + for (int cJ = 0; cJ < skill.methodE.get( + metodo.text).classE.size(); cJ++) { + s += ", other" + cJ; + } + s += ");" + Candies.LF; + for (TableOutfit tab : skill.methodE.get( + metodo.text).tableE) { + String interfaccia = "private I" + + tab.railUppercase + tab.entityNameU + + "Dao" + " " + tab.railLowercase + + tab.entityName + "Dao;"; + /* I have to avoid repetition */ + if (aws.indexOf(interfaccia) == -1) { + aws += Candies.TABS + "@Autowired" + + Candies.LF; + aws += Candies.TABS + interfaccia + + Candies.LF; + } + } + } + if (!aws.isEmpty() & !autowired) { + for (Train train : markupE.get( + "hdefrail").recurrenceE) { + impAuto += "import " + skill.networkDomain + "." + + skill.applicationNameLower + "." + + Cst.RAIL + train.locomotor.text + + ".dao.*;" + Candies.LF; + } + if (impAuto.indexOf(".Autowired;") == -1) { + impAuto += "import org.springframework.beans." + + "factory.annotation.Autowired;" + + Candies.LF; + } + autowired = true; + } + s += Candies.TABS + Candies.TABS + + "return new ModelAndView(\"" + rm.pathJsp + + "\", \"belong\"," + Candies.LF + Candies.TABS + + Candies.TABS + rm.jsp + Cst.JU[rm.tipo] + ");" + + Candies.LF; + } else { // type model + if (skill.ldapService & !accountController) { + if (skill.ldapService) { + s += Candies.TABS + + "private final UserDetailsService" + + " userDetailsService;" + Candies.LF; + } + s += Candies.TABS + "@Autowired" + Candies.LF; + s += Candies.TABS + "public " + + skill.groupControllerF + + "(UserDetailsService" + + " userDetailsService) {" + Candies.LF; + s += Candies.TABS + Candies.TABS + + "if (userDetailsService == null) {" + + Candies.LF; + s += Candies.TABS + + "throw new IllegalArgumentException(" + + "\"userDetailsService cannot be null\");" + + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + Candies.LF; + s += Candies.TABS + Candies.TABS + + "this.userDetailsService = userDetailsService;" + + Candies.LF; + s += Candies.TABS + "}" + Candies.LF; + accountController = true; + } + s += Candies.TABS + "@RequestMapping(value = { "; + for (int k = 0; k < rm.map.length; k++) { + s += "\"" + Strings.replaceFirst(rm.map[k], + skill.correlationE.get(skill.cntK).gruppo, + " ") + "\", "; + } + /* I remove the last comma-space pair */ + s = s.substring(0, s.length() - 2); + s += " })" + Candies.LF; + s += Candies.TABS + "public String view_" + i + + "(Model model) {" + Candies.LF + Candies.LF; + if (skill.ldapService) { + s += Equipment.oneString(candyScrew.snippetsYS + + "java/ldapAuthenticationModelService.java"); + } else { + s += Equipment.oneString(candyScrew.snippetsYS + + "java/ldapAuthenticationModel.java"); + } + s += Candies.TABS + Candies.TABS + "return \"" + + rm.pathJsp + "\";" + Candies.LF; + // producedMaterial = Strings.replaceFirst( + // producedMaterial, "+importModel+", impMod); + } + s += Candies.TABS + "}" + Candies.LF; + if (rm.tipo == Cst.FORM & jspKit.crud) { + // producedMaterial = Strings.replaceFirst( + // producedMaterial, "+importForm+", impForm); + for (int crudJ = 0; crudJ < 4; crudJ++) { + s += Candies.LF + Candies.TABS + + "@RequestMapping(value = \"/screw" + + rm.jsp + Candies.CRUD[crudJ] + + "\", method = RequestMethod.POST)" + + Candies.LF; + s += Candies.TABS + "public ModelAndView compile" + + rm.jsp + Candies.CRUD[crudJ] + "("; + if (skill.hiberValid | skill.springValid) { + s += "@ModelAttribute(\"" + rm.jsp + + Cst.JU[rm.tipo] + "\") "; + s += "@Valid "; // v 1.10.2 + } + s += rm.jspU + Cst.JU[rm.tipo] + "Impl " + rm.jsp + + Cst.JU[rm.tipo] + "," + Candies.LF; + s += Candies.TABS + Candies.TABS + + "BindingResult result," + Candies.LF; + s += Candies.TABS + Candies.TABS + + "RedirectAttributes redirectAttributes) {" + + Candies.LF; + if (skill.hiberValid | skill.springValid) { + s += Candies.TABS + Candies.TABS + + "if (result.hasErrors()) {" + + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "return new ModelAndView(\"" + + rm.pathJsp + "\", \"belong\"," + + Candies.LF + Candies.TABS + + Candies.TABS + rm.jsp + + Cst.JU[rm.tipo] + ");" + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + } + + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + /* I reject the others */ + if (!jbe.controlType.equals(Cst.LIST_BOX)) { + continue; + } + if (crudJ == 1 & jbe.dao != null + & jbe.hsqln != null) { + tableReading(jbe, rm); + } else if (crudJ == 1 & jbe.ftokens != null) { + tokensReading(jbe, rm); + } + } + + s += Candies.TABS + Candies.TABS + + "/* here you can use " + rm.jsp + + Cst.JU[rm.tipo] + " */" + Candies.LF; + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.CHECK_BOX)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jbe.name + "\", " + rm.jsp + "" + + Cst.JU[rm.tipo] + ".is" + jbe.nameU + + "());" + Candies.LF; + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.TEXT_AREA)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jspKit.controlE.get(j).name + "\", " + + rm.jsp + "" + Cst.JU[rm.tipo] + ".get" + + jbe.nameU + "());" + Candies.LF; + + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.LIST_BOX)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jspKit.controlE.get(j).name + "\", " + + rm.jsp + "" + Cst.JU[rm.tipo] + + ".getArr_" + jspKit.controlE.get( + j).name + "());" + Candies.LF; + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.TEXT_BOX)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jspKit.controlE.get(j).name + "\", " + + rm.jsp + "" + Cst.JU[rm.tipo] + ".get" + + jspKit.controlE.get(j).nameU + "());" + + Candies.LF; + + } + s += Candies.TABS + Candies.TABS + "return screw" + + rm.jsp + Candies.CRUD[crudJ] + "(" + + rm.jsp + "Form);" + Candies.LF; + s += Candies.TABS + "}" + Candies.LF; + } + File crudMethods = new File(skill.candies.snippetsYS + + "java/Crud.java"); + String cr = Equipment.oneStringUnicode_A(crudMethods, + "UTF-8"); + cr = cr.replaceAll("\\x2bjsp\\x2b", rm.jsp); + cr = cr.replaceAll("\\x2bJsp\\x2b", rm.jspU); + cr = cr.replaceAll("\\x2bscrewModel\\x2b", rm.pathJsp); + s += cr; + } else if (rm.tipo == Cst.FORM) { // &!jspKit.crud + // producedMaterial = Strings.replaceFirst( + // producedMaterial, "+importForm+", impForm); + s += Candies.LF + Candies.TABS + + "@RequestMapping(value = \"/screw" + rm.jsp + + "\", method = RequestMethod.POST)" + + Candies.LF; + s += Candies.TABS + "public String compile" + rm.jsp + + "("; + if (skill.hiberValid | skill.springValid) { + s += "@ModelAttribute(\"" + rm.jsp + Cst.JU[rm.tipo] + + "\") "; + s += "@Valid "; // / v 1.10.2 + } + s += rm.jspU + Cst.JU[rm.tipo] + "Impl " + rm.jsp + + Cst.JU[rm.tipo] + "," + Candies.LF; + s += Candies.TABS + Candies.TABS + + "BindingResult result," + Candies.LF; + s += Candies.TABS + Candies.TABS + + "RedirectAttributes redirectAttributes) {" + + Candies.LF; + s += Candies.TABS + Candies.TABS + + "/* here you can use " + rm.jsp + + Cst.JU[rm.tipo] + " */" + Candies.LF; + if (skill.hiberValid | skill.springValid) { + s += Candies.TABS + Candies.TABS + + "if (result.hasErrors()) {" + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "return \"redirect:/" + rm.pathRedirect + + "\";" + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + Candies.LF; + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.CHECK_BOX)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jbe.name + "\", " + rm.jsp + "" + + Cst.JU[rm.tipo] + ".is" + jbe.nameU + + "());" + Candies.LF; + + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.TEXT_AREA)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jbe.name + "\", " + rm.jsp + "" + + Cst.JU[rm.tipo] + ".get" + jbe.nameU + + "());" + Candies.LF; + + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.LIST_BOX)) { + continue; + } + // s += Candies.TABS + Candies.TABS + // + "redirectAttributes.addAttribute(\"" + // + jbe.name + "\", " + rm.jsp + "" + // + Cst.JU[rm.tipo] + ".get" + jbe.nameU + // + "());" + Candies.LF; + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jspKit.controlE.get(j).name + "\", " + + rm.jsp + "" + Cst.JU[rm.tipo] + ".getArr_" + + jspKit.controlE.get(j).name + "());" + + Candies.LF; + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.TEXT_BOX)) { + continue; + } + s += Candies.TABS + Candies.TABS + + "redirectAttributes.addAttribute(\"" + + jbe.name + "\", " + rm.jsp + "" + + Cst.JU[rm.tipo] + ".get" + jbe.nameU + + "());" + Candies.LF; + } + s += Candies.TABS + Candies.TABS + "return \"redirect:/" + + rm.pathRedirect + "\";" + Candies.LF; + s += Candies.TABS + "}" + Candies.LF; + } else if (rm.tipo == Cst.PLAIN) { + // producedMaterial = Strings.replaceFirst( + // producedMaterial, "+importPlain+", impPlain); + } + } + producedMaterial += s; + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}" + Candies.LF; + /* WE COOK EVERYTHING */ + producedMaterial = Strings.replaceFirst(producedMaterial, + "+importModel+", impMod); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+importForm+", impForm); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+importPlain+", impPlain); + producedMaterial = producedMaterial.replaceAll( + "\\x2bzoccolo\\x2b", skill.pckg); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+autowireds+", aws); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+importAutowired+", impAuto); + } + + private void tableReading(JspBeanElement jbe, RequestMap rm) { + /* now I distinguish between a select with a single column + * (evaluation = 1) and select with multiple columns (evaluation + * = 2) */ + String interfaccia0 = ((String[][]) (jbe.dao.substance))[1][0]; + // impForm += "import org.hibernate.HibernateException;" + // + Candies.LF; + if (jbe.hsqln.valutazioneColonne == 1) { + /* one column case */ + s += Candies.TABS + Candies.TABS + "List " + + jbe.name + "E = null;" + Candies.LF; + s += Candies.TABS + Candies.TABS + "try {" + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + jbe.name + + "E = " + interfaccia0 + ".oneColumnQuery(\"" + + jbe.hsqln.text + "\");" + Candies.LF; + } else { + /* case many columns */ + s += Candies.TABS + Candies.TABS + "List " + + jbe.name + "E = null;" + Candies.LF; + s += Candies.TABS + Candies.TABS + "try {" + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + jbe.name + + "E = " + interfaccia0 + ".manyColumnQuery(\"" + + jbe.hsqln.text + "\");" + Candies.LF; + } + String interfaccia1 = "private " + interfaccia0.replaceFirst( + Cst.RAIL, Cst.IRAILU) + " " + Mix.lowercaseFirstChar( + interfaccia0) + ";"; + /* I have to avoid repetition */ + if (aws.indexOf(interfaccia1) == -1) { + aws += Candies.TABS + "@Autowired" + Candies.LF; + aws += Candies.TABS + interfaccia1 + Candies.LF; + } + s += Candies.TABS + Candies.TABS + + "} catch (HibernateException e) {" + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "e.printStackTrace();" + Candies.LF; + s += Candies.TABS + Candies.TABS + "} catch (Exception e) {" + + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "e.printStackTrace();" + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + Candies.LF; + s += Candies.TABS + Candies.TABS + rm.jsp + Cst.JU[rm.tipo] + + ".setArr_" + jbe.name + "(" + jbe.name + "E);" + + Candies.LF; + } + + private void tokensReading(JspBeanElement jbe, RequestMap rm) { + s += Candies.TABS + Candies.TABS + "List " + jbe.name + + "E = null;" + Candies.LF; + s += Candies.TABS + Candies.TABS + + "List tE = new ArrayList();" + + Candies.LF; + String[][] wE = (String[][]) (jbe.ftokens.substance); + for (int tK = 0; tK < wE[0].length; tK++) { + s += Candies.TABS + Candies.TABS + "tE.add(\"" + wE[0][tK] + + "\");" + Candies.LF; + } + s += Candies.TABS + Candies.TABS + "try {" + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + jbe.name + + "E = tE;" + Candies.LF; + s += Candies.TABS + Candies.TABS + "} catch (Exception e) {" + + Candies.LF; + s += Candies.TABS + Candies.TABS + Candies.TABS + + "e.printStackTrace();" + Candies.LF; + s += Candies.TABS + Candies.TABS + "}" + Candies.LF; + s += Candies.TABS + Candies.TABS + rm.jsp + Cst.JU[rm.tipo] + + ".setArr_" + jbe.name + "(" + jbe.name + "E);" + + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + skill.javaWebController = skill.javaWebY + "/controller"; + skill.buildDirectory(skill.javaWebController); + + } + + private boolean equivalente(RequestMap rm, RequestMap rmW) { + if (rm == null | rmW == null) { + return false; + } else { + return rm.path.equals(rmW.path) & rm.jsp.equals(rmW.jsp) + & rm.tipo == rmW.tipo; + } + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Dispatcher_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Dispatcher_xml.java new file mode 100644 index 0000000..08fcecf --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Dispatcher_xml.java @@ -0,0 +1,365 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.everyday.Universal; +import it.ramecera.salad.file.Abacus; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20
+ * Company: Rameceraâ„¢ + *

+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ */ +final public class Dispatcher_xml extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Dispatcher_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + final public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String dispatcherG = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(dispatcherG) + + Candies.LF; + String xmlns_altri = ""; + String sdefauto = ""; + String location_altri = ""; + if (skill.defaultAutowire) { + sdefauto += "default-autowire = \"" + markupE.get( + "sdefauto").recurrenceE.get(0).locomotor.text + + "\""; + } + if (skill.springSecurity) { + xmlns_altri += Candies.LF + Candies.TABS + + "xmlns:s=\"http://www.springframework.org/schema/security\""; + location_altri += Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + + "http://www.springframework.org/schema/security"; + location_altri += Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + + "http://www.springframework.org/schema/secu" + + "rity/spring-security-" + + skill.springSecurityReductVersion + ".xsd"; + } + if (skill.webFlow) { + xmlns_altri += Candies.LF + Candies.TABS + + "xmlns:webflow-config=\"http://www.spring" + + "framework.org/schema/webflow-config\""; + location_altri += Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + "http://www.springframe" + + "work.org/schema/webflow-config"; + location_altri += Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + + "http://www.springframework.org/schema/web" + + "flow-config/spring-webflow-config-2.3.xsd"; + } + location_altri += Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + + "http://www.springframework.org/schema/jdbc"; + location_altri += Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + + "http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd"; + producedMaterial += Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + } + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + if (skill.springSecurity) { + producedMaterial += Candies.TABS + + "" + Candies.LF; + } + producedMaterial += Candies.LF; + /* RESOURCES */ + for (int i = 0; i < markupE.get("sreso").recurrenceE + .size(); i++) { + String risorsa = markupE.get("sreso").recurrenceE.get( + i).locomotor.text; + if (i == 0 & risorsa.length() == 0) { + producedMaterial += Candies.TABS + + "" + Candies.LF; + if (markupE.get("sreso").recurrenceE.size() > 1) { + ExactException ce = new ExactException( + "The \"sreso+\" markup without data is incompatible with other sreso+.", + 1000, this.getClass().getName(), ""); + throw ce; + } + } else if (i > 0 & risorsa.length() == 0) { + ExactException ce = new ExactException( + "The \"sreso+\" markup without data is incompatible with other sreso+.", + 1001, this.getClass().getName(), ""); + throw ce; + } else { + producedMaterial += Candies.TABS + + "" + Candies.LF + Candies.LF; + skill.buildDirectory(skill.webAppResourcesY + "/" + + risorsa); + } + } + producedMaterial += Candies.TABS + + "" + Candies.LF + + Candies.LF; + if (skill.robots) { + producedMaterial += Candies.TABS + + "" + + Candies.LF; + File robots = new File(skill.candies.snippetsYS + + "robots.txt"); + if (!robots.exists() | !robots.isFile()) { + ExactException ce = new ExactException( + "Among the snippets the file " + + "«robots.txt» does not exist.", 1002, + this.getClass().getName(), ""); + throw ce; + } else { + Abacus.copyFile(robots, new File(skill.webAppG + "/" + + "robots.txt")); + } + } + /* INTERCEPTOR */ + String newInterceptor = skill.javaWebY + "/interceptor"; + File screwInterceptor = null; + if (skill.interceptor) { + skill.buildDirectory(newInterceptor); + producedMaterial += Candies.LF + Candies.TABS + + ""; + screwInterceptor = new File(skill.candies.snippetsYS + + "java/ScrewInterceptor.java"); + if (!screwInterceptor.exists() | !screwInterceptor + .isFile()) { + ExactException ce = new ExactException( + "Among the snippets the file " + + "«ScrewInterceptor.java» does not exist.", + 1003, this.getClass().getName(), ""); + throw ce; + } + } + for (int i = 0; i < markupE.get("sinterce").recurrenceE + .size(); i++) { + String nomeFile = Mix.uppercaseFirstChar(markupE.get( + "sinterce").recurrenceE.get(i).locomotor.text); + FileComponent.addClass("ScrewInterceptor.java", + newInterceptor, nomeFile, skill.candies, + recycleBinY, skill, -1, markupE, "java"); + producedMaterial += Candies.LF + Candies.TABS + Candies.TABS + + ""; + } + if (skill.interceptor) { + if (skill.i18n) { + producedMaterial += Candies.LF + Candies.TABS + + Candies.TABS + + ""; + producedMaterial += Candies.LF + Candies.TABS + + Candies.TABS + Candies.TABS + + ""; + producedMaterial += Candies.LF + Candies.TABS + + Candies.TABS + "" + Candies.LF; + } + producedMaterial += Candies.LF + Candies.TABS + + "" + Candies.LF + Candies.LF; + } + if (skill.viewController) { + producedMaterial += Candies.LF; + for (int i = 0; i < markupE.get("sieco").recurrenceE + .size(); i++) { + String[] s = (String[]) markupE.get("sieco").recurrenceE + .get(i).locomotor.substance; + producedMaterial += Candies.TABS + + "" + Candies.LF + Candies.LF; + } + } + if (skill.tiles) { + String[] qualificatoreE = skill.tilesVersion.split("\\x2e"); + String g = skill.candies.snippetsYS + + "corpoDispatcherTiles_" + qualificatoreE[0] + + ".txt"; + producedMaterial += Equipment.oneString(g) + Candies.LF; + } else { + String g = skill.candies.snippetsYS + "ViewResolver.txt"; + producedMaterial += Equipment.oneString(g) + Candies.LF; + } + if (skill.i18n) { + producedMaterial += Candies.LF + Candies.TABS + + ""; + producedMaterial += Candies.LF + Candies.TABS + Candies.TABS + + ""; + producedMaterial += Candies.LF + Candies.TABS + "" + + Candies.LF + Candies.LF; + } + if (skill.springValid | skill.hiberValid) { + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + } + if (skill.prettyPrint) { + String g = skill.candies.snippetsYS + "jacksonView.txt"; + producedMaterial += Equipment.oneString(g) + Candies.LF + + Candies.LF; + } + /* FUTURE RELEASE N6 */ + // if (skill.embedded) { + // embeddedMaker(); + // } + producedMaterial += "" + Candies.LF; + /* WE COOK EVERYTHING */ + producedMaterial = Strings.replaceFirst(producedMaterial, + "+xmlns_altri+", xmlns_altri); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+default-autowire+", sdefauto); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+location_altri+", location_altri); + producedMaterial = producedMaterial.replaceAll( + "\\x2bzoccolo\\x2b", skill.pckg); + producedMaterial += ""; + } + + /* FUTURE RELEASE N6 */ + // final private void embeddedMaker() + // + // throws ExactException { + // + // Iterator iterator = skill.dbmsE.iterator(); + // while (iterator.hasNext()) { + // producedMaterial += Candies.TABS + // + "" + Candies.LF; + // if (skill.ddl != null) { + // for (int i = 0; i < skill.ddl.length; i++) { + // producedMaterial += Candies.TABS + Candies.TABS + // + "" + Candies.LF; + // Equipment.scriviFileVuoto(skill.mainResources + // + "/database/" + Mix.lowercaseInitial( + // (String) (iterator.next())) + "/" + // + skill.ddl[i] + ".sql"); + // } + // } + // } + // producedMaterial += Candies.TABS + "" + // + Candies.LF; + // producedMaterial += Candies.TABS + // + "" + Candies.LF; + // producedMaterial += Candies.TABS + "" + Candies.LF; + // } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/FileComponent.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/FileComponent.java new file mode 100644 index 0000000..8ee82f6 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/FileComponent.java @@ -0,0 +1,406 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.analysis.Flute; +import it.ramecera.salad.analysis.JavaAnnotation; +import it.ramecera.salad.analysis.JavaProperty; +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.JspKit; +import it.ramecera.screwdriver.outfits.MenuKit; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** + *

+ * Application to automatically generate files that make up an + * application. + *

+ * + * @author M. Maglioni + *

+ * ​​Company: Ramecera™
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-09
+ *

+ *

+ * History:
+ * The description of N# is in project plan report.
+ * 2020-09-03 implementation of N3
+ * 2020-09-09 implementation of N8
+ *

+ */ +public abstract class FileComponent { + + // PROTECTED + + /** the main features of the application */ + protected Skill skill; + /** the properties of the job */ + protected CandyScrew candies; + /** directory with recycle bin function */ + protected String recycleBinY; + + protected final static String SERVER_HOME = "${jboss.server.home.url}"; + + // PUBLIC + + /** the content of the file to be built */ + public String producedMaterial = ""; + /** the snippet to be copied, path and file name */ + public String snippetG; + /** Jsp kit of JSP features */ + public JspKit jspKit = new JspKit(); + /** Jsp kit of JSP features */ + public MenuKit menuKit = new MenuKit(); + + /** name of the Quartz configuration file */ + public static final String QUARTZ_JOB_XML_F = "quartz-job.xml"; + + // PRIVATE + // + // private static final String sep = System.getProperty( + // "file.separator"); + // /** ordinary logger */ + // private static final Logger logger = Logger.getLogger( + // FileComponent.class); + + /** + *

+ * Class for producing the component file. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param markupE the list of markups + * @param trainE the train list + * @param candyScrew list of application properties + * @throws IOException ordinary exception + * @throws FileNotFoundException ordinary exception + * @throws ExactException ordinary exception + * @throws ExactException standard exception */ + public abstract void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException, + ExactException; + + /** @param markupE the list of markups + * @throws ExactException exception specified by a numeric code */ + abstract public void directory(HashMap markupE) + + throws ExactException; + + /** + *

+ * Class for writing the component file. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param y output directory + * @param nomeFileOutput output file + * @param filenameInput input file name + * @param type the extension of the output file; only java, + * properties, xml and jsp are allowed + * @param candies the set of properties external to the application + * @param recycleBinY recycle bin directory + * @throws ExactException specified by a numeric code + * @throws IOException ordinary exception + * @throws FileNotFoundException ordinary exception */ + public void write(final String y, final String nomeFileOutput, + final String filenameInput, final String type, + CandyScrew candies, final String recycleBinY) + + throws ExactException, FileNotFoundException, IOException { + skill.toTarget(y, nomeFileOutput, producedMaterial, + filenameInput, recycleBinY, type); + } + + /** + *

+ * Class for deleting the component file. Return false if the file + * does not exist or cannot be moved. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param y directory of the file to be deleted + * @param f file from delete + * @param trash directory where you put the deleted files + * @param skill TODO + * @return if the operation was successful */ + public static boolean deleteComponent(final String y, + final String f, File trash, Skill skill) { + File x = new File(Mix.dress_C(y) + f); + if (!x.exists()) { + return false; + } + skill.buildDirectory(trash); + File destinazione = new File(trash.getPath() + "/" + f); + destinazione.delete(); + return x.renameTo(destinazione); + } + + /** + *

+ * Overload of the previous method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param y directory of the file to be deleted + * @param f file from delete + * @param trash directory where you put the deleted files + * @param skill TODO + * @return if the operation was successful */ + public static boolean deleteComponent(final String y, + final String f, final String trash, Skill skill) { + return deleteComponent(y, f, new File(trash), skill); + } + + /** @param filenameInput class name + * @param outputPath path to go to write + * @param outputFile name of the output file + * @param candies application main constants + * @param trashY the directory with trash function + * @param skill set of application descriptive data + * @param tableJ index in the list of DB tables + * @param markupE map of markups + * @param tipoFileInput type of input file, as classified inside the + * box + * @throws ExactException standard exception + * @throws IOException standard exception + * @throws FileNotFoundException standard exception */ + public static void addClass(final String filenameInput, + final String outputPath, final String outputFile, + CandyScrew candies, final String trashY, Skill skill, + final int tableJ, HashMap markupE, + final String tipoFileInput) + + throws ExactException, FileNotFoundException, IOException { + + String dir = candies.snippetsYS + tipoFileInput; + String material = Equipment.oneStringUnicode_A(dir + "/" + + filenameInput, "UTF-8"); + material = Strings.replaceFirst(material, "package +zoccolo+", + "package " + skill.pckg); + material = material.replaceAll("\\x2bApplicaz\\x2b", Mix + .uppercaseFirstChar(skill.applicationNameLower)); + material = material.replaceAll("import \\x2bzoccolo\\x2b", + "import " + skill.pckg); + material = material.replaceAll("\\x2bnocciolo\\x2b", + outputFile); + if (tableJ > -1) { + material = material.replaceAll("\\x2btabella\\x2b", + skill.tableDBE.get(tableJ).entityName); + material = material.replaceAll("\\x2bdbschema\\x2b", + skill.tableDBE.get(tableJ).railLowercase); + material = Strings.replaceFirst(material, "+jpapath+", + skill.tableDBE.get(tableJ).pathDots); + } + material = material.replaceAll("\\x2bRail\\x2b", Cst.RAILU + + skill.tabUser[1]); + material = material.replaceAll("\\x2brail\\x2b", Cst.RAIL + + skill.tabUser[1]); + material = material.replaceAll("\\x2btabuser\\x2b", Mix + .uppercaseFirstChar(skill.tabUser[0])); + if (!markupE.get("xencoder").recurrenceE.isEmpty() && markupE + .get("xencoder").recurrenceE.get(0).locomotor.text + .equalsIgnoreCase("useridmd5")) { + String t = ""; + t += "public String getCredentials() {" + Candies.LF; + t += Candies.TABS + Candies.TABS + + "String s = super.getPrincipal()" + Candies.LF; + t += Candies.TABS + Candies.TABS + + "+ (String) super.getCredentials();" + Candies.LF; + t += Candies.TABS + Candies.TABS + "MessageDigest m = null;" + + Candies.LF; + t += Candies.TABS + Candies.TABS + "try {" + Candies.LF; + t += Candies.TABS + Candies.TABS + Candies.TABS + + "m = MessageDigest.getInstance(\"MD5\");" + + Candies.LF; + t += Candies.TABS + Candies.TABS + + "} catch (NoSuchAlgorithmException e) {" + + Candies.LF; + t += Candies.TABS + Candies.TABS + "}" + Candies.LF; + t += Candies.TABS + Candies.TABS + + "m.update(s.getBytes(), 0, s.length());" + + Candies.LF; + t += Candies.TABS + Candies.TABS + + "return new BigInteger(1, m.digest()).toString(16);" + + Candies.LF; + t += Candies.TABS + "}"; + material = Strings.replaceFirst(material, "+newMethod+", t); + } else { + material = Strings.replaceFirst(material, "+newMethod+", + ""); + } + skill.toTarget(outputPath, outputFile, material, filenameInput, + trashY, "java"); + } + + /** @param inputFileName obvious + * @param outputFileName obvious + * @param outputPath path of the output file + * @param candies external properties + * @param recycleBinY directory-trashcan, i.e. where to put the + * files to be deleted + * @param skill set of application descriptive data + * @throws ExactException a standard exception + * @throws IOException standard exception + * @throws FileNotFoundException standard exception */ + public static void addFile(final String inputFileName, + String outputFileName, final String outputPath, + CandyScrew candies, final String recycleBinY, Skill skill) + + throws ExactException, FileNotFoundException, IOException { + + String dir = candies.snippetsYS; + String extension = Mix.estraiExtension(inputFileName); + String tipo = "xml"; + if (extension != null && extension.equals("xml")) { + dir += "xml/"; + } else if (extension != null && extension.equals("css")) { + dir += "css/"; + } else if (inputFileName.endsWith("_jsp.txt")) { + dir += "jsp/"; + tipo = "jsp"; + } else if (inputFileName.endsWith(".properties")) { + dir += "properties/"; + } + if (extension != null && extension.equals("java")) { + tipo = extension; + } else if (extension != null && extension.equals( + "properties")) { + tipo = extension; + } else if (extension != null && extension.equals("jsp")) { + tipo = extension; + } + String material = Equipment.oneString(dir + inputFileName); + material = Strings.replaceFirst(material, "+Applicaz+", Mix + .uppercaseFirstChar(skill.applicationNameLower)); + if (skill.authenticationErrorMenu == null) { + material = Strings.replaceFirst(material, "+navigation+", + ""); + } else { + material = Strings.replaceFirst(material, "+navigation+", + ""); + } + material = material.replaceAll("\\x2bapplicaz\\x2b", + skill.applicationNameLower); + skill.toTarget(outputPath, outputFileName, material, + inputFileName, recycleBinY, tipo); + } + + /** identifies the type of the key; it doesn't have to be a + * primitive type */ + + protected String[] locateKey(TableOutfit ct) + + throws ExactException, FileNotFoundException, IOException { + + Flute flute = ct.flute; + int i = 0; + int j = 0; + String tipo = null; + String nome = null; + String[] b = new String[3]; + for (; i < flute.fpropertyE.size(); i++) { + JavaProperty p = flute.fpropertyE.get(i); + j = 0; + for (; j < p.fannotationE.size(); j++) { + JavaAnnotation a = p.fannotationE.get(j); + if (a.fnome.equals("EmbeddedId") | a.fnome.equals( + "Id")) { + if (p.fprimitivo != null) { + ExactException ce = new ExactException( + "In the «" + ct.entityName + ".java»" + + " the key «" + p.fnome + + "» is declared by the primitive type «" + + p.fprimitivo + + "», it is not allowed.", 1101, + this.getClass().getName(), ""); + throw ce; + } + tipo = p.fclasse; + nome = p.fnome; + break; + } + } + if (j < p.fannotationE.size()) { + break; + } + } + if (i == flute.fpropertyE.size()) { + // b [0] = ""; + // b [1] = ""; + // b [2] = ""; + // return b; + ExactException ce = new ExactException("In the file " + + ct.entityName + ".java" + + "there are no Id annotation or Embedded Id.", + 1102, this.getClass().getName(), ""); + throw ce; + } + /* the 3 elements are: 1) property annotation; 2) property + * class; 3) name of the property */ + b[0] = flute.fpropertyE.get(i).fannotationE.get(j).fnome; + b[1] = tipo; + b[2] = nome; + return b; + } + + /** + *

+ * Identifies the type of the key; must not be a primitive type + *

+ * + * @param ct table main elements + * @param nomeColonna column name + * @return whether the DB table column is present or not */ + + public static boolean checkColumn(TableOutfit ct, + String nomeColonna) { + + Flute flute = ct.flute; + int i = 0; + for (; i < flute.fpropertyE.size(); i++) { + JavaProperty p = flute.fpropertyE.get(i); + if (p.fnome.equalsIgnoreCase(nomeColonna)) { + break; + } + } + return i < flute.fpropertyE.size(); + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/GenericModel_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/GenericModel_java.java new file mode 100644 index 0000000..2af085e --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/GenericModel_java.java @@ -0,0 +1,68 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class GenericModel_java extends FileComponent { + + /** @param skill application base values + * @param snippetG path and snippet file name (fragment) + * @param candies external application properties */ + public GenericModel_java(Skill skill, String snippetG, + CandyScrew candies) { + super(); + this.skill = skill; + this.snippetG = snippetG; + this.candies = candies; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial += "package " + skill.pckg + ".web.model;" + + Candies.LF; + producedMaterial += "/* screwdriver_knife */" + Candies.LF; + producedMaterial += Candies.LF + "public class GenericModel {" + + Candies.LF + Candies.LF; + producedMaterial += "/* screwdriver_knife */" + Candies.LF; + producedMaterial += "}" + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + skill.javaWebModelY = skill.javaWebY + "/model"; + skill.buildDirectory(skill.javaWebModelY); + skill.javaWebModelUtilityY = skill.javaWebModelY + "/utility"; + skill.buildDirectory(skill.javaWebModelUtilityY); + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Hoof.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Hoof.java new file mode 100644 index 0000000..7baa735 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Hoof.java @@ -0,0 +1,163 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** + *

+ * This class is used for the following components: headerJsp, + * footerJsp, genericRailDaoImplJPAx, tiles_xml, service_xml, orm_xml, + * doorControllerBelong_java, genericCrud_java, controllerBelong_java, + * jspForm_java, jspPlain_ java, Xtajut user , quartzTask_java, + * quartzTaskImpl_java + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20
+ * Company: Rameceraâ„¢ + *

+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ */ +final public class Hoof extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Hoof(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String g = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(g) + Candies.LF; + + /* WE COOK EVERYTHING */ + if (skill.pckg != null) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bzoccolo\\x2b", skill.pckg); + } + if (skill.applicationNameLower != null) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+titolo+", skill.applicationNameLower); + } + if (skill.quartzVers != null) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bQuartzjob\\x2b", skill.clockHands.jobNameU); + producedMaterial = producedMaterial.replaceAll( + "\\x2bQuartztask\\x2b", skill.clockHands.taskNameU); + } + if (skill.hasUseridPassword) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+tabposition+", (skill.networkDomain + + ".screwdriver." + skill.tabUser[2] + "." + + skill.tabUser[3]).toLowerCase()); + if (skill.authenticationMode.equals("trivial")) { + producedMaterial = Strings.replaceFirst( + producedMaterial, "+beanposition+", skill.pckg + + ".domain"); + } else { + producedMaterial = Strings.replaceFirst( + producedMaterial, "+beanposition+", + (skill.networkDomain + ".screwdriver." + + skill.tabUser[2] + "." + + skill.tabUser[3]).toLowerCase()); + } + if (producedMaterial.indexOf("+tabella+") > -1) { + producedMaterial = producedMaterial.replaceAll( + "\\x2btabella\\x2b", skill.tabUser[0]); + } + if (producedMaterial.indexOf("+bean+") > -1) { + if (skill.authenticationMode.equals("trivial")) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bbean\\x2b", "King"); + } else { + producedMaterial = producedMaterial.replaceAll( + "\\x2bbean\\x2b", skill.tabUser[0]); + } + } + if (producedMaterial.indexOf("+userrail+") > -1) { + producedMaterial = producedMaterial.replaceAll( + "\\x2buserrail\\x2b", Cst.RAIL + + skill.tabUser[1]); + } + if (producedMaterial.indexOf("+Userrail+") > -1) { + producedMaterial = producedMaterial.replaceAll( + "\\x2bUserrail\\x2b", Cst.RAILU + + skill.tabUser[1]); + } + producedMaterial = Strings.replaceFirst(producedMaterial, + "+password+", Mix.uppercaseFirstChar( + skill.password)); + } + if (markupE.get("hdefrail").recurrenceE.size() > 0) { + Train f = markupE.get("hdefrail").recurrenceE.get( + skill.railK); + producedMaterial = producedMaterial.replaceAll( + "\\x2brail\\x2b", Cst.RAIL + f.locomotor.text); + producedMaterial = producedMaterial.replaceAll( + "\\x2bRail\\x2b", Cst.RAILU + f.locomotor.text); + } + + if (markupE.get("usignup").recurrenceE.size() > 0) { + String t = ""; + t += Candies.TABS + "@RequestMapping(\"/signup/form\")" + + Candies.LF; + t += Candies.TABS + "public String nuovoUtente() {" + + Candies.LF; + t += Candies.TABS + Candies.TABS + "return \"home/signup\";" + + Candies.LF; + t += Candies.TABS + "}" + Candies.LF; + producedMaterial = Strings.replaceFirst(producedMaterial, + "+signup+", t); + } else { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+signup+", ""); + } + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the descriptive data of the + * application + * @param file basket where the deleted files are moved + * @throws ExactException exception specified by a numerical code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ImplementTabellaService_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ImplementTabellaService_java.java new file mode 100644 index 0000000..782944b --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ImplementTabellaService_java.java @@ -0,0 +1,106 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** @author M. Maglioni */ +final public class ImplementTabellaService_java extends FileComponent { + + /** @param skill application base values + * @param snippetG path and snippet file name (fragment) + * @param candies external application properties */ + public ImplementTabellaService_java(Skill skill, String snippetG, + CandyScrew candies) { + super(); + this.skill = skill; + this.snippetG = snippetG; + this.candies = candies; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + TableOutfit ct = skill.tableDBE.get(skill.tK); + producedMaterial += "package " + skill.pckg + "." + + ct.railLowercase + ".service.impl;" + Candies.LF + + Candies.LF; + producedMaterial += "import " + skill.pckg + "." + + ct.railLowercase + ".dao.I" + ct.railUppercase + + ct.entityName + "Dao;" + Candies.LF; + producedMaterial += "import " + ct.pathDots + "." + + ct.entityName + ";" + Candies.LF; + producedMaterial += "import " + skill.pckg + "." + + ct.railLowercase + ".service.I" + ct.railUppercase + + ct.entityName + "Service;" + Candies.LF; + producedMaterial += "import org.springframework.stereotype.Service;" + + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + producedMaterial += "import org.springframework.beans.factory.annotation.Autowired;" + + Candies.LF; + producedMaterial += "import org.hibernate.criterion.Restrictions;" + + Candies.LF; + producedMaterial += "import org.hibernate.criterion.Projections;" + + Candies.LF; + producedMaterial += "import org.springframework.transaction.annotation.Transactional;" + + Candies.LF + Candies.LF; + producedMaterial += "@Service" + Candies.LF; + producedMaterial += "@Transactional" + Candies.LF; + producedMaterial += "public class " + ct.railUppercase + + ct.entityName + "Service" + Candies.LF; + producedMaterial += Candies.TABS + "implements I" + + ct.railUppercase + ct.entityName + "Service {" + + Candies.LF + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + "/** ordinary logger */" + + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static Logger logger = Logger.getLogger(" + + ct.railUppercase + ct.entityName + "Service" + + ".class.getName());" + Candies.LF + Candies.LF; + } + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}"; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ImplementTableDao_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ImplementTableDao_java.java new file mode 100644 index 0000000..c14eed7 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/ImplementTableDao_java.java @@ -0,0 +1,126 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** @author M. Maglioni */ +final public class ImplementTableDao_java extends FileComponent { + + /** @param skill application descriptive data set + * @param snippetG path and snippet file name (fragment) + * @param candies external properties of the application */ + public ImplementTableDao_java(Skill skill, String snippetG, + CandyScrew candies) { + super(); + this.skill = skill; + this.snippetG = snippetG; + this.candies = candies; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String[] tipo = locateKey(skill.tableDBE.get(skill.tK)); + TableOutfit ct = skill.tableDBE.get(skill.tK); + producedMaterial += "package " + skill.pckg + "." + + ct.railLowercase + ".dao.impl;" + Candies.LF + + Candies.LF; + producedMaterial += "import org.hibernate.Criteria;" + + Candies.LF; + producedMaterial += "import org.hibernate.criterion.Projections;" + + Candies.LF; + producedMaterial += "import org.springframework.dao.DataAccessException;" + + Candies.LF; + producedMaterial += "import org.springframework.stereotype.Repository;" + + Candies.LF + Candies.LF; + producedMaterial += "import " + skill.pckg + "." + + ct.railLowercase + ".dao.I" + ct.railUppercase + + ct.entityName + "Dao;" + Candies.LF; + producedMaterial += "import " + ct.pathDots + "." + + ct.entityName + ";" + Candies.LF; + if (tipo[0].equals("EmbeddedId")) { + producedMaterial += "import " + ct.pathDots + "." + tipo[1] + + ";" + Candies.LF; + } + producedMaterial += "import " + skill.pckg + "." + + ct.railLowercase + ".Generic" + ct.railUppercase + + "DaoImpl;" + Candies.LF + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + producedMaterial += "@Repository" + Candies.LF; + if (skill.jpaVersion == 1) { + producedMaterial += "public class " + ct.railUppercase + + ct.entityName + "Dao extends" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "Generic" + + ct.railUppercase + "DaoImpl<" + ct.entityName + + ", " + tipo[1] + ">" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "implements I" + + ct.railUppercase + ct.entityName + "Dao {" + + Candies.LF + Candies.LF; + } else { + producedMaterial += "public class " + ct.railUppercase + + ct.entityName + "Dao extends" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "Generic" + + ct.railUppercase + "DaoImpl" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + "implements I" + + ct.railUppercase + ct.entityName + "Dao {" + + Candies.LF + Candies.LF; + } + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + "/** ordinary logger */" + + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static Logger logger = Logger.getLogger(" + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + ct.railUppercase + ct.entityName + + "Dao" + ".class);" + Candies.LF + Candies.LF; + } + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}"; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the descriptive data of the + * application + * @param file basket where the deleted files are moved + * @throws ExactException exception specified by a numerical code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/InterfaceTabellaService_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/InterfaceTabellaService_java.java new file mode 100644 index 0000000..c5bcfc9 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/InterfaceTabellaService_java.java @@ -0,0 +1,71 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** @author M. Maglioni */ +final public class InterfaceTabellaService_java extends FileComponent { + + /** @param skill application base values + * @param snippetG path and snippet file name (fragment) + * @param candies external application properties */ + public InterfaceTabellaService_java(Skill skill, String snippetG, + CandyScrew candies) { + super(); + this.skill = skill; + this.snippetG = snippetG; + this.candies = candies; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + TableOutfit ct = skill.tableDBE.get(skill.tK); + producedMaterial += "package " + skill.pckg + "." + + ct.railLowercase + ".service;" + Candies.LF + + Candies.LF; + producedMaterial += "import " + ct.pathDots + "." + + ct.entityName + ";" + Candies.LF + Candies.LF; + producedMaterial += "public interface I" + ct.railUppercase + + ct.entityName + "Service {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}"; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/InterfaceTableDao_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/InterfaceTableDao_java.java new file mode 100644 index 0000000..04a9620 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/InterfaceTableDao_java.java @@ -0,0 +1,92 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** @author M. Maglioni */ +final public class InterfaceTableDao_java extends FileComponent { + + /** @param skill application main elements + * @param snippetG file containing the snippet + * @param candies elements */ + public InterfaceTableDao_java(Skill skill, String snippetG, + CandyScrew candies) { + super(); + this.skill = skill; + this.snippetG = snippetG; + this.candies = candies; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String[] tipo = locateKey(skill.tableDBE.get(skill.tK)); + TableOutfit ct = skill.tableDBE.get(skill.tK); + producedMaterial += "package " + skill.pckg + "." + + skill.tableDBE.get(skill.tK).railLowercase + ".dao;" + + Candies.LF + Candies.LF; + producedMaterial += "import " + ct.pathDots + "." + + ct.entityName + ";" + Candies.LF; + if (tipo[0].equals("EmbeddedId")) { + producedMaterial += "import " + ct.pathDots + "." + tipo[1] + + ";" + Candies.LF; + } + producedMaterial += "import org.springframework.dao.DataAccessException;" + + Candies.LF + Candies.LF; + if (skill.jpaVersion == 1) { + producedMaterial += "import " + skill.pckg + + ".generic.GenericCrud;" + Candies.LF + Candies.LF; + producedMaterial += "public interface I" + ct.railUppercase + + ct.entityName + "Dao" + Candies.LF + Candies.LF + + Candies.TABS + "extends GenericCrud<" + + ct.entityName + ", " + tipo[1] + "> {" + + Candies.LF + Candies.LF; + } else { + producedMaterial += "import " + skill.pckg + + ".jpa.dao.GenericDao;" + Candies.LF + Candies.LF; + producedMaterial += "public interface I" + ct.railUppercase + + ct.entityName + "Dao" + Candies.LF + Candies.LF + + Candies.TABS + "extends GenericDao {" + + Candies.LF + Candies.LF; + } + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}"; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspFormImpl_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspFormImpl_java.java new file mode 100644 index 0000000..295ea2a --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspFormImpl_java.java @@ -0,0 +1,141 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20
+ * Company: Rameceraâ„¢ + *

+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ */ +final public class JspFormImpl_java extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public JspFormImpl_java(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = ""; + producedMaterial += "package " + skill.pckg + ".web.model." + + jspKit.path + ";" + Candies.LF + Candies.LF; + for (int i = 0; i < jspKit.methodE.size(); i++) { + String nomeMetodo = jspKit.methodE.get(i).text; + for (int j = 0; j < skill.methodE.get(nomeMetodo).tableE + .size(); j++) { + TableOutfit t = skill.methodE.get(nomeMetodo).tableE + .get(j); + producedMaterial += "import " + skill.pckg + "." + + t.railLowercase + ".dao.I" + Mix + .uppercaseFirstChar(t.railLowercase) + + t.entityName + "Dao;" + Candies.LF; + producedMaterial += "import " + skill.pckg + "." + + t.railLowercase + ".dao.impl." + Mix + .uppercaseFirstChar(t.railLowercase) + + t.entityName + "Dao;" + Candies.LF; + } + } + producedMaterial += "import org.springframework.stereotype.Component;" + + Candies.LF; + producedMaterial += Candies.LF + + "import javax.servlet.http.HttpServletRequest;" + + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.LF + + "import org.apache.log4j.Logger;" + Candies.LF + + Candies.LF; + } + producedMaterial += "@Component" + Candies.LF; + producedMaterial += "public class " + jspKit.nomeFileU + + Cst.FORMU + "Impl extends " + jspKit.nomeFileU + + Cst.FORMU + " {" + Candies.LF + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + "/** ordinary logger */" + + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static final Logger logger = Logger.getLogger(" + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + jspKit.nomeFileU + Cst.FORMU + + "Impl.class);" + Candies.LF + Candies.LF; + } + for (int i = 0; i < jspKit.methodE.size(); i++) { + String nomeMetodo = jspKit.methodE.get(i).text; + producedMaterial += Candies.TABS + "@Override" + Candies.LF; + producedMaterial += Candies.TABS + "public void " + + nomeMetodo + "("; + producedMaterial += "HttpServletRequest request"; + if (!skill.methodE.get(nomeMetodo).upperArguments.trim() + .isEmpty()) { + producedMaterial += ", "; + } + producedMaterial += skill.methodE.get( + nomeMetodo).upperArguments; + for (int cJ = 0; cJ < skill.methodE.get(nomeMetodo).classE + .size(); cJ++) { + producedMaterial += ", "; + producedMaterial += skill.methodE.get( + nomeMetodo).classE.get(cJ) + " other" + cJ; + + } + producedMaterial += ") {" + Candies.LF + Candies.LF; + if (skill.methodE.get(nomeMetodo).source != null) { + producedMaterial += skill.methodE.get( + nomeMetodo).source + Candies.LF; + } + producedMaterial += Candies.TAB + "}" + Candies.LF + + Candies.LF; + } + producedMaterial += "}" + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspForm_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspForm_java.java new file mode 100644 index 0000000..06ee5da --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspForm_java.java @@ -0,0 +1,436 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.Wagon; +import it.ramecera.screwdriver.outfits.JspBeanElement; +import it.ramecera.screwdriver.utilities.ValidConstScrew; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20
+ * Company: Rameceraâ„¢ + *

+ * + * @author Massimo Maglioni + *

+ * Description: + *

+ */ +final public class JspForm_java extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public JspForm_java(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = ""; + producedMaterial += "package " + skill.pckg + ".web.model." + + jspKit.path + ";" + Candies.LF + Candies.LF; + producedMaterial += "import java.text.DecimalFormat;" + + Candies.LF; + producedMaterial += "import javax.servlet.http.HttpServletRequest;" + + Candies.LF; + if (jspKit.arrayStringPropertyE.size() > 0) { + producedMaterial += "import java.util.List;" + Candies.LF; + producedMaterial += "import java.util.ArrayList;" + + Candies.LF; + } + producedMaterial += "import " + skill.pckg + + ".web.model.GenericModel;" + Candies.LF; + if (jspKit.controlE.size() > 0) { + producedMaterial += "import java.util.ArrayList;" + + Candies.LF; + producedMaterial += "import java.util.List;" + Candies.LF; + } + for (Train t : markupE.get("hdefrail").recurrenceE) { + producedMaterial += "import " + skill.networkDomain + + ".screwdriver." + t.wagonE.get("hjndi").text + .toLowerCase() + "." + t.wagonE.get( + "hdbschema").text + ".*;" + + Candies.LF; + } + if (jspKit.methodE.size() > 0) { + producedMaterial += "import org.springframework.dao." + + "DataAccessException;" + Candies.LF; + } + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + if (jspKit.methodE.size() > 0) { + for (Train t : markupE.get("hdefrail").recurrenceE) { + producedMaterial += "import " + skill.networkDomain + + "." + skill.applicationNameLower + "." + + Cst.RAIL + t.locomotor.text + ".dao.*;" + + Candies.LF; + } + } + if (jspKit.methodE.size() > 0) { + producedMaterial += "abstract "; + } + producedMaterial += "public class " + jspKit.nomeFileU + + Cst.FORMU + " extends GenericModel {" + Candies.LF + + Candies.LF; + + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + "/** ordinary logger */" + + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static final Logger logger = Logger.getLogger(" + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + jspKit.nomeFileU + Cst.FORMU + + ".class);" + Candies.LF + Candies.LF; + } + for (JspBeanElement jbe : jspKit.integerPropertyE) { + producedMaterial += Candies.TABS + "/** bean property */" + + Candies.LF; + producedMaterial += Candies.TABS + "private " + + jbe.datumType + " " + jbe.name + ";" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + for (JspBeanElement jbe : jspKit.longPropertyE) { + producedMaterial += Candies.TABS + "/** bean property */" + + Candies.LF; + producedMaterial += Candies.TABS + "private " + + jbe.datumType + " " + jbe.name + ";" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final " + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + for (JspBeanElement jbe : jspKit.booleanPropertyE) { + producedMaterial += Candies.TABS + "/** bean property */" + + Candies.LF; + producedMaterial += Candies.TABS + "private " + + jbe.datumType + " " + jbe.name + ";" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " is" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + for (JspBeanElement jbe : jspKit.stringPropertyE) { + producedMaterial += Candies.TABS + "/** bean property */" + + Candies.LF; + producedMaterial += Candies.TABS + "private " + + jbe.datumType + " " + jbe.name + ";" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + for (JspBeanElement jbe : jspKit.arrayStringPropertyE) { + producedMaterial += Candies.TABS + "/** bean property */" + + Candies.LF; + producedMaterial += Candies.TABS + "private " + + jbe.datumType + " " + jbe.name + ";" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.TEXT_BOX)) { + continue; + } + producedMaterial += Candies.LF; + for (ValidConstScrew vc : jbe.validConstE) { + producedMaterial += Candies.TABS + vc.valcons.text + + "("; + if (vc.valparams != null) { + producedMaterial += vc.valparams.text + ", "; + } + producedMaterial += "message = \"{" + vc.valtag.text + + "}\")" + Candies.LF; + } + stringProperty(jbe.name, jbe.nameU); + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.TEXT_AREA)) { + continue; + } + producedMaterial += Candies.LF; + for (ValidConstScrew vc : jbe.validConstE) { + producedMaterial += Candies.TABS + vc.valcons.text + + "("; + if (vc.valparams != null) { + producedMaterial += vc.valparams.text + ", "; + } + producedMaterial += "message = \"{" + vc.valtag.text + + "}\")" + Candies.LF; + } + stringProperty(jbe.name, jbe.nameU); + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.LIST_BOX)) { + continue; + } + producedMaterial += Candies.LF; + if (jbe.ftokens != null) { + producedMaterial += Candies.TABS + + "private List arr_" + jbe.name + ";" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + + "public List getArr_" + jbe.name + + "() {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return arr_" + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += Candies.TABS + "public void setArr_" + + jbe.name + "(List arr_" + jbe.name + + ") {" + Candies.LF; + } else if (jbe.hsqln.valutazioneColonne == 1) { + producedMaterial += Candies.TABS + + "private List arr_" + jbe.name + ";" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + + "public List getArr_" + jbe.name + + "() {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return arr_" + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += Candies.TABS + "public void setArr_" + + jbe.name + "(List arr_" + jbe.name + + ") {" + Candies.LF; + } else { + producedMaterial += Candies.TABS + + "private List arr_" + jbe.name + ";" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + + "public List getArr_" + jbe.name + + "() {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return arr_" + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += Candies.TABS + "public void setArr_" + + jbe.name + "(List arr_" + jbe.name + + ") {" + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "this.arr_" + jbe.name + " = arr_" + jbe.name + + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + stringProperty("selected", "Selected"); + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.CHECK_BOX)) { + continue; + } + producedMaterial += Candies.LF; + for (ValidConstScrew vc : jbe.validConstE) { + producedMaterial += Candies.TABS + vc.valcons.text + + "("; + if (vc.valparams != null) { + producedMaterial += vc.valparams.text + ", "; + } + producedMaterial += "message = \"{" + vc.valtag.text + + "}\")" + Candies.LF; + } + producedMaterial += Candies.TABS + "private boolean " + + jbe.name + ";" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "public boolean is" + + jbe.nameU + "() {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "return " + + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(boolean " + jbe.name + ") {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = " + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + for (int j = 0; j < jspKit.controlE.size(); j++) { + JspBeanElement jbe = jspKit.controlE.get(j); + if (!jbe.controlType.equals(Cst.RADIO_BUTTON)) { + continue; + } + producedMaterial += Candies.LF; + producedMaterial += Candies.TABS + "private Integer " + + jbe.name + ";" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "public Integer get" + + jbe.nameU + "() {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "return " + + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(Integer " + jbe.name + ") {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = " + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + /* abstract method declaration */ + for (Wagon d : jspKit.methodE) { + producedMaterial += Candies.LF + "/** additional method */" + + Candies.LF; + producedMaterial += Candies.TABS + "abstract public void " + + d.text + "("; + producedMaterial += "HttpServletRequest request"; + if (!skill.methodE.get(d.text).upperArguments.trim() + .isEmpty()) { + producedMaterial += ", "; + } + producedMaterial += skill.methodE.get( + d.text).upperArguments; + for (int cJ = 0; cJ < skill.methodE.get(d.text).classE + .size(); cJ++) { + producedMaterial += ", "; + producedMaterial += skill.methodE.get(d.text).classE + .get(cJ) + " other" + cJ; + + } + producedMaterial += ");" + Candies.LF; + } + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}" + Candies.LF; + } + + private void stringProperty(final String name, final String nameU) { + producedMaterial += Candies.TABS + "private String " + name + + ";" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "public String get" + nameU + + "() {" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "return " + + name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + nameU + + "(String " + name + ") {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + name + + " = " + name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + skill.javaWebModelY = skill.javaWebY + "/model"; + skill.buildDirectory(skill.javaWebModelY); + skill.javaWebModelBodyY = skill.javaWebModelY + "/" + + jspKit.path; + skill.buildDirectory(skill.javaWebModelBodyY); + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspPlainImpl_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspPlainImpl_java.java new file mode 100644 index 0000000..b7e186a --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspPlainImpl_java.java @@ -0,0 +1,129 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.TableOutfit; + +/** @author M. Maglioni */ +final public class JspPlainImpl_java extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public JspPlainImpl_java(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candies) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = ""; + producedMaterial += "package " + skill.pckg + ".web.model." + + jspKit.path + ";" + Candies.LF + Candies.LF; + for (int i = 0; i < jspKit.methodE.size(); i++) { + String nomeMetodo = jspKit.methodE.get(i).text; + for (int j = 0; j < skill.methodE.get(nomeMetodo).tableE + .size(); j++) { + TableOutfit t = skill.methodE.get(nomeMetodo).tableE + .get(j); + producedMaterial += "import " + skill.pckg + "." + + t.railLowercase + ".dao.I" + Mix + .uppercaseFirstChar(t.railLowercase) + + t.entityName + "Dao;" + Candies.LF; + producedMaterial += "import " + skill.pckg + "." + + t.railLowercase + ".dao.impl." + Mix + .uppercaseFirstChar(t.railLowercase) + + t.entityName + "Dao;" + Candies.LF; + } + } + producedMaterial += "import org.springframework.stereotype.Component;" + + Candies.LF; + producedMaterial += Candies.LF + + "import javax.servlet.http.HttpServletRequest;" + + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.LF + + "import org.apache.log4j.Logger;" + Candies.LF + + Candies.LF; + } + producedMaterial += "@Component" + Candies.LF; + producedMaterial += "public class " + jspKit.nomeFileU + + Cst.PLAINU + "Impl extends " + jspKit.nomeFileU + + Cst.PLAINU + " {" + Candies.LF + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.LF + Candies.TABS + + "/** ordinary logger */" + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static final Logger logger = Logger.getLogger(" + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + jspKit.nomeFileU + Cst.PLAINU + + "Impl.class);" + Candies.LF + Candies.LF; + } + for (int i = 0; i < jspKit.methodE.size(); i++) { + String nomeMetodo = jspKit.methodE.get(i).text; + producedMaterial += Candies.TABS + "@Override" + Candies.LF; + producedMaterial += Candies.TABS + "public void " + + nomeMetodo + "("; + producedMaterial += "HttpServletRequest request"; + if (!skill.methodE.get(nomeMetodo).upperArguments.trim() + .isEmpty()) { + producedMaterial += ", "; + } + producedMaterial += skill.methodE.get( + nomeMetodo).upperArguments; + for (int cJ = 0; cJ < skill.methodE.get(nomeMetodo).classE + .size(); cJ++) { + producedMaterial += ", "; + producedMaterial += skill.methodE.get(nomeMetodo).classE + .get(cJ) + " other" + cJ; + } + producedMaterial += ") {" + Candies.LF + Candies.LF; + if (skill.methodE.get(nomeMetodo).source != null) { + producedMaterial += skill.methodE.get(nomeMetodo).source + + Candies.LF; + } + producedMaterial += Candies.TAB + "}" + Candies.LF + + Candies.LF; + } + producedMaterial += "}" + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspPlain_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspPlain_java.java new file mode 100644 index 0000000..af24476 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/JspPlain_java.java @@ -0,0 +1,353 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.Wagon; +import it.ramecera.screwdriver.outfits.JspBeanElement; + +/** @author M. Maglioni */ +final public class JspPlain_java extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public JspPlain_java(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candies) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = ""; + producedMaterial += "package " + skill.pckg + ".web.model." + + jspKit.path + ";" + Candies.LF + Candies.LF; + producedMaterial += "import java.text.DecimalFormat;" + + Candies.LF; + producedMaterial += "import javax.servlet.http.HttpServletRequest;" + + Candies.LF; + producedMaterial += "import " + skill.pckg + + ".web.model.GenericModel;" + Candies.LF; + if (jspKit.arrayStringPropertyE.size() > 0) { + producedMaterial += "import java.util.ArrayList;" + + Candies.LF; + } + for (Train t : markupE.get("hdefrail").recurrenceE) { + producedMaterial += "import " + skill.networkDomain + + ".screwdriver." + t.wagonE.get("hjndi").text + .toLowerCase() + "." + t.wagonE.get( + "hdbschema").text + ".*;" + + Candies.LF; + } + if (jspKit.methodE.size() > 0) { + producedMaterial += "import org.springframework.dao." + + "DataAccessException;" + Candies.LF; + } + if (jspKit.methodE.size() > 0) { + for (Train t : markupE.get("hdefrail").recurrenceE) { + producedMaterial += "import " + skill.networkDomain + + "." + skill.applicationNameLower + "." + + Cst.RAIL + t.locomotor.text + ".dao.*;" + + Candies.LF; + } + } + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + if (jspKit.methodE.size() > 0) { + producedMaterial += "abstract "; + } + producedMaterial += "public class " + jspKit.nomeFileU + + Cst.PLAINU + " extends GenericModel {" + Candies.LF + + Candies.LF; + if (jspKit.stringPropertyE.size() > 0) { + for (JspBeanElement x : jspKit.stringPropertyE) { + producedMaterial += Candies.TABS + + "/** proprietà del bean */" + Candies.LF; + producedMaterial += Candies.TABS + "private " + + x.datumType + " " + x.name + ";" + Candies.LF; + } + } + if (jspKit.arrayStringPropertyE.size() > 0) { + for (JspBeanElement x : jspKit.arrayStringPropertyE) { + producedMaterial += Candies.TABS + + "/** proprietà del bean */" + Candies.LF; + producedMaterial += Candies.TABS + "private " + + x.datumType + " " + x.name + ";" + Candies.LF; + } + } + if (jspKit.integerPropertyE.size() > 0) { + for (JspBeanElement x : jspKit.integerPropertyE) { + producedMaterial += Candies.TABS + + "/** proprietà del bean */" + Candies.LF; + producedMaterial += Candies.TABS + "private " + + x.datumType + " " + x.name + ";" + Candies.LF; + } + } + if (jspKit.longPropertyE.size() > 0) { + for (JspBeanElement x : jspKit.longPropertyE) { + producedMaterial += Candies.TABS + + "/** proprietà del bean */" + Candies.LF; + producedMaterial += Candies.TABS + "private " + + x.datumType + " " + x.name + ";" + Candies.LF; + } + } + if (jspKit.booleanPropertyE.size() > 0) { + for (JspBeanElement x : jspKit.booleanPropertyE) { + producedMaterial += Candies.TABS + + "/** proprietà del bean */" + Candies.LF; + producedMaterial += Candies.TABS + "private " + + x.datumType + " " + x.name + ";" + Candies.LF; + } + } + if (skill.log4jVers != null) { + + producedMaterial += Candies.LF + Candies.TABS + + "/** ordinary logger */" + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static final Logger logger = Logger.getLogger(" + + Candies.LF + Candies.TABS + Candies.TABS + + Candies.TABS + Mix.uppercaseFirstChar( + jspKit.fileName) + Cst.PLAINU + ".class);" + + Candies.LF + Candies.LF; + } + for (JspBeanElement jbe : jspKit.stringPropertyE) { + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument Integer */" + + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final Integer i) {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = " + jbe.datumType + ".valueOf(i);" + + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** set formattato, argomento Integer */" + + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final Integer i, final String f) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = new DecimalFormat(f).format(i);" + + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument Short */" + + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final Short i) {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = " + jbe.datumType + ".valueOf(i);" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** set formattato, argomento Short */" + + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final Short i, final String f) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = new DecimalFormat(f).format(i);" + + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** set formattato, argomento Long */" + + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final Long i, final String f) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = new DecimalFormat(f).format(i);" + + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + } + for (JspBeanElement jbe : jspKit.integerPropertyE) { + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + } + for (JspBeanElement jbe : jspKit.longPropertyE) { + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(final " + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + } + for (JspBeanElement jbe : jspKit.booleanPropertyE) { + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " is" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + } + for (JspBeanElement jbe : jspKit.arrayStringPropertyE) { + producedMaterial += Candies.TABS + + "/** standard get method */" + Candies.LF; + producedMaterial += Candies.TABS + "public " + jbe.datumType + + " get" + jbe.nameU + "() {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return this." + jbe.name + ";" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + + "/** standard set method, argument " + + jbe.datumType + " */" + Candies.LF; + producedMaterial += Candies.TABS + "public void set" + + jbe.nameU + "(" + jbe.datumType + " s) {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "this." + + jbe.name + " = s;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + } + /* abstract method declaration */ + for (Wagon d : jspKit.methodE) { + producedMaterial += Candies.LF + "/** additional method */" + + Candies.LF; + producedMaterial += Candies.TABS + "abstract public void " + + d.text + "("; + producedMaterial += "HttpServletRequest request"; + if (!skill.methodE.get(d.text).upperArguments.trim() + .isEmpty()) { + producedMaterial += ", "; + } + producedMaterial += skill.methodE.get( + d.text).upperArguments; + for (int cJ = 0; cJ < skill.methodE.get(d.text).classE + .size(); cJ++) { + producedMaterial += ", "; + producedMaterial += skill.methodE.get(d.text).classE + .get(cJ) + " other" + cJ; + } + producedMaterial += ");" + Candies.LF; + } + producedMaterial += Candies.TABS + "/* " + Cst.KNIFE + " */" + + Candies.LF; + producedMaterial += "}" + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + skill.javaWebModelY = skill.javaWebY + "/model"; + skill.buildDirectory(skill.javaWebModelY); + skill.javaWebModelBodyY = skill.javaWebModelY + "/" + + jspKit.path; + skill.buildDirectory(skill.javaWebModelBodyY); + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Navigation_jsp.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Navigation_jsp.java new file mode 100644 index 0000000..f672779 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Navigation_jsp.java @@ -0,0 +1,214 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class Navigation_jsp extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public Navigation_jsp(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = ""; + producedMaterial += "<%@ page language=\"java\" " + + "pageEncoding=\"UTF-8\" contentType=\"text/html; " + + "charset=UTF-8\" %>" + Candies.LF; + if (skill.springSecurity) { + producedMaterial += "<%@ taglib uri=\"http://www.springframework.org" + + "/security/tags\" prefix=\"sec\"%>" + Candies.LF; + } + producedMaterial += "<%@ taglib prefix=\"c\" uri=\"http://java.sun." + + "com/jsp/jstl/core\" %>" + Candies.LF; + producedMaterial += Candies.TABS + + "
" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "
" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + + /* in the couples array, at least the first couple is needed, + * that is the brand or home */ + if (menuKit.clicE.size() == 0) { + ExactException ee = new ExactException( + "The individual elements of the menu description" + + " are not defined (blabel and burl markups in pair)."); + ee.code = 1100; + ee.datum = ee.getMessage(); + ee.className = this.getClass().getName(); + throw ee; + } + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + menuKit.clicE.get(0)[0] + "" + Candies.LF; + + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "
" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "
    " + + Candies.LF; + + /* ordinary couples */ + for (int i = 1; i < menuKit.clicE.size(); i++) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "
  • " + menuKit.clicE + .get(i)[0] + "
  • " + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "
" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "
" + Candies.LF; + if (skill.hasUseridPassword) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "
" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
    " + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + Candies.LF; + if (skill.authenticationMode.equals("trivial")) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
  • Welcome \"\"
  • " + + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
  • Welcome " + + "
  • " + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
  • Logout
  • " + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "
    " + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + Candies.LF; + if (skill.signup) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
  • Signup
  • " + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
  • Login
  • " + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "
    " + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "
    " + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "
" + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "
" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "
" + + Candies.LF; + producedMaterial += Candies.TABS + "
" + Candies.LF; + producedMaterial += Candies.TABS + + "
 
" + Candies.LF; + + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Orm_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Orm_xml.java new file mode 100644 index 0000000..5895cdb --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Orm_xml.java @@ -0,0 +1,315 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** last update date: 2020-04-09 + * + * @author M. Maglioni */ +final public class Orm_xml extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public Orm_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + skill.springPropertiesG = skill.candies.snippetsYS + snippetG; + Train f = markupE.get("hdefrail").recurrenceE.get(skill.railK); + producedMaterial = Equipment.oneString(skill.springPropertiesG) + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + if (skill.applicationServer.toLowerCase().startsWith( + "jboss eap 6.4")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + String g = Mix.dress_C(skill.mainResources) + + "config.properties"; + String configPropertiesS = Equipment.oneString(g); + if (configPropertiesS.indexOf(skill.jndi.toLowerCase()) == -1) { + configPropertiesS = configPropertiesS.replaceAll("#", "# "); + configPropertiesS = Mix.compactingSpaces_A( + configPropertiesS); + if (configPropertiesS.indexOf(Cst.KNIFE) > -1) { + configPropertiesS.replaceFirst(Cst.KNIFE, Cst.UPPER + + Candies.LF + "# " + Cst.LOWER); + } + if (configPropertiesS.indexOf("# " + Cst.LOWER) > -1 + & skill.dbms.equals("Postgres")) { + configPropertiesS = Strings.replaceFirst( + configPropertiesS, "# " + Cst.LOWER, skill.jndi + .toLowerCase() + + ".jndiname=jboss/datasources/" + + skill.jndi + Candies.LF + "# " + + Cst.LOWER); + } else if (configPropertiesS.indexOf("# " + + Cst.LOWER) > -1) { + configPropertiesS = Strings.replaceFirst( + configPropertiesS, "# " + Cst.LOWER, skill.jndi + .toLowerCase() + ".jndiname=" + + skill.jndi + Candies.LF + "# " + + Cst.LOWER); + } + Equipment.scriviFileDaStringa(new File(g), + configPropertiesS); + } + producedMaterial += Candies.TABS + "" + Candies.LF; + if (skill.jpaVersion == 1) { + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "hibernate.default_schema=" + + skill.dbSchema + Candies.LF; + if (f.wagonE.get("hdbms").text.equalsIgnoreCase( + "postgres")) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "hibernate.dialect=org.hibernate.dialect." + + "PostgreSQLDialect" + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "hibernate.dialect=org.hibernate.dialect." + + f.wagonE.get("hdbms").text + "Dialect" + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "hibernate.cache.use_second_level_cache=false" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "hibernate.cache.use_query_cache=false" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "hibernate.cache.provider_class=org.hibernate.cache.NoCacheProvider" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "hibernate.show_sql=false" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "hibernate.format_sql=false" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "hibernate.query.substitutions true=1, false=0" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + + producedMaterial += Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "true" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + + producedMaterial += Candies.TABS + "" + Candies.LF; + if (skill.springVersion1m < 4) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + } + producedMaterial += Candies.TABS + "" + Candies.LF; + } else { + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + skill.dbSchema + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + "false" + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + "false" + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + "false" + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + "false" + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + "org.hibernate.cache.NoCacheProvider" + "" + + Candies.LF; + if (f.wagonE.get("hdbms").text.equalsIgnoreCase( + "postgres")) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "org.hibernate.dialect." + + "PostgreSQLDialect" + "" + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "org.hibernate.dialect." + + f.wagonE.get("hdbms").text + "Dialect" + + "" + Candies.LF; + + } + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + + producedMaterial += Candies.TABS + "" + Candies.LF; + } + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += ""; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Pom_properties.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Pom_properties.java new file mode 100644 index 0000000..1c376df --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Pom_properties.java @@ -0,0 +1,71 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** + *

+ * Class for producing the web.xml file. + *

+ * + * @author M. Maglioni + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ */ +final public class Pom_properties extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Pom_properties(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** sysnthesis */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = ""; + if (skill.mavenCompiler) { + producedMaterial += "pom.java.version="; + producedMaterial += skill.mavenCompilerVersion + Candies.LF; + } + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Pom_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Pom_xml.java new file mode 100644 index 0000000..f80e8ee --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Pom_xml.java @@ -0,0 +1,413 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** + *

+ * Class for the production of the pom.xml file. + *

+ * + * @author M. Maglioni + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ */ +final public class Pom_xml extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public Pom_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @param markupE the list of markups + * @param trainE the list of trains + * @param candyScrew the list of properties + * @throws IOException standard exception + * @throws FileNotFoundException standard exception + * @throws ExactException standard exception */ + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + producedMaterial = "" + + Candies.LF; + producedMaterial += ""; + producedMaterial = producedMaterial.replaceAll(Candies.SEGNO_A, + skill.mavenModel) + Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.mavenModel + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.mavenGroupId + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.applicationNameLower + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.mavenVersion + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.mavenPackage + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.applicationNameLower + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + if (skill.spring) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + skill.springVersion + + "" + Candies.LF; + } + if (skill.springSecurity) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + skill.springSecurityVersion + + "" + + Candies.LF; + } + if (skill.tiles) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + skill.tilesVersion + + "" + Candies.LF; + } + // if (skill.mavenCompiler) { + // materialProduct + = Candies.TABS + Candies.TABS + // + "" + // + skill.mavenCompilerVersion + // + "" + Candies.LF; + // materialProduct + = Candies.TABS + Candies.TABS + // + "" + // + skill.mavenCompilerVersion + // + "" + Candies.LF; + // } + producedMaterial += Candies.TABS + Candies.TABS + + "" + + skill.charsetSenzaTrattino + + "" + Candies.LF; + if (skill.pomProperties) { + skill.pomPropertiesG = skill.candies.snippetsYS + "pompr" + + "_" + markupE.get("pompr").recurrenceE.get( + 0).locomotor.substance + ".txt"; + producedMaterial += Equipment.oneString( + skill.pomPropertiesG) + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + + skill.applicationNameLower + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + if (skill.mavenBuild) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "pom_build.txt") + + Candies.LF; + } + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + if (skill.spring) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "depen_spring_" + + skill.springVersion + ".txt") + + Candies.LF; + } + if (skill.springSecurity) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "depen_secu_" + + skill.springSecurityReductVersion + + ".txt") + Candies.LF; + } + if (skill.tiles) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "depen_tiles.txt") + + Candies.LF; + } + if (skill.antiSamy) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "antisamyDepen.txt") + + Candies.LF; + } + if (skill.ldap) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "depen_apache_ldap.txt") + + Candies.LF; + } + if (skill.captcha) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "depen_captcha_" + + skill.captchaVersion + ".txt") + + Candies.LF; + } + if (skill.webFlow) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "depen_webflow_" + + skill.webflowVersion + ".txt") + + Candies.LF; + } + if (skill.jpaVersion == 2) { + if (skill.jeeVersion == null) { + skill.jeeVersion = "6.0"; + } + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "javax" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "javaee-api" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.jeeVersion + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "provided" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "javax.persistence" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "persistence-api" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + "1.0.2" + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "antlr" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "antlr" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + "2.7.7" + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + } + if (skill.dbSchema != null + & skill.versioneArtifactJPA != null) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.networkDomain + ".ict" + + Candies.LF;// v1.11.1 d2020-04-09 + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.jndi.toLowerCase() + "-" + skill.dbSchema + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.versioneArtifactJPA + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + } + if (skill.log4jVers != null && skill.log4jVers.startsWith( + "1")) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "log4j" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "log4j" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.log4jVers + "" + Candies.LF; + if (!skill.applicationServer.startsWith("Tomcat")) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "provided" + Candies.LF; + } + /* log4j is not necessarily contained in the app server */ + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + } else if (skill.log4jVers != null && skill.log4jVers + .startsWith("2")) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "org.apache.logging.log4j" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "log4j-api" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.log4jVers + "" + Candies.LF; + /* log4j is not necessarily contained in the app server */ + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "org.apache.logging.log4j" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "log4j-core" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.log4jVers + "" + Candies.LF; + /* log4j is not necessarily contained in the app server */ + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + } + if (skill.quartzVers != null) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "org.quartz-scheduler" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "quartz" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + skill.quartzVers + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + "org.slf4j" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + Candies.TABS + + "slf4j-api" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF + + Candies.LF; + } + if (skill.dependencies) { + producedMaterial += Equipment.oneString(skill.dependenciesG) + + Candies.LF; + } + if (skill.hibernate) { + producedMaterial += Equipment.oneString(skill.depenHiberG) + + Candies.LF; + } + if (skill.jackson) { + producedMaterial += Equipment.oneString(skill.depenJacksonG) + + Candies.LF; + } + if (skill.hiberValid) { + producedMaterial += Equipment.oneString(skill.depenHValidG) + + Candies.LF; + } + if (skill.springValid) { + producedMaterial += Equipment.oneString( + skill.depenValidatorG) + Candies.LF; + } + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += ""; + + /* WE COOK EVERYTHING */ + /* x2b is the + sign */ + producedMaterial = producedMaterial.replaceFirst( + "\\x2bfinal.name\\x2b", skill.applicationNameLower); + if (skill.mavenCompilerPlugin) { + producedMaterial = producedMaterial.replaceFirst( + "\\x2bmaven.compiler.plugin\\x2b", + skill.mavenCompilerPluginVersion); + } + if (skill.mavenWarPlugin) { + producedMaterial = producedMaterial.replaceFirst( + "\\x2bmaven.war.plugin\\x2b", + skill.mavenWarPluginVersion); + } + if (skill.mavenCleanPlugin) { + producedMaterial = producedMaterial.replaceFirst( + "\\x2bmaven.clean.plugin\\x2b", + skill.mavenCleanPluginVersion); + } + producedMaterial = producedMaterial.replaceAll( + "\\x2bhvalid\\x2b", skill.hiberValidVersion); + producedMaterial = producedMaterial.replaceAll( + "\\x2bjackson\\x2b", skill.jacksonVersion); + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + if (skill.dependencies) { + String dependenciesF = markupE.get("depen").stub + "_" + + ((Train) markupE.get("depen").recurrenceE.get( + 0)).locomotor.substance + ".txt"; + skill.dependenciesG = skill.candies.snippetsYS + + dependenciesF; + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Quartz_job_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Quartz_job_xml.java new file mode 100644 index 0000000..1920eda --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Quartz_job_xml.java @@ -0,0 +1,129 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.ClockHands; + +/** + *

+ * Class for producing the web.xml file. + *

+ * + * @author M. Maglioni + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ */ +final public class Quartz_job_xml extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Quartz_job_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** sysnthesis */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String quartz_job_xmlG = skill.candies.snippetsYS + "xml/" + + QUARTZ_JOB_XML_F; + producedMaterial = Equipment.oneString(skill.candies.snippetsYS + + snippetG) + Candies.LF; + producedMaterial += Equipment.oneString(quartz_job_xmlG) + + Candies.LF + Candies.LF; + + for (ClockHands l : skill.handE) { + producedMaterial += Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + if (l.simple != null) { + // x2c is comma + String[] p = l.simple.split("\\x2c"); + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + } + if (l.cron != null) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + + } + + producedMaterial += "" + Candies.LF; + + /* WE COOK EVERYTHING */ + producedMaterial = producedMaterial.replaceAll( + "\\x2bapplicaz\\x2b", skill.applicationNameLower); + producedMaterial = producedMaterial.replaceAll("\\x2brail\\x2b", + Cst.RAIL + skill.clockHands.rail); + producedMaterial = producedMaterial.replaceAll( + "\\x2bquartztask\\x2b", skill.clockHands.taskName); + producedMaterial = producedMaterial.replaceAll( + "\\x2bQuartztask\\x2b", skill.clockHands.taskNameU); + producedMaterial = producedMaterial.replaceAll( + "\\x2bquartzjob\\x2b", skill.clockHands.jobName); + producedMaterial = producedMaterial.replaceAll( + "\\x2bQuartzjob\\x2b", skill.clockHands.jobNameU); + producedMaterial = producedMaterial.replaceAll( + "\\x2bzoccolo\\x2b", skill.pckg); + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Screwdriver_css.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Screwdriver_css.java new file mode 100644 index 0000000..964edef --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Screwdriver_css.java @@ -0,0 +1,84 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.Costume; + +/** @author M. Maglioni */ +final public class Screwdriver_css extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Screwdriver_css(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String g = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(g) + Candies.LF; + + for (Costume c : skill.costumeE) { + producedMaterial += "." + c.className + " {" + Candies.LF; + producedMaterial += Candies.TABS + "color: " + c.color + + ";" + Candies.LF; + producedMaterial += Candies.TABS + "background-color: " + + c.background_color + ";" + Candies.LF; + producedMaterial += Candies.TABS + "border-color: " + + c.background_color + ";" + Candies.LF; + producedMaterial += Candies.TABS + "padding-top: " + + c.padding_top + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "padding-left: " + + c.padding_left + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "padding-right: " + + c.padding_right + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "padding-bottom: " + + c.padding_bottom + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "font-size: " + + c.font_size + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "margin-top: " + + c.margin_top + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "text-align: " + + c.text_align + ";" + Candies.LF; + producedMaterial += "}" + Candies.LF; + } + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Screwdriver_cssC.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Screwdriver_cssC.java new file mode 100644 index 0000000..dfa9a94 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Screwdriver_cssC.java @@ -0,0 +1,85 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.outfits.Costume; + +/** @author M. Maglioni */ +final public class Screwdriver_cssC extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Screwdriver_cssC(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String g = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(g) + Candies.LF; + + for (Costume c : skill.costumeE) { + producedMaterial += "." + c.className + "C {" + Candies.LF; + producedMaterial += Candies.TABS + "color: " + c.color + ";" + + Candies.LF; + producedMaterial += Candies.TABS + "background-color: " + + c.background_color + ";" + Candies.LF; + producedMaterial += Candies.TABS + "border-color: " + + c.background_color + ";" + Candies.LF; + producedMaterial += Candies.TABS + "padding-top: " + + c.padding_top + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "padding-left: " + + c.padding_left + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "padding-right: " + + c.padding_right + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "padding-bottom: " + + c.padding_bottom + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "font-size: " + Integer + .valueOf(c.font_size) * 1.5 + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "margin-top: " + + c.margin_top + "px;" + Candies.LF; + producedMaterial += Candies.TABS + "text-align: center;" + + Candies.LF; + producedMaterial += "}" + Candies.LF; + } + + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Service_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Service_xml.java new file mode 100644 index 0000000..12cc1dc --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Service_xml.java @@ -0,0 +1,73 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class Service_xml extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public Service_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + Train t = markupE.get("hdefrail").recurrenceE.get(skill.railK); + skill.springPropertiesG = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString( + skill.springPropertiesG) + Candies.LF; + producedMaterial += Candies.TABS + + "" + Candies.LF; + producedMaterial += ""; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/SpringProperties_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/SpringProperties_xml.java new file mode 100644 index 0000000..40d071f --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/SpringProperties_xml.java @@ -0,0 +1,136 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Universal; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class SpringProperties_xml extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public SpringProperties_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + skill.springPropertiesG = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(skill.springPropertiesG) + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + String content = "# PROPERTIES LIST" + Candies.LF; + content += "# SPRING SECURITY" + Candies.LF; + content += "AbstractUserDetailsAuthenticationProvider" + + ".badCredentials=Username o password errata" + + Candies.LF; + content += "AbstractUserDetailsAuthenticationProvider" + + ".disabled=Disabled user" + Candies.LF; + content += "AbstractUserDetailsAuthenticationProvider" + + ".expired=Expired account" + Candies.LF; + content += "ConcurrentSessionControllerImpl.exceededAllowed" + + "=This user is already logged in." + Candies.LF; + content += "AbstractAccessDecisionManager.accessDenied" + + "=Denied access" + Candies.LF; + content += "ConcurrentSessionControlStrategy.exceededAllowed" + + "=The maximum number of sessions for this user have been exceeded" + + Candies.LF; + for (int i = 0; i < markupE.get("uintp").recurrenceE + .size(); i++) { + Equipment.scriviFileDaStringa(new File(Mix.dress_C( + skill.mainResources) + markupE.get( + "uintp").recurrenceE.get(i).locomotor.text + + ".properties"), content); + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "classpath:" + + markupE.get("uintp").recurrenceE.get( + i).locomotor.text + "" + Candies.LF; + } + /* the markup i18n can be present one time, but here I desire + * execute a loop */ + for (int i = 0; i < markupE.get("i18n").recurrenceE + .size(); i++) { + Equipment.scriviFileDaStringa(new File(Mix.dress_C( + skill.mainResources) + markupE.get( + "i18n").recurrenceE.get(i).locomotor.text + + ".properties"), content); + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "classpath:" + + markupE.get("i18n").recurrenceE.get( + i).locomotor.text + "" + Candies.LF; + for (int j = 0; j < markupE.get("language").recurrenceE + .size(); j++) { + if (!markupE.get("language").recurrenceE.get( + j).locomotor.text.equalsIgnoreCase( + Universal.languageE[skill.defaulan][1])) { + Equipment.scriviFileDaStringa(new File(Mix.dress_C( + skill.mainResources) + markupE.get( + "i18n").recurrenceE.get( + i).locomotor.text + "_" + + markupE.get("language").recurrenceE.get( + j).locomotor.text + ".properties"), + content); + } + } + } + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + producedMaterial += ""; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the characteristics of the application + * @param trash file where the deleted files are moved + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/SpringSecurity_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/SpringSecurity_xml.java new file mode 100644 index 0000000..55f22d6 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/SpringSecurity_xml.java @@ -0,0 +1,611 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; +import it.ramecera.screwdriver.Wagon; +import it.ramecera.screwdriver.outfits.JspKit; + +/** @author M. Maglioni */ +final public class SpringSecurity_xml extends FileComponent { + + /** @param skill application main data + * @param snippetG name of the file containing the snippet */ + public SpringSecurity_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String g = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(g) + Candies.LF; + + producedMaterial += Candies.TABS + + "" + + Candies.LF; + if (skill.authenticationProvider.equals("class") + && skill.authenticationMode != null + && skill.authenticationMode.equals("trivial")) { + producedMaterial += Candies.TABS + + "" + + Candies.LF; + } else if (skill.authenticationProvider.equals("class")) { + producedMaterial += Candies.TABS + + "" + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + + /* LOOP ON ALL REQUEST MAPS */ + for (int i = 0; i < markupE.get("requmap").recurrenceE + .size(); i++) { + Wagon permitWagon = markupE.get("requmap").recurrenceE.get( + i).wagonE.get("permit"); + Wagon goalWagon = markupE.get("requmap").recurrenceE.get( + i).wagonE.get("goal"); + // Wagon redirectWagon = markupE.get ("requmap"). + // OccurrenceE + // .get (i) .wagonE.get ("redirect"); + int z = 0; + // GOAL CONTROL + List tE = markupE.get("jsp").recurrenceE; + if (goalWagon != null) { + for (z = 0; z < tE.size(); z++) { + if (tE.get(z).locomotor.text.equals( + goalWagon.text)) { + break; + } + } + if (z == tE.size()) { + ExactException ne = new ExactException(); + ne.code = 2300; + ne.datum = "I've not found the JSP " + Mix.dress_A( + goalWagon.text) + + " declared as \"goal\" in " + Mix.dress_A( + "requestmap+" + markupE.get( + "requmap").recurrenceE.get( + i).locomotor.text) + + "."; + ne.className = this.getClass().getName(); + throw ne; + } + } + String[] segmentiE = Mix.separaPath(markupE.get( + "requmap").recurrenceE.get(i).locomotor.text); + JspKit jspKit = (JspKit) tE.get(z).locomotor.substance; + + // TREATMENT OF SECURITY SPRING PERMISSIONS + + if (permitWagon != null && permitWagon.text + .equalsIgnoreCase("all")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + /* both in the case of a crud, but also in the case of a + * simple form (jspType == 1), the permission is the + * same as the mother (the mother is the one without the + * prefix "screw") */ + if (jspKit.crud | jspKit.jspType == 1) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + } + } else if (permitWagon != null && permitWagon.text + .equalsIgnoreCase("user")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + if (jspKit.crud) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + } else if (permitWagon != null && permitWagon.text + .equalsIgnoreCase("admin")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + if (jspKit.crud) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + } + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + if (skill.authenticationProvider.equals("class") + && skill.authenticationMode != null + && skill.authenticationMode.equals("trivial")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } else if (skill.authenticationProvider.equals("class") + && skill.authenticationMode != null + && skill.authenticationMode.equals("domain")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } else if (skill.authenticationProvider.equals("class") + && skill.authenticationMode != null + && skill.authenticationMode.equals("simple")) { + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + Candies.LF; + + if (skill.authenticationProvider != null) { + /* let's see what value the xprovider + markup takes */ + switch (skill.authenticationProvider) { + case "ldap": + producedMaterial += Candies.TABS + + "" + + Candies.LF; + } + } + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + if (skill.ldapPasswordMethod != null) { + switch (skill.ldapPasswordMethod) { + case "password-compare": + producedMaterial += Candies.TABS + + "" + Candies.LF; + break; + case "hash_ssha": + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + break; + default: + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + Candies.LF; + break; + case "user-service": + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + + "" + Candies.LF; + break; + case "jdbc": + Train t = markupE.get("hdefrail").recurrenceE.get( + skill.railK); + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + + "" + Candies.LF; + if (skill.passEncoder != null && skill.passEncoder + .equalsIgnoreCase("saltedSHA256")) { + producedMaterial += Candies.TABS + + "" + + Candies.LF; + } + break; + case "class": + if (skill.authenticationMode == null) { + /* non fare nulla */ + } else if (skill.authenticationMode.equals("domain")) { + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + } else if (skill.authenticationMode.equals("simple")) { + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + } else if (skill.authenticationMode.equals("trivial")) { + if (skill.userTrivialADMIN != null + & skill.passTrivialADMIN == null) { + throw new ExactException("Non è stato" + + " impostato correttamente il markup «uspaformadmin+».", + 1301, this.getClass().getName(), ""); + } + if (skill.userTrivialUSER != null + & skill.passTrivialUSER == null) { + throw new ExactException("Non è stato" + + " impostato correttamente il markup «uspaformuser+».", + 1302, this.getClass().getName(), ""); + } + if (skill.userTrivialUSER == null + & skill.passTrivialUSER == null) { + throw new ExactException("Non sono stati" + + " impostati né il markup " + + "«uspaformuser+» né il markup" + + " «uspaformadmin+».", 1303, this + .getClass().getName(), ""); + } + producedMaterial += Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + + Candies.LF; + if (skill.userTrivialUSER != null) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + if (skill.userTrivialADMIN != null) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "" + + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + + Candies.LF; + producedMaterial += Candies.TABS + + "" + + Candies.LF; + } + break; + default: + throw new ExactException("Il valore «" + + skill.authenticationProvider + + "» per il markup xprovider+ non è" + + " tra quelli previsti.", 1300, this.getClass() + .getName(), ""); + } + } else { + producedMaterial += Candies.TABS + + "" + Candies.LF; + } + producedMaterial += ""; + } + + /* scritta solo per ottemperare alla className astratta + * FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE l'elenco dei markup + * @param skill insieme delle caratteristiche dell'applicazione + * @param recycleBin file dove sono spostati i file cancellati + * @throws ExactException eccezione precisata da un code numerico */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Tiles_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Tiles_xml.java new file mode 100644 index 0000000..800e6ea --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Tiles_xml.java @@ -0,0 +1,73 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class Tiles_xml extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Tiles_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String[] qualifierE = skill.tilesVersion.split("\\x2e"); + String g = skill.candies.snippetsYS + "testaTiles_" + + qualifierE[0] + ".txt"; + producedMaterial = Equipment.oneString(g) + Candies.LF; + for (int i = 0; i < markupE.get("edefn").recurrenceE + .size(); i++) { + String[] s = (String[]) markupE.get("edefn").recurrenceE + .get(i).locomotor.substance; + producedMaterial += Candies.TABS + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + } + producedMaterial += ""; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the descriptive data of the + * application + * @param file basket where the deleted files are moved + * @throws ExactException exception specified by a numerical code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/UserAuthenticationProvider_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/UserAuthenticationProvider_java.java new file mode 100644 index 0000000..cb85dc3 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/UserAuthenticationProvider_java.java @@ -0,0 +1,188 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class UserAuthenticationProvider_java extends + FileComponent { + + /** @param skill set of application descriptive data + * @param snippetG path and name of the snippet file (fragment) */ + public UserAuthenticationProvider_java(Skill skill, + String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + skill.applicUserAuthenticationProviderG = skill.candies.snippetsYS + + snippetG; + producedMaterial = Equipment.oneString( + skill.applicUserAuthenticationProviderG) + Candies.LF + + Candies.LF; + producedMaterial = Strings.replaceFirst(producedMaterial, + "package +zoccolo+", "package " + skill.pckg); + producedMaterial = Strings.replaceFirst(producedMaterial, + "+userpass+", Mix.uppercaseFirstChar( + skill.authenticationMode)); + producedMaterial = producedMaterial.replaceAll( + "\\x2bApplicaz\\x2b", Mix.uppercaseFirstChar( + skill.applicationNameLower)); + producedMaterial = producedMaterial.replaceAll( + "import \\x2bzoccolo\\x2b", "import " + skill.pckg); + producedMaterial = producedMaterial.replaceAll( + "\\x2bdomain\\x2b", skill.networkDomain); + producedMaterial = producedMaterial.replaceAll( + "\\x2bdsname\\x2b", skill.tabUser[2].toLowerCase()); + producedMaterial = producedMaterial.replaceAll( + "\\x2bdbschema\\x2b", skill.tabUser[3]); + producedMaterial = producedMaterial.replaceAll( + "\\x2bRail\\x2b", Cst.RAILU + skill.tabUser[1]); + producedMaterial = producedMaterial.replaceAll( + "\\x2brail\\x2b", Cst.RAIL + skill.tabUser[1]); + producedMaterial = producedMaterial.replaceAll( + "\\x2btabuser\\x2b", Mix.uppercaseFirstChar( + skill.tabUser[0])); + producedMaterial += Candies.TABS + "@Override" + Candies.LF; + producedMaterial += Candies.TABS + + "public Authentication authenticate(" + + "Authentication authentication)" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "throws AuthenticationException {" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Mix + .uppercaseFirstChar(skill.authenticationMode) + + "UsernamePasswordAuthenticationToken token" + " = (" + + Mix.uppercaseFirstChar(skill.authenticationMode) + + "UsernamePasswordAuthenticationToken)" + + " authentication;" + Candies.LF; + + producedMaterial += Candies.TABS + Candies.TABS + + "String userName = token.getName();" + Candies.LF; + if (skill.authenticationMode.equals("domain")) { + producedMaterial += Candies.TABS + Candies.TABS + + "String domain = token.getDomain();" + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "Utenti user = null;" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "try {" + + Candies.LF; + if (skill.jpaVersion == 1) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "user = " + Cst.RAIL + + skill.tabUser[1] + Mix.uppercaseFirstChar( + skill.tabUser[0]) + + ".findById(userName, true);" + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "user = (" + Mix.uppercaseFirstChar( + skill.tabUser[0]) + ")" + Cst.RAIL + + skill.tabUser[1] + Mix.uppercaseFirstChar( + skill.tabUser[0]) + ".findUniqueById(" + Mix + .uppercaseFirstChar(skill.tabUser[0]) + + ".class, userName);" + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "} catch (DataAccessException e) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "} catch (Exception e) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "e.printStackTrace();" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (user == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "throw new UsernameNotFoundException(" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "\"Invalid username/password\");" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "String password = user.get" + Mix.uppercaseFirstChar( + skill.password) + "();" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (!password.equals(token.getCredentials())) {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "throw new BadCredentialsException(" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "\"Invalid username/password\");" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "Collection authorities" + + " = UserAuthorityUtils.createAuthorities(user);" + + Candies.LF; + if (skill.authenticationMode.equals("domain")) { + producedMaterial += Candies.TABS + Candies.TABS + + "return new" + " " + Mix.uppercaseFirstChar( + skill.authenticationMode) + + "UsernamePasswordAuthenticationToken(user," + + " password, domain, authorities);" + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + "return new" + " " + Mix.uppercaseFirstChar( + skill.authenticationMode) + + "UsernamePasswordAuthenticationToken(user," + + " password, authorities);" + Candies.LF; + } + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + "@Override" + Candies.LF; + producedMaterial += Candies.TABS + + "public boolean supports(Class authentication) {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return true;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + + producedMaterial += Candies.TABS + "/* screwdriver_knife */" + + Candies.LF; + producedMaterial += "}" + Candies.LF; + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the descriptive data of the + * application + * @param file basket where the deleted files are moved + * @throws ExactException exception specified by a numerical code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/UserContextImpl_java.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/UserContextImpl_java.java new file mode 100644 index 0000000..6b5429c --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/UserContextImpl_java.java @@ -0,0 +1,301 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** @author M. Maglioni */ +final public class UserContextImpl_java extends FileComponent { + + /** @param skill set of application descriptive data + * @param snippetG path and name of the snippet file (fragment) */ + public UserContextImpl_java(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** array of 3 positions: 0) annotation of the key; 1) type of key; + * 2) name of the key */ + public String[] utenteChiave; + + /** @throws ExactException exception specified by a numeric code */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + if (skill.authenticationMode.equals("trivial")) { + producedMaterial = "package " + skill.pckg + + ".web.authentication;" + Candies.LF + Candies.LF; + producedMaterial += "import org.springframework.beans.factory.annotation.Autowired;" + + Candies.LF; + producedMaterial += "import org.springframework.stereotype.Component;" + + Candies.LF; + producedMaterial += "import " + skill.pckg + + ".web.authentication.KingDao;" + Candies.LF; + producedMaterial += "import " + skill.pckg + + ".domain.King;" + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + /* this + * + * @Component is not there in the case of simple and + * domain */ + producedMaterial += "@Component" + Candies.LF; + producedMaterial += "public class UserContextStub implements UserContext {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + + "private final KingDao userService;" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + + "private String currentUserId = null;" + + Candies.LF + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + + "/** ordinary logger */" + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static Logger logger = Logger.getLogger(" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "UserContextStub.class);" + Candies.LF + + Candies.LF; + } + producedMaterial += Candies.TABS + "@Autowired" + + Candies.LF; + producedMaterial += Candies.TABS + + "public UserContextStub(KingDao userService) {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (userService == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "throw new IllegalArgumentException(" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "\"userService cannot be null\");" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "this.userService = userService;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + "@Override" + + Candies.LF; + producedMaterial += Candies.TABS + + "public King getCurrentUser() {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "return userService.getUser(currentUserId);" + + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + + producedMaterial += Candies.TABS + "@Override" + + Candies.LF; + producedMaterial += Candies.TABS + + "public void setCurrentUser(King user) {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (user == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "throw new IllegalArgumentException(\"user cannot be null\");" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "String currentId = user.getUserid();" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (currentId == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "throw new IllegalArgumentException(" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "\"user.getUserid() cannot be null\");" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "this.currentUserId = currentId;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += "}"; + } else { + utenteChiave = locateKey(skill.tableDBE.get( + skill.uK)); + producedMaterial = "package " + skill.pckg + + ".web.authentication;" + Candies.LF + Candies.LF; + producedMaterial += "import org.springframework.beans.factory.annotation.Autowired;" + + Candies.LF; + producedMaterial += "import org.springframework.dao.DataAccessException;" + + Candies.LF; + producedMaterial += "import " + skill.pckg + "." + Cst.RAIL + + skill.tabUser[1] + ".dao.I" + Cst.RAILU + Mix + .uppercaseFirstChar(skill.tabUser[1]) + + skill.tabUser[0] + "Dao;" + Candies.LF; + producedMaterial += "import " + (skill.networkDomain + + ".screwdriver." + skill.tabUser[2] + "." + + skill.tabUser[3]).toLowerCase() + "." + + skill.tabUser[0] + ";" + Candies.LF; + + if (skill.log4jVers != null) { + producedMaterial += "import org.apache.log4j.Logger;" + + Candies.LF + Candies.LF; + } + + producedMaterial += "public class UserContextStub implements UserContext {" + + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "private final I" + + Cst.RAILU + skill.tabUser[1] + skill.tabUser[0] + + "Dao<" + Mix.uppercaseFirstChar(skill.tabUser[0]) + + "> userService;" + Candies.LF + Candies.LF; + producedMaterial += Candies.TABS + "private " + + utenteChiave[1] + " currentUserId;" + Candies.LF + + Candies.LF; + if (skill.log4jVers != null) { + producedMaterial += Candies.TABS + + "/** ordinary logger */" + Candies.LF; + producedMaterial += Candies.TABS + + "@SuppressWarnings(\"unused\")" + Candies.LF; + producedMaterial += Candies.TABS + + "private static Logger logger = Logger.getLogger(" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "UserContextStub.class);" + Candies.LF + + Candies.LF; + } + producedMaterial += Candies.TABS + "@Autowired" + + Candies.LF; + producedMaterial += Candies.TABS + + "public UserContextStub(I" + Cst.RAILU + + skill.tabUser[1] + skill.tabUser[0] + "Dao<" + Mix + .uppercaseFirstChar(skill.tabUser[0]) + + "> userService) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (userService == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "throw new IllegalArgumentException(" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + + "\"userService cannot be null\");" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "this.userService = userService;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF + + Candies.LF; + producedMaterial += Candies.TABS + "@Override" + + Candies.LF; + producedMaterial += Candies.TABS + "public " + + skill.tabUser[0] + " getCurrentUser() {" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "try {" + + Candies.LF; + if (skill.jpaVersion == 1) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "return userService.findById(currentUserId, false);" + + Candies.LF; + } else { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "return (" + Mix + .uppercaseFirstChar(skill.tabUser[0]) + + ")userService.findUniqueById(" + Mix + .uppercaseFirstChar(skill.tabUser[0]) + + ".class, currentUserId);" + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + + "} catch (DataAccessException e) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "e.printStackTrace();" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "return null;" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "} catch (Exception e) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "e.printStackTrace();" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "return null;" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + + producedMaterial += Candies.TABS + "@Override" + + Candies.LF; + producedMaterial += Candies.TABS + + "public void setCurrentUser(" + skill.tabUser[0] + + " user) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (user == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "throw new IllegalArgumentException(\"user cannot be null\");" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + utenteChiave[1] + " currentId = user.get" + Mix + .uppercaseFirstChar(utenteChiave[2]) + "();" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "if (currentId == null) {" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + + "throw new IllegalArgumentException(" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + Candies.TABS + "\"user.get" + Mix + .uppercaseFirstChar(utenteChiave[2]) + + "() cannot be null\");" + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + "}" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "this.currentUserId = currentId;" + Candies.LF; + producedMaterial += Candies.TABS + "}" + Candies.LF; + producedMaterial += "}"; + } + } + + /* written only to comply with the abstract class FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE the list of markups + * @param skill together with the descriptive data of the + * application + * @param file basket where the deleted files are moved + * @throws ExactException exception specified by a numerical code */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Web_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Web_xml.java new file mode 100644 index 0000000..e76cdca --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Web_xml.java @@ -0,0 +1,253 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Strings; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** + *

+ * Class for producing the web.xml file. + *

+ * + * @author M. Maglioni + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-09-29
+ *

+ */ +final public class Web_xml extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Web_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** sysnthesis */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + final String XML_Y = "/WEB-INF/spring/"; + + String web_xmlF = null; + String mimeMappingF = "webmime.txt"; + String errorPageF = "weberror.txt"; + if (skill.spring) { + web_xmlF = "web.xml.spring.txt"; + } else { + web_xmlF = "web.xml.txt"; + } + String web_xmlG = skill.candies.snippetsYS + web_xmlF; + String mimeMappingG = skill.candies.snippetsYS + mimeMappingF; + String errorPageG = skill.candies.snippetsYS + errorPageF; + producedMaterial = "" + + Candies.LF; + switch (skill.applicationServer.toLowerCase()) { + case ("jboss eap 6.4"): + case ("jboss eap 7.1"): + case ("jboss eap 7.1.spring3"): + case ("jboss eap 7.1.uv"): + case ("jboss eap 6.4.uv"): + producedMaterial += "" + + Candies.LF; + break; + case ("jboss eap 5.2"): + case ("jboss eap 5.2.uv"): + producedMaterial += "" + Candies.LF; + break; + case ("tomcat 7.0"): + case ("tomcat 7.0.uv"): + producedMaterial += "" + Candies.LF; + break; + default: + ExactException ne = new ExactException(); + ne.code = 1200; + ne.datum = "The declared application server «" + + skill.applicationServer + + "» version is not expected."; + throw ne; + } + producedMaterial += Candies.LF; + producedMaterial += Candies.TABS + "" + + skill.applicationNameLower.toUpperCase() + + "" + Candies.LF; + producedMaterial += Equipment.oneString(web_xmlG) + Candies.LF + + Candies.LF; + if (skill.mimeMapping) { + producedMaterial += Equipment.oneString(mimeMappingG) + + Candies.LF; + } + if (skill.errorPage) { + producedMaterial += Equipment.oneString(errorPageG) + + Candies.LF; + } + if (skill.captcha) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "web_captcha.txt") + + Candies.LF + Candies.LF; + } + if (skill.antiSamy) { + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "policy_file_path" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "/" + skill.pckg + + "/web/sanitizer/policy.xml" + + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF; + } + producedMaterial += Candies.TABS + "" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "contextConfigLocation" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + if (skill.quartzVers != null) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + "/WEB-INF/spring/" + + skill.applicationNameLower + "-" + + FileComponent.QUARTZ_JOB_XML_F + Candies.LF; + } + producedMaterial += Candies.TABS + Candies.TABS + Candies.TABS + + "/WEB-INF/spring/root-context.xml" + Candies.LF; + if (skill.internalProperties | skill.springSecurity | markupE + .get("hdefrail").recurrenceE.size() > 0) { + if (skill.internalProperties) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + XML_Y + + skill.applicationNameLower + "-props.xml" + + Candies.LF; + } + if (skill.springSecurity) { + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + XML_Y + + skill.applicationNameLower + "-security.xml" + + Candies.LF; + } + if (markupE.get("hdefrail").recurrenceE.size() > 0) { + for (int i = 0; i < markupE.get("hdefrail").recurrenceE + .size(); i++) { + Train t = markupE.get("hdefrail").recurrenceE.get( + i); + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + XML_Y + Cst.RAIL + + t.locomotor.text + "-orm.xml" + + Candies.LF; + producedMaterial += Candies.TABS + Candies.TABS + + Candies.TABS + XML_Y + Cst.RAIL + + t.locomotor.text + "-service.xml" + + Candies.LF; + } + } + } + producedMaterial += Candies.TABS + Candies.TABS + + "" + Candies.LF; + producedMaterial += Candies.TABS + "" + + Candies.LF + Candies.LF; + producedMaterial += Equipment.oneString(skill.candies.snippetsYS + + "listn_0.txt") + Candies.LF; + if (skill.springSecurity) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "uvListener.txt") + + Candies.LF; + } + if (skill.antiSamy) { + String listener = Candies.TABS + "" + Candies.LF; + listener += Candies.TABS + Candies.TABS + "" + + skill.pckg + ".web.listener" + + ".AntiSamyListener" + Candies.LF; + listener += Candies.TABS + "" + Candies.LF + + Candies.LF; + producedMaterial += listener; + } + /* secuFilte deve essere il primo di tutti i filtri, e deve + * riportare le clausolE REQUEST e ERROR */ + if (skill.springSecurity) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "secuFilte.txt") + + Candies.LF; + } + if (skill.filter) { + producedMaterial += Equipment.oneString( + skill.candies.snippetsYS + "filte.txt") + + Candies.LF; + } + /* CUCINIAMO IL TUTTO */ + if (skill.quartzVers == null) { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+startup+", ""); + } else { + producedMaterial = Strings.replaceFirst(producedMaterial, + "+startup+", + "1"); + } + producedMaterial = producedMaterial.replaceAll( + "\\x2bzoccolo\\x2b", skill.pckg); + producedMaterial += ""; + } + + /* scritta solo per ottemperare alla className astratta + * FileComponent */ + @SuppressWarnings("javadoc") + @Override + /** @param markupE l'elenco dei markup + * @param skill insieme delle caratteristiche dell'applicazione + * @param recycleBin file dove sono spostati i file cancellati + * @throws ExactException eccezione precisata da un code numerico */ + public void directory(HashMap markupE) + + throws ExactException { + + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Webflow_xml.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Webflow_xml.java new file mode 100644 index 0000000..828fbfc --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/component/Webflow_xml.java @@ -0,0 +1,73 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.component; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.file.Equipment; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Markup; +import it.ramecera.screwdriver.Skill; +import it.ramecera.screwdriver.Train; + +/** + *

+ * Class for producing the web.xml file. + *

+ * + * @author M. Maglioni + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ */ +final public class Webflow_xml extends FileComponent { + + /** @param skill together with the descriptive data of the + * @param snippetG application */ + public Webflow_xml(Skill skill, String snippetG) { + super(); + this.skill = skill; + this.snippetG = snippetG; + } + + /** sysnthesis */ + @Override + public void synthesis(HashMap markupE, + List trainE, CandyScrew candyScrew) + + throws FileNotFoundException, IOException, ExactException { + + String webflowG = skill.candies.snippetsYS + snippetG; + producedMaterial = Equipment.oneString(webflowG); + } + + /** @param markupE the list of markups + * @throws ExactException exception specified by a numeric code */ + public void directory(HashMap markupE) + + throws ExactException { + + skill.webFlowY = skill.webInfY + "/flows"; + if (skill.webFlow) { + skill.buildDirectory(skill.webFlowY); + /* I don't want the flow, so the webinf / flows directory + * needs to be cleared */ + } else if (new File(skill.webFlowY).exists()) { + new File(skill.webFlowY).renameTo(new File(recycleBinY + "/" + + skill.webFlowY)); + } + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ClockHands.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ClockHands.java new file mode 100644 index 0000000..032c65e --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ClockHands.java @@ -0,0 +1,87 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.Wagon; + +/** + *

+ * Elements forming a quartz trigger. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class ClockHands { + + /** elements of a simple trigger */ + public String simple; + /** elements of a cron trigger */ + public String cron; + /** job name, with one or more triggers */ + public String jobName; + /** capitalized job name */ + public String jobNameU; + /** task name, with one or more triggers */ + public String taskName; + /** capitalized job name */ + public String taskNameU; + /** rail number where the DB quartz tables are placed */ + public int rail; + + /** default constructor */ + public ClockHands() { + + } + + /** + *

+ * Classic constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param simpleV elements of a simple trigger + * @param cronV elements of a cron trigger + * @param jobNameV name of the job + * @param taskNameV name of the task + * @param railV rail where the DB tables for quartz are placed */ + public ClockHands(Wagon simpleV, Wagon cronV, Wagon jobNameV, + Wagon taskNameV, Wagon railV) { + super(); + if (simpleV != null) { + this.simple = simpleV.text.trim(); + } + if (cronV != null) { + this.cron = cronV.text.trim(); + } + if (jobNameV != null) { + this.jobName = jobNameV.text.trim(); + this.taskName = taskNameV.text.trim(); + this.jobNameU = Mix.uppercaseFirstChar(this.jobName); + this.taskNameU = Mix.uppercaseFirstChar(this.taskName); + } + if (railV.text.matches("d+")) { + this.rail = Integer.valueOf(railV.text); + } + } + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ControllerBelong.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ControllerBelong.java new file mode 100644 index 0000000..ad9b995 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ControllerBelong.java @@ -0,0 +1,61 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import java.util.ArrayList; +import java.util.List; + +import it.ramecera.salad.everyday.Mix; + +/** + *

+ * Elements that go a class of type @Controller. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class ControllerBelong { + + /** the request group gives the class its name */ + public String gruppo; + /** the group with the initial maisucola */ + public String gruppoMaius; + /** the group with the initial minusucola */ + public String gruppoMinus; + /** the list of request-mappings and group-name-of-jsp */ + public List rmE = new ArrayList(); + + /** default constructor */ + public ControllerBelong() { + + } + + /** standard constructor + * + * @param gruppo name of the 1st segment of the mapping + * @param rmE collection of mapping-jsp pairs */ + public ControllerBelong(String gruppo, List rmE) { + super(); + if (gruppo.equals("")) { + this.gruppo = "dummy"; + } else { + this.gruppo = gruppo; + } + this.gruppoMaius = Mix.uppercaseFirstChar(this.gruppo); + this.gruppoMinus = Mix.lowercaseFirstChar(this.gruppo); + this.rmE = rmE; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/Costume.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/Costume.java new file mode 100644 index 0000000..818b861 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/Costume.java @@ -0,0 +1,126 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import it.ramecera.screwdriver.Train; + +/** + *

+ * Elements that go to form a CSS class. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class Costume { + + /** name of the CSS class */ + public String className; + /** CSS element */ + public String color; + /** CSS element */ + public String background_color; + /** CSS element */ + public String border_color; + /** CSS element */ + public String padding_top; + /** CSS element */ + public String padding_bottom; + /** CSS element */ + public String padding_left; + /** CSS element */ + public String padding_right; + /** CSS element */ + public String font_size; + /** CSS element */ + public String margin_top; + /** CSS element */ + public String text_align; + + /** default constructor */ + public Costume() { + + } + + /** + *

+ * Classic constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param className CSS class name + * @param color CSS element + * @param background_color CSS element + * @param border_color CSS element + * @param padding_top CSS element + * @param padding_bottom CSS element + * @param padding_left CSS element + * @param padding_right CSS element + * @param font_size CSS element + * @param margin_top CSS element + * @param text_align CSS element */ + public Costume(final String className, final String color, + final String background_color, final String border_color, + final String padding_top, final String padding_bottom, + final String padding_left, final String padding_right, + final String font_size, final String margin_top, + final String text_align) { + super(); + this.className = className; + this.color = color; + this.background_color = background_color; + this.border_color = border_color; + this.padding_top = padding_top; + this.padding_bottom = padding_bottom; + this.padding_left = padding_left; + this.padding_right = padding_right; + this.font_size = font_size; + this.margin_top = margin_top; + this.text_align = text_align; + } + + /** + *

+ * Useful constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param f the sling, with the locomotor and all its wagons */ + public Costume(Train f) { + this.className = f.locomotor.text; + this.color = f.wagonE.get("ocolor").text; + this.background_color = f.wagonE.get("obackcolor").text; + this.border_color = f.wagonE.get("ocolor").text; + this.padding_top = f.wagonE.get("opadding").text; + this.padding_bottom = f.wagonE.get("opadding").text; + this.padding_left = f.wagonE.get("opadding").text; + this.padding_right = f.wagonE.get("opadding").text; + this.font_size = f.wagonE.get("ofontsize").text; + this.margin_top = f.wagonE.get("omargin").text; + this.text_align = f.wagonE.get("oalign").text; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/DBPlaceKit.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/DBPlaceKit.java new file mode 100644 index 0000000..6eb0475 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/DBPlaceKit.java @@ -0,0 +1,60 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +/** + *

+ * Elements forming a JSP. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class DBPlaceKit { + + /** the name of the schema DB */ + public String dbSchema; + /** the name of the JNDI */ + public String jndiName; + /** the name of the DBMS */ + public String dbms; + + /** default constructor */ + public DBPlaceKit() { + } + + /** + *

+ * Standard constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param dbSchema the name of the DB schema + * @param jndiName the name of the JNDI + * @param dbms the name of the DBMS */ + public DBPlaceKit(final String dbSchema, final String jndiName, + final String dbms) { + super(); + this.dbSchema = dbSchema; + this.jndiName = jndiName; + this.dbms = dbms; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ELEMethod.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ELEMethod.java new file mode 100644 index 0000000..9e77e7d --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/ELEMethod.java @@ -0,0 +1,123 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import java.util.ArrayList; +import java.util.List; + +import it.ramecera.salad.everyday.Candies; + +/** + *

+ * Elements forming a method described in the ele file. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-08-03 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class ELEMethod { + + /** name of the method */ + public String name; + /** the java source code */ + public String source; + /** method DAO arguments, type + object */ + public String upperArguments; + /** method DAO arguments, object only */ + public String lowerArguments; + + /** the list of DB tables involved in the method */ + public List tableE = new ArrayList(); + + /** the list of classes of the topic objects of the method */ + public List classE = new ArrayList(); + + /** default constructor */ + public ELEMethod() { + + } + + /** + *

+ * Classic constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param name method name + * @param sorgente java source code + * @param upperArguments method arguments, type + object + * @param lowerArguments method arguments, only object + * @param tableE list of DB tables involved in the method + * @param classE list of types, optional, after the list of DAOs */ + public ELEMethod(final String name, final String sorgente, + final String upperArguments, final String lowerArguments, + List tableE, List classE) { + super(); + this.name = name; + this.source = sorgente; + this.upperArguments = upperArguments; + this.lowerArguments = lowerArguments; + this.tableE = tableE; + this.classE = classE; + } + + /** + *

+ * Classic toString method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string */ + public String toString() { + String s = ""; + s += "********************" + Candies.LF; + s += "Method «" + name + "»" + Candies.LF + Candies.LF; + if (tableE.size() > 0) { + s += "Tables: "; + for (TableOutfit t : tableE) { + s += t.entityName + ", "; + } + /* I cut the last 2 characters */ + s = s.substring(0, s.length() - 2); + s += Candies.LF; + } + if (upperArguments != null) { + s += "Arguments with uppercase char.: " + upperArguments + + Candies.LF; + } + if (lowerArguments != null) { + s += "Arguments with lowercase char.: " + lowerArguments + + Candies.LF; + } + if (source != null) { + s += Candies.LF + "Source code:" + Candies.LF; + s += source + Candies.LF; + } + s += "********************" + Candies.LF; + return s; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/JspBeanElement.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/JspBeanElement.java new file mode 100644 index 0000000..e707f4e --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/JspBeanElement.java @@ -0,0 +1,234 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import java.util.ArrayList; +import java.util.List; + +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Wagon; +import it.ramecera.screwdriver.utilities.ValidConstScrew; + +/** + *

+ * Elements of each control present in a JSP. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-10-10 + *

+ *

+ * History: 2020-08-02 implementation of N13; 2020-10-10 implementation + * of N12 + *

+ * + * @author M. Maglioni */ +final public class JspBeanElement { + + /** name of the property */ + public String name; + /** name of the property with uppercase initial character */ + public String nameU; + /** data type: String, int, boolean, etc. */ + public String datumType; + /** if it is a data that participates in the structure of the + * connected JSP (true), or if it is only auxiliary (false); in + * practice, that one indicated by belong; it is auxiliary if it is + * part of the bean but is not directly exposed in the JSP */ + public boolean participate; + /** the label of the graphic control in the form */ + public String label; + /** the sign, that is the string that appears on the list-box when + * it is closed */ + public Wagon cartel; + /** if it has a button that immediately sends the chosen data + * online, the label inside the button; otherwise null */ + public Wagon button_label; + /** based on which side the fill SQL query starts */ + public Wagon dao; + /** the SQL query wagon to fill a dropdown graphic control */ + public Wagon hsqln; + /** the list of tokens to fill a dropdown graphic control */ + public Wagon ftokens; + /** only for radio buttons group, the initially selected element */ + public int startingRadio; + /** type of the control connected to this datum */ + public String controlType; + /** the list of validation constraints */ + public List validConstE = new ArrayList(); + + /** default constructor */ + public JspBeanElement() { + + } + + /** + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20 + *

+ * + * @param name name of the property + * @param datumType data type + * @param participate if it participates in the JSP text (true), or + * if it is only auxiliary (false) + * @param label the label of the graphic control in the form + * @param button_label the label of the button that puts immediately + * the data online + * @param validConstE validation constants + * @param controlType type of the control graphic element + * @author M. Maglioni */ + public JspBeanElement(final String name, final String datumType, + final boolean participate, final String label, + Wagon button_label, List validConstE, + final String controlType) { + super(); + this.name = name; + this.nameU = Mix.uppercaseFirstChar(this.name); + this.datumType = datumType; + this.participate = participate; + this.label = label; + this.button_label = button_label; + this.validConstE = validConstE; + this.controlType = controlType; + } + + /** + *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-10-10 + *

+ *

+ * History: 2020-08-02 implementation of N13 (see + * martoraProject.ods); 2020-10-10 implementation of N12 + *

+ * + * @param name name of the property + * @param datumType data type + * @param participate if it participates in the JSP text (true), or + * if it is only auxiliary (false) + * @param label the label of the grafdico control in the form + * @param cartel the cartel, that is the string that appears on the + * list-box when it is closed + * @param button_label the label of the button that puts the + * @param dao data online based on which side the filling SQL query + * @param hsqln the filling SQL query + * @param controlType type of the control element + * @param ftokens the filling list of tokens + * @param startingRadio only for radio buttons group, the element + * initially selected + * @author M. Maglioni + * @throws ExactException standard exception */ + public JspBeanElement(final String name, final String datumType, + final boolean participate, final String label, Wagon cartel, + Wagon button_label, Wagon dao, Wagon hsqln, + final String controlType, Wagon ftokens, + final int startingRadio) + + throws ExactException { + + super(); + this.name = name; + this.nameU = Mix.uppercaseFirstChar(this.name); + this.datumType = datumType; + this.participate = participate; + this.label = label; + this.cartel = cartel; + this.button_label = button_label; + ExactException ee = new ExactException(); + this.dao = dao; + if (dao != null) { + String[][] w = (String[][]) dao.substance; + for (int i = 0; i < w[0].length; i++) { + if (!w[0][i].startsWith(Cst.IRAILU)) { + ee.datum = "The value of markup dao+: " + Mix + .dress_A(w[0][i]) + + " is wrong, it must start with prefix " + + Mix.dress_A(Cst.IRAILU) + "."; + ee.code = 1300; + ee.className = this.getClass().getName(); + ee.method = "constructor of " + ee.className; + throw ee; + } else if (!w[0][i].endsWith("Dao")) { + ee.datum = "The value of markup dao+: " + Mix + .dress_A(w[0][i]) + + " is wrong, it must end with suffix \"Dao\"."; + ee.code = 1301; + ee.className = this.getClass().getName(); + ee.method = "constructor of " + ee.className; + throw ee; + } else if (!w[0][i].matches( + "IRail\\d+\\p{Upper}\\p{Graph}*")) { + ee.datum = "The value of markup dao: " + Mix + .dress_A(w[0][i]) + + " is wrong, it is a bad structured string."; + ee.code = 1302; + ee.className = this.getClass().getName(); + ee.method = "constructor of " + ee.className; + throw ee; + } + w[1][i] = w[0][i].replaceFirst("IR", "r"); + } + this.dao.substance = w; + } + this.hsqln = hsqln; + this.ftokens = ftokens; + this.controlType = controlType; + this.startingRadio = startingRadio; + } + + /** + *

+ * Classic toString method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string + * @author M. Maglioni */ + public String toString() { + String s = ""; + s += "name=" + name; + if (datumType != null) { + s += "; type of datum=" + datumType; + } + s += "; participate=" + participate + "; label=" + label; + if (cartel != null) { + s += "; cartel=" + cartel.text; + } + if (button_label != null) { + s += "; button_label=" + button_label.text; + } + if (hsqln != null) { + s += "; hsqln=" + hsqln; + } + if (controlType != null) { + s += "; control type=" + controlType; + } + if (validConstE != null) { + for (int j = 0; j < validConstE.size(); j++) { + s += "; valid constant" + j + "=" + validConstE.get(j); + } + } + if (dao != null) { + + } + return s; + } +} \ No newline at end of file diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/JspKit.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/JspKit.java new file mode 100644 index 0000000..87b9293 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/JspKit.java @@ -0,0 +1,206 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.salad.graphic.Placard; +import it.ramecera.screwdriver.Cst; +import it.ramecera.screwdriver.Wagon; + +/** + *

+ * Elements forming a JSP. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class JspKit { + + /** the path, without final slash */ + public String path; + /** the name of the file without extension and without final dot */ + public String fileName; + /** the name of the file without extension and without final dot, + * first character uppercase */ + public String nomeFileU; + /** the extension without the initial dot */ + public String extension; + /** if I want the pragma feature */ + public boolean pragma; + /** when the jsp is form, the list of controls */ + public List controlE = new ArrayList(); + /** together with the request-maps that lead to this JSP through the + * Spring controllers */ + public List requestMapE = new ArrayList(); + /** presence in the JSP of a navigation bar */ + public String navigationBar; + /** navigation bar's Jsp kit */ + public MenuKit menuKit; + /** type of JSP: 0 = plain; 1 = form; 2 = model */ + public int jspType; + /** list of String properties of the JSP bean */ + public List stringPropertyE = new ArrayList(); + /** list of JSP bean ArrayList properties */ + public List arrayStringPropertyE = new ArrayList(); + /** list of Integer properties of the JSP bean */ + public List integerPropertyE = new ArrayList(); + /** list of Long type properties of the JSP bean */ + public List longPropertyE = new ArrayList(); + /** list of Boolean properties of the JSP bean */ + public List booleanPropertyE = new ArrayList(); + /** list of additional methods contained in the jsp bean */ + public List methodE = new ArrayList(); + /** placed in the list of trains */ + public int placeJ; + /** the predominant CSS class in this JSP */ + public String classeCss; + /** JSP refresh period, expressed in seconds */ + public int refresh; + /** title of the page to be placed in the center, clearly visible */ + public String pageTitle; + /** if it is a CRUD JSP, therefore with 4 buttons */ + public boolean crud; + /** if it is a JSP that must be born on a new TAB */ + public boolean blank; + /** legend parameter to show in the JSP */ + public String legend = ""; + + /** ordinary logger */ + private static final Logger logger = Logger.getLogger(JspKit.class); + + /** default constructor */ + public JspKit() { + + } + + /** + *

+ * Standard constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @param path the path, without final slash + * @param fileName the name of the file without extension and + * without final dot + * @param extension the extension without initial dot + * @param pragma if I want the pragma feature + * @param controlE if the jsp contains a form + * @param navigationBar name of the navigation bar to be inserted in + * the JSP + * @param methodE list of methods present as source code java + * @param placeJ place of the JSP markup in the list of trains + * @param classeCss the predominant CSS class in this JSP + * @param refresh refresh period of the JSP, expressed in seconds */ + public JspKit(final String path, final String fileName, + final String extension, final boolean pragma, + List controlE, final String navigationBar, + List methodE, final int placeJ, + final String classeCss, final int refresh) { + super(); + if (path.startsWith("/")) { + String message = "JSP " + path + "/" + fileName + "." + + extension + " path starts with a slash," + + " it will be automatically removed."; + logger.info(message); + new Placard(null, message, "Notice"); + this.path = path.substring(1); + } else { + this.path = path; + } + this.fileName = fileName; + this.nomeFileU = Mix.uppercaseFirstChar(fileName); + this.extension = extension; + this.pragma = pragma; + this.controlE = controlE; + this.navigationBar = navigationBar; + this.methodE = methodE; + this.placeJ = placeJ; + this.classeCss = classeCss; + this.refresh = refresh; + } + + /** + *

+ * Classic toString. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string */ + public String toString() { + String s = Candies.LF + Cst.CUT3; + s += " * Path and file name=" + path + "/" + fileName + + "." + extension + Candies.LF; + if (classeCss != null) { + s += " * CSS predominant className = " + classeCss + + Candies.LF; + } + if (legend != null && !legend.isEmpty()) { + s += " * legend = " + legend + Candies.LF; + } + if (crud) { + s += " * with CRUD" + Candies.LF; + } else { + s += " * no CRUD" + Candies.LF; + } + if (blank) { + s += " * with blank command" + Candies.LF; + } + if (requestMapE.size() > 0) { + s += " * Request mappings list:" + Candies.LF; + for (int i = 0; i < requestMapE.size(); i++) { + RequestMap rm = requestMapE.get(i); + s += " * " + i + ") " + rm.toString(); + } + s += Cst.CUT3; + } + if (stringPropertyE.size() > 0) { + s += " * Properties list of the linked bean:" + + Candies.LF; + for (int i = 0; i < stringPropertyE.size(); i++) { + JspBeanElement x = stringPropertyE.get(i); + s += " * " + i + ") " + x.toString() + + Candies.LF; + } + for (int i = 0; i < arrayStringPropertyE.size(); i++) { + JspBeanElement x = arrayStringPropertyE.get(i); + s += " * " + i + ") (array)" + x.toString() + + Candies.LF; + } + s += Cst.CUT3; + } + s += Cst.CUT3; + return s; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/MenuKit.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/MenuKit.java new file mode 100644 index 0000000..ea977d6 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/MenuKit.java @@ -0,0 +1,40 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import java.util.ArrayList; +import java.util.List; + +/** + *

+ * Elements forming a JSP menu. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class MenuKit { + + /** the menu items */ + public List clicE = new ArrayList(); + + /** default constructor */ + public MenuKit() { + } + + /** property of the navigation bar */ + public boolean navbarFixedTop; + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/RequestMap.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/RequestMap.java new file mode 100644 index 0000000..d8fa811 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/RequestMap.java @@ -0,0 +1,159 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.Cst; + +/** + *

+ * Elements forming a set of request maps to be grouped in a class of + * jspType @Controller. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class RequestMap { + + /** the complete map */ + public String[] map; + /** the first segment of the map path, which must be cut to be + * shared by all methods, in the class RequestMapping */ + public String firstSegmentPath; + /** the path / jsp where the check ends */ + public String pathJsp; + /** the path / jsp indicated as redirect */ + public String pathRedirect; + /** the name of the jsp */ + public String jsp; + /** the name of the jsp with a capital initial */ + public String jspU; + /** the name of the path */ + public String path; + /** type of JSP requested by the request map: 0 = plain; 1 = form; 2 + * = model */ + public int tipo; + /** type of the JSP requested by the request map, lowercase + * initial */ + public String tipoX; + /** type of the JSP requested by the request map, capital initial */ + public String tipoU; + + /** useful constructor + * + * @param map the complete map + * @param pathJsp the path / jsp where the control ends + * @param pathJspRedirect TODO + * @param tipo JSP type: 0 = plain; 1 = form; 2 = model */ + + public RequestMap(final String map, final String pathJsp, + final String pathJspRedirect, final int tipo) { + super(); + String[] s = map.split("\\x2c"); + this.map = new String[s.length]; + for (int i = 0; i < s.length; i++) { + s[i] = s[i].trim(); + this.map[i] = s[i]; + } + for (int i = 0; i < s.length; i++) { + String[] m = s[i].split("\\x2f"); // x2f is the slash + /* if any of the paths do not have slashes, I give up the + * first segment */ + if (m.length == 1) { + this.firstSegmentPath = ""; + break; + /* if it is the first path, and it is useful, I take + * it */ + } else if (i == 0) { + this.firstSegmentPath = m[0]; + /* if it is a subsequent path, check that the first + * segment is not different; in which case, I give up + * the first segment */ + } else if (!m[0].equals(this.firstSegmentPath)) { + this.firstSegmentPath = ""; + break; + } + } + this.pathJsp = pathJsp; + this.pathRedirect = pathJspRedirect; + String[] p = pathJsp.split("\\x2f"); // x2f is the slash + if (p.length == 1) { + this.path = ""; + } else { + this.path = p[0]; + } + this.jsp = p[p.length - 1]; + this.jspU = Mix.uppercaseFirstChar(this.jsp); + this.tipo = tipo; + this.tipoX = Cst.JX[tipo]; + this.tipoU = Cst.JU[tipo]; + + } + + /** default constructor */ + public RequestMap() { + + } + + /** + *

+ * Classic toString method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string */ + public String toString() { + String s = ""; + s += "map=" + map + "; tipo=" + tipo + "; primoSegmentoPath=" + + firstSegmentPath + Candies.LF; + return s; + + } + + /** + *

+ * Classic clone method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string */ + public RequestMap clone() { + RequestMap x = new RequestMap(); + x.map = map; + x.firstSegmentPath = firstSegmentPath; + x.pathJsp = pathJsp; + x.jsp = jsp; + x.jspU = jspU; + x.path = path; + x.tipo = tipo; + x.tipoX = tipoX; + x.tipoU = tipoU; + return x; + } +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/TableOutfit.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/TableOutfit.java new file mode 100644 index 0000000..bd8f72f --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/outfits/TableOutfit.java @@ -0,0 +1,152 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.outfits; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import it.ramecera.salad.analysis.Flute; +import it.ramecera.salad.analysis.JavaAnnotation; +import it.ramecera.salad.everyday.Candies; +import it.ramecera.salad.everyday.ExactException; +import it.ramecera.salad.everyday.Mix; +import it.ramecera.screwdriver.CandyScrew; +import it.ramecera.screwdriver.Cst; + +/** + *

+ * Elements forming a JSP. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @author M. Maglioni */ +final public class TableOutfit { + + /** the real name of the table */ + public String tableName; + /** the real name of the table, first character uppercase */ + public String tableNameU; + /** the name of the table in JPA project */ + public String entityName; + /** the name of the table in JPA project, first character + * uppercase */ + public String entityNameU; + /** the path of the entity bean, expressed with points */ + public String pathDots; + /** the path of the entity bean, expressed with slashes */ + public String pathSlash; + /** Java analysis of the entity bean */ + public Flute flute; + /** the DB scheme */ + public String dbSchema; + /** the JNDI */ + public String jndi; + /** the abbreviation rail0, rail1, rail2, etc. which sums up the + * DB-place jndi-dbschema, all in lowercase */ + public String railLowercase; + /** the abbreviation rail0, rail1, rail2, etc. which sums up the + * place-DB jndi-dbschema, capital inial */ + public String railUppercase; + + /** default constructor */ + public TableOutfit() { + + } + + /** + *

+ * Standard constructor. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-06-20 + *

+ *

+ * Modifications:
+ *

+ * + * @param entityName the name of the table + * @param pathDots the path of the entity bean + * @param dbSchema DB schema of the DB table + * @param candies external properties + * @param jndi the JNDI + * @param stub stub of the "rail" markup, then simply the string + * "hdefrail" + * @param text «rail» markup text + * @throws IOException a standard exception + * @throws ExactException a standard exception + * @throws FileNotFoundException a standard exception */ + + public TableOutfit(final String entityName, final String pathDots, + final String dbSchema, CandyScrew candies, + final String jndi, final String stub, final String text) + + throws FileNotFoundException, ExactException, IOException { + + super(); + this.entityName = entityName; + this.entityNameU = Mix.uppercaseFirstChar(entityName); + this.pathDots = pathDots; + this.pathSlash = pathDots.replaceAll("\\x2e", "/"); + this.dbSchema = dbSchema.toLowerCase(); + this.jndi = jndi; + String s = Cst.RAIL + text; + railLowercase = s.toLowerCase(); + railUppercase = Mix.uppercaseFirstChar(railLowercase + .toLowerCase()); + this.flute = new Flute(candies.outputYS + this.jndi + .toLowerCase() + "-" + this.dbSchema + "/src/" + + pathSlash + "/" + entityName + ".java"); + this.flute.analyze(); + for (JavaAnnotation ja : this.flute.fannotationE) { + if (ja.fnome.equals("Table")) { + this.tableName = ja.paramE.get("name"); + this.tableNameU = Mix.uppercaseFirstChar(ja.paramE.get( + "name")); + } + } + } + + /** + *

+ * Classic toString() method. + *

+ *

+ * Company: Rameceraâ„¢
+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string */ + public String toString() { + String s = ""; + s += Candies.LF + "********************" + Candies.LF; + s += "Entity «" + entityName + "»" + Candies.LF; + s += "Table «" + tableName + "»" + Candies.LF + Candies.LF; + s += "PathP = " + pathDots + Candies.LF; + s += "PathS = " + pathSlash + Candies.LF; + s += "DB schema = " + dbSchema + Candies.LF; + s += "JNDI = " + jndi + Candies.LF; + s += "Rail = " + railLowercase + Candies.LF; + s += "********************" + Candies.LF; + return s; + + } + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidConstScrew.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidConstScrew.java new file mode 100644 index 0000000..470a077 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidConstScrew.java @@ -0,0 +1,72 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.utilities; + +import it.ramecera.screwdriver.Wagon; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @author M.Maglioni */ +public class ValidConstScrew { + + /** Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * + * @author M.Maglioni + * @param valcons constants + * @param valparams parameters + * @param valtag tag */ + public ValidConstScrew(Wagon valcons, Wagon valparams, + Wagon valtag) { + super(); + this.valcons = valcons; + this.valparams = valparams; + this.valtag = valtag; + } + + /** the name of the validation constraint */ + public Wagon valcons; + /** parameters */ + public Wagon valparams; + /** message tag to be produced in case of error */ + public Wagon valtag; + + /** + *

+ * Classic toString method. + *

+ *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09 + *

+ *

+ * Modifications:
+ *

+ * + * @return the compound string + * @author M. Maglioni */ + public String toString() { + String s = ""; + if (valcons != null) { + s += "VC constraint=" + valcons.text; + } + if (valparams != null) { + s += "; VC parametri=" + valparams.text; + } + if (valtag != null) { + s += "; VC tag=" + valtag.text; + } + return s; + } + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidationLabelScrew.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidationLabelScrew.java new file mode 100644 index 0000000..384a068 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidationLabelScrew.java @@ -0,0 +1,77 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.utilities; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @author M.Maglioni */ +public class ValidationLabelScrew { + + /** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @author M.Maglioni + * @param label validation label + * @param languageCodeIndex language code */ + public ValidationLabelScrew(String label, int languageCodeIndex) { + super(); + this.label = label; + this.languageCodeIndex = languageCodeIndex; + } + + /** the message label */ + public String label; + /** index in the list of language codes */ + public int languageCodeIndex; + + /** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @return the language code index */ + + @Override + public int hashCode() { + return languageCodeIndex; + } + + /** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @param o object to evaluate + * @return true if equal, false if not equal */ + @Override + public boolean equals(Object o) { + if (o == null) { + return false; + } + if (o == this) { + return true; + } + if (!(o instanceof ValidationLabelScrew)) { + return false; + } + ValidationLabelScrew vl = (ValidationLabelScrew) o; + return vl.label.equals(label) + & vl.languageCodeIndex == languageCodeIndex; + } + +} diff --git a/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidationMessageScrew.java b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidationMessageScrew.java new file mode 100644 index 0000000..0474ed2 --- /dev/null +++ b/screwdriver-3.5.6/src/main/java/it/ramecera/screwdriver/utilities/ValidationMessageScrew.java @@ -0,0 +1,38 @@ +// +// https://www.ramecera.it/myscrewdriver.html +// e-mail: screwdriver@ramecera.it +// +/* This program and the accompanying materials are made available under + * the terms of the Eclipse Public License v1.0 which accompanies this + * distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html */ +package it.ramecera.screwdriver.utilities; + +/** + *

+ * Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ *

+ * + * @author M.Maglioni */ +public class ValidationMessageScrew { + + /** Creation date: 2020-04-09
+ * Last updated: 2020-04-09
+ * + * @author M.Maglioni + * @param vl validation label + * @param message obvious */ + public ValidationMessageScrew(ValidationLabelScrew vl, + final String message) { + super(); + this.vl = vl; + this.message = message.replaceAll("\\x27", "''"); + } + + /** the label + language of the message */ + public ValidationLabelScrew vl; + /** corresponding message */ + public String message; + +} diff --git a/screwdriver-3.5.6/target/classes/META-INF/MANIFEST.MF b/screwdriver-3.5.6/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..a397208 --- /dev/null +++ b/screwdriver-3.5.6/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Built-By: siwat +Build-Jdk: 14.0.2 +Class-Path: log4j-1.2.17.jar jsp-api-2.2.jar +Main-Class: it.ramecera.screwdriver.Hammer +Created-By: Maven Integration for Eclipse + diff --git a/screwdriver-3.5.6/target/classes/META-INF/maven/it.ramecera.ict/screwdriver/pom.properties b/screwdriver-3.5.6/target/classes/META-INF/maven/it.ramecera.ict/screwdriver/pom.properties new file mode 100644 index 0000000..a168d17 --- /dev/null +++ b/screwdriver-3.5.6/target/classes/META-INF/maven/it.ramecera.ict/screwdriver/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Oct 29 15:42:14 ICT 2020 +m2e.projectLocation=C\:\\Users\\siwat\\GitHub\\ise-comprog-after-midterm\\screwdriver-3.5.6 +m2e.projectName=screwdriver-3.5.6 +groupId=it.ramecera.ict +artifactId=screwdriver +version=3.5.6 diff --git a/screwdriver-3.5.6/target/classes/META-INF/maven/it.ramecera.ict/screwdriver/pom.xml b/screwdriver-3.5.6/target/classes/META-INF/maven/it.ramecera.ict/screwdriver/pom.xml new file mode 100644 index 0000000..0f247d6 --- /dev/null +++ b/screwdriver-3.5.6/target/classes/META-INF/maven/it.ramecera.ict/screwdriver/pom.xml @@ -0,0 +1,51 @@ + + 4.0.0 + it.ramecera.ict + screwdriver + 3.5.6 + screwdriver + http://www.ramecera.it + + UTF-8 + + a java source code generator + + + log4j + log4j + 1.2.17 + + + javax.servlet.jsp + jsp-api + 2.2 + + + + src/main/java + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.0 + + + + true + it.ramecera.screwdriver.Hammer + + + + + + + \ No newline at end of file diff --git a/versions.properties b/versions.properties new file mode 100644 index 0000000..9d16a80 --- /dev/null +++ b/versions.properties @@ -0,0 +1,13 @@ +4.9=2018-09 +4.8=Photon +4.7=Oxygen +4.6=Neon +4.5=Mars +4.17=2020-09 +4.16=2020-06 +4.15=2020-03 +4.14=2019-12 +4.13=2019-09 +4.12=2019-06 +4.11=2019-03 +4.10=2018-12 \ No newline at end of file diff --git a/waxds-copper/.classpath b/waxds-copper/.classpath new file mode 100644 index 0000000..be86bf9 --- /dev/null +++ b/waxds-copper/.classpath @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/waxds-copper/.project b/waxds-copper/.project new file mode 100644 index 0000000..1ed733f --- /dev/null +++ b/waxds-copper/.project @@ -0,0 +1,34 @@ + + + waxds-copper + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + + + org.eclipse.wst.validation.validationbuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + + diff --git a/waxds-copper/.settings/org.eclipse.jdt.core.prefs b/waxds-copper/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..4e4a3ad --- /dev/null +++ b/waxds-copper/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,9 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/waxds-copper/.settings/org.eclipse.jpt.core.prefs b/waxds-copper/.settings/org.eclipse.jpt.core.prefs new file mode 100644 index 0000000..7ff3376 --- /dev/null +++ b/waxds-copper/.settings/org.eclipse.jpt.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +org.eclipse.jpt.core.platform=generic2_1 +org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true diff --git a/waxds-copper/.settings/org.eclipse.jpt.entitygen.ramecerawax.copper b/waxds-copper/.settings/org.eclipse.jpt.entitygen.ramecerawax.copper new file mode 100644 index 0000000..532b3e3 Binary files /dev/null and b/waxds-copper/.settings/org.eclipse.jpt.entitygen.ramecerawax.copper differ diff --git a/waxds-copper/.settings/org.eclipse.m2e.core.prefs b/waxds-copper/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..f897a7f --- /dev/null +++ b/waxds-copper/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/waxds-copper/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/waxds-copper/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml new file mode 100644 index 0000000..7961132 --- /dev/null +++ b/waxds-copper/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/waxds-copper/.settings/org.eclipse.wst.common.project.facet.core.xml b/waxds-copper/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 0000000..b73a2d9 --- /dev/null +++ b/waxds-copper/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/waxds-copper/Eclipse Public License - Version 1.0.html b/waxds-copper/Eclipse Public License - Version 1.0.html new file mode 100644 index 0000000..bdec535 --- /dev/null +++ b/waxds-copper/Eclipse Public License - Version 1.0.html @@ -0,0 +1,259 @@ + + + + +Eclipse Public License - Version 1.0 + + + + + + +

Eclipse Public License - v 1.0

+ +

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR +DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS +AGREEMENT.

+ +

1. DEFINITIONS

+ +

"Contribution" means:

+ +

a) in the case of the initial Contributor, the initial +code and documentation distributed under this Agreement, and

+

b) in the case of each subsequent Contributor:

+

i) changes to the Program, and

+

ii) additions to the Program;

+

where such changes and/or additions to the Program +originate from and are distributed by that particular Contributor. A +Contribution 'originates' from a Contributor if it was added to the +Program by such Contributor itself or anyone acting on such +Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) +are not derivative works of the Program.

+ +

"Contributor" means any person or entity that distributes +the Program.

+ +

"Licensed Patents" mean patent claims licensable by a +Contributor which are necessarily infringed by the use or sale of its +Contribution alone or when combined with the Program.

+ +

"Program" means the Contributions distributed in accordance +with this Agreement.

+ +

"Recipient" means anyone who receives the Program under +this Agreement, including all Contributors.

+ +

2. GRANT OF RIGHTS

+ +

a) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free copyright license to reproduce, prepare derivative works +of, publicly display, publicly perform, distribute and sublicense the +Contribution of such Contributor, if any, and such derivative works, in +source code and object code form.

+ +

b) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free patent license under Licensed Patents to make, use, sell, +offer to sell, import and otherwise transfer the Contribution of such +Contributor, if any, in source code and object code form. This patent +license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, +such addition of the Contribution causes such combination to be covered +by the Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder.

+ +

c) Recipient understands that although each Contributor +grants the licenses to its Contributions set forth herein, no assurances +are provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility to +secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow Recipient +to distribute the Program, it is Recipient's responsibility to acquire +that license before distributing the Program.

+ +

d) Each Contributor represents that to its knowledge it +has sufficient copyright rights in its Contribution, if any, to grant +the copyright license set forth in this Agreement.

+ +

3. REQUIREMENTS

+ +

A Contributor may choose to distribute the Program in object code +form under its own license agreement, provided that:

+ +

a) it complies with the terms and conditions of this +Agreement; and

+ +

b) its license agreement:

+ +

i) effectively disclaims on behalf of all Contributors +all warranties and conditions, express and implied, including warranties +or conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose;

+ +

ii) effectively excludes on behalf of all Contributors +all liability for damages, including direct, indirect, special, +incidental and consequential damages, such as lost profits;

+ +

iii) states that any provisions which differ from this +Agreement are offered by that Contributor alone and not by any other +party; and

+ +

iv) states that source code for the Program is available +from such Contributor, and informs licensees how to obtain it in a +reasonable manner on or through a medium customarily used for software +exchange.

+ +

When the Program is made available in source code form:

+ +

a) it must be made available under this Agreement; and

+ +

b) a copy of this Agreement must be included with each +copy of the Program.

+ +

Contributors may not remove or alter any copyright notices contained +within the Program.

+ +

Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution.

+ +

4. COMMERCIAL DISTRIBUTION

+ +

Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use of +the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create +potential liability for other Contributors. Therefore, if a Contributor +includes the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and +indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") +arising from claims, lawsuits and other legal actions brought by a third +party against the Indemnified Contributor to the extent caused by the +acts or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In +order to qualify, an Indemnified Contributor must: a) promptly notify +the Commercial Contributor in writing of such claim, and b) allow the +Commercial Contributor to control, and cooperate with the Commercial +Contributor in, the defense and any related settlement negotiations. The +Indemnified Contributor may participate in any such claim at its own +expense.

+ +

For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages.

+ +

5. NO WARRANTY

+ +

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED 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. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable laws, +damage to or loss of data, programs or equipment, and unavailability or +interruption of operations.

+ +

6. DISCLAIMER OF LIABILITY

+ +

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT +NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

+ +

7. GENERAL

+ +

If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable.

+ +

If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the +date such litigation is filed.

+ +

All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of time +after becoming aware of such noncompliance. If all Recipient's rights +under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

+ +

Everyone is permitted to copy and distribute copies of this +Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The +Agreement Steward reserves the right to publish new versions (including +revisions) of this Agreement from time to time. No one other than the +Agreement Steward has the right to modify this Agreement. The Eclipse +Foundation is the initial Agreement Steward. The Eclipse Foundation may +assign the responsibility to serve as the Agreement Steward to a +suitable separate entity. Each new version of the Agreement will be +given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version +of the Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives no +rights or licenses to the intellectual property of any Contributor under +this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved.

+ +

This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No party +to this Agreement will bring a legal action under this Agreement more +than one year after the cause of action arose. Each party waives its +rights to a jury trial in any resulting litigation.

+ + + + \ No newline at end of file diff --git a/waxds-copper/TermsOfUse.txt b/waxds-copper/TermsOfUse.txt new file mode 100644 index 0000000..59a4056 --- /dev/null +++ b/waxds-copper/TermsOfUse.txt @@ -0,0 +1,53 @@ +Definitions +Software: Any software that is made available to you +by plug-in "Drill", by the application "Screwdriver" +and all software associated to it. Your use of the +Software is governed by the terms of the end user +license agreement LGPL which accompanies or is +included with the Software ("License Agreement"). + +DISCLAIMER +THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY +OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF +COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO +EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY +GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE +USE OR INABILITY TO USE THE SOFTWARE OR FROM OTHER +DEALINGS IN THIS SOFTWARE. BEING A CODE GENERATOR, +THIS DECLARATION REFERS NOT ONLY TO THE SOFTWARE +PROVIDED, BUT ALSO TO ALL THE APPLICATIONS THAT WILL +BE GENERATED BY IT. +THE FINAL USER OF "SCREWDRIVER" OWNS THE INTELLECTUAL +PROPERTIES OF THE SOFTWARE HE HAS GENERATED. + +Definizioni +Software: qualsiasi software reso disponibile dal +plug-in "Drill", dall'applicazione "Screwdriver" e da +tutto il software ad esso associato. L'utilizzo del +software è regolato dai termini del contratto di +licenza per l'utente finale LGPL che accompagna o è +incluso nel software ("Contratto di licenza"). + +DECLINAZIONE DI RESPONSABILITA' +QUESTO SOFTWARE È FORNITO "COSÌ COM'È", SENZA ALCUN +TIPO DI GARANZIA, ESPRESSA O IMPLICITA, SENZA ALCUNA +GARANZIA DI COMMERCIABILITÀ, IDONEITÀ A UN +PARTICOLARE SCOPO E SENZA DIRITTO DI COPYRIGHT, +BREVETTO, MARCHIO O ALTRO DIRITTO. IN NESSUN CASO IL +TITOLARE DEL COPYRIGHT SARÀ RESPONSABILE DI QUALSIASI +RECLAMO, DANNO O ALTRA RESPONSABILITÀ, COMPRESO +QUALSIASI DANNO GENERALE, SPECIALE, INDIRETTO, +INCIDENTALE O CONSEQUENZIALE, SIA NELL'AMBITO DI UN +CONTRATTO, SIA DI UNA CONTROVERSIA O ALTRO, DERIVANTE +DALL'UTILIZZO O DALL'IMPOSSIBILITÀ DI UTILIZZARE +QUESTO SOFTWARE. TRATTANDOSI DI UN GENERATORE DI +CODICE, QUESTA DICHIARAZIONE SI RIFERISCE NON SOLO AL +SOFTWARE FORNITO, MA ANCHE A TUTTE LE APPLICAZIONI +CHE SARANNO DA ESSO GENERATE. +L'UTENTE FINALE DI "CACCIAVITE" DETIENE LA PROPRIETÀ +INTELLETTUALE DEL SOFTWARE CHE HA GENERATO. \ No newline at end of file diff --git a/waxds-copper/createSchema.sql b/waxds-copper/createSchema.sql new file mode 100644 index 0000000..d6da558 --- /dev/null +++ b/waxds-copper/createSchema.sql @@ -0,0 +1 @@ +CREATE SCHEMA copper; \ No newline at end of file diff --git a/waxds-copper/dropCreateAll.sql b/waxds-copper/dropCreateAll.sql new file mode 100644 index 0000000..bd95f9c --- /dev/null +++ b/waxds-copper/dropCreateAll.sql @@ -0,0 +1,86 @@ +drop trigger trg_novels on copper.novels; +drop trigger trg_authors on copper.authors; +drop trigger trg_actors on copper.actors; + +ALTER TABLE copper.novels + DROP CONSTRAINT nvl_FK_thrs; +ALTER TABLE copper.novels + DROP CONSTRAINT nvl_FK_ctrs; +ALTER TABLE copper.authors + DROP CONSTRAINT thrs_FK_ctrs; + +drop table copper.novels; +drop table copper.authors; +drop table copper.actors; + +drop sequence copper.novels_star_seq; +drop sequence copper.authors_star_seq; +drop sequence copper.actors_star_seq; + +CREATE SEQUENCE copper.novels_star_seq; +CREATE SEQUENCE copper.authors_star_seq; +CREATE SEQUENCE copper.actors_star_seq; + +CREATE TABLE copper.novels ( + star INTEGER DEFAULT nextval('copper.novels_star_seq') NOT NULL PRIMARY KEY, + title VARCHAR(1023) NOT NULL, + language VARCHAR(255) NOT NULL, + author integer NOT NULL, + modifier integer NOT NULL, + creationDate timestamp NOT NULL DEFAULT now(), + updateDate timestamp +) tablespace waxts; + +CREATE TABLE copper.authors ( + star INTEGER DEFAULT nextval('copper.authors_star_seq') NOT NULL PRIMARY KEY, + name VARCHAR(255) NOT NULL, + surname VARCHAR(255) NOT NULL, + modifier integer NOT NULL, + creationDate timestamp NOT NULL DEFAULT now(), + updateDate timestamp +) tablespace waxts; + +CREATE TABLE copper.actors ( + star INTEGER DEFAULT nextval('copper.actors_star_seq') NOT NULL PRIMARY KEY, + userid VARCHAR(255), + password VARCHAR(255), + lastUpdatePassword timestamp, + firstLogin timestamp, + lastLogin timestamp, + penalities INTEGER, + firstname VARCHAR(255) NOT NULL, + lastname VARCHAR(255) NOT NULL, + rating INTEGER NOT NULL DEFAULT 0, + creationDate timestamp NOT NULL DEFAULT now(), + updateDate timestamp +) tablespace waxts; + +create trigger trg_novels before update +on copper.novels for each row +execute procedure upd_dt(); +create trigger trg_authors before update +on copper.authors for each row +execute procedure upd_dt(); +create trigger trg_actors before update +on copper.actors for each row +execute procedure upd_dt(); + +ALTER TABLE copper.novels + ADD CONSTRAINT nvl_FK_thrs + FOREIGN KEY(author) + REFERENCES copper.authors(star) + ON DELETE CASCADE + ON UPDATE CASCADE; +ALTER TABLE copper.novels + ADD CONSTRAINT nvl_FK_ctrs + FOREIGN KEY(modifier) + REFERENCES copper.actors(star) + ON DELETE CASCADE + ON UPDATE CASCADE; +ALTER TABLE copper.authors + ADD CONSTRAINT thrs_FK_ctrs + FOREIGN KEY(modifier) + REFERENCES copper.actors(star) + ON DELETE CASCADE + ON UPDATE CASCADE; + diff --git a/waxds-copper/function_upd_dt.sql b/waxds-copper/function_upd_dt.sql new file mode 100644 index 0000000..ef30a1d --- /dev/null +++ b/waxds-copper/function_upd_dt.sql @@ -0,0 +1,7 @@ +create or replace function upd_dt() +returns trigger as ' +begin + NEW.updatedate := current_timestamp; + RETURN NEW; +end; +' LANGUAGE plpgsql; \ No newline at end of file diff --git a/waxds-copper/inserts.sql b/waxds-copper/inserts.sql new file mode 100644 index 0000000..b3427ed --- /dev/null +++ b/waxds-copper/inserts.sql @@ -0,0 +1,13 @@ +INSERT INTO copper.actors VALUES (1, NULL, NULL, NULL, NULL, NULL, NULL, 'Thomas', 'Johnson', 0, '2020-06-04 18:00:38.317374', NULL); +INSERT INTO copper.actors VALUES (2, NULL, NULL, NULL, NULL, NULL, NULL, 'Kevin', 'Livingstone', 0, '2020-06-04 18:01:58.164193', NULL); +INSERT INTO copper.actors VALUES (0, NULL, NULL, NULL, NULL, NULL, NULL, 'nobody', 'nobody', 0, '2020-06-25 18:46:32.042848', NULL); +INSERT INTO copper.authors VALUES (2, 'Charles', 'Dickens', 2, '2020-06-04 18:04:14.023161', NULL); +INSERT INTO copper.authors VALUES (3, 'Mark', 'Twain', 2, '2020-06-04 18:06:06.444514', NULL); +INSERT INTO copper.authors VALUES (4, 'Carson', 'McCullers', 1, '2020-06-04 18:11:25.001664', NULL); +INSERT INTO copper.authors VALUES (5, 'Norman', 'Mailer', 2, '2020-06-04 18:11:25.009645', NULL); +INSERT INTO copper.authors VALUES (6, 'Truman', 'Capote', 2, '2020-06-04 18:12:05.758629', NULL); +INSERT INTO copper.novels VALUES (1, 'David Copperfield', 'english', 2, 2, '2020-06-04 18:18:56.673253', NULL); +INSERT INTO copper.novels VALUES (3, 'Oliver Twist', 'english', 2, 1, '2020-06-04 18:20:08.404755', NULL); +INSERT INTO copper.novels VALUES (4, 'A Christmas Carol', 'english', 2, 2, '2020-06-04 18:21:17.88829', NULL); +INSERT INTO copper.novels VALUES (5, 'The Naked and the Dead', 'english', 5, 1, '2020-06-04 18:23:12.513388', NULL); +INSERT INTO copper.novels VALUES (6, 'The Executioner''s Song', 'english', 5, 2, '2020-06-04 18:24:05.237597', NULL); diff --git a/waxds-copper/makeJar.jardesc b/waxds-copper/makeJar.jardesc new file mode 100644 index 0000000..119d6c6 --- /dev/null +++ b/waxds-copper/makeJar.jardesc @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/waxds-copper/pom.xml b/waxds-copper/pom.xml new file mode 100644 index 0000000..19faf41 --- /dev/null +++ b/waxds-copper/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + it.ramecera.ict + waxds-copper + 0.2.0 + https://www.ramecera.it + a JPA project for "Hello world" by Screwdriver + + UTF-8 + + + + javax.persistence + persistence-api + 1.0 + + + + src + + + src + + + + + + + + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + + + + + \ No newline at end of file diff --git a/waxds-copper/src/META-INF/persistence.xml b/waxds-copper/src/META-INF/persistence.xml new file mode 100644 index 0000000..a69f0e5 --- /dev/null +++ b/waxds-copper/src/META-INF/persistence.xml @@ -0,0 +1,8 @@ + + + + it.ramecera.screwdriver.waxds.copper.Actor + it.ramecera.screwdriver.waxds.copper.Author + it.ramecera.screwdriver.waxds.copper.Novel + + diff --git a/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Actor.java b/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Actor.java new file mode 100644 index 0000000..572eec9 --- /dev/null +++ b/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Actor.java @@ -0,0 +1,199 @@ +package it.ramecera.screwdriver.waxds.copper; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +/** The persistent class for the actors database table. */ +@Entity +@Table(name = "actors", schema = "copper") +@NamedQuery(name = "Actor.findAll", query = "SELECT a FROM Actor a") +public class Actor implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer star; + + private Timestamp creationdate; + + private Timestamp firstlogin; + + private String firstname; + + private Timestamp lastlogin; + + private String lastname; + + private Timestamp lastupdatepassword; + + private String password; + + private Integer penalities; + + private Integer rating; + + private Timestamp updatedate; + + private String userid; + + // bi-directional many-to-one association to Author + @OneToMany(mappedBy = "actor") + private List authors; + + // bi-directional many-to-one association to Novel + @OneToMany(mappedBy = "actor") + private List novels; + + public Actor() { + } + + public Integer getStar() { + return this.star; + } + + public void setStar(Integer star) { + this.star = star; + } + + public Timestamp getCreationdate() { + return this.creationdate; + } + + public void setCreationdate(Timestamp creationdate) { + this.creationdate = creationdate; + } + + public Timestamp getFirstlogin() { + return this.firstlogin; + } + + public void setFirstlogin(Timestamp firstlogin) { + this.firstlogin = firstlogin; + } + + public String getFirstname() { + return this.firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public Timestamp getLastlogin() { + return this.lastlogin; + } + + public void setLastlogin(Timestamp lastlogin) { + this.lastlogin = lastlogin; + } + + public String getLastname() { + return this.lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public Timestamp getLastupdatepassword() { + return this.lastupdatepassword; + } + + public void setLastupdatepassword(Timestamp lastupdatepassword) { + this.lastupdatepassword = lastupdatepassword; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getPenalities() { + return this.penalities; + } + + public void setPenalities(Integer penalities) { + this.penalities = penalities; + } + + public Integer getRating() { + return this.rating; + } + + public void setRating(Integer rating) { + this.rating = rating; + } + + public Timestamp getUpdatedate() { + return this.updatedate; + } + + public void setUpdatedate(Timestamp updatedate) { + this.updatedate = updatedate; + } + + public String getUserid() { + return this.userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public List getAuthors() { + return this.authors; + } + + public void setAuthors(List authors) { + this.authors = authors; + } + + public Author addAuthor(Author author) { + getAuthors().add(author); + author.setActor(this); + + return author; + } + + public Author removeAuthor(Author author) { + getAuthors().remove(author); + author.setActor(null); + + return author; + } + + public List getNovels() { + return this.novels; + } + + public void setNovels(List novels) { + this.novels = novels; + } + + public Novel addNovel(Novel novel) { + getNovels().add(novel); + novel.setActor(this); + + return novel; + } + + public Novel removeNovel(Novel novel) { + getNovels().remove(novel); + novel.setActor(null); + + return novel; + } + +} \ No newline at end of file diff --git a/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Author.java b/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Author.java new file mode 100644 index 0000000..d254c24 --- /dev/null +++ b/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Author.java @@ -0,0 +1,118 @@ +package it.ramecera.screwdriver.waxds.copper; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +/** The persistent class for the authors database table. */ +@Entity +@Table(name = "authors", schema = "copper") +@NamedQuery(name = "Author.findAll", query = "SELECT a FROM Author a") +public class Author implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer star; + + private Timestamp creationdate; + + private String name; + + private String surname; + + private Timestamp updatedate; + + // bi-directional many-to-one association to Actor + @ManyToOne + @JoinColumn(name = "modifier") + private Actor actor; + + // bi-directional many-to-one association to Novel + @OneToMany(mappedBy = "authorBean") + private List novels; + + public Author() { + } + + public Integer getStar() { + return this.star; + } + + public void setStar(Integer star) { + this.star = star; + } + + public Timestamp getCreationdate() { + return this.creationdate; + } + + public void setCreationdate(Timestamp creationdate) { + this.creationdate = creationdate; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return this.surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public Timestamp getUpdatedate() { + return this.updatedate; + } + + public void setUpdatedate(Timestamp updatedate) { + this.updatedate = updatedate; + } + + public Actor getActor() { + return this.actor; + } + + public void setActor(Actor actor) { + this.actor = actor; + } + + public List getNovels() { + return this.novels; + } + + public void setNovels(List novels) { + this.novels = novels; + } + + public Novel addNovel(Novel novel) { + getNovels().add(novel); + novel.setAuthorBean(this); + + return novel; + } + + public Novel removeNovel(Novel novel) { + getNovels().remove(novel); + novel.setAuthorBean(null); + + return novel; + } + +} \ No newline at end of file diff --git a/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Novel.java b/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Novel.java new file mode 100644 index 0000000..f73eb48 --- /dev/null +++ b/waxds-copper/src/it/ramecera/screwdriver/waxds/copper/Novel.java @@ -0,0 +1,103 @@ +package it.ramecera.screwdriver.waxds.copper; + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** The persistent class for the novels database table. */ +@Entity +@Table(name = "novels", schema = "copper") +@NamedQuery(name = "Novel.findAll", query = "SELECT n FROM Novel n") +public class Novel implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer star; + + private Timestamp creationdate; + + private String language; + + private String title; + + private Timestamp updatedate; + + // bi-directional many-to-one association to Actor + @ManyToOne + @JoinColumn(name = "modifier") + private Actor actor; + + // bi-directional many-to-one association to Author + @ManyToOne + @JoinColumn(name = "author") + private Author authorBean; + + public Novel() { + } + + public Integer getStar() { + return this.star; + } + + public void setStar(Integer star) { + this.star = star; + } + + public Timestamp getCreationdate() { + return this.creationdate; + } + + public void setCreationdate(Timestamp creationdate) { + this.creationdate = creationdate; + } + + public String getLanguage() { + return this.language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Timestamp getUpdatedate() { + return this.updatedate; + } + + public void setUpdatedate(Timestamp updatedate) { + this.updatedate = updatedate; + } + + public Actor getActor() { + return this.actor; + } + + public void setActor(Actor actor) { + this.actor = actor; + } + + public Author getAuthorBean() { + return this.authorBean; + } + + public void setAuthorBean(Author authorBean) { + this.authorBean = authorBean; + } + +} \ No newline at end of file diff --git a/waxds-copper/target/classes/META-INF/MANIFEST.MF b/waxds-copper/target/classes/META-INF/MANIFEST.MF new file mode 100644 index 0000000..da8beab --- /dev/null +++ b/waxds-copper/target/classes/META-INF/MANIFEST.MF @@ -0,0 +1,5 @@ +Manifest-Version: 1.0 +Built-By: siwat +Build-Jdk: 14.0.2 +Created-By: Maven Integration for Eclipse + diff --git a/waxds-copper/target/classes/META-INF/maven/it.ramecera.ict/waxds-copper/pom.properties b/waxds-copper/target/classes/META-INF/maven/it.ramecera.ict/waxds-copper/pom.properties new file mode 100644 index 0000000..b2ca369 --- /dev/null +++ b/waxds-copper/target/classes/META-INF/maven/it.ramecera.ict/waxds-copper/pom.properties @@ -0,0 +1,7 @@ +#Generated by Maven Integration for Eclipse +#Thu Oct 29 15:42:21 ICT 2020 +m2e.projectLocation=C\:\\Users\\siwat\\GitHub\\ise-comprog-after-midterm\\waxds-copper +m2e.projectName=waxds-copper +groupId=it.ramecera.ict +artifactId=waxds-copper +version=0.2.0 diff --git a/waxds-copper/target/classes/META-INF/maven/it.ramecera.ict/waxds-copper/pom.xml b/waxds-copper/target/classes/META-INF/maven/it.ramecera.ict/waxds-copper/pom.xml new file mode 100644 index 0000000..19faf41 --- /dev/null +++ b/waxds-copper/target/classes/META-INF/maven/it.ramecera.ict/waxds-copper/pom.xml @@ -0,0 +1,39 @@ + + 4.0.0 + it.ramecera.ict + waxds-copper + 0.2.0 + https://www.ramecera.it + a JPA project for "Hello world" by Screwdriver + + UTF-8 + + + + javax.persistence + persistence-api + 1.0 + + + + src + + + src + + + + + + + + maven-compiler-plugin + 3.7.0 + + 1.8 + 1.8 + + + + + \ No newline at end of file diff --git a/waxds-copper/target/classes/META-INF/persistence.xml b/waxds-copper/target/classes/META-INF/persistence.xml new file mode 100644 index 0000000..a69f0e5 --- /dev/null +++ b/waxds-copper/target/classes/META-INF/persistence.xml @@ -0,0 +1,8 @@ + + + + it.ramecera.screwdriver.waxds.copper.Actor + it.ramecera.screwdriver.waxds.copper.Author + it.ramecera.screwdriver.waxds.copper.Novel + + diff --git a/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Actor.class b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Actor.class new file mode 100644 index 0000000..1db2471 Binary files /dev/null and b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Actor.class differ diff --git a/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Actor.java b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Actor.java new file mode 100644 index 0000000..572eec9 --- /dev/null +++ b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Actor.java @@ -0,0 +1,199 @@ +package it.ramecera.screwdriver.waxds.copper; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +/** The persistent class for the actors database table. */ +@Entity +@Table(name = "actors", schema = "copper") +@NamedQuery(name = "Actor.findAll", query = "SELECT a FROM Actor a") +public class Actor implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer star; + + private Timestamp creationdate; + + private Timestamp firstlogin; + + private String firstname; + + private Timestamp lastlogin; + + private String lastname; + + private Timestamp lastupdatepassword; + + private String password; + + private Integer penalities; + + private Integer rating; + + private Timestamp updatedate; + + private String userid; + + // bi-directional many-to-one association to Author + @OneToMany(mappedBy = "actor") + private List authors; + + // bi-directional many-to-one association to Novel + @OneToMany(mappedBy = "actor") + private List novels; + + public Actor() { + } + + public Integer getStar() { + return this.star; + } + + public void setStar(Integer star) { + this.star = star; + } + + public Timestamp getCreationdate() { + return this.creationdate; + } + + public void setCreationdate(Timestamp creationdate) { + this.creationdate = creationdate; + } + + public Timestamp getFirstlogin() { + return this.firstlogin; + } + + public void setFirstlogin(Timestamp firstlogin) { + this.firstlogin = firstlogin; + } + + public String getFirstname() { + return this.firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public Timestamp getLastlogin() { + return this.lastlogin; + } + + public void setLastlogin(Timestamp lastlogin) { + this.lastlogin = lastlogin; + } + + public String getLastname() { + return this.lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public Timestamp getLastupdatepassword() { + return this.lastupdatepassword; + } + + public void setLastupdatepassword(Timestamp lastupdatepassword) { + this.lastupdatepassword = lastupdatepassword; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getPenalities() { + return this.penalities; + } + + public void setPenalities(Integer penalities) { + this.penalities = penalities; + } + + public Integer getRating() { + return this.rating; + } + + public void setRating(Integer rating) { + this.rating = rating; + } + + public Timestamp getUpdatedate() { + return this.updatedate; + } + + public void setUpdatedate(Timestamp updatedate) { + this.updatedate = updatedate; + } + + public String getUserid() { + return this.userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public List getAuthors() { + return this.authors; + } + + public void setAuthors(List authors) { + this.authors = authors; + } + + public Author addAuthor(Author author) { + getAuthors().add(author); + author.setActor(this); + + return author; + } + + public Author removeAuthor(Author author) { + getAuthors().remove(author); + author.setActor(null); + + return author; + } + + public List getNovels() { + return this.novels; + } + + public void setNovels(List novels) { + this.novels = novels; + } + + public Novel addNovel(Novel novel) { + getNovels().add(novel); + novel.setActor(this); + + return novel; + } + + public Novel removeNovel(Novel novel) { + getNovels().remove(novel); + novel.setActor(null); + + return novel; + } + +} \ No newline at end of file diff --git a/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Author.class b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Author.class new file mode 100644 index 0000000..18332a4 Binary files /dev/null and b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Author.class differ diff --git a/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Author.java b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Author.java new file mode 100644 index 0000000..d254c24 --- /dev/null +++ b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Author.java @@ -0,0 +1,118 @@ +package it.ramecera.screwdriver.waxds.copper; + +import java.io.Serializable; +import java.sql.Timestamp; +import java.util.List; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +/** The persistent class for the authors database table. */ +@Entity +@Table(name = "authors", schema = "copper") +@NamedQuery(name = "Author.findAll", query = "SELECT a FROM Author a") +public class Author implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer star; + + private Timestamp creationdate; + + private String name; + + private String surname; + + private Timestamp updatedate; + + // bi-directional many-to-one association to Actor + @ManyToOne + @JoinColumn(name = "modifier") + private Actor actor; + + // bi-directional many-to-one association to Novel + @OneToMany(mappedBy = "authorBean") + private List novels; + + public Author() { + } + + public Integer getStar() { + return this.star; + } + + public void setStar(Integer star) { + this.star = star; + } + + public Timestamp getCreationdate() { + return this.creationdate; + } + + public void setCreationdate(Timestamp creationdate) { + this.creationdate = creationdate; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return this.surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + public Timestamp getUpdatedate() { + return this.updatedate; + } + + public void setUpdatedate(Timestamp updatedate) { + this.updatedate = updatedate; + } + + public Actor getActor() { + return this.actor; + } + + public void setActor(Actor actor) { + this.actor = actor; + } + + public List getNovels() { + return this.novels; + } + + public void setNovels(List novels) { + this.novels = novels; + } + + public Novel addNovel(Novel novel) { + getNovels().add(novel); + novel.setAuthorBean(this); + + return novel; + } + + public Novel removeNovel(Novel novel) { + getNovels().remove(novel); + novel.setAuthorBean(null); + + return novel; + } + +} \ No newline at end of file diff --git a/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Novel.class b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Novel.class new file mode 100644 index 0000000..0cedb5e Binary files /dev/null and b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Novel.class differ diff --git a/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Novel.java b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Novel.java new file mode 100644 index 0000000..f73eb48 --- /dev/null +++ b/waxds-copper/target/classes/it/ramecera/screwdriver/waxds/copper/Novel.java @@ -0,0 +1,103 @@ +package it.ramecera.screwdriver.waxds.copper; + +import java.io.Serializable; +import java.sql.Timestamp; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +/** The persistent class for the novels database table. */ +@Entity +@Table(name = "novels", schema = "copper") +@NamedQuery(name = "Novel.findAll", query = "SELECT n FROM Novel n") +public class Novel implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private Integer star; + + private Timestamp creationdate; + + private String language; + + private String title; + + private Timestamp updatedate; + + // bi-directional many-to-one association to Actor + @ManyToOne + @JoinColumn(name = "modifier") + private Actor actor; + + // bi-directional many-to-one association to Author + @ManyToOne + @JoinColumn(name = "author") + private Author authorBean; + + public Novel() { + } + + public Integer getStar() { + return this.star; + } + + public void setStar(Integer star) { + this.star = star; + } + + public Timestamp getCreationdate() { + return this.creationdate; + } + + public void setCreationdate(Timestamp creationdate) { + this.creationdate = creationdate; + } + + public String getLanguage() { + return this.language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Timestamp getUpdatedate() { + return this.updatedate; + } + + public void setUpdatedate(Timestamp updatedate) { + this.updatedate = updatedate; + } + + public Actor getActor() { + return this.actor; + } + + public void setActor(Actor actor) { + this.actor = actor; + } + + public Author getAuthorBean() { + return this.authorBean; + } + + public void setAuthorBean(Author authorBean) { + this.authorBean = authorBean; + } + +} \ No newline at end of file