From 4c06676009580dc4544fb8b6218bc6a6052a380a Mon Sep 17 00:00:00 2001 From: Stefano Sinatti Date: Thu, 21 Sep 2023 14:59:30 +0200 Subject: [PATCH] Release 4.11.0 (#2) * New release 4.11.0 * Fix pom.xml * Fix pom.xml * Update release 4.11.0 --- .gitignore | 6 +- .mvn/jvm.config | 0 .mvn/wrapper/maven-wrapper.jar | Bin 0 -> 59925 bytes .mvn/wrapper/maven-wrapper.properties | 18 + CHANGELOG.md | 114 ++ LICENSE.txt | 661 +++++++++ README.md | 159 ++- RELEASE-NOTES.md | 4 +- mvnw | 287 ++++ mvnw.cmd | 187 +++ pom.xml | 134 +- spagolite-core/pom.xml | 19 +- .../configuration/ConfigProperties.java | 183 +++ .../configuration/ConfigServlet.java | 386 +++--- .../configuration/ConfigSingleton.java | 493 +------ .../java/it/eng/spagoCore/error/EMFError.java | 62 +- .../it/eng/spagoCore/util/CharsetFilter.java | 17 + .../spagoCore/util/CustomKeycloakFilter.java | 58 + .../it/eng/spagoCore/util/JavaScript.java | 109 +- .../java/it/eng/spagoCore/util/JpaUtils.java | 40 + .../it/eng/spagoCore/util/Oauth2Srvlt.java | 68 + .../it/eng/spagoCore/util/StringUtils.java | 830 ----------- .../eng/spagoCore/util/UUIDLoggerFilter.java | 17 + .../util/UUIDLoggerSessionListener.java | 17 + .../spagoCore/util/UUIDLoggerSoapHandler.java | 17 + .../it/eng/spagoCore/util/UUIDMdcLogUtil.java | 36 +- .../eng/spagoCore/util/UriEcondingFilter.java | 34 +- .../main/java/it/eng/spagoIFace/Values.java | 87 +- .../eng/spagoIFace/model/BaseController.java | 28 +- .../spagoIFace/model/BaseControllerIFace.java | 23 +- .../eng/spagoIFace/model/PublisherInfo.java | 20 +- .../session/SessionCoreManager.java | 23 +- spagolite-hibernate-test/pom.xml | 158 +++ .../main/java/it/eng/arquillian/Greeter.java | 41 + .../eng/hibernate/lazyLoad/ChildEntity.java | 52 + .../eng/hibernate/lazyLoad/ParentEntity.java | 51 + .../paginator/StatementInterceptor.java | 65 + .../sequence/SequenceChild2Entity.java | 101 ++ .../sequence/SequenceChild3Entity.java | 86 ++ .../sequence/SequenceChildEntity.java | 99 ++ .../hibernate/sequence/SequenceEntity.java | 86 ++ .../src/main/resources/META-INF/MANIFEST.MF | 2 + .../src/main/resources/META-INF/ejb-jar.xml | 46 + .../main/resources/META-INF/persistence.xml | 40 + .../test/java/it/eng/DummyTimerHelper.java | 56 + .../src/test/java/it/eng/FakeAuth.java | 52 + .../src/test/java/it/eng/PaginatorTests.java | 113 ++ .../src/test/java/it/eng/SimplyEjb.java | 64 + .../it/eng/arquillian/ArquillianTest.java | 56 + .../lazyLoad/HibernateLazyLoadTests.java | 87 ++ .../hibernate/sequence/CascadeMergeTests.java | 116 ++ .../NonMonotonicSequenceGeneratorTests.java | 237 ++++ .../test/resources/countselectlist.properties | 1 + .../src/test/resources/create.sql | 15 + .../src/test/resources/data.sql | 11 + .../src/test/resources/jndi.properties | 29 + spagolite-hibernate-test/transaction.log | 0 spagolite-middle/pom.xml | 46 +- .../it/eng/spagoLite/ExecutionHistory.java | 17 + .../java/it/eng/spagoLite/FrameElement.java | 21 +- .../eng/spagoLite/FrameElementInterface.java | 21 +- .../java/it/eng/spagoLite/SessionManager.java | 26 +- .../it/eng/spagoLite/actions/ActionBase.java | 59 +- .../eng/spagoLite/actions/RedirectAction.java | 24 +- .../ApplicationBaseProperties.java | 17 + .../IApplicationBasePropertiesSevice.java | 17 + .../spagoLite/actions/form/FormAction.java | 42 +- .../spagoLite/actions/form/ListAction.java | 222 +-- .../actions/security/LoginAction.java | 17 + .../actions/security/LogoutAction.java | 17 + .../it/eng/spagoLite/db/SqlTypesName.java | 17 + .../spagoLite/db/base/BaseRowInterface.java | 17 + .../spagoLite/db/base/BaseTableInterface.java | 59 +- .../db/base/JEEBaseRowInterface.java | 17 + .../db/base/paging/AbstractPaginator.java | 52 +- .../spagoLite/db/base/paging/IPaginator.java | 17 + .../it/eng/spagoLite/db/base/row/BaseRow.java | 18 + .../db/base/sorting/RowComparator.java | 17 + .../db/base/sorting/SortingRule.java | 17 + .../db/base/table/AbstractBaseTable.java | 70 +- .../spagoLite/db/base/table/BaseTable.java | 17 + .../spagoLite/db/base/table/LazyListBean.java | 99 +- .../db/base/table/LazyListInterface.java | 37 + .../db/base/table/LazyListReflectionBean.java | 130 ++ .../spagoLite/db/base/table/LazyQuery.java | 73 + .../it/eng/spagoLite/db/base/table/Param.java | 97 ++ .../spagoLite/db/decodemap/DecodeMapIF.java | 17 + .../oracle/bean/column/ColumnDescriptor.java | 17 + .../oracle/bean/column/TableDescriptor.java | 17 + .../spagoLite/db/oracle/decode/DecodeMap.java | 17 + .../db/oracle/decode/DecodeMapAbs.java | 17 + .../java/it/eng/spagoLite/form/Component.java | 17 + .../java/it/eng/spagoLite/form/Element.java | 17 + .../java/it/eng/spagoLite/form/Elements.java | 17 + .../main/java/it/eng/spagoLite/form/Form.java | 17 + .../spagoLite/form/base/BaseComponent.java | 17 + .../eng/spagoLite/form/base/BaseElement.java | 17 + .../eng/spagoLite/form/base/BaseElements.java | 17 + .../it/eng/spagoLite/form/base/BaseForm.java | 17 + .../spagoLite/form/buttonList/ButtonList.java | 17 + .../it/eng/spagoLite/form/fields/Field.java | 17 + .../it/eng/spagoLite/form/fields/Fields.java | 42 +- .../spagoLite/form/fields/IMappableField.java | 17 + .../form/fields/MultiValueField.java | 17 + .../it/eng/spagoLite/form/fields/Section.java | 17 + .../form/fields/SingleValueField.java | 17 + .../spagoLite/form/fields/impl/Button.java | 17 + .../spagoLite/form/fields/impl/CheckBox.java | 17 + .../spagoLite/form/fields/impl/ComboBox.java | 17 + .../eng/spagoLite/form/fields/impl/Input.java | 17 + .../eng/spagoLite/form/fields/impl/Link.java | 17 + .../form/fields/impl/MultiSelect.java | 17 + .../form/fields/impl/MultiSemaphore.java | 37 +- .../eng/spagoLite/form/fields/impl/Radio.java | 17 + .../spagoLite/form/fields/impl/Semaphore.java | 17 + .../spagoLite/form/fields/impl/TextArea.java | 17 + .../java/it/eng/spagoLite/form/grid/Grid.java | 17 + .../it/eng/spagoLite/form/grid/GridCell.java | 17 + .../it/eng/spagoLite/form/grid/GridRow.java | 17 + .../java/it/eng/spagoLite/form/list/List.java | 29 + .../spagoLite/form/list/ListExcelWriter.java | 173 ++- .../eng/spagoLite/form/list/NestedList.java | 19 + .../java/it/eng/spagoLite/form/tab/Tab.java | 17 + .../it/eng/spagoLite/form/tab/TabElement.java | 23 + .../java/it/eng/spagoLite/form/tree/Tree.java | 20 + .../it/eng/spagoLite/form/tree/TreeField.java | 17 + .../it/eng/spagoLite/form/wizard/EndPage.java | 17 + .../it/eng/spagoLite/form/wizard/Step.java | 17 + .../it/eng/spagoLite/form/wizard/Wizard.java | 17 + .../spagoLite/form/wizard/WizardElement.java | 17 + .../it/eng/spagoLite/message/Message.java | 17 + .../it/eng/spagoLite/message/MessageBox.java | 18 + .../it/eng/spagoLite/message/MessageUtil.java | 17 + .../AbstractRowSmandrupper.java | 17 + .../rowsmandrupper/BaseRowSmandrupper.java | 17 + .../RowSmandrupperInterface.java | 19 +- .../it/eng/spagoLite/security/BaseUser.java | 28 + .../it/eng/spagoLite/security/CsrfHelper.java | 17 + .../java/it/eng/spagoLite/security/IUser.java | 26 +- .../it/eng/spagoLite/security/Secure.java | 17 + .../spagoLite/security/SuppressLogging.java | 17 + .../java/it/eng/spagoLite/security/User.java | 17 + .../auth/AuthenticationHandlerConstants.java | 17 + .../security/auth/Authenticator.java | 18 + .../eng/spagoLite/security/auth/PwdUtil.java | 55 +- .../security/auth/SOAPClientLoginHandler.java | 17 + .../auth/SOAPClientLoginHandlerResolver.java | 19 +- .../security/auth/SOAPIamLoginHandler.java | 17 + .../security/auth/SOAPServerLoginHandler.java | 17 + .../auth/SOAPServerLoginHandler2.java | 17 + .../security/auth/WSLoginHandler.java | 85 +- .../security/exception/AuthWSException.java | 17 + .../security/exception/SOAPFaultInfo.java | 17 + .../spagoLite/security/menu/MenuEntry.java | 17 + .../spagoLite/security/menu/impl/Link.java | 17 + .../spagoLite/security/menu/impl/Menu.java | 17 + .../spagoLite/security/profile/Attribute.java | 17 + .../spagoLite/security/profile/Azione.java | 17 + .../spagoLite/security/profile/Component.java | 17 + .../spagoLite/security/profile/Function.java | 17 + .../spagoLite/security/profile/MenuDips.java | 17 + .../spagoLite/security/profile/Pagina.java | 17 + .../spagoLite/security/profile/Profile.java | 17 + .../security/profile/ProfileElement.java | 17 + .../ReloadableCachingMetadataManager.java | 17 + .../security/saml/SliteSAMLUserDetail.java | 59 +- .../security/saml/SliteWebSSOProfileImpl.java | 36 + .../eng/spagoLite/tag/BaseSpagoLiteTag.java | 17 + .../java/it/eng/spagoLite/tag/BodyTag.java | 17 + .../it/eng/spagoLite/tag/ContentTitleTag.java | 43 +- .../java/it/eng/spagoLite/tag/DoctypeTag.java | 17 + .../java/it/eng/spagoLite/tag/FooterTag.java | 95 +- .../java/it/eng/spagoLite/tag/HeadTag.java | 119 +- .../java/it/eng/spagoLite/tag/HtmlTag.java | 17 + .../java/it/eng/spagoLite/tag/MenuTag.java | 50 +- .../it/eng/spagoLite/tag/MessageBoxTag.java | 17 + .../java/it/eng/spagoLite/tag/NewLineTag.java | 17 + .../it/eng/spagoLite/tag/PulsantieraTag.java | 17 + .../it/eng/spagoLite/tag/UserInfoTag.java | 17 + .../eng/spagoLite/tag/form/BaseFormTag.java | 33 +- .../it/eng/spagoLite/tag/form/BaseTag.java | 17 + .../tag/form/fields/CsrfInputTag.java | 17 + .../tag/form/fields/DoubleLblFieldTag.java | 17 + .../tag/form/fields/FieldBarDetailTag.java | 17 + .../spagoLite/tag/form/fields/FieldTag.java | 47 +- .../tag/form/fields/FieldsBoxTag.java | 17 + .../tag/form/fields/FileFieldTag.java | 18 + .../spagoLite/tag/form/fields/LabelTag.java | 17 + .../tag/form/fields/LblFieldTag.java | 59 +- .../spagoLite/tag/form/fields/ValueTag.java | 17 + .../tag/form/formLayout/ContainerTag.java | 17 + .../tag/form/formLayout/FieldSetTag.java | 17 + .../tag/form/formLayout/FilterBoxTag.java | 17 + .../spagoLite/tag/form/formLayout/RowTag.java | 17 + .../tag/form/formLayout/SectionTag.java | 17 + .../tag/form/formLayout/TableSectionTag.java | 17 + .../tag/form/list/AbstractListNavBarTag.java | 39 +- .../tag/form/list/AbstractListTag.java | 27 +- .../tag/form/list/ButtonListTag.java | 19 +- .../tag/form/list/CheckBoxListTag.java | 21 +- .../tag/form/list/EditableListTag.java | 24 +- .../tag/form/list/ListNavBackTag.java | 19 +- .../tag/form/list/ListNavBarDetailTag.java | 17 + .../tag/form/list/ListNavBarTag.java | 19 +- .../eng/spagoLite/tag/form/list/ListTag.java | 23 +- .../tag/form/list/NestedListTag.java | 25 +- .../spagoLite/tag/form/list/RadioListTag.java | 21 +- .../tag/form/list/SelectListTag.java | 22 +- .../tag/form/list/SimpleListTag.java | 19 +- .../tag/form/pageLayout/ContentTag.java | 31 + .../tag/form/pageLayout/HeaderTag.java | 119 +- .../tag/form/pageLayout/SimpleFormTag.java | 17 + .../tag/form/panel/AbstractPanelTag.java | 17 + .../it/eng/spagoLite/tag/form/tab/TabTag.java | 17 + .../eng/spagoLite/tag/form/tree/TreeTag.java | 17 + .../tag/form/wizard/AbstractWizardTag.java | 23 + .../spagoLite/tag/form/wizard/EndPageTag.java | 17 + .../spagoLite/tag/form/wizard/StepTag.java | 17 + .../tag/form/wizard/WizardNavBarTag.java | 17 + .../spagoLite/tag/form/wizard/WizardTag.java | 18 + .../tag/prototype/AbstractLblSelectTag.java | 17 + .../tag/prototype/AbstractLblTag.java | 21 + .../spagoLite/tag/prototype/LblCheckTag.java | 17 + .../tag/prototype/LblMultiSelectTag.java | 17 + .../spagoLite/tag/prototype/LblSelectTag.java | 19 +- .../spagoLite/tag/prototype/LblTextTag.java | 17 + .../eng/spagoLite/util/Casting/Casting.java | 68 +- .../java/it/eng/spagoLite/util/DataTypes.java | 17 + .../java/it/eng/spagoLite/util/Format.java | 20 +- .../it/eng/spagoLite/util/MessageCodes.java | 51 - .../java/it/eng/spagoLite/util/Parse.java | 42 + .../src/main/java/it/eng/util/ClassUtil.java | 17 + .../main/java/it/eng/util/EncryptionUtil.java | 21 +- .../main/java/it/eng/util/FileSystemUtil.java | 19 +- .../main/java/it/eng/util/SpagoLiteTool.java | 27 +- .../main/java/it/eng/util/SpringLiteTool.java | 31 +- .../eng/util/actionWriter/ActionWriter.java | 17 + .../util/constantWriter/ConstantWriter.java | 17 + .../eng/util/constantWriter/ScriptWriter.java | 17 + .../eng/util/formWriter/ButtonListWriter.java | 17 + .../it/eng/util/formWriter/EndPageWriter.java | 17 + .../it/eng/util/formWriter/FieldWriter.java | 17 + .../it/eng/util/formWriter/FieldsWriter.java | 17 + .../it/eng/util/formWriter/FormWriter.java | 17 + .../it/eng/util/formWriter/ListWriter.java | 17 + .../eng/util/formWriter/NestedListWriter.java | 17 + .../it/eng/util/formWriter/SectionWriter.java | 17 + .../it/eng/util/formWriter/StepWriter.java | 17 + .../eng/util/formWriter/TabElementWriter.java | 17 + .../it/eng/util/formWriter/TabWriter.java | 17 + .../util/formWriter/TreeElementWriter.java | 17 + .../it/eng/util/formWriter/TreeWriter.java | 17 + .../util/formWriter/WizardElementWriter.java | 17 + .../it/eng/util/formWriter/WizardWriter.java | 17 + .../util/formWriter/base/ElementWriter.java | 17 + .../src/main/resources/META-INF/sl.tld | 17 + .../src/main/resources/messages.properties | 67 - .../security/auth/TestPasswordUtil.java | 71 + spagolite-paginator-ejb/arquillian.xml | 24 + spagolite-paginator-ejb/pom.xml | 82 ++ .../it/eng/paginator/ejb/PaginatorImpl.java | 42 + .../paginator/ejb/PaginatorInterceptor.java | 44 + .../eng/paginator/helper/LazyListHelper.java | 163 +++ .../it/eng/paginator/helper/LazyQuery.java | 116 ++ .../hibernate/OracleSqlInterceptor.java | 29 + .../NonMonotonicSequenceGenerator.java | 56 + .../src/main/resources/META-INF/MANIFEST.MF | 2 + .../src/main/resources/META-INF/ejb-jar.xml | 31 +- .../NonMonotonicSequenceGeneratorTest.java | 107 ++ .../hibernate/SequenceChild2Entity.java | 104 ++ .../hibernate/SequenceChild3Entity.java | 90 ++ .../hibernate/SequenceChildEntity.java | 102 ++ .../sequences/hibernate/SequenceEntity.java | 90 ++ .../org.hibernate.integrator.spi.Integrator | 1 + .../src/test/resources/persistence.xml | 17 + spagolite-paginator-gf/arquillian.xml | 24 + spagolite-paginator-gf/pom.xml | 71 +- .../eclipselink/CountQueryRedirector.java | 113 -- .../eclipselink/ListSessionListener.java | 40 - .../it/eng/paginator/ejb/InvokerLocal.java | 14 - .../it/eng/paginator/ejb/PaginatorImpl.java | 24 - .../paginator/ejb/PaginatorInterceptor.java | 100 -- .../paginator/util/CriteriaQueryUtils.java | 356 +++++ .../it/eng/paginator/util/HibernateUtils.java | 130 ++ .../it/eng/paginator/util/QueryUtils.java | 137 ++ .../NonMonotonicSequenceGenerator.java | 112 -- .../util/CriteriaQueryUtilsTest.java | 112 ++ .../eng/paginator/util/PigAmbienteVers.java | 55 + .../it/eng/paginator/util/QueryUtilsTest.java | 246 ++++ .../src/test/resources/persistence.xml | 17 + spagolite-si-client/pom.xml | 2 +- spagolite-si-server/pom.xml | 4 +- .../it/eng/integriam/server/ws/Costanti.java | 17 + .../integriam/server/ws/ReplicaUtente.java | 32 +- .../ws/reputente/CancellaUtenteRisposta.java | 17 + .../reputente/InserimentoUtenteRisposta.java | 17 + .../server/ws/reputente/ListaIndIp.java | 17 + .../server/ws/reputente/ListaOrganizAbil.java | 19 +- .../ws/reputente/ListaServiziAutor.java | 17 + .../ws/reputente/ListaTipiDatoAbil.java | 19 +- .../ws/reputente/ModificaUtenteRisposta.java | 19 +- .../server/ws/reputente/OrganizAbil.java | 19 +- .../ws/reputente/ReplicaUtenteInterface.java | 17 + .../ReplicaUtenteRispostaAbstract.java | 17 + .../server/ws/reputente/TipoDatoAbil.java | 17 + .../integriam/server/ws/reputente/Utente.java | 17 + .../src/main/webapp/WEB-INF/beans.xml | 6 +- spagolite-si-util/pom.xml | 46 +- .../eng/integriam/client/util/UserUtil.java | 49 +- .../integriam/client/ws/IAMRestClients.java | 51 +- .../integriam/client/ws/IAMSoapClients.java | 371 +++-- .../integriam/client/ws/TestSoapClients.java | 252 ++++ spagolite-sl-ejb/pom.xml | 17 +- .../eng/parer/sacerlog/common/Constants.java | 17 + .../sacerlog/common/SacerLogEjbType.java | 17 + .../eng/parer/sacerlog/ejb/SacerLogEjb.java | 64 +- .../parer/sacerlog/ejb/SacerLogWebEjb.java | 92 +- .../ejb/common/AppServerInstance.java | 17 + .../ejb/common/helper/ParamApplicHelper.java | 17 + .../ejb/helper/ExportImportFotoHelper.java | 51 +- .../sacerlog/ejb/helper/SacerLogHelper.java | 181 ++- .../sacerlog/ejb/util/LogOggettoRuolo.java | 17 + .../sacerlog/ejb/util/ObjectsToLogBefore.java | 17 + .../parer/sacerlog/ejb/util/PremisEnums.java | 17 + .../it/eng/parer/sacerlog/job/Constants.java | 17 + .../it/eng/parer/sacerlog/job/JobData.java | 17 + .../job/SacerLogAllineamentoTimer.java | 25 +- .../eng/parer/sacerlog/job/SacerLogJob.java | 28 +- .../parer/sacerlog/job/SacerLogJobHelper.java | 33 +- .../eng/parer/sacerlog/job/SacerLogTimer.java | 24 +- .../src/main/resources/META-INF/ejb-jar.xml | 5 +- spagolite-sl-jpa/pom.xml | 24 +- .../sacerlog/entity/EntityConstraints.java | 17 + .../sacerlog/entity/LogAgenteEvento.java | 35 +- .../entity/LogChiaveAccessoEvento.java | 37 +- .../parer/sacerlog/entity/LogDeltaFoto.java | 49 +- .../eng/parer/sacerlog/entity/LogEvento.java | 36 +- .../sacerlog/entity/LogEventoByScript.java | 32 +- .../sacerlog/entity/LogEventoLoginUser.java | 172 +++ .../sacerlog/entity/LogFotoOggettoEvento.java | 49 +- ...LogFotoOggettoEventoXMLDataCustomizer.java | 22 - .../sacerlog/entity/LogOggettoEvento.java | 38 +- .../constraint/ConstLogEventoLoginUser.java | 50 + .../it/eng/parer/sacerlog/util/LogParam.java | 17 + .../sacerlog/util/TransactionLogContext.java | 17 + .../viewEntity/AplVLogChiaveTiOgg.java | 26 +- .../viewEntity/AplVLogFotoTiEvnOgg.java | 26 +- .../sacerlog/viewEntity/AplVLogInit.java | 26 +- .../sacerlog/viewEntity/AplVLogTiEvn.java | 25 +- .../viewEntity/AplVLogTiEvnConOrigine.java | 74 +- .../viewEntity/AplVLogTiEvnConOrigineId.java | 112 ++ .../sacerlog/viewEntity/AplVLogTiOgg.java | 25 +- .../viewEntity/AplVLogTrigTiEvnOgg.java | 26 +- .../sacerlog/viewEntity/AplVParamApplic.java | 18 + .../sacerlog/viewEntity/ILogVRicEventi.java | 17 + .../viewEntity/LogVDeltaAsserzioni.java | 25 +- .../viewEntity/LogVLisAsserzioniDati.java | 26 +- .../viewEntity/LogVLisEventoByScript.java | 26 +- .../viewEntity/LogVLisEventoOggetto.java | 27 +- .../sacerlog/viewEntity/LogVLogAgente.java | 25 +- .../sacerlog/viewEntity/LogVRicEventi.java | 59 +- .../sacerlog/viewEntity/LogVRicEventiId.java | 84 ++ .../viewEntity/LogVRicEventiOrganiz.java | 61 +- .../viewEntity/LogVRicEventiOrganizId.java | 84 ++ .../viewEntity/LogVUsrAbilOrganiz.java | 64 +- .../viewEntity/LogVUsrAbilOrganizId.java | 84 ++ .../viewEntity/LogVVisEventoOggetto.java | 26 +- .../viewEntity/LogVVisEventoPrincTx.java | 24 +- .../sacerlog/viewEntity/LogVVisOggetto.java | 27 +- spagolite-sl-slg/pom.xml | 31 +- .../sacerlog/slite/gen/util/ParerTool.java | 26 +- .../gen/viewbean/AplVLogTiOggRowBean.java | 23 +- .../gen/viewbean/AplVLogTiOggTableBean.java | 26 +- .../viewbean/AplVLogTiOggTableDescriptor.java | 24 +- .../LogVLisAsserzioniDatiRowBean.java | 21 +- .../LogVLisAsserzioniDatiTableBean.java | 26 +- .../LogVLisAsserzioniDatiTableDescriptor.java | 24 +- .../viewbean/LogVLisEventoOggettoRowBean.java | 25 +- .../LogVLisEventoOggettoTableBean.java | 26 +- .../LogVLisEventoOggettoTableDescriptor.java | 23 +- .../gen/viewbean/LogVRicEventiRowBean.java | 23 +- .../gen/viewbean/LogVRicEventiTableBean.java | 28 +- .../LogVRicEventiTableDescriptor.java | 23 +- .../viewbean/LogVUsrAbilOrganizRowBean.java | 31 +- .../viewbean/LogVUsrAbilOrganizTableBean.java | 26 +- .../LogVUsrAbilOrganizTableDescriptor.java | 23 +- .../viewbean/LogVVisEventoPrincTxRowBean.java | 25 +- .../LogVVisEventoPrincTxTableBean.java | 26 +- .../LogVVisEventoPrincTxTableDescriptor.java | 24 +- .../gen/viewbean/LogVVisOggettoRowBean.java | 25 +- .../gen/viewbean/LogVVisOggettoTableBean.java | 26 +- .../LogVVisOggettoTableDescriptor.java | 23 +- .../resources/forms/GestioneLogEventi.xml | 1 + spagolite-sl-test/nbactions.xml | 32 + spagolite-sl-test/pom.xml | 21 +- .../src/test/java/prova/DummyTimerHelper.java | 17 + .../src/test/java/prova/EjbTest.java | 24 +- .../src/test/java/prova/LogEventoPippo.java | 21 +- .../src/test/java/prova/ProvaAuth.java | 30 +- .../test/java/prova/TestExportImportFoto.java | 237 ++-- .../src/test/java/prova/TestLogging.java | 848 +++++------- .../src/test/java/prova/TestLogging_1.java | 725 ++++------ .../src/test/java/prova/TestXml.java | 431 +++--- .../test/resources/META-INF/persistence.xml | 2 +- .../src/test/resources/jndi.properties | 20 +- spagolite-sl-web/pom.xml | 10 +- .../sacerlog/util/web/SpagoliteLogUtil.java | 20 +- .../web/action/GestioneLogEventiAction.java | 62 +- .../sacerlog/web/validator/TypeValidator.java | 27 + .../webapp/jsp/logEventi/DettaglioXml.jsp | 13 +- spagolite-timer-wrapper-common/pom.xml | 6 +- .../jboss/timer/common/CronSchedule.java | 17 + .../jboss/timer/common/JbossJobTimer.java | 18 + .../parer/jboss/timer/common/JobTable.java | 21 +- .../timer/common/entity/JobDefinition.java | 19 +- .../timer/common/entity/JobDefinition_.java | 46 + spagolite-timer-wrapper-ejb/pom.xml | 9 +- .../eng/parer/jboss/timer/MasterOfTimers.java | 28 +- .../exception/TimerNotFoundException.java | 17 + .../helper/AbstractJbossTimerHelper.java | 25 +- .../jboss/timer/helper/JbossTimerHelper.java | 27 +- .../jboss/timer/helper/package-info.java | 17 + .../JbossTimerNodeInterceptor.java | 25 +- .../JbossTimerResetStatusInterceptor.java | 25 +- .../JbossTimerStartInterceptor.java | 23 +- .../JbossTimerTimeoutInterceptor.java | 24 +- .../jboss/timer/interceptor/package-info.java | 17 + .../jboss/timer/service/JbossTimerEjb.java | 61 +- .../jboss/timer/service/package-info.java | 17 + spagolite-webresources/pom.xml | 17 +- .../security/baseSecurityContext.xml | 8 +- .../highlightjs.custom.css | 0 .../1.12.1/images/ui-icons_444444_256x240.png | Bin 6992 -> 0 bytes .../1.12.1/images/ui-icons_555555_256x240.png | Bin 6988 -> 0 bytes .../1.12.1/images/ui-icons_777620_256x240.png | Bin 4549 -> 0 bytes .../1.12.1/images/ui-icons_777777_256x240.png | Bin 6999 -> 0 bytes .../1.12.1/images/ui-icons_cc0000_256x240.png | Bin 4549 -> 0 bytes .../1.12.1/images/ui-icons_f5c20d_256x240.png | Bin 4549 -> 0 bytes .../1.12.1/images/ui-icons_ffffff_256x240.png | Bin 6299 -> 0 bytes .../jquery-ui-custom/1.12.1/jquery-ui.min.css | 7 - .../1.12.1/jquery-ui.structure.min.css | 5 - .../1.12.1/jquery-ui.theme.min.css | 5 - .../1.13.2/images/ui-icons_444444_256x240.png | Bin 0 -> 7142 bytes .../1.13.2/images/ui-icons_555555_256x240.png | Bin 0 -> 7126 bytes .../1.13.2/images/ui-icons_777620_256x240.png | Bin 0 -> 4670 bytes .../1.13.2/images/ui-icons_777777_256x240.png | Bin 0 -> 7163 bytes .../1.13.2/images/ui-icons_cc0000_256x240.png | Bin 0 -> 4670 bytes .../1.13.2/images/ui-icons_ffffff_256x240.png | Bin 0 -> 6539 bytes .../{1.12.1 => 1.13.2}/jquery-ui.css | 211 +-- .../jquery-ui-custom/1.13.2/jquery-ui.min.css | 7 + .../jquery-ui.structure.css | 182 +-- .../1.13.2/jquery-ui.structure.min.css | 12 + .../{1.12.1 => 1.13.2}/jquery-ui.theme.css | 27 +- .../1.13.2/jquery-ui.theme.min.css | 5 + .../src/main/webapp/css/external/README.txt | 1 + .../src/main/webapp/css/slForms.css | 74 +- .../src/main/webapp/img/external/README.txt | 1 + .../main/webapp/img/{regione => }/favicon.ico | Bin .../src/main/webapp/img/logos/logo1.png | Bin 0 -> 210 bytes .../src/main/webapp/img/logos/logo2.png | Bin 0 -> 192 bytes .../{regione/LogoIbc.png => logos/logo3.png} | Bin .../src/main/webapp/img/logos/logo_app.png | Bin 0 -> 665 bytes .../src/main/webapp/img/regione/LogoER.png | Bin 10279 -> 0 bytes .../src/main/webapp/img/regione/LogoParer.png | Bin 7446 -> 0 bytes .../src/main/webapp/js/sips/classes.js | 1213 +++++++++-------- .../src/main/webapp/js/sips/main.js | 3 + .../src/main/webapp/jsp/confirmDeletePage.jsp | 58 + .../src/main/webapp/jsp/genericError.jsp | 27 + .../main/webapp/jsp/login/idpSelection.jsp | 132 +- .../src/main/webapp/jsp/notAllowedError.jsp | 22 + 470 files changed, 16926 insertions(+), 5850 deletions(-) create mode 100644 .mvn/jvm.config create mode 100644 .mvn/wrapper/maven-wrapper.jar create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100644 LICENSE.txt create mode 100755 mvnw create mode 100644 mvnw.cmd create mode 100644 spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigProperties.java create mode 100644 spagolite-core/src/main/java/it/eng/spagoCore/util/CustomKeycloakFilter.java create mode 100644 spagolite-core/src/main/java/it/eng/spagoCore/util/JpaUtils.java create mode 100644 spagolite-core/src/main/java/it/eng/spagoCore/util/Oauth2Srvlt.java delete mode 100644 spagolite-core/src/main/java/it/eng/spagoCore/util/StringUtils.java create mode 100644 spagolite-hibernate-test/pom.xml create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/arquillian/Greeter.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ChildEntity.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ParentEntity.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/paginator/StatementInterceptor.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild2Entity.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild3Entity.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChildEntity.java create mode 100644 spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceEntity.java create mode 100644 spagolite-hibernate-test/src/main/resources/META-INF/MANIFEST.MF create mode 100644 spagolite-hibernate-test/src/main/resources/META-INF/ejb-jar.xml create mode 100644 spagolite-hibernate-test/src/main/resources/META-INF/persistence.xml create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/DummyTimerHelper.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/FakeAuth.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/PaginatorTests.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/SimplyEjb.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/arquillian/ArquillianTest.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/hibernate/lazyLoad/HibernateLazyLoadTests.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/CascadeMergeTests.java create mode 100644 spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/NonMonotonicSequenceGeneratorTests.java create mode 100644 spagolite-hibernate-test/src/test/resources/countselectlist.properties create mode 100644 spagolite-hibernate-test/src/test/resources/create.sql create mode 100644 spagolite-hibernate-test/src/test/resources/data.sql create mode 100644 spagolite-hibernate-test/src/test/resources/jndi.properties create mode 100644 spagolite-hibernate-test/transaction.log create mode 100644 spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListInterface.java create mode 100644 spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListReflectionBean.java create mode 100644 spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyQuery.java create mode 100644 spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/Param.java delete mode 100644 spagolite-middle/src/main/java/it/eng/spagoLite/util/MessageCodes.java delete mode 100644 spagolite-middle/src/main/resources/messages.properties create mode 100644 spagolite-middle/src/test/java/it/eng/spagolite/security/auth/TestPasswordUtil.java create mode 100644 spagolite-paginator-ejb/arquillian.xml create mode 100644 spagolite-paginator-ejb/pom.xml create mode 100644 spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java create mode 100644 spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java create mode 100644 spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyListHelper.java create mode 100644 spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyQuery.java create mode 100644 spagolite-paginator-ejb/src/main/java/it/eng/paginator/hibernate/OracleSqlInterceptor.java create mode 100644 spagolite-paginator-ejb/src/main/java/it/eng/sequences/hibernate/NonMonotonicSequenceGenerator.java create mode 100644 spagolite-paginator-ejb/src/main/resources/META-INF/MANIFEST.MF rename spagolite-paginator-gf/src/main/resources/ejb-jar-TEMPLATE.xml => spagolite-paginator-ejb/src/main/resources/META-INF/ejb-jar.xml (65%) create mode 100644 spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/NonMonotonicSequenceGeneratorTest.java create mode 100644 spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild2Entity.java create mode 100644 spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild3Entity.java create mode 100644 spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChildEntity.java create mode 100644 spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceEntity.java create mode 100644 spagolite-paginator-ejb/src/test/resources/org.hibernate.integrator.spi.Integrator create mode 100644 spagolite-paginator-ejb/src/test/resources/persistence.xml create mode 100644 spagolite-paginator-gf/arquillian.xml delete mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/CountQueryRedirector.java delete mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/ListSessionListener.java delete mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/InvokerLocal.java delete mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java delete mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java create mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/util/CriteriaQueryUtils.java create mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/util/HibernateUtils.java create mode 100644 spagolite-paginator-gf/src/main/java/it/eng/paginator/util/QueryUtils.java delete mode 100644 spagolite-paginator-gf/src/main/java/it/eng/sequences/eclipselink/NonMonotonicSequenceGenerator.java create mode 100644 spagolite-paginator-gf/src/test/java/it/eng/paginator/util/CriteriaQueryUtilsTest.java create mode 100644 spagolite-paginator-gf/src/test/java/it/eng/paginator/util/PigAmbienteVers.java create mode 100644 spagolite-paginator-gf/src/test/java/it/eng/paginator/util/QueryUtilsTest.java create mode 100644 spagolite-paginator-gf/src/test/resources/persistence.xml create mode 100644 spagolite-si-util/src/test/java/it/eng/integriam/client/ws/TestSoapClients.java create mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoLoginUser.java delete mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEventoXMLDataCustomizer.java create mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/constraint/ConstLogEventoLoginUser.java create mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigineId.java create mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiId.java create mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganizId.java create mode 100644 spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganizId.java create mode 100644 spagolite-sl-test/nbactions.xml create mode 100644 spagolite-timer-wrapper-common/src/main/java/it/eng/parer/jboss/timer/common/entity/JobDefinition_.java rename spagolite-webresources/src/main/webapp/css/custom/highlightjs/{9.15.10 => 11.5.0}/highlightjs.custom.css (100%) delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_444444_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_555555_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_777620_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_777777_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_cc0000_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_f5c20d_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/images/ui-icons_ffffff_256x240.png delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/jquery-ui.min.css delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/jquery-ui.structure.min.css delete mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.12.1/jquery-ui.theme.min.css create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/images/ui-icons_444444_256x240.png create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/images/ui-icons_555555_256x240.png create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/images/ui-icons_777620_256x240.png create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/images/ui-icons_777777_256x240.png create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/images/ui-icons_cc0000_256x240.png create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/images/ui-icons_ffffff_256x240.png rename spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/{1.12.1 => 1.13.2}/jquery-ui.css (90%) create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/jquery-ui.min.css rename spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/{1.12.1 => 1.13.2}/jquery-ui.structure.css (99%) create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/jquery-ui.structure.min.css rename spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/{1.12.1 => 1.13.2}/jquery-ui.theme.css (83%) create mode 100644 spagolite-webresources/src/main/webapp/css/custom/jquery-ui-custom/1.13.2/jquery-ui.theme.min.css create mode 100644 spagolite-webresources/src/main/webapp/css/external/README.txt create mode 100644 spagolite-webresources/src/main/webapp/img/external/README.txt rename spagolite-webresources/src/main/webapp/img/{regione => }/favicon.ico (100%) create mode 100644 spagolite-webresources/src/main/webapp/img/logos/logo1.png create mode 100644 spagolite-webresources/src/main/webapp/img/logos/logo2.png rename spagolite-webresources/src/main/webapp/img/{regione/LogoIbc.png => logos/logo3.png} (100%) create mode 100644 spagolite-webresources/src/main/webapp/img/logos/logo_app.png delete mode 100644 spagolite-webresources/src/main/webapp/img/regione/LogoER.png delete mode 100644 spagolite-webresources/src/main/webapp/img/regione/LogoParer.png create mode 100644 spagolite-webresources/src/main/webapp/jsp/confirmDeletePage.jsp create mode 100644 spagolite-webresources/src/main/webapp/jsp/genericError.jsp create mode 100644 spagolite-webresources/src/main/webapp/jsp/notAllowedError.jsp diff --git a/.gitignore b/.gitignore index e91c4dd..61bd299 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,13 @@ /**/.project /**/.classpath /**/.metadata +/**/*.iml +**/.idea +/spagolite-paginator-gf/nbproject/ /nbactions.xml +/**/xaDiskHome/ /**/nbproject .idea/ **/*.iml .vscode/ -spagolite-paginator-gf/.settings/org.eclipse.core.resources.prefs \ No newline at end of file +spagolite-paginator-gf/.settings/org.eclipse.core.resources.prefs diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 0000000..e69de29 diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..bf82ff01c6cdae4a1bb754a6e062954d77ac5c11 GIT binary patch literal 59925 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

dy!05UMhSKsK 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 VCNKd3JGtOvEm(5t0lFyE{{i--k}m)N literal 0 HcmV?d00001 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..3005215 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/CHANGELOG.md b/CHANGELOG.md index 8336a1e..78a24cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,54 @@ +## 4.11.0 (01-08-2023) + + +## 4.10.0 (13-07-2023) + + +## 4.9.0 (19-06-2023) + +### Novità: 1 +- [#29501](https://parermine.regione.emilia-romagna.it/issues/29501) Rimozione totale delle tracce degli accessi agli applicativi più vecchie di un anno + +## 4.8.0 (01-06-2023) + +### Novità: 1 +- [#29686](https://parermine.regione.emilia-romagna.it/issues/29686) Autenticazione tramite OAUTH2 per il servizio di annullamento + +## 4.7.0 (31-05-2023) + +### Novità: 1 +- [#22913](https://parermine.regione.emilia-romagna.it/issues/22913) Logging accessi SPID non autorizzati +## 4.6.0 (21-04-2023) + +### Novità: 1 +- [#18340](https://parermine.regione.emilia-romagna.it/issues/18340) Creazione pacchetti unici delle applicazioni del parer + +## 4.5.0 (20-02-2023) + +### Novità: 1 +- [#22913](https://parermine.regione.emilia-romagna.it/issues/22913) Logging accessi SPID non autorizzati +## 4.4.0 (01-02-2023) + + +## 4.3.1 (08-11-2022) + +### Novità: 1 +- [#27945](https://parermine.regione.emilia-romagna.it/issues/27945) Modifica lettura CIG per estrazione righe per fatture + +## 4.3.0 (20-10-2022) + +### Novità: 2 +- [#27750](https://parermine.regione.emilia-romagna.it/issues/27750) Aggiornamento framework javascript (JQuery) e di alcuni plugin +- [#27393](https://parermine.regione.emilia-romagna.it/issues/27393) Analisi librerie obsolete 2022 - branch hibernate + +## 4.2.29 (14-09-2022) + +### Bugfix: 1 +- [#27675](https://parermine.regione.emilia-romagna.it/issues/27675) Correzione di un errore nella gestione della cancellazione da lista + +## 4.2.28 (09-09-2022) + ## 4.1.27 (18-07-2022) ### Bugfix: 1 @@ -9,36 +59,100 @@ ### Novità: 1 - [#27367](https://parermine.regione.emilia-romagna.it/issues/27367) allineamento del framework 4.1.6 versione non hibernate alla versione 4.2.6 hibernae +## 4.2.26 (21-06-2022) + +### Bugfix: 1 +- [#27364](https://parermine.regione.emilia-romagna.it/issues/27364) Risoluzione Errore critico di funzionalità da "Visualizza dettaglio transazione" dal log eventi in dettaglio ente non convenzionato + +### Novità: 2 +- [#27366](https://parermine.regione.emilia-romagna.it/issues/27366) Nuova pagina gestione JOB +- [#27365](https://parermine.regione.emilia-romagna.it/issues/27365) Integrazione della gestione di SPID della Puglia nell'attuale gestione SPID in RER + +## 4.2.25 (28-03-2022) + +### Novità: 1 +- [#27012](https://parermine.regione.emilia-romagna.it/issues/27012) Aggiornamento librerie: BouncyCastle JCE/Varie + ## 4.1.25 (24-03-2022) ### Novità: 1 - [#26717](https://parermine.regione.emilia-romagna.it/issues/26717) Aggiornamento librerie: BouncyCastle JCE/Varie +## 4.2.24 (10-02-2022) + +### Novità: 1 +- [#26660](https://parermine.regione.emilia-romagna.it/issues/26660) aggiornamento librerie obsolete primo quadrimestre 2021 + ## 4.1.24 ### Novità: 1 - [#26661](https://parermine.regione.emilia-romagna.it/issues/26661) aggiornamento librerie obsolete primo quadrimestre 2021 +## 4.2.23 + +### Novità: 1 +- [#26702](https://parermine.regione.emilia-romagna.it/issues/26702) Gestione accordi: introduzione nuova pagina di ricerca + ## 4.1.23 ### Novità: 1 - [#26465](https://parermine.regione.emilia-romagna.it/issues/26465) Aggiunto tooltip per fornire indicazioni per compilazione campi di tipo input - textarea - checkbox +## 4.2.22 + +### Novità: 1 +- [#26294](https://redmine.ente.regione.emr.it/issues/26294) Autenticazione sui web services di recupero con certificato client + ## 4.1.22 ### Novità: 1 - [#26293](https://parermine.regione.emilia-romagna.it/issues/26293) Autenticazione sui web services di recupero con certificato client +## 4.2.21 (27-10-2021) + +### Bugfix: 1 +- [#26131](https://redmine.ente.regione.emr.it/issues/26131) Correzione errore login con livello 2 e 3 di SPID + +## 4.2.20 (25-10-2021) + +### Bugfix: 1 +- [#26108](https://redmine.ente.regione.emr.it/issues/26108) Sostiuzione del messaggio di caricamento con un loader overlay +## 4.2.19 + +### Novità: 1 +- [#26070](https://redmine.ente.regione.emr.it/issues/26070) Aggiornamento link di default del logo PARER + +### Novità: 1 +- [#26070](https://redmine.ente.regione.emr.it/issues/26070) Aggiornamento link di default del logo PARER + +## 4.2.18 (06-10-2021) + +### Bugfix: 1 +- [#26002](https://redmine.ente.regione.emr.it/issues/26002) Correzione gestione proprieta di sistema relativa al livello di autenticazione spid + ## 4.1.18 ### Bugfix: 1 - [#26171](https://parermine.regione.emilia-romagna.it/issues/26171) Correzione gestione proprietà di sistema relativa al livello di autenticazione SPID +## 4.2.17 + +### Novità: 1 +- [#25771](https://redmine.ente.regione.emr.it/issues/25771) Modifica per la gestione di diversi livelli di accesso con credenziali SPID + ## 4.1.17 (21-10-2021) ### Bugfix: 1 - [#26101](https://parermine.regione.emilia-romagna.it/issues/26101) Introduzione livelli accesso spid +## 4.2.16 + +### Bugfix: 1 +- [#25304](https://redmine.ente.regione.emr.it/issues/25304) risoluzione lettura parametri all'interno della combo box con ricerca incrementale. + +### Novità: 1 +- [#25475](https://redmine.ente.regione.emr.it/issues/25475) Associazione utente SPID con anagrafica utenti + ## 4.1.16 ### Novità: 1 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..be3f7b2 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/README.md b/README.md index 996365e..cc7a9f3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,158 @@ -# Framework SPAGO +# Framework SpagoLite -Framework front-end spago versione "lite" modificata opportunamente rispetto l'originale nota come "fat". +Fonte template redazione documento: https://www.makeareadme.com/. -Contiene al suo interno la gestione delle dipendenze e risorse web (processo di overlay), utilizzate dai progetti web di PARER. +# Descrizione + +Il seguente progetto è utilizzato come **dipendenza** interna. +Lo scopo è quello di definire un vero e proprio framework basato su modello MVC (Model View Control) con il quale è quindi possibile definire le modalità di interazione client-server per l'implementazioni di applicazion Web (con front-end / UI). + +# Installazione + +Come già specificato nel paragrafo precedente [Descrizione](# Descrizione) si tratta di un progetto di tipo "libreria", quindi un modulo applicativo utilizzato attraverso la definzione della dipendenza Maven secondo lo standard previsto (https://maven.apache.org/): + +```xml + + it.eng.parer + spagofat + 4.11.0 + pom + import + +``` + +# Utilizzo + +Il framework Spagolite, nasce con l'idea di realizzare un set di moduli (e relative dipendenze) per "standardizzare" e "personalizzare" sviluppi legati ad applicazioni con front-end basate sul modello MVC (Model View Control) che eredita design pattern già noti da framework esistenti come Struts e Spring. +Lo scopo è quello di definire un vero e proprio framework con il quale le applicazioni web che prevedono front-end (e.g. Sacer), possono definire le modalità di interazione client-server, ereditare il set di librerie standard previsto dalla logica, le risore statiche previste per la definizione di stili, javascript, immagini e molto altro, attraverdso delle implementazioni standard con le quali si definisce l'intero processo. + + +## Personalizzazioni interfaccia web (e parametri applicativi) + +Esiste una apposita servlet [ConfigServlet.java](spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigServlet.java) che permette di definire alcune configurazioni legate ad elementi personalizzabili dell'interfaccia grafica (loghi, stili, ecc.) con la quale si possono inoltre modificare parametri applicativi esistenti che sono legati a processi server-side (timeout, URI webservice, ecc.). +Di seguito viene riportata una tabella riepilogativa. + +| Nome parametro| Descrizione| Valore predefinito | +|------------------------|--------------------------------------------------------------------|--------------------| +| *disableSecurity* | Permette di disabilitare i controlli di sicurezza tra le varie pagine. | **false** | +| *enableLazySort* | Abilita la possibilità di ordinare le colonne delle liste. | **true** | +| *debugAuthorization* | Debug sulle informazioni relative all'autorizzazione degli utenti.| **false** | +| *logoApp_absolutePath* | Percorso assoluto del logo dell'applicazione. Se configurato sovrascrive l'utilizzo del percorso relativo. | | +| *logoApp_relativePath* | Percorso relativo del logo dell'applicazione. | **/img/logos/logo_app.png** | +| *logoApp_alt* | Nome alternativo del logo dell'applicazione (se non viene trovata l'immagine). | | +| *logoApp_url* | Pagina web associata al logo dell'applicazione. | | +| *logoApp_title* | Title per il logo dell'applicazione. | | +| *logo1_absolutePath* | Percorso assoluto del "logo 1". Se configurato sovrascrive l'utilizzo del percorso relativo. | | +| *logo1_relativePath* | Percorso relativo del "logo 1". | **/img/logos/logo1.png** | +| *logo1_alt* | Nome alternativo del "logo 1" (se non viene trovata l'immagine). | | +| *logo1_url* | Pagina web associata al "logo 1". | | +| *logo1_title* | Title per il "logo 1". | | +| *logo2_absolutePath* | Percorso assoluto del "logo 2". Se configurato sovrascrive l'utilizzo del percorso relativo. | | +| *logo2_relativePath* | Percorso relativo del "logo 2". | **/img/logs/logo2.png** | +| *logo2_alt* | Nome alternativo del "logo 2" (se non viene trovata l'immagine). | | +| *logo2_url* | Pagina web associata al "logo 2". | | +| *logo2_title* | Title per il "logo 2". | | +| *logo3_absolutePath* | Percorso assoluto del "logo 3". Se configurato sovrascrive l'utilizzo del percorso relativo. | | +| *logo3_relativePath* | Percorso relativo del "logo 3". | **/img/logos/logo3.png** | +| *logo3_alt* | Nome alternativo del "logo 3" (se non viene trovata l'immagine). | | +| *logo3_url* | Pagina web associata al "logo 3". | | +| *logo3_title* | Title per il "logo 3". | | +| *favicon_absolutePath* | Percorso assoluto della favicon. Se configurato sovrascrive l'utilizzo del percorso relativo. | | +| *favicon_relativePath* | Percorso relativo della favicon. | **/img/logos/favicon.ico** | +| *cssover_absolutePath* | Percorso assoluto dell'overlay sui css. Se configurato sovrascrive l'utilizzo del percorso relativo. | | +| *cssover_relativePath* | Percorso relativo dell'overlay sui css. | **/css/slForms-over.css** | +| *titolo_applicativo* | Titolo (title html) dell'applicazione. | **Titolo Applicazione** | +| *ambiente_deploy* | Ambiente su cui viene effettuato il deploy dell'applicazione | | +| *enableHelpOnline* | Abilita l'help online. | **false** | + + +Oltre alle risorse statiche con le quali è possibile, per ambiente, customizzare l'aspetto grafico delle singoli applicazioni, vengono introdotti alcuni parametri che riguardano le configurazioni legate ad alcuni WS Rest esposti dalle stesse, attraverso tali parametri è quindi possibile "personalizzare" alcuni valori da essi utilizzati. +Si riporta nella seguente tabelle di quali parametri è possibile modificare il valore (con "null" si intende nessun valore impostato di default): + +| Nome parametro| Descrizione| Valore predefinito | +|------------------------|--------------------------------------------------------------------|--------------------| +| *ws.instanceName* | Nome istanza. | **minefield** | +| *ws.upload.directory* | Directory su cui si effettua l'upload dei file raw presenti sulla chiamata multipart/form-data. | **/tmp** | +| *versamentoSync.saveLogSession* | Versamento sicrono unità documentaria: abilitazione dei log di sessione. | **true** | +| *versamentoSync.maxRequestSize* | Versamento sicrono unità documentaria: dimensione massima della richiesta multipart/form-data in byte. | **1000000000** (1 Gbyte) | +| *versamentoSync.maxFileSize* | Versamento sicrono unità documentaria: dimensione massima del singolo file presente su richiesta multipart/form-data in byte. | **1000000000** (1 Gbyte) | +| *aggAllegati.saveLogSession* | Aggiunta documento: abilitazione dei log di sessione. | **false** | +| *aggAllegati.maxRequestSize* | Aggiunta documento: dimensione massima della richiesta multipart/form-data in byte. | **1000000000** (1 Gbyte) | +| *aggAllegati.maxFileSize* | Aggiunta documento: dimensione massima del singolo file presente su richiesta multipart/form-data in byte. | **1000000000** (1 Gbyte) | +| *profilerApp.upload.directory* | Applicazione profile: directory su cui si effettua l'upload dei file raw presenti sulla chiamata multipart/form-data. | **/tmp** | +| *profilerApp.maxRequestSize* | Applicazione profile:dimensione massima della richiesta multipart/form-data in byte. | **1000000000** (1 Gbyte) | +| *profilerApp.maxFileSize* | Applicazione profile: dimensione massima del singolo file presente su richiesta multipart/form-data in byte.| **10000000** (10 Mbyte) | +| *profilerApp.charset* | Applicazione profile: charset di riferimento. | **UTF-8** | +| *recuperoSync.saveLogSession* | Servizi di recupero: abilitazione dei log di sessione. | **false** | +| *recuperoSync.maxResponseSize* | Servizi di recupero: dimensione massima della risposta restituida dal servizio in byte. | **20000000** (20 Mbyte) | +| *recuperoSync.maxFileSize* | Servizi di recupero: dimensione massima del singolo file presente su richiesta multipart/form-data in byte. | **20000000** (20 Mbyte) | +| *loadXsdApp.upload.directory* | Caricamento modello XSD: directory su cui si effettua l'upload dei file. | **/tmp** | +| *loadXsdApp.maxRequestSize* | Caricamento modello XSD: dimensiome massima della richiesta. | **1000000000** (1 Gbyte) | +| *loadXsdApp.maxFileSize* | Caricamento modello XSD: dimensiome massima del file xsd caricato. | **10000000** (1 Mbyte) | +| *loadXsdApp.charset* | Caricamento modello XSD: charset di riferimento. | **UTF-8** | +| *moduloInformazioni.upload.maxFileSize* | Modulo Informazioni: dimensiome massima del file caricato. | **10000000** (1 Mbyte) | +| *helpOnline.upload.maxFileSize* | Help Online: dimensiome massima del file caricato. | **10000000** (1 Mbyte) | +| *variazioneAccordo.upload.maxFileSize* | Variazione Accordo: dimensiome massima del file caricato. | **10000000** (1 Mbyte) | +| *disciplinareTecnico.upload.maxFileSize* | Disciplinare Tecnico: dimensiome massima del file caricato. | **10000000** (1 Mbyte) | +| *importVersatore.upload.maxFileSize* | Import Versatore: dimensiome massima del file caricato. | **10000000** (1 Mbyte) | +| *parameters.csv.maxFileSize* | Parametri CSV: dimensiome massima del file caricato. | **10000000** (1 Mbyte) | +| *serverName.property* | Property di sistema per identificare il nome del server/nodo (e.s. su Jboss identificato con il valore jboss.node.name). | jboss.node.name | +| *uri.versamentoSync* | URI API versamento sincrono unità documentaria. | | + + +Nota: alcune delle property sopra elencate sono il frutto di un censimento "globale" che non trovo però sempre applicazione, alcune di essere sono infatti da ritenersi non più utilizzate (vedi ~~non utilizzata~~). + +La logica con cui vengono letti e configurati i parametri d'inizializzazione è la seguente: + +1. il parametro è presente sul web.xml; +2. è presente un parametro dal nome ```applicazione-nome_parametro``` sulle proprietà di sistema; +3. è presente un parametro dal nome ```nome_parametro``` sulle proprietà di sistema; +4. viene utilizzato un valore predefinito per il parametro. + +Nel caso in cui si ricada in uno dei casi sopracitati, tutti gli altri non vengono valutati. + +Le risorse con un percorso assoluto non vengono referenziate sull'HTML delle pagine come risorse esterne ma vengono **incluse** nell'applicazione a **deploy time**. +In particolare: + + * il logo dell'applicazione (*logoApp_absolutePath*) sarà disponibile all'applicazione al percorso `/img/external/logo_app.png` + * il logo in alto a destra (*logo1_absolutePath*) sarà disponibile all'applicazione al percorso `/img/external/logo1.png` + * il logo in basso a sinistra (*logo2_absolutePath*) sarà disponibile all'applicazione al percorso `/img/external/logo2.png` + * il logo in basso a destra (*logo3_absolutePath*) sarà disponibile all'applicazione al percorso `/img/external/logo3.png` + * la favicon (*favicon_absolutePath*) sarà disponibile all'applicazione al percorso `/img/external/favicon.ico` + * la sovrascrittura stili CSS (*cssover_absolutePath*) sarà disponibile all'applicazione al percorso `/css/external/slForms-over.css` + +Tali risorse devono essere espresse come URL e possono referenziare indirizzi remoti oppure file. Ecco un esempio: + * logo1_absolutePath: `https://parer.pages.ente.regione.emr.it/risorse-statiche/parer-svil/sacer/img/logo_sacer_small.png` + * logo1_absolutePath: `file:///opt/jbosseap/images/logo_sacer_small.png` + +Siccome le risorse vengono caricate all'interno dell'applicazione non è necessario che siano esposte esternamente. Questo significa che anche per ambienti esposti su internet i loghi possono essere registrati su percorsi interni alle rete dell'application server. + +Disposizione dei loghi all'interno della pagina: + +``` +,--------------------------------------. +|logo applicazione | | logo 1 | +|------------------' '--------| +| | +| | +| | +| | +|-------, ,--------| +|logo 2 | | logo 3 | +`--------------------------------------' +``` +# Supporto + +Progetto a cura di [Engineering Ingegneria Informatica S.p.A.](https://www.eng.it/). + +# Contributi + +Se interessati a crontribuire alla crescita del progetto potete scrivere all'indirizzo email areasviluppoparer@regione.emilia-romagna.it. + +# Autori + +Proprietà intellettuale del progetto di [Regione Emilia-Romagna](https://www.regione.emilia-romagna.it/) e [Polo Archivisitico](https://poloarchivistico.regione.emilia-romagna.it/). + +# Licenza + +Questo progetto è rilasciato sotto licenza GNU Affero General Public License v3.0 or later ([LICENSE.txt](LICENSE.txt)). diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 36490ed..15e2fb9 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,4 +1,2 @@ -## 4.1.27 (18-07-2022) +## 4.11.0 (01-08-2023) -### Bugfix: 1 -- [#27444](https://parermine.regione.emilia-romagna.it/issues/27444) Correzione visualizzazione dettaglio differenze negative in Esame Consistenza Sacer diff --git a/mvnw b/mvnw new file mode 100755 index 0000000..b7f0646 --- /dev/null +++ b/mvnw @@ -0,0 +1,287 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.1.1 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + printf '%s' "$(cd "$basedir"; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname $0)") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $wrapperUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + QUIET="--quiet" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + QUIET="" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" + fi + [ $? -eq 0 ] || rm -f "$wrapperJarPath" + elif command -v curl > /dev/null; then + QUIET="--silent" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + QUIET="" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L + fi + [ $? -eq 0 ] || rm -f "$wrapperJarPath" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=`cygpath --path --windows "$javaSource"` + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..cba1f04 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,187 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.1.1 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index faa626a..81e671b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,8 +1,7 @@ 4.0.0 - it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT pom Spagolite Framework utilizzato dalle applicazioni web, si tratta di uno strato software comune contenente anche le dipendenze di terze parti ed ereditato come bom. @@ -11,27 +10,19 @@ it.eng.parer parer-pom - 3.0.16 + 4.2.0 - + - scm:git:https://github.com/RegioneER/parer.sacer.framework.git + scm:git:https://github.com/RegioneER/parer-framework-spagolite.git HEAD github - https://maven.pkg.github.com/RegioneER/parer.sacer.parent - - - pentaho - https://public.nexus.pentaho.org/content/groups/omni - - - central - https://repo1.maven.org/maven2 - + https://maven.pkg.github.com/RegioneER/parer-framework-parerpom + @@ -39,14 +30,22 @@ true ${project.version} + + 5.3.20.Final-redhat-00001 + 6.0.22.Final-redhat-00002 + 5.6.14.Final-redhat-00001 + 2.1.3.redhat-00001 + 21.1.1 + 1.4.01 + 3.1.0 - 3.4.1 - 1.12.1 + 3.6.4 + 1.13.2 3.3.8 1.8.7 4.0.13 - 4.7.0 - 9.15.10 + 6.4.0 + 11.5.0 2.7.0 0.0.5 @@ -72,6 +71,13 @@ war runtime + + it.eng.parer + spagofat-paginator-ejb + ${project.version} + ejb + + it.eng.parer spagofat-paginator-gf @@ -230,10 +236,6 @@ xml-resolver xml-resolver - - xml-resolver - xml-resolver - org.bouncycastle bcprov-jdk15on @@ -253,11 +255,6 @@ - - log4j - log4j - ${log4j.version} - org.slf4j slf4j-api @@ -309,11 +306,17 @@ org.jboss.spec - jboss-javaee-6.0 + jboss-jakartaee-8.0 pom - ${jboss-javaee-6.0.version} + ${jboss-jakartaee-8.0.version} + + + org.jboss.bom + jboss-eap-jakartaee8-with-tools + ${jboss-eap-jakartaee8-with-tools.version} + pom + import - org.apache.commons @@ -331,23 +334,32 @@ ${commons-net.version} - + - org.glassfish.main.persistence - eclipselink-wrapper - ${eclipselink-wrapper.version} - pom + org.hibernate + hibernate-core + ${hibernate-core-version} + provided - org.eclipse.persistence - eclipselink - ${eclipselink.version} + org.hibernate + hibernate-entitymanager + ${hibernate-core-version} + provided - org.bouncycastle - bcprov-jdk15on - ${bcprov-jdk15on.version} + org.hibernate.validator + hibernate-validator + provided + ${hibernate-validator-version} + + org.hibernate + hibernate-jpamodelgen + ${hibernate-jpamodelgen-version} + provided + + org.codehaus.jettison @@ -364,6 +376,7 @@ org.dom4j dom4j ${dom4j.version} + provided xml-apis @@ -413,7 +426,6 @@ commons-text ${commons-text.version} - org.owasp.esapi @@ -440,19 +452,13 @@ jquery-ui ${jquery-ui.version} - - org.webjars - jquery-ui-themes - ${jquery-ui.version} - runtime - org.webjars jstree ${jstree.version} - org.webjars + org.webjars.bower chosen ${chosen.version} @@ -472,7 +478,7 @@ ${highlightjs-line-numbers.js.version} - org.webjars.bower + org.webjars font-awesome ${font-awesome.version} @@ -483,23 +489,31 @@ - com.fasterxml.uuid - java-uuid-generator - ${java-uuid-generator.version} - - - com.fasterxml.jackson.core - jackson-databind - ${jackson-databind.version} - + org.keycloak + keycloak-servlet-filter-adapter + ${keycloak-filter.version} + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + it.eng.spagoLite.spagoLite.*:it.eng.spagoLite.xmlbean.*:it.eng.integriam.* + + + + spagolite-core spagolite-middle spagolite-webresources spagolite-paginator-gf + spagolite-paginator-ejb spagolite-si-server spagolite-si-client diff --git a/spagolite-core/pom.xml b/spagolite-core/pom.xml index b2909e9..7e8758f 100644 --- a/spagolite-core/pom.xml +++ b/spagolite-core/pom.xml @@ -8,7 +8,7 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT @@ -31,18 +31,23 @@ org.slf4j slf4j-api - - - com.fasterxml.uuid - java-uuid-generator - org.apache.commons - commons-lang3 + org.apache.commons + commons-lang3 com.fasterxml.jackson.core jackson-databind + + org.hibernate + hibernate-core + provided + + + org.keycloak + keycloak-servlet-filter-adapter + diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigProperties.java b/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigProperties.java new file mode 100644 index 0000000..6b90a42 --- /dev/null +++ b/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigProperties.java @@ -0,0 +1,183 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.spagoCore.configuration; + +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.commons.lang3.StringUtils; + +public class ConfigProperties { + + // Valori predefiniti. + + private static final String LOGOS_BASE_DIR = "/img/logos"; + private static final String IMG_EXT_BASE_DIR = "/img/external"; + private static final String ONEGB = "1000000000"; + private static final String ONEMB = "10000000"; + private static final String TWENTYMB = "20000000"; + + // Percorsi interni su cui verranno mappate le risorse esterne + + private static final String LOGO_APP_PATH_FROM_EXT = IMG_EXT_BASE_DIR + "/logo_app.png"; + private static final String LOGO_1_PATH_FROM_EXT = IMG_EXT_BASE_DIR + "/logo1.png"; + private static final String LOGO_2_PATH_FROM_EXT = IMG_EXT_BASE_DIR + "/logo2.png"; + private static final String LOGO_3_PATH_FROM_EXT = IMG_EXT_BASE_DIR + "/logo3.png"; + private static final String FAV_ICON_PATH_FROM_EXT = IMG_EXT_BASE_DIR + "/favicon.ico"; + private static final String CSS_OVER_PATH_FROM_EXT = "/css/external/slForms-over.css"; + + public enum StandardProperty { + + DISABLE_SECURITY("disableSecurity", Boolean.FALSE.toString()), + ENABLE_LAZY_SORT("enableLazySort", Boolean.TRUE.toString()), + DEBUG_AUTHORIZATION("debugAuthorization", Boolean.FALSE.toString()), + LOGO_APP_ALT("logoApp_alt", StringUtils.EMPTY), LOGO_APP_URL("logoApp_url", StringUtils.EMPTY), + LOGO_APP_TITLE("logoApp_title", StringUtils.EMPTY), LOGO_1_ALT("logo1_alt", StringUtils.EMPTY), + LOGO_1_URL("logo1_url", StringUtils.EMPTY), LOGO_1_TITLE("logo1_title", StringUtils.EMPTY), + LOGO_2_ALT("logo2_alt", StringUtils.EMPTY), LOGO_2_URL("logo2_url", StringUtils.EMPTY), + LOGO_2_TITLE("logo2_title", StringUtils.EMPTY), LOGO_3_ALT("logo3_alt", StringUtils.EMPTY), + LOGO_3_URL("logo3_url", StringUtils.EMPTY), LOGO_3_TITLE("logo3_title", StringUtils.EMPTY), + TITOLO_APPLICATIVO("titolo_applicativo", "Titolo Applicazione"), AMBIENTE("ambiente_deploy", StringUtils.EMPTY), + ENABLE_HELP_ONLINE("enableHelpOnline", Boolean.FALSE.toString()), + WS_INSTANCE_NAME("ws.instanceName", "minefield"), + WS_STAGING_UPLOAD_DIR("ws.upload.directory", System.getProperty("java.io.tmpdir")), + VERSAMENTO_SYNC_SAVE_LOG_SESSION("versamentoSync.saveLogSession", Boolean.TRUE.toString()), + VERSAMENTO_SYNC_MAX_REQUEST_SIZE("versamentoSync.maxRequestSize", ONEGB), + VERSAMENTO_SYNC_MAX_FILE_SIZE("versamentoSync.maxFileSize", ONEGB), + AGG_ALLEGATI_SAVE_LOG_SESSION("aggAllegati.saveLogSession", Boolean.TRUE.toString()), + AGG_ALLEGATI_MAX_REQUEST_SIZE("aggAllegati.maxRequestSize", ONEGB), + AGG_ALLEGATI_MAX_FILE_SIZE("aggAllegati.maxFileSize", ONEGB), + PROFILER_APP_UPLOAD_DIR("profilerApp.upload.directory", System.getProperty("java.io.tmpdir")), + PROFILER_APP_MAX_REQUEST_SIZE("profilerApp.maxRequestSize", ONEGB), + PROFILER_APP_MAX_FILE_SIZE("profilerApp.maxFileSize", ONEMB), + PROFILER_APP_CHARSET("profilerApp.charset", StandardCharsets.UTF_8.name()), + RECUPERO_SYNC_SAVE_LOG_SESSION("recuperoSync.saveLogSession", Boolean.FALSE.toString()), + RECUPERO_SYNC_MAX_RESPONSE_SIZE("recuperoSync.maxResponseSize", TWENTYMB), + RECUPERO_SYNC_MAX_FILE_SIZE("recuperoSync.maxFileSize", TWENTYMB), + LOAD_XSD_APP_UPLOAD_DIR("loadXsdApp.upload.directory", System.getProperty("java.io.tmpdir")), + LOAD_XSD_APP_MAX_REQUEST_SIZE("loadXsdApp.maxRequestSize", ONEGB), + LOAD_XSD_APP_MAX_FILE_SIZE("loadXsdApp.maxFileSize", ONEMB), + LOAD_XSD_APP_CHARSET("loadXsdApp.charset", StandardCharsets.UTF_8.name()), + HELP_ONLINE_MAX_FILE_SIZE("helpOnline.upload.maxFileSize", ONEMB), + MODULO_INFORMAZIONI_MAX_FILE_SIZE("moduloInformazioni.upload.maxFileSize", ONEMB), + VARIAZIONE_ACCORDO_MAX_FILE_SIZE("variazioneAccordo.upload.maxFileSize", ONEMB), + DISCIPLINARE_TECNICO_MAX_FILE_SIZE("disciplinareTecnico.upload.maxFileSize", ONEMB), + IMPORT_VERSATORE_MAX_FILE_SIZE("importVersatore.upload.maxFileSize", ONEMB), + PARAMS_CSV_MAX_FILE_SIZE("parameters.csv.maxFileSize", ONEMB), + SERVER_NAME_PROPERTY("serverName.property", "jboss.node.name"), + URI_VERSMENTO_SYNC("uri.versamentoSync", StringUtils.EMPTY); + + private final String propName; + private final String propDefaultValue; + + private StandardProperty(String propName, String propDefaultValue) { + this.propName = propName; + this.propDefaultValue = propDefaultValue; + } + + public String getPropName() { + return propName; + } + + public String getPropDefaultValue() { + return propDefaultValue; + } + + public static String[] toList() { + return Stream.of(ConfigProperties.StandardProperty.values()).map(StandardProperty::getPropName) + .toArray(String[]::new); + } + + @Override + public String toString() { + return Stream.of(toList()).collect(Collectors.joining(",")); + } + + } + + public enum URIProperty { + + LOGO_APP_RELATIVE("logoApp_absolutePath", StringUtils.EMPTY, "logoApp_relativePath", + LOGOS_BASE_DIR + "/logo_app.png", LOGO_APP_PATH_FROM_EXT), + LOGO_1_RELATIVE("logo1_absolutePath", StringUtils.EMPTY, "logo1_relativePath", LOGOS_BASE_DIR + "/logo1.png", + LOGO_1_PATH_FROM_EXT), + LOGO_2_RELATIVE("logo2_absolutePath", StringUtils.EMPTY, "logo2_relativePath", LOGOS_BASE_DIR + "/logo2.png", + LOGO_2_PATH_FROM_EXT), + LOGO_3_RELATIVE("logo3_absolutePath", StringUtils.EMPTY, "logo3_relativePath", LOGOS_BASE_DIR + "/logo3.png", + LOGO_3_PATH_FROM_EXT), + FAV_ICON_RELATIVE("favicon_absolutePath", StringUtils.EMPTY, "favicon_relativePath", "/img/favicon.ico", + FAV_ICON_PATH_FROM_EXT), + CSS_OVER_RELATIVE("cssover_absolutePath", StringUtils.EMPTY, "cssover_relativePath", "/css/slForms-over.css", + CSS_OVER_PATH_FROM_EXT); + + private final String propAbsolutePathName; + private final String propAbsoluteDefaultValue; + private final String propRelativePathName; + private final String propRelativeDefaultValue; + private final String destination; + + private URIProperty(String propAbsolutePathName, String propAbsoluteDefaultValue, String propRelativePathName, + String propRelativeDefaultValue, String destination) { + this.propAbsolutePathName = propAbsolutePathName; + this.propAbsoluteDefaultValue = propAbsoluteDefaultValue; + this.propRelativePathName = propRelativePathName; + this.propRelativeDefaultValue = propRelativeDefaultValue; + this.destination = destination; + } + + public String getPropAbsolutePathName() { + return propAbsolutePathName; + } + + public String getPropAbsoluteDefaultValue() { + return propAbsoluteDefaultValue; + } + + public String getPropRelativePathName() { + return propRelativePathName; + } + + public String getPropRelativeDefaultValue() { + return propRelativeDefaultValue; + } + + public String getDestination() { + return destination; + } + + public static String[] toList() { + return Stream + .concat(Arrays.asList(URIProperty.values()).stream().map(URIProperty::getPropAbsolutePathName), + Arrays.asList(URIProperty.values()).stream().map(URIProperty::getPropRelativePathName)) + .toArray(String[]::new); + } + + @Override + public String toString() { + return Stream.of(toList()).collect(Collectors.joining(",")); + + } + + } +} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigServlet.java b/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigServlet.java index 2022592..b325001 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigServlet.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigServlet.java @@ -1,193 +1,273 @@ -/** - - Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. - - This file is part of Spago. - - Spago is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - any later version. - - Spago is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with Spago; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ - **/ package it.eng.spagoCore.configuration; -import java.io.FileNotFoundException; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; + import java.io.IOException; import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; +import java.util.stream.Stream; + import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; -/* - * DATE CONTRIBUTOR/DEVELOPER NOTE - * 13-12-2004 Butano Se afRootPath == null chiamta a getResourcesAsStream() - **/ +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Servlet di configurazione di SpagoLite. + * + * Supporta i parametri di configurazione definiti dalle costanti sottostanti. + */ public class ConfigServlet extends HttpServlet { private static final long serialVersionUID = 1L; + private static final Logger LOGGER = LoggerFactory.getLogger(ConfigServlet.class.getName()); - /** - * Oggetto che permette di leggere la configurazione tramite il contesto della servlet, indispensabile se - * l'applicazione viene rilasciata sotto forma di WAR che non viene espanso. - */ - // class StreamCreatorConfiguration implements IConfigurationCreator { - // - // public InputStream getInputStream(String resourceName) { - // ServletContext context = getServletConfig().getServletContext(); - // InputStream resourcesStream = context.getResourceAsStream(resourceName); - // return resourcesStream; - // } - // - // public SourceBean createConfiguration(String configName) throws SourceBeanException { - // SourceBean result = null; - // InputStream resourcesStream = getInputStream(configName); - // - // try { - // result = SourceBean.fromXMLStream(new InputSource(resourcesStream)); - // } finally { - // if (resourcesStream != null) { - // try { - // resourcesStream.close(); - // } catch (Exception ex) { - // throw new SourceBeanException(ex.getMessage()); - // } - // } - // } - // return result; - // } - // - // } + // cache + private final Map configCache = new HashMap<>(); + @Override public void init(ServletConfig config) throws ServletException { super.init(config); - ConfigSingleton.set_contextRoot(config.getServletContext().getContextPath()); - // String afRootPath = config.getInitParameter("AF_ROOT_PATH"); - String afConfigFile = config.getInitParameter("AF_CONFIG_FILE"); - // Setto il parametro per l'abilitazione dell'help online - if (config.getInitParameter("enableHelpOnline") != null) { - Boolean enableHelpOnline = new Boolean(config.getInitParameter("enableHelpOnline")); - ConfigSingleton.setEnableHelpOnline(enableHelpOnline); - // Setto il parametro con l'URI dove sono deployate le pagine html dell'help - if (config.getInitParameter("helpServerURI") != null) { - ConfigSingleton.setHelpServerURI(config.getInitParameter("helpServerURI")); + + ConfigSingleton configSingleton = ConfigSingleton.getInstance(); + configSingleton.setContextPath(config.getServletContext().getContextPath()); + final String appPrefix = config.getServletContext().getContextPath().replace("/", ""); + + // fill cache standard properties + Stream.of(ConfigProperties.StandardProperty.values()).forEach(p -> { + configCache.put(p.name(), getValue(config, appPrefix, p.getPropName(), p.getPropDefaultValue())); + }); + + // fill cache URI properties + Stream.of(ConfigProperties.URIProperty.values()).forEach(p -> { + + // Imposto i parametri per la visualizzazione dei loghi (risorse URI) + final String absolutePath = getValue(config, appPrefix, p.getPropAbsolutePathName(), + p.getPropAbsoluteDefaultValue()); + String relativePath = getValue(config, appPrefix, p.getPropRelativePathName(), + p.getPropRelativeDefaultValue()); + // L'absolutePath ha precedenza su tutto + if (StringUtils.isNotBlank(absolutePath)) { + relativePath = getRelativePathFromExternalResource(absolutePath, p.getDestination(), + p.getPropRelativeDefaultValue()); } - } - // Setto il parametro per l'abilitazione dell'help online - if (config.getInitParameter("disableSecurity") != null) { - Boolean disableSecurity = new Boolean(config.getInitParameter("disableSecurity")); - ConfigSingleton.setDisableSecurity(disableSecurity); - } + configCache.put(p.name(), relativePath); + }); - if (config.getInitParameter("enableLazySort") != null) { - Boolean enableLazySort = new Boolean(config.getInitParameter("enableLazySort")); - ConfigSingleton.setEnableLazySort(enableLazySort); - } + // set cache + configSingleton.setConfigCache(configCache); - // Setto il parametro per l'abilitazione dell'help online - if (config.getInitParameter("debugAuthorization") != null) { - Boolean debugAuthorization = new Boolean(config.getInitParameter("debugAuthorization")); - ConfigSingleton.setDebugAuthorization(debugAuthorization); - } + // Load MANIFEST.MF, necessary for startup + Properties prop = new Properties(); - // Setto i parametri per la visualizzazione dei loghi - if (config.getInitParameter("logo1_relativePath") != null) { - ConfigSingleton.setLogo1_relativePath(config.getInitParameter("logo1_relativePath")); - } - if (config.getInitParameter("logo1_alt") != null) { - ConfigSingleton.setLogo1_alt(config.getInitParameter("logo1_alt")); - } - if (config.getInitParameter("logo1_url") != null) { - ConfigSingleton.setLogo1_url(config.getInitParameter("logo1_url")); - } - if (config.getInitParameter("logo1_title") != null) { - ConfigSingleton.setLogo1_title(config.getInitParameter("logo1_title")); - } - if (config.getInitParameter("logo2_relativePath") != null) { - ConfigSingleton.setLogo2_relativePath(config.getInitParameter("logo2_relativePath")); - } - if (config.getInitParameter("logo2_alt") != null) { - ConfigSingleton.setLogo2_alt(config.getInitParameter("logo2_alt")); - } - if (config.getInitParameter("logo2_url") != null) { - ConfigSingleton.setLogo2_url(config.getInitParameter("logo2_url")); - } - if (config.getInitParameter("logo2_title") != null) { - ConfigSingleton.setLogo2_title(config.getInitParameter("logo2_title")); + try (InputStream in = getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF");) { + prop.load(in); + if (!prop.containsKey("App-Version") || !prop.containsKey("App-BuildDate") + || !prop.containsKey("App-Name")) { + throw new ServletException( + "File /META-INF/MANIFEST.MF exists, but it doesn't contains necessary metadata"); + } + } catch (IOException e) { + throw new ServletException("Error reading /META-INF/MANIFEST.MF file", e); } - if (config.getInitParameter("logo3_relativePath") != null) { - ConfigSingleton.setLogo3_relativePath(config.getInitParameter("logo3_relativePath")); + + String appVersion = prop.getProperty("App-Version"); + String appBuildDate = prop.getProperty("App-BuildDate"); + String appName = prop.getProperty("App-Name"); + + configSingleton.setAppVersion(appVersion); + configSingleton.setAppBuildDate(appBuildDate); + configSingleton.setAppName(appName); + + LOGGER.debug("ConfigServlet::init: Init param [APP_VERSION] ottenuto dal MANIFEST.MF con il valore di [{}]", + appVersion); + LOGGER.debug("ConfigServlet::init: Init param [APP_BUILD_DATE] ottenuto dal MANIFEST.MF con il valore di [{}]", + appBuildDate); + LOGGER.debug("ConfigServlet::init: Init param [APP_NAME] ottenuto dal MANIFEST.MF con il valore di [{}]", + appName); + + Properties props = System.getProperties(); + Enumeration propNames = props.propertyNames(); + while (propNames.hasMoreElements()) { + String name = (String) propNames.nextElement(); + LOGGER.trace("ConfigServlet::init: SysProp [{}] con valore [{}]", name, props.getProperty(name)); } - if (config.getInitParameter("logo3_alt") != null) { - ConfigSingleton.setLogo3_alt(config.getInitParameter("logo3_alt")); + handleNotSupportedConfig(config); + + if (LOGGER.isTraceEnabled()) { + LOGGER.trace("ConfigServlet::init: ConfigSingleton: {}", configSingleton.toString()); } - if (config.getInitParameter("logo3_url") != null) { - ConfigSingleton.setLogo3_url(config.getInitParameter("logo3_url")); + } + + /** + * Gestione delle configurazioni di inizializzazione. L'ordine con cui viene scelto il valore del parametro è il + * seguente: + *

    + *
  1. il parametro è presente sul web.xml;
  2. + *
  3. E' presente un parametro dal nome applicazione-nome_parametro sulle proprietà  di sistema;
  4. + *
  5. E' presente un parametro dal nome nome_parametro sulle proprietà di sistema;
  6. + *
  7. viene utilizzato un valore predefinito per il parametro.
  8. + *
+ * + * @param config + * ServletConfig, configurazioni della servlet definite su web.xml + * @param applicationPrefix + * contesto dell'applicazione senza "/" per esempio saceriam + * @param configName + * nome della proprietà  supportata dallla Servlet + * + * @return valore della configurazione. + */ + private String getValue(ServletConfig config, String applicationPrefix, String configName, String defaultValue) { + + // web.xml personalizzazione su questo specifico pacchetto + String configValue = config.getInitParameter(configName); + if (configValue != null && !configValue.isEmpty()) { + LOGGER.debug("ConfigServlet::init: Init param [{}] definito in web.xml con il valore di [{}]", configName, + configValue); + return configValue; } - if (config.getInitParameter("logo3_title") != null) { - ConfigSingleton.setLogo3_title(config.getInitParameter("logo3_title")); + + // system property specifica per applicationPrefix per esempio il logo + // dell'applicazione + configValue = System.getProperty(applicationPrefix + "-" + configName); + if (configValue != null) { + LOGGER.debug( + "ConfigServlet::init: Init param [{}] definito tramite system property specifica per l'applicazione [{}] (ottenuto come [{}-{}] con il valore di [{}]", + configName, applicationPrefix, applicationPrefix, configName, configValue); + return configValue; } - if (config.getInitParameter("titolo_applicativo") != null) { - ConfigSingleton.setTitolo_applicativo(config.getInitParameter("titolo_applicativo")); + + // system property generica (per esempio "ambiente_deploy") + configValue = System.getProperty(configName); + if (configValue != null) { + LOGGER.debug( + "ConfigServlet::init: Init param [{}}] definito tramite system property generica (ottenuto come [{}]) con il valore di [{}].", + configName, configName, configValue); + return configValue; } + // valore predefinito + configValue = defaultValue; + LOGGER.debug("ConfigServlet::init: Init param [{}] non definito. Utilizzo il valore predefinito [{}].", + configName, defaultValue); - // ConfigSingleton.setConfigFileName(afConfigFile); - // if (afRootPath == null) { - // ConfigSingleton.setConfigurationCreation(new StreamCreatorConfiguration()); - // ConfigSingleton.setRootPath(config.getServletContext().getRealPath("")); - // } else { - // ConfigSingleton.setConfigurationCreation(new FileCreatorConfiguration(afRootPath)); - // ConfigSingleton.setRootPath(afRootPath); - // } + return configValue; + } - // Load MANIFEST.MF, necessary for startup - Properties prop = new Properties(); + /** + * Carica, internamente all'applicazione in fase di deploy, la risorsa esterna. Per l'applicazione la risorsa sarà, + * a tutti gli effetti, interna. + * + * @param externalResource + * percorso della risorsa esterna all'applicazione. + * @param destinationPath + * percorso relativo della risorsa all'interno dell'applicazione + * @param defaultRelativePath + * percorso della risorsa predefinita + * + * @return percorso relativo dalle risorsa + */ + private String getRelativePathFromExternalResource(String externalResource, String destinationPath, + String defaultRelativePath) { try { - InputStream in = getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF"); - if (in != null) { - prop.load(in); - } else { - throw new FileNotFoundException("Unable to find /META-INF/MANIFEST.MF file"); - } + loadResource(externalResource, destinationPath); + LOGGER.debug("ConfigServlet::init: Risorsa {} correttamente caricata su {}.", externalResource, + destinationPath); + return destinationPath; + } catch (IOException e) { - e.printStackTrace(); - throw new ServletException("Error reading /META-INF/MANIFEST.MF file", e); + LOGGER.warn("ConfigServlet::init: Impossibile caricare la risorsa {}. Utilizzo il valore predefinito {}.", + externalResource, defaultRelativePath, e); + + return defaultRelativePath; } - if (!prop.containsKey("App-Version") || !prop.containsKey("App-BuildDate") || !prop.containsKey("App-Name")) { - throw new ServletException("File /META-INF/MANIFEST.MF exists, but it doesn't contains necessary metadata"); + } + + /** + * Carica una risorsa e la mette a disposizione della webapp. Attualmente sono supportati i seguenti schema: + *
    + *
  • file://
  • http(s):// + *
+ * + * Esempio di chiamata: + *
    + *
  • loadResource("file:///opt/jboss/logo1_snap.png", "/img/logo1.png")
  • + *
  • loadResource("https:///my.beautiful.css/overlay.css", "/css/overlay.css")
  • + *
+ * + * @param resourceURL + * URL della risorsa da caricare + * @param destination + * percorso relativo della risorsa su cui copiare + */ + private void loadResource(String resourceURL, String destinationPath) throws IOException { + URL url = new URL(resourceURL); + String applicationRealPath = getServletContext().getRealPath("/"); + Path newFile = Paths.get(applicationRealPath + destinationPath); + URLConnection connection = url.openConnection(); + Files.copy(connection.getInputStream(), newFile, REPLACE_EXISTING); + } + + /** + * Stampa la lista dei parametri forniti ma non supportati dall'applicazione. + * + * @param config + * configurazione della servlet + */ + private void handleNotSupportedConfig(ServletConfig config) { + Enumeration initParameterNames = config.getInitParameterNames(); + while (initParameterNames.hasMoreElements()) { + String name = initParameterNames.nextElement(); + if (!Arrays.asList(ConfigProperties.StandardProperty.toList()).contains(name) + && !Arrays.asList(ConfigProperties.URIProperty.toList()).contains(name)) { + LOGGER.warn("ConfigServlet::init: Init param [{}] con valore [{}] non supportato", name, + config.getInitParameter(name)); + } } + } - ConfigSingleton.set_appVersion(prop.getProperty("App-Version")); - ConfigSingleton.set_appBuildDate(prop.getProperty("App-BuildDate")); - ConfigSingleton.set_appName(prop.getProperty("App-Name")); - - // Print system properties - // String startupConsoleStr = (String) ConfigSingleton.getInstance().getAttribute("COMMON.startup_console"); - // if ((startupConsoleStr == null) || (!startupConsoleStr.equalsIgnoreCase("FALSE"))) { - // System.out.println("ConfigServlet::init: AF_ROOT_PATH = " + afRootPath); - System.out.println("ConfigServlet::init: AF_CONFIG_FILE = " + afConfigFile); - System.out.println("ConfigServlet::init: APP_VERSIONE = " + ConfigSingleton.get_appVersion()); - System.out.println("ConfigServlet::init: APP_BUILD_DATE = " + ConfigSingleton.get_appBuildDate()); - Properties props = System.getProperties(); - Enumeration propNames = props.propertyNames(); - while (propNames.hasMoreElements()) { - String name = (String) propNames.nextElement(); - System.out.println("ConfigServlet::init: " + name + " [" + System.getProperty(name) + "]"); + @Override + public String getServletInfo() { + StringBuilder sb = new StringBuilder(); + sb.append("La servlet ").append(getClass().getName()) + .append(" supporta la seguente lista di parametri di inizializzazione:\n"); + for (String parametro : ConfigProperties.StandardProperty.toList()) { + sb.append(" - ").append(parametro).append("\n"); + } + for (String parametro : ConfigProperties.URIProperty.toList()) { + sb.append(" - ").append(parametro).append("\n"); } - // } + return sb.toString(); - // InitializerManager.init(); } } diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigSingleton.java b/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigSingleton.java index 1e6f595..8da4a39 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigSingleton.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/configuration/ConfigSingleton.java @@ -1,474 +1,105 @@ -/** - * - * Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. - * - * This file is part of Spago. - * - * Spago is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * Spago is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Spago; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * */ -package it.eng.spagoCore.configuration; - -/** - * DATE CONTRIBUTOR/DEVELOPER NOTE 13-12-2004 Butano Passaggio ad ArrayList in SourceBean Introdotto - * nuovo costruttore (vedi getResourcesAsStream in ConfigServlet) 24-01-2005 Bernabei Aggiunto - * l'impostazione a null dell'attributo _resources nel metodo reset() - * - */ -/** - * Questa classe offre i servizi per recuperare da tutti i files di configurazione XML dell'applicazione il valore dei - * parametri in esso contenuti. +/* + * Engineering Ingegneria Informatica S.p.A. * - * @author Luigi Bellio from it.eng.spagoCore.base.sourceBean + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -public final class ConfigSingleton { - - /** - * - */ - private static final long serialVersionUID = 1L; - - private static String _rootPath = null; - - private static String _engConfigFile = null; - - // private static IConfigurationCreator _configurationCreator = null; - - private static ConfigSingleton _instance = null; - - private static final String AF_ROOT_PATH = ""; - - private static final String AF_CONFIG_FILE = "/WEB-INF/conf/spago/master.xml"; - - public static final String CONFIGURATOR = "CONFIGURATOR"; - - public static final String CONFIGURATOR_PATH = "PATH"; - - public static final String CONFIGURATOR_MASTER = "MASTER"; - - private static String _contextRoot; - - public static final String LINE_SEPARATOR = System.getProperty("line.separator"); - - private static String _appVersion; - private static String _appBuildDate; - - private static String _appName; - - private static Boolean enableHelpOnline = false; - - private static Boolean debugAuthorization = false; - - private static String helpServerURI = ""; +package it.eng.spagoCore.configuration; - private static Boolean disableSecurity = false; +import java.io.Serializable; +import java.net.URI; +import java.util.Map; - private static Boolean enableLazySort = false; +/** + * Bean di configurazione dell'applicazione. Lo stato del bean può essere modificato solamente all'interno di questo + * package. + */ +public final class ConfigSingleton implements Serializable { - private static String logo1_relativePath = "/img/regione/LogoParer.png"; - private static String logo1_url = "https://poloarchivistico.regione.emilia-romagna.it/"; - private static String logo1_title = "ParER - Polo Archivistico Regionale dell'Emilia-Romagna"; - private static String logo1_alt = "Logo"; + private static final ConfigSingleton INSTANCE = new ConfigSingleton(); + private static final long serialVersionUID = 5441406425769570888L; - private static String logo2_relativePath = "/img/regione/LogoER.png"; - private static String logo2_url = "http://www.regione.emilia-romagna.it"; - private static String logo2_title = "Regione Emilia-Romagna"; - private static String logo2_alt = "Regione Emilia-Romagna"; + // cache + private Map configCache; - private static String logo3_relativePath = ""; // "/img/regione/LogoIbc.png"; - private static String logo3_url = ""; // "http://www.ibc.regione.emilia-romagna.it"; - private static String logo3_title = ""; // "Istituto per i beni artistici culturali e naturali della Regione - // Emilia-Romagna"; - private static String logo3_alt = ""; // "Logo IBC"; + private String contextPath = "/applicazione"; + private String appName = "Applicazione"; + private String appVersion = "SNAPSHOT"; + private String appBuildDate = "today"; - private static String titolo_applicativo = ""; + private ConfigSingleton() { - // patch per il funzionamento del framework con junit o vm esterne all'app - // server. - // occorre settare la propriet� AF_ROOT_PATH come parametro della vm: - static { - // if (System.getProperty("AF_ROOT_PATH") != null) { - // _configurationCreator = new FileCreatorConfiguration(getRootPath()); - // } } - /** - * @param creation - * The _configurationCreation to set. - */ - // public static void setConfigurationCreation(IConfigurationCreator creator) { - // _configurationCreator = creator; - // } - // - // public static IConfigurationCreator getConfigurationCreator() { - // return _configurationCreator; - // } - - /** - * In questo costruttore tutti i files XML di configurazione vengono letti e con le informazioni in essi contenute - * vengono create delle istanze di SourceBean; questo permette di accedere alle informazioni utilizzando i metodi - * della classe SourceBean. - * - * @param engConfigFile - * percorso e nome del file XML da leggere. - */ - private ConfigSingleton(String engConfigFile) throws Exception { - // Leggo il file principale di configurazione - - // super(_configurationCreator.createConfiguration(engConfigFile)); - // - // List configuratorsList = getAttributeAsList(CONFIGURATOR); - - // configuratorsObject � una lista di nomi di file di configurazione - // // che devo elaborare uno alla volta. - // for (int i = 0; i < configuratorsList.size(); i++) { - // Object configuratorObject = configuratorsList.get(i); - // if (configuratorObject instanceof SourceBean) { - // SourceBean sbConfigurator = (SourceBean) configuratorObject; - // String configuratorName = (String) sbConfigurator.getAttribute(CONFIGURATOR_PATH); - // if (configuratorName == null) { - // continue; - // } - // try { - // // Leggo il singolo file - // ConfigSingleton singleConfiguration = new ConfigSingleton(configuratorName); - // - // // Reperisco il root del file - // String singleFileRootName = singleConfiguration.getName(); - // - // if (singleFileRootName.equalsIgnoreCase(CONFIGURATOR_MASTER)) { - // // Il file di configurazione � un MASTER: mi interessa - // // solo il suo contenuto, - // // non l'intera struttura ... - // List currentConfigurationAttributes = getContainedAttributes(); - // List singleFileAttributes = singleConfiguration.getContainedAttributes(); - // - // // Faccio il merge delle due configurazioni e Imposto la - // // nuova configurazione - // currentConfigurationAttributes.addAll(singleFileAttributes); - // setContainedAttributes(currentConfigurationAttributes); - // } else { - // - // // Verifico se esiste gi� una busta con lo stesso nome - // // della configurazione corrente: - // // ad esempio "ACTIONS", nel qual caso sto leggendo una - // // configurazione - // // splittata in pi� file - // Object rootAttribute = getAttribute(singleFileRootName); - // if (rootAttribute != null) { - // if (rootAttribute instanceof SourceBean) { - // // Esiste gi�, reperisco le sottobuste: ad - // // esempio - // // le buste "ACTION" - // List currentConfigurationAttributes = ((SourceBean) rootAttribute).getContainedAttributes(); - // List singleFileAttributes = singleConfiguration.getContainedAttributes(); - // // Faccio il merge delle due configurazioni - // currentConfigurationAttributes.addAll(singleFileAttributes); - // - // // Imposto la nuova configurazione - // ((SourceBean) rootAttribute).setContainedAttributes(currentConfigurationAttributes); - // } else { - // System.out.println("ConfigSingleton::ConfigSingleton: errore creazione configuratore [" + singleFileRootName - // + "]"); - // return; - // } - // } else { - // // Non esiste, nessun problema - // setAttribute(singleConfiguration); - // } - // - // } - // - // } // try - // catch (Exception ex) { - // System.out.println("ConfigSingleton::ConfigSingleton: errore creazione configuratore [" + configuratorName + - // "]"); - // ex.printStackTrace(); - // } // catch(Exception ex) try - // } // if (configuratorObject instanceof SourceBean) - // } // for (int i = 0; i < configuratorsVector.size(); i++) - - } // private ConfigSingleton(String engConfigFile) throws Exception - public static ConfigSingleton getInstance() { - if (_instance == null) { - synchronized (ConfigSingleton.class) { - if (_instance == null) { - try { - _instance = new ConfigSingleton(getConfigFileName()); - } // try - catch (Exception ex) { - System.out.println("ConfigSingleton::getInstance: errore creazione configuratore [" - + getConfigFileName() + "]"); - ex.printStackTrace(); - } // catch(Exception ex) try - } // if (_instance == null) - } // synchronized(ConfigSingleton.class) - } // if (_instance == null) - return _instance; - } // public static ConfigSingleton getInstance() - - public static void release() { - if (_instance != null) { - synchronized (ConfigSingleton.class) { - _instance = null; - } // synchronized (ConfigSingleton.class) - } // if (_instance != null) - } // public static void release() - - /** - * Ritorna il rootPath dell'installazione dell'applicativo. Questo percorso viene utilizzato dal framework per - * recuperare le risorse(esempio i files XML).L'informazione del rootPath pu� essere resa disponibile al framework - * anche impostando una variabile di ambiente con nome "AF_ROOT_PATH". - * - * @return String specifica il rootPath. - */ - public static String getRootPath() { - if (_rootPath == null) { - synchronized (ConfigSingleton.class) { - if (_rootPath == null) { - _rootPath = System.getProperty("AF_ROOT_PATH"); - } - if (_rootPath == null) { - _rootPath = AF_ROOT_PATH; - } - } // synchronized(ConfigSingleton.class) - } // if (_rootPath == null) - return _rootPath; - } // public static String getRootPath() - - /** - * Questo metodo permette di impostare il rootPath. - * - * @param rootPath - * stringa che rappresenta il rootpath. - */ - public static void setRootPath(String rootPath) { - synchronized (ConfigSingleton.class) { - _rootPath = rootPath; - } // synchronized(ConfigSingleton.class) - } // protected static void setRootPath(String rootPath) - - /** - * Ritorna il nome del file XML contenente i riferimenti agli altri files XML.Il nome del file XML master pu� - * essere resa disponibile al framework anche impostando una variabile di ambiente con nome "AF_CONFIG_FILE". - * - * @return String specifica il nome del file XML master. - */ - public static String getConfigFileName() { - if (_engConfigFile == null) { - synchronized (ConfigSingleton.class) { - if (_engConfigFile == null) { - _engConfigFile = System.getProperty("AF_CONFIG_FILE"); - } - if (_engConfigFile == null) { - _engConfigFile = AF_CONFIG_FILE; - } - } // synchronized(ConfigSingleton.class) - } // if (_engConfigFile == null) - return _engConfigFile; - } // public static String getConfigFileName() - - /** - * Questo metodo permette di impostare il nome del file XML master. - * - * @param engConfigFile - * specifica il nome del file XML master. - */ - public static void setConfigFileName(String engConfigFile) { - synchronized (ConfigSingleton.class) { - _engConfigFile = engConfigFile; - } // synchronized(ConfigSingleton.class) - } // public static void setConfigFileName(String engConfigFile) - - public static String get_appVersion() { - return _appVersion; - } - - public static void set_appVersion(String _appVersion) { - ConfigSingleton._appVersion = _appVersion; - } - - public static String get_appBuildDate() { - return _appBuildDate; - } - - public static void set_appBuildDate(String _appBuildDate) { - ConfigSingleton._appBuildDate = _appBuildDate; - } - - public static String get_appName() { - return _appName; - } - - public static void set_appName(String _appName) { - ConfigSingleton._appName = _appName; - } - - public static Boolean getEnableHelpOnline() { - return enableHelpOnline; - } - - public static void setEnableHelpOnline(Boolean enableHelpOnline) { - ConfigSingleton.enableHelpOnline = enableHelpOnline; - } - - public static String getHelpServerURI() { - return helpServerURI; - } - - public static void setHelpServerURI(String helpServerURI) { - ConfigSingleton.helpServerURI = helpServerURI; - } - - public static void setDisableSecurity(Boolean disableSecurity) { - ConfigSingleton.disableSecurity = disableSecurity; - - } - - public static Boolean getDisableSecurity() { - return disableSecurity; - } - - public static String get_contextRoot() { - return _contextRoot; - } - - public static void set_contextRoot(String _contextRoot) { - ConfigSingleton._contextRoot = _contextRoot; - } - - public static Boolean getDebugAuthorization() { - return debugAuthorization; - } - - public static void setDebugAuthorization(Boolean debugAuthorization) { - ConfigSingleton.debugAuthorization = debugAuthorization; - } - - public static Boolean getEnableLazySort() { - return enableLazySort; - } - - public static void setEnableLazySort(Boolean enableLazySort) { - ConfigSingleton.enableLazySort = enableLazySort; - } - - public static String getLogo1_relativePath() { - return logo1_relativePath; - } - - public static void setLogo1_relativePath(String logo1_relativePath) { - ConfigSingleton.logo1_relativePath = logo1_relativePath; - } - - public static String getLogo1_url() { - return logo1_url; - } - - public static void setLogo1_url(String logo1_url) { - ConfigSingleton.logo1_url = logo1_url; - } - - public static String getLogo1_title() { - return logo1_title; - } - - public static void setLogo1_title(String logo1_title) { - ConfigSingleton.logo1_title = logo1_title; - } - - public static String getLogo1_alt() { - return logo1_alt; - } - - public static void setLogo1_alt(String logo1_alt) { - ConfigSingleton.logo1_alt = logo1_alt; - } - - public static String getLogo2_relativePath() { - return logo2_relativePath; - } - - public static void setLogo2_relativePath(String logo2_relativePath) { - ConfigSingleton.logo2_relativePath = logo2_relativePath; - } - - public static String getLogo2_url() { - return logo2_url; - } - - public static void setLogo2_url(String logo2_url) { - ConfigSingleton.logo2_url = logo2_url; + return INSTANCE; } - public static String getLogo2_title() { - return logo2_title; + public String getContextPath() { + return contextPath; } - public static void setLogo2_title(String logo2_title) { - ConfigSingleton.logo2_title = logo2_title; + public void setContextPath(String contextPath) { + this.contextPath = contextPath; } - public static String getLogo2_alt() { - return logo2_alt; + public void setConfigCache(Map configCache) { + this.configCache = configCache; } - public static void setLogo2_alt(String logo2_alt) { - ConfigSingleton.logo2_alt = logo2_alt; + public URI getUriValue(String propName) { + return URI.create(configCache.get(propName)); } - public static String getLogo3_relativePath() { - return logo3_relativePath; + public long getLongValue(String propName) { + return Long.parseLong(configCache.get(propName)); } - public static void setLogo3_relativePath(String logo3_relativePath) { - ConfigSingleton.logo3_relativePath = logo3_relativePath; + public boolean getBooleanValue(String propName) { + return Boolean.parseBoolean(configCache.get(propName)); } - public static String getLogo3_url() { - return logo3_url; + public String getStringValue(String propName) { + return configCache.get(propName); } - public static void setLogo3_url(String logo3_url) { - ConfigSingleton.logo3_url = logo3_url; + public int getIntValue(String propName) { + return Integer.parseInt(configCache.get(propName)); } - public static String getLogo3_title() { - return logo3_title; + public String getAppName() { + return appName; } - public static void setLogo3_title(String logo3_title) { - ConfigSingleton.logo3_title = logo3_title; + public void setAppName(String appName) { + this.appName = appName; } - public static String getLogo3_alt() { - return logo3_alt; + public String getAppVersion() { + return appVersion; } - public static void setLogo3_alt(String logo3_alt) { - ConfigSingleton.logo3_alt = logo3_alt; + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; } - public static String getTitolo_applicativo() { - return titolo_applicativo; + public String getAppBuildDate() { + return appBuildDate; } - public static void setTitolo_applicativo(String titolo_applicativo) { - ConfigSingleton.titolo_applicativo = titolo_applicativo; + public void setAppBuildDate(String appBuildDate) { + this.appBuildDate = appBuildDate; } -} // public final class ConfigSingleton extends SourceBean +} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/error/EMFError.java b/spagolite-core/src/main/java/it/eng/spagoCore/error/EMFError.java index 7332d21..eca9867 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/error/EMFError.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/error/EMFError.java @@ -1,32 +1,32 @@ /** - - Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. - - This file is part of Spago. - - Spago is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - any later version. - - Spago is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with Spago; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - **/ + * + * Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. + * + * This file is part of Spago. + * + * Spago is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Spago is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Spago; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * */ package it.eng.spagoCore.error; import java.io.Serializable; /** - * + * * @author Enrico Grillini - * + * */ public class EMFError extends Exception implements Serializable { @@ -37,9 +37,9 @@ public class EMFError extends Exception implements Serializable { public static final String ERROR = "ERROR"; public static final String BLOCKING = "BLOCKING"; - private String severity; - private String description; - private Throwable throwable; + private final String severity; + private final String description; + private final Throwable throwable; public EMFError(String severity, String description, Throwable throwable) { this.severity = severity; @@ -59,26 +59,14 @@ public String getSeverity() { return severity; } - public void setSeverity(String severity) { - this.severity = severity; - } - public String getDescription() { return description; } - public void setDescription(String description) { - this.description = description; - } - public Throwable getThrowable() { return throwable; } - public void setThrowable(Throwable throwable) { - this.throwable = throwable; - } - public boolean isOk(String serverity) { if (getSeverity() == null) { return true; diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/CharsetFilter.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/CharsetFilter.java index 458141b..95142b8 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/CharsetFilter.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/CharsetFilter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoCore.util; import java.io.*; diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/CustomKeycloakFilter.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/CustomKeycloakFilter.java new file mode 100644 index 0000000..cd64d37 --- /dev/null +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/CustomKeycloakFilter.java @@ -0,0 +1,58 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagoCore.util; + +import java.io.IOException; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletRequestWrapper; +import org.keycloak.adapters.servlet.KeycloakOIDCFilter; + +/** + * + * @author gpiccioli + */ +public class CustomKeycloakFilter extends KeycloakOIDCFilter { + + public CustomKeycloakFilter() throws IOException { + super(); + } + + public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) + throws IOException, ServletException { + + HttpServletRequestWrapper wrap = new HttpServletRequestWrapper((HttpServletRequest) req); + + Enumeration enumer = wrap.getHeaders("Authorization"); + + List authHeaders = Collections.list(enumer); + + if (authHeaders == null || authHeaders.size() == 0) { + chain.doFilter(wrap, res); + return; + } else { + super.doFilter(wrap, res, chain); + } + } +} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/JavaScript.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/JavaScript.java index bfa9c0d..af11bce 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/JavaScript.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/JavaScript.java @@ -1,47 +1,45 @@ /** - - Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. - - This file is part of Spago. - - Spago is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - any later version. - - Spago is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with Spago; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - **/ + * + * Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. + * + * This file is part of Spago. + * + * Spago is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Spago is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Spago; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * */ package it.eng.spagoCore.util; -/** - * DATE CONTRIBUTOR/DEVELOPER NOTE - * 13-12-2004 Butano SourceBean ora restituisce ArrayList - * - **/ - /** * La classe JavaScript è una classe di utility che mette a disposizione dei metodi statici che * implementano le stesse funzionalità di alcune funzioni in javascript. - * + * * @author Luigi Bellio */ - public class JavaScript { + + private JavaScript() { + throw new IllegalStateException("Impossibile istanziare la classe, contiene solo metodi statici"); + } + /** * Questo metodo implementa la stessa logica della funzione javascript escape. - * + * * @param input * stringa da manipolare. * - * @return restituisce risultato dell'escaping + * @return Stringa manipolata */ public static String escape(String input) { input = replace(input, "%", "%25"); @@ -53,15 +51,15 @@ public static String escape(String input) { input = replace(input, "?", "%3F"); input = replace(input, "&", "%26"); return input; - } // public static String escape(String input) + } /** * This method implements the same logic of the javascript unescape function. - * + * * @param input * the string to manage. * - * @return restituisce risultato di unescape + * @return stringa manipolata */ public static String unescape(String input) { input = replace(input, "%25", "%"); @@ -73,26 +71,26 @@ public static String unescape(String input) { input = replace(input, "%3F", "?"); input = replace(input, "%26", "&"); return input; - } // public static String unescape(String input) + } /** * Questo metodo manipola la stringa in input permettendo le seguenti sostituzioni: da "\n" a * "\\n", da "\"" a "'" - * + * * @param input * stringa da manipolare. * - * @return restituisce risultato di escapeText + * @return testo manipolato */ public static String escapeText(String input) { input = replace(input, "\n", "\\n"); input = replace(input, "\"", "'"); return input; - } // public static String escapeCarrigeReturn(String input) + } /** * Questo metodo permette di sostituire una parte di una stringa con un'altra. - * + * * @param toParse * stringa da manipolare. * @param replacing @@ -100,15 +98,15 @@ public static String escapeText(String input) { * @param replaced * stringa nuova. * - * @return restituisce risultato della replace + * @return stringa modificata */ public static String replace(String toParse, String replacing, String replaced) { if (toParse == null) { return toParse; - } // if (toParse == null) + } if (replacing == null) { return toParse; - } // if (replacing == null) + } if (replaced != null) { int parameterIndex = toParse.indexOf(replacing); while (parameterIndex != -1) { @@ -124,10 +122,11 @@ public static String replace(String toParse, String replacing, String replaced) // replaced) public static String stringToHTMLString(String string) { - if (string == null) + if (string == null) { return ""; + } - StringBuffer sb = new StringBuffer(string.length()); + StringBuilder sb = new StringBuilder(string.length()); // true if last char was blank boolean lastWasBlankChar = false; int len = string.length(); @@ -151,26 +150,26 @@ public static String stringToHTMLString(String string) { lastWasBlankChar = false; // // HTML Special Chars - if (c == '"') + if (c == '"') { sb.append("""); - else if (c == '&') + } else if (c == '&') { sb.append("&"); - else if (c == '<') + } else if (c == '<') { sb.append("<"); - else if (c == '>') + } else if (c == '>') { sb.append(">"); - else if (c == '\n') - // Handle Newline + } else if (c == '\n') // Handle Newline + { sb.append("<br/>"); - else { + } else { int ci = 0xffff & c; - if (ci < 160) - // nothing special only 7 Bit + if (ci < 160) // nothing special only 7 Bit + { sb.append(c); - else { + } else { // Not 7 Bit use the unicode system sb.append("&#"); - sb.append(new Integer(ci).toString()); + sb.append(String.valueOf(ci)); sb.append(';'); } } @@ -179,4 +178,4 @@ else if (c == '\n') return sb.toString(); } -} // public class JavaScript +} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/JpaUtils.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/JpaUtils.java new file mode 100644 index 0000000..69dc95d --- /dev/null +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/JpaUtils.java @@ -0,0 +1,40 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.spagoCore.util; + +import java.sql.Connection; +import java.sql.SQLException; +import javax.persistence.EntityManager; +import org.hibernate.Session; +import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; + +/** + * @author Manuel Bertuzzi + */ +public class JpaUtils { + + public static Connection provideConnectionFrom(EntityManager em) throws SQLException { + return em.unwrap(Session.class).getSessionFactory().getSessionFactoryOptions().getServiceRegistry() + .getService(ConnectionProvider.class).getConnection(); + } +} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/Oauth2Srvlt.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/Oauth2Srvlt.java new file mode 100644 index 0000000..a3fd067 --- /dev/null +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/Oauth2Srvlt.java @@ -0,0 +1,68 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagoCore.util; + +import java.io.IOException; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.keycloak.KeycloakSecurityContext; + +/** + * + * @author gpiccioli + */ +public class Oauth2Srvlt extends HttpServlet { + + public KeycloakSecurityContext session; + + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + KeycloakSecurityContext session = getKeycloakSession(request); + + this.session = session; + } + + public boolean isOauth2Request(HttpServletRequest request) { + Enumeration enumer = request.getHeaders("Authorization"); + + List authHeaders = Collections.list(enumer); + + if (authHeaders == null || authHeaders.size() == 0) { + return false; + } else { + return true; + } + } + + /** + * Get keycloak session from request + * + * @param req + * + * @return + */ + private KeycloakSecurityContext getKeycloakSession(HttpServletRequest req) { + return (KeycloakSecurityContext) req.getAttribute(KeycloakSecurityContext.class.getName()); + } + +} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/StringUtils.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/StringUtils.java deleted file mode 100644 index 277338f..0000000 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/StringUtils.java +++ /dev/null @@ -1,830 +0,0 @@ -/** - * - * Copyright 2004, 2007 Engineering Ingegneria Informatica S.p.A. - * - * This file is part of Spago. - * - * Spago is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * Spago is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Spago; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * */ -package it.eng.spagoCore.util; - -import it.eng.spagoCore.base.Constants; - -import java.math.BigDecimal; -import java.text.NumberFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Locale; -import java.util.StringTokenizer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class StringUtils { - - private static final Logger LOGGER = LoggerFactory.getLogger(StringUtils.class); - - private static SimpleDateFormat getFormatterGGMM() { - return new SimpleDateFormat("dd/MM", Locale.ITALY); - } - - private static SimpleDateFormat getFormatter() { - SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy", Locale.ITALY); - formatter.setLenient(false); - return formatter; - } - - private static SimpleDateFormat getFormatterOra() { - return new SimpleDateFormat("dd/MM/yyyy HH:mm:ss", Locale.ITALY); - } - - private static NumberFormat getNumberFormat() { - return getNumberFormat(2, 2); - } - - private static NumberFormat getNumberFormat(int numCifreDecimaliMin, int numCifreDecimaliMax) { - NumberFormat myDecFormat = NumberFormat.getInstance(Locale.ITALY); - myDecFormat.setMinimumFractionDigits(numCifreDecimaliMin); - myDecFormat.setMaximumFractionDigits(numCifreDecimaliMax); - return myDecFormat; - } - - /** - * Method getCurrentDate. Il metodo restituisce la data corrente con ore,minuti,sec,e millesec. a zero - * - * @return Date - */ - public static Date getCurrentDate() { - Date today = null; - try { - GregorianCalendar calendar = new GregorianCalendar(); - calendar.set(GregorianCalendar.HOUR_OF_DAY, 0); - // calendar.set(GregorianCalendar.HOUR,0); - calendar.set(GregorianCalendar.MINUTE, 0); - calendar.set(GregorianCalendar.SECOND, 0); - calendar.set(GregorianCalendar.MILLISECOND, 0); - today = calendar.getTime(); - - } catch (Exception ex) { - LOGGER.warn("Utils. getCurrentDate", ex); - } - return today; - } - - /** - * Method stringToDateGGMM. Converte una stringa in data. - * - * @param stringToFormat - * Stringa da convertire: deve essere nel formato dd/MM. - * - * @return Date La data convertita o null se il formato della stringa non era valido. - */ - public static Date stringToDateGGMM(String stringToFormat) { - try { - if (stringToFormat == null) { - return null; - } - return getFormatterGGMM().parse(stringToFormat); - } catch (ParseException ex) { - LOGGER.warn("Utils.stringToDateGGMM", ex); - return null; - } - } - - /** - * Method stringToDate. Converte una stringa in data. - * - * @param stringToFormat - * Stringa da convertire: deve essere nel formato dd/MM/yyyy. - * - * @return Date La data convertita o null se il formato della stringa non era valido. - */ - public static Date stringToDate(String stringToFormat) { - try { - if (stringToFormat == null) { - return null; - } - return getFormatter().parse(stringToFormat); - } catch (ParseException ex) { - LOGGER.warn("Utils.stringToDate", ex); - return null; - } - } - - /** - * Method dateToString. Converte una data in stringa. - * - * @param dateToFormat - * Data da convertire - * - * @return String Stringa nel formato dd/MM/yyyy - */ - public static String dateToString(Date dateToFormat) { - return getFormatter().format(dateToFormat); - } - - public static String dateToStringBlankIfNull(Date dateToFormat) { - if (dateToFormat == null) { - return ""; - } else { - return dateToString(dateToFormat); - } - } - - /** - * Method dateToString. Converte una data in stringa. - * - * @param dateToFormat - * Data da convertire - * @param dateFormat - * Formato della stringa risultante - * - * @return String Stringa nel formato stabilito - */ - public static String dateToString(final Date dateToFormat, final String dateFormat) { - SimpleDateFormat customFormatter = new SimpleDateFormat(dateFormat, Locale.ITALY); - return customFormatter.format(dateToFormat); - } - - /** - * Method dateToString. Converte una data in stringa. - * - * @param dateToFormat - * Data da convertire - * - * @return String Stringa nel formato dd/MM/yyyy - */ - public static String dateOraToString(Date dateToFormat) { - return getFormatterOra().format(dateToFormat); - } - - /** - * Method stringToDate. Converte una stringa in data con orario. - * - * @param stringToFormat - * Stringa da convertire: deve essere nel formato dd/MM/yyyy HH:mm:ss. - * - * @return Date La data convertita o null se il formato della stringa non era valido. - */ - public static Date stringToDateOra(String stringToFormat) { - try { - if (stringToFormat == null) { - return null; - } - return getFormatterOra().parse(stringToFormat); - } catch (ParseException ex) { - LOGGER.warn("Utils.stringToDateOra", ex); - return null; - } - } - - /** - * Data Una stringa sorgente, una stringa search e una replace, sostituisce nella sorgente ogni occorrenza di search - * con replace - * - * @param source - * stringa sorgente - * @param search - * stringa da cercare - * @param replace - * stringa da sostituire - * - * @return stringa modificata - */ - public static String replace(String source, String search, String replace) { - if (source == null || search == null || replace == null) { - return null; - } - String ritorna = ""; - String appoggio = source; - while (appoggio.length() >= 0) { - if (appoggio.indexOf(search) != -1) { - if (appoggio.indexOf(search) == 0) { - ritorna += replace; - } else { - ritorna += appoggio.substring(0, appoggio.indexOf(search)) + replace; - } - appoggio = appoggio.substring(appoggio.indexOf(search) + search.length()); - } else { - ritorna += appoggio; - break; - } - } - return ritorna; - } - - /** - * Method bigDecimalToInteger. Converte un BigDecimal in un Integer. - * - * @param bdNumber - * BigDecimal da convertire. - * - * @return Integer L'Integer convertito o null se l'input è null - */ - public static Integer bigDecimalToInteger(BigDecimal bdNumber) { - return bdNumber != null ? (new Integer(bdNumber.intValue())) : null; - } - - /** - * Method bigDecimalToInteger. Converte un BigDecimal in un Long. - * - * @param bdNumber - * BigDecimal da convertire. - * - * @return Integer Il Long convertito o null se l'input è null - */ - public static Long bigDecimalToLong(BigDecimal bdNumber) { - return bdNumber != null ? (new Long(bdNumber.longValue())) : null; - } - - /** - * Method bigDecimalToDouble. Converte un BigDecimal in un Double. - * - * @param bdNumber - * BigDecimal da convertire. - * - * @return Double Il Double convertito o null se l'input è null - */ - public static Double bigDecimalToDouble(BigDecimal bdNumber) { - return bdNumber != null ? (new Double(bdNumber.doubleValue())) : null; - } - - /** - * Method dateToCalendar. Converte un java.util.Date in Calendar - * - * @param date - * da convertire. - * - * @return Calendar Calendar convertito o null se l'input è null - */ - public static Calendar dateToCalendar(Date date) { - Calendar cal = null; - if (date != null) { - cal = Calendar.getInstance(); - cal.setTime(date); - } - return cal; - } - - /** - * Method stringToDouble.Converte una Stringa in Double - * - * @param string - * da convertire. - * @param separatoreDecimale - * separatore decimale - * - * @return il valore double della string - */ - public static double stringToDouble(String string, char separatoreDecimale) { - double d = 0.0; - - try { - if (separatoreDecimale == ',') { - // Elimino i punti - string = replace(string, ".", ""); - // Sostituisco virgola con punto - string = string.replace(',', '.'); - } - d = Double.parseDouble(string); - } catch (Exception ex) { - } - return d; - } - - /** - * Method doubleToString. Converte un Double in una Stringa - * - * @param d - * da convertire. - * - * @return il valore string del double - */ - public static String doubleToString(double d) { - return getNumberFormat().format(d); - } - - /** - * Method doubleToString.Converte un Double in una Stringa - * - * @param d - * da convertire. - * @param numCifreDecimaliMin - * @param numCifreDecimaliMax - * - * @return il valore string del double - */ - public static String doubleToString(double d, int numCifreDecimaliMin, int numCifreDecimaliMax) { - return getNumberFormat(numCifreDecimaliMin, numCifreDecimaliMax).format(d); - } - - /** - * Method isNumberValue.Indica se un valore è un numero o un carattere - * - * @param s - * stringa che dovrebbe rappresentare un numero - * - * @return restituisce true se il valore passato è un numero - */ - public static boolean isNumberValue(String s) { - try { - if (s == null) { - return false; - } - Integer.parseInt(s); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - /** - * Method isNumberValue.Indica se un valore è un numero o un carattere - * - * @param s - * stringa che dovrebbe rappresentare un double - * - * @return restituisce true se il valore passato è un numero - */ - public static boolean isDoubleValue(String s) { - try { - if (s == null) { - return false; - } - Double.parseDouble(s); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - /** - * Method isNumberLongValue.Indica se un valore è un numero o un carattere - * - * @param s - * stringa che dovrebbe rappresentare un long - * - * @return restituisce true se il valore passato è un numero - */ - public static boolean isNumberLongValue(String s) { - try { - if (s == null) { - return false; - } - Long.parseLong(s); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - /** - * Method isNumberDoubleValue.Indica se un valore nel formato ###.###,## (con punti e virgola) è un numero double o - * un carattere - * - * @param s - * stringa che dovrebbe rappresentare un double - * - * @return restituisce true se il valore passato è un numero double - */ - public static boolean isNumberDoubleValue(String s) { - try { - if (s == null) { - return false; - } - - // Elimino i punti - s = replace(s, ".", ""); - - // Sostituisco virgola con punto - s = s.replace(',', '.'); - - Double.parseDouble(s); - return true; - } catch (NumberFormatException e) { - return false; - } - } - - /** - * Method doubleToString. Formatta un numerico con una stringa aggiungendo come carattere di riempimento il - * parametro passato - * - * @param value - * da convertire. - * @param carattere - * per il concatenamento. - * @param len - * dimensione. - * - * @return il valore string del double - */ - public static String formatSNtoString(long value, char carattere, int len) { - String result = null; - int nCicli = 0; - // Converto intero passato in una stringa - result = String.valueOf(value); - // Calcolo numero di caratteri da concatenare a sinistra - nCicli = len - result.length(); - for (int i = 0; i < nCicli; i++) { - result = carattere + result; - } - return result; - } - - /** - * Formatta una stringa aggiungendo come carattere di riempimento il parametro passato - * - * @param value - * da convertire. - * @param carattere - * per il concatenamento. - * @param len - * dimensione. - * - * @return il valore string - */ - public static String fillString(String value, char carattere, int len) { - int nCicli = 0; - // Calcolo numero di caratteri da concatenare a sinistra - if (len > value.length()) { - nCicli = len - value.length(); - } - for (int i = 0; i < nCicli; i++) { - value = carattere + value; - } - return value; - } - - /** - * Formatta una stringa aggiungendo come carattere di riempimento il parametro passato nella pos indicata - * - * @param value - * da convertire. - * @param carattere - * per il concatenamento. - * @param pos - * posizione. - * - * @return il valore string - */ - public static String fillString(String value, char carattere, int len, String pos) { - int nCicli = 0; - // Calcolo numero di caratteri da concatenare a sinistra - if (len > value.length()) { - nCicli = len - value.length(); - } - for (int i = 0; i < nCicli; i++) { - if (pos != null && pos.equalsIgnoreCase("D")) { - value += carattere; - } else { - value = carattere + value; - } - } - return value; - } - - /** - * Formatta un numerico che prevede la parte decimale. Per la parte intera aggiunge tanti caratteri di riempimento a - * sinistra, al massimo lenPrecision, per la parte decimale riempie per al massimo lenScale a destra - * - * @param value - * da riempire. - * @param carattere - * per il concatenamento. - * @param lenPrecision - * precisione. - * @param lenScale - * scala. - * - * @return il valore string - */ - public static String fillNumDec(String value, char carattere, int lenPrecision, int lenScale) { - String parteInt = value; - String parteDec = "0"; - - if (value.indexOf(".") != -1) { - parteInt = value.substring(0, value.indexOf(".")); - parteDec = value.substring(value.indexOf(".") + 1, value.length()); - } - value = fillString(parteInt, carattere, lenPrecision); - value += "." + fillString(parteDec, carattere, lenScale, "D"); - - return value; - } - - /** - * Method stringToInteger. Converte una stringa in integer. - * - * @param string - * Stringa da convertire - * - * @return Integer corrispondente alla stringa oppure null - */ - public static Integer stringToInteger(String string) { - - return isNumberValue(string) ? Integer.valueOf(string) : null; - - } - - /** - * Method stringToInteger. Converte una stringa in integer. - * - * @param string - * Stringa da convertire - * - * @return Integer corrispondente alla stringa oppure null - */ - public static Long stringToLong(String string) { - - return isNumberLongValue(string) ? Long.valueOf(string) : null; - - } - - /** - * Method formatString. Formatta una Stringa secondo le cifre decimali impostate. - * - * @param d - * Stringa da formattare. - * @param numCifreDecimaliMin - * minimo numero di cifre decimali. - * @param numCifreDecimaliMax - * massimo numero di cifre decimali. - * - * @return la stringa formattata - */ - public static String formatDouble(Double d, int numCifreDecimaliMin, int numCifreDecimaliMax) { - String newValue = null; - NumberFormat decFormat = NumberFormat.getInstance(Locale.US); - try { - decFormat.setMinimumFractionDigits(numCifreDecimaliMin); - decFormat.setMaximumFractionDigits(numCifreDecimaliMax); - newValue = decFormat.format(d); - newValue = replace(newValue, ",", ""); - } catch (Exception ex) { - newValue = "0."; - for (int i = 0; i < numCifreDecimaliMin; i++) { - newValue += "0"; - } - } - return newValue; - } - - /** - * Method isTimeValue. Indica se un valore stringa rappresenta correttamente un orario nella forma hh:mm - * - * @return restituisce true se il valore passato è una stringa in formato orario corretto - */ - public static boolean isTimeValue(String s) { - - if (s == null) { - return false; - } - if (s.trim().equals("")) { - return false; - } - String tmCh = ":"; - int pos = s.indexOf(tmCh); - if (pos == -1) { - return false; - } - if (s.length() != 5) { - return false; - } - - StringTokenizer stk = new StringTokenizer(s, tmCh); - String strHour = null; - String strMinute = null; - int hour = 0; - int minute = 0; - - try { - if (stk.hasMoreElements()) { - strHour = stk.nextToken(); - } else { - return false; - } - if (stk.hasMoreElements()) { - strMinute = stk.nextToken(); - } else { - return false; - } - - if (strHour.charAt(0) == '0' && strHour.length() > 1) { - strHour = strHour.substring(1); - } - if (strMinute.charAt(0) == '0' && strMinute.length() > 1) { - strMinute = strMinute.substring(1); - } - if (isNumberValue(strHour)) { - hour = Integer.parseInt(strHour); - } else { - return false; - } - if (isNumberValue(strMinute)) { - minute = Integer.parseInt(strMinute); - } else { - return false; - } - if (hour < 0 || hour > 23) { - return false; - } - if (minute < 0 || minute > 59) { - return false; - } - } catch (Exception e) { - return false; - } - return true; - } - - /** - * Method isDateGiornoMese. Indica se un valore stringa rappresenta correttamente una data nel formato gg/mm - * - * @param dataggmm - * anno/giorno/mese - * - * @return restituisce true se il valore passato è una stringa in formato gg/mm corretto - */ - public static boolean isDateGiornoMese(String dataggmm) { - if (dataggmm == null) { - return false; - } - // caso particolare 29/02 deve essere sempre permesso - if (dataggmm.equals("29/02")) { - return true; - } - // usiamo l'anno corrente per verificare che sia una data valida - Calendar date = Calendar.getInstance(); - String year = String.valueOf(date.get(Calendar.YEAR)); - if (stringToDate(dataggmm + "/" + year) == null) { - return false; - } - return true; - } - - /** - * Funzione di conversione dei seriali biglietti. - * - * @param serial - * seriale - * - * @return restituisce il seriale calcolato - * - */ - public static long convertSerial(String serial) { - long result; - int i = 0; - - while (serial.charAt(i) == '0') { - i++; - } - - result = Long.valueOf(serial.substring(i, serial.length())).longValue(); - return result; - } - - /** - * - * Funzione di formattazione di una data da "01/12" a "0112" - * - * @param data - * da formattare - * - * @return restituisce la data formattata - * - */ - public static String formatDataGGMM(String data) { - String result = data; - - if (data != null && !data.equals("")) { - result = data.substring(0, data.indexOf("/")) + data.substring(data.indexOf("/") + 1, data.length()); - } - return result; - } - - /** - * Method getMinuteFromTimeValue. Estra le ore dalla string in formato orario hh:mm - * - * @param s - * valore - * - * @return ore calcolate - */ - public static Integer getHourFromTimeValue(String s) { - if (!isTimeValue(s)) { - return null; - } - String tmCh = ":"; - String strHour = null; - Integer hour = null; - try { - strHour = s.substring(0, s.indexOf(tmCh)); - if (strHour.charAt(0) == '0' && strHour.length() > 1) { - strHour = strHour.substring(1); - } - hour = Integer.valueOf(strHour); - } catch (Exception e) { - return null; - } - return hour; - } - - /** - * Method getMinuteFromTimeValue. Estra i minuti dalla string in formato orario hh:mm - * - * @param s - * valore - * - * @return minuti calcolati - */ - public static Integer getMinuteFromTimeValue(String s) { - if (!isTimeValue(s)) { - return null; - } - String tmCh = ":"; - String strMinute = null; - Integer minute = null; - try { - strMinute = s.substring(s.indexOf(tmCh) + 1); - if (strMinute.charAt(0) == '0' && strMinute.length() > 1) { - strMinute = strMinute.substring(1); - } - minute = Integer.valueOf(strMinute); - } catch (Exception e) { - return null; - } - return minute; - } - - /** - * Counts the occurrence of the given char in the string. - * - * @param str - * The string to be tested - * @param c - * the char to be counted - * - * @return the occurrence of the character in the string. - */ - public static int count(String str, char c) { - int index = 0; - char[] chars = str.toCharArray(); - for (int i = 0; i < chars.length; i++) { - if (chars[i] == c) { - index++; - } - } - return index; - } - - public static int unique_id() { - return new Object().hashCode(); - } - - // public static String notNull(SourceBean cbSb, String string) { - // // TODO Auto-generated method stub - // if(cbSb==null){ - // return ""; - // } - // return notNull(cbSb.getAttribute(string)); - // } - public static String notNull(Object input) { - if (input == null) { - return ""; - } else { - return input.toString(); - } - } - - public static String notNullAndTrim(String input) { - if (input == null) { - return ""; - } else { - return input.toString().trim(); - } - } - - public static boolean getBooleanFromStringSN(String input) { - if (input != null && "S".equalsIgnoreCase(input)) { - return true; - } else { - return false; - } - } -} diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerFilter.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerFilter.java index 785168c..65a1a27 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerFilter.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerFilter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoCore.util; import java.io.IOException; diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSessionListener.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSessionListener.java index 0cc9cb9..37259a5 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSessionListener.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSessionListener.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSoapHandler.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSoapHandler.java index e18ea6c..f54b7e4 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSoapHandler.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDLoggerSoapHandler.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDMdcLogUtil.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDMdcLogUtil.java index ab6182d..1b0b2e7 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDMdcLogUtil.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/UUIDMdcLogUtil.java @@ -1,34 +1,54 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoCore.util; +import java.util.UUID; + import org.apache.commons.lang3.StringUtils; import org.slf4j.MDC; -import com.fasterxml.uuid.Generators; - public class UUIDMdcLogUtil { private static final String UUID_LOG_MDC = "log_uuid"; + private UUIDMdcLogUtil() { + throw new IllegalStateException("Impossibile istanziare la classe, contiene solo metodi statici"); + } + /** * Generate UUID and put it on MDC Log4j - * + * * "Remember MDC is managed on a per thread basis and every child thread automatically inherits a copy of the mapped * diagnostic context from its parent. This is achieved by using InheritableThreadLocal class, which is a subclass * of the ThreadLocal class." - * + * * L'application server in determinati contesti applicativi (N servlet coinvolte) potrebbe gestire più worker (multi * thread) non parenti, il meccanismo di ereditarietà dell'MDC non sarebbe quindi garantito (l'UUID non è trasmesso * tra thread cge non sono parenti). */ public static void genUuid() { - MDC.put(UUID_LOG_MDC, Generators.randomBasedGenerator().generate().toString()); + MDC.put(UUID_LOG_MDC, UUID.randomUUID().toString()); } /** * Get UUID from MDC (if is blank - it means new thread, create a new one) - * - * @return UUID - * + * + * @return String of uuid */ public static String getUuid() { if (StringUtils.isBlank(MDC.get(UUIDMdcLogUtil.UUID_LOG_MDC))) { diff --git a/spagolite-core/src/main/java/it/eng/spagoCore/util/UriEcondingFilter.java b/spagolite-core/src/main/java/it/eng/spagoCore/util/UriEcondingFilter.java index 3b9c4ce..3625bc0 100644 --- a/spagolite-core/src/main/java/it/eng/spagoCore/util/UriEcondingFilter.java +++ b/spagolite-core/src/main/java/it/eng/spagoCore/util/UriEcondingFilter.java @@ -1,23 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoCore.util; -import java.io.IOException; -import java.io.UnsupportedEncodingException; +import java.io.*; import java.net.URLDecoder; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; - -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.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; - import org.apache.commons.lang3.StringUtils; import com.fasterxml.jackson.core.JsonParseException; @@ -138,6 +148,7 @@ private void buildURIEncodParameterMap() throws UnsupportedEncodingException { } else { // no value values = new String[] { "" }; // empty + } // if param exists on the map replacing with old list and new one if (localEncoded.get(paramAndValue[PARAM]) != null) { @@ -164,7 +175,7 @@ private boolean checkParam(String name) { /** * Check if value is a valid JSON or a list of elements separated by one of the separator defined in * multiValueSeparator. It manages also array of multiple JSON Object like [{json1},{json2},{json3}]. - * + * * @param value * valore atteso * @@ -198,5 +209,4 @@ private String[] valuesAsList(String value) { */ public void destroy() { } - } diff --git a/spagolite-core/src/main/java/it/eng/spagoIFace/Values.java b/spagolite-core/src/main/java/it/eng/spagoIFace/Values.java index 7ecf358..89b22cc 100644 --- a/spagolite-core/src/main/java/it/eng/spagoIFace/Values.java +++ b/spagolite-core/src/main/java/it/eng/spagoIFace/Values.java @@ -1,66 +1,41 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoIFace; -public class Values { - public final static String LOGGED_USER = "LOGGED_USER"; +public final class Values { + + public static final String LOGGED_USER = "LOGGED_USER"; public static final String MENU_STATUS = "MENU_STATUS"; public static final int MENU_OPEN = 0; public static final int MENU_CLOSED = 1; - public final static String CURRENT_ACTION = "CURRENT_ACTION"; - public final static int LIST_DEFAULT_PAGE_SIZE = 10; - public final static String OPERATION = "operation"; - public final static String PUBLISHER_REDIRECT = "REDIRECT"; - public final static String VOID_SESSION = "VOID_SESSION"; - public final static String SESSION_ID = "SESSION_ID"; + public static final String CURRENT_ACTION = "CURRENT_ACTION"; + public static final int LIST_DEFAULT_PAGE_SIZE = 10; + public static final String OPERATION = "operation"; + public static final String PUBLISHER_REDIRECT = "REDIRECT"; + public static final String VOID_SESSION = "VOID_SESSION"; + public static final String SESSION_ID = "SESSION_ID"; public static final String OPERATION_SEPARATOR = "__"; - public final static int SELECT_LIST_MAX_ROW = 20; - public final static String SUB_LIST = "TABELLA"; - - // public static abstract class Authentication { - // private final static String LOCALHOST = "Security.AUTHENTICATION.localhost"; - // private final static String AUTENTICAZIONE_CENTRALIZZATA = - // "Security.AUTHENTICATION.autenticazione_centralizzata"; - // - // public static boolean isLocalHost() { - // return "true".equalsIgnoreCase((String) ConfigSingleton.getInstance().getAttribute(LOCALHOST)); - // } - // - // public static String autenticazioneCentralizzata() { - // return (String) ConfigSingleton.getInstance().getAttribute(AUTENTICAZIONE_CENTRALIZZATA); - // } - // } + public static final int SELECT_LIST_MAX_ROW = 20; + public static final String SUB_LIST = "TABELLA"; - // public static abstract class Login { - // private final static String LOGIN_CLASS = "Security.LOGIN.loginServiceClassname"; - // private final static String CODE = "Security.LOGIN.cdnApplication"; - // private final static String NAME = "Security.LOGIN.appName"; - // private final static String SALT = "Security.LOGIN.appSalt"; - // private final static String MENU_ROOT = "Security.LOGIN.menuRoot"; - // private final static String HOME_ACTION = "Security.LOGIN.actionHome"; - // - // public static String loginClass() { - // return (String) ConfigSingleton.getInstance().getAttribute(LOGIN_CLASS); - // } - // - // public static String homeAction() { - // return (String) ConfigSingleton.getInstance().getAttribute(HOME_ACTION); - // } - // - // public static String menuRoot() { - // return (String) ConfigSingleton.getInstance().getAttribute(MENU_ROOT); - // } - // - // public static BigDecimal code() { - // return new BigDecimal((String) ConfigSingleton.getInstance().getAttribute(CODE)); - // } - // - // public static String name() { - // return (String) ConfigSingleton.getInstance().getAttribute(NAME); - // } - // - // public static String salt() { - // return (String) ConfigSingleton.getInstance().getAttribute(SALT); - // } - // } + private Values() { + throw new IllegalStateException("Impossibile istanziare la classe, contiene solo costanti"); + } } diff --git a/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseController.java b/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseController.java index 1510d64..d69682b 100644 --- a/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseController.java +++ b/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseController.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoIFace.model; import it.eng.spagoIFace.session.SessionCoreManager; @@ -41,7 +58,8 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletRespons // Gestico la pubblicazione ModelAndView mav = null; // Forward-to-publisher - if (publisherInfo.getType().equals(PublisherInfo.Override.forward)) { + if (publisherInfo.getType().equals(PublisherInfo.Override.forward) + || publisherInfo.getType().equals(PublisherInfo.Override.forwardSkipSetLast)) { // controllo le autorizzazioni di pagina String codiceOrganizzazione = getNomeOrganizzazione(publisherInfo.getDestination()); String nuovaDestinazione = publisherInfo.getDestination(); @@ -50,7 +68,9 @@ public ModelAndView handleRequest(HttpServletRequest request, HttpServletRespons } if (isAuthorized(nuovaDestinazione)) { logger.info("Forward to: " + publisherInfo.getDestination()); - setLastPublisher(publisherInfo.getDestination()); + if (!publisherInfo.getType().equals(PublisherInfo.Override.forwardSkipSetLast)) { + setLastPublisher(publisherInfo.getDestination()); + } mav = new ModelAndView(publisherInfo.getDestination()); } else { mav = new ModelAndView("/login/notAuthorized"); @@ -130,6 +150,10 @@ protected void forwardToPublisher(String publisherName) { publisherInfo = new PublisherInfo(PublisherInfo.Override.forward, publisherName, null); } + protected void forwardToPublisherSkipSetLast(String publisherName) { + publisherInfo = new PublisherInfo(PublisherInfo.Override.forwardSkipSetLast, publisherName, null); + } + protected void forwardToAction(String publisherName) { publisherInfo = new PublisherInfo(PublisherInfo.Override.actionForward, publisherName, null); } diff --git a/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseControllerIFace.java b/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseControllerIFace.java index 224e8bb..872ca01 100644 --- a/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseControllerIFace.java +++ b/spagolite-core/src/main/java/it/eng/spagoIFace/model/BaseControllerIFace.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoIFace.model; import javax.servlet.http.HttpServletRequest; @@ -8,21 +25,21 @@ public interface BaseControllerIFace { /** * Ritorna la request - * + * * @return HttpServletRequest {@link HttpServletRequest} */ public HttpServletRequest getRequest(); /** * Ritorna la response - * + * * @return HttpServletResponse {@link HttpServletResponse} */ public HttpServletResponse getResponse(); /** * Ritorna la sessione - * + * * @return HttpSession {@link HttpSession} */ public HttpSession getSession(); diff --git a/spagolite-core/src/main/java/it/eng/spagoIFace/model/PublisherInfo.java b/spagolite-core/src/main/java/it/eng/spagoIFace/model/PublisherInfo.java index ad6b895..7913bfb 100644 --- a/spagolite-core/src/main/java/it/eng/spagoIFace/model/PublisherInfo.java +++ b/spagolite-core/src/main/java/it/eng/spagoIFace/model/PublisherInfo.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoIFace.model; import org.codehaus.jettison.json.JSONObject; @@ -5,7 +22,8 @@ public class PublisherInfo { public enum Override { - forward, actionForward, actionRedirect, actionProfiledRedirect, redirect, ajaxRedirect, freeze + forward, actionForward, actionRedirect, actionProfiledRedirect, redirect, ajaxRedirect, freeze, + forwardSkipSetLast } private Override type; diff --git a/spagolite-core/src/main/java/it/eng/spagoIFace/session/SessionCoreManager.java b/spagolite-core/src/main/java/it/eng/spagoIFace/session/SessionCoreManager.java index 218ec69..d88951b 100644 --- a/spagolite-core/src/main/java/it/eng/spagoIFace/session/SessionCoreManager.java +++ b/spagolite-core/src/main/java/it/eng/spagoIFace/session/SessionCoreManager.java @@ -1,8 +1,26 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoIFace.session; import javax.servlet.http.HttpSession; public abstract class SessionCoreManager { + protected static final String ACTION_CONTAINER = "###_ACTION_CONTAINER"; protected static final String MESSAGE_CONTAINER = "###_MESSAGE_CONTAINER"; protected static final String FORM_CONTAINER = "###_FORM_CONTAINER"; @@ -14,7 +32,7 @@ public abstract class SessionCoreManager { /** * Ritorna l'url dell'action corrente - * + * * @param httpSession * sessione http * @@ -42,7 +60,7 @@ public static String getLastPublisher(HttpSession httpSession) { /** * Ritorna l'url dell'operazione indicata - * + * * @param httpSession * sessione http * @param operation @@ -55,7 +73,6 @@ public static String getLastPublisher(HttpSession httpSession) { public static String getOperationUrl(HttpSession httpSession, String operation, String additionalInfo) { String actionUrl = getCurrentActionUrl(httpSession); if (additionalInfo != null && !additionalInfo.isEmpty()) { - // if (StringUtils.isNotBlank(additionalInfo)) { return actionUrl + "?operation=" + operation + "&" + additionalInfo; } else { return actionUrl + "?operation=" + operation; diff --git a/spagolite-hibernate-test/pom.xml b/spagolite-hibernate-test/pom.xml new file mode 100644 index 0000000..307df2a --- /dev/null +++ b/spagolite-hibernate-test/pom.xml @@ -0,0 +1,158 @@ + + + 4.0.0 + spagofat-hibernate-test + Spagolite hibernate - test + jar + + it.eng.parer + spagofat + 4.0.2-migrazioneHibernate-SNAPSHOT + + + UTF-8 + 4.3.30.Final + 5.2.5.Final + + + + + + org.apache.openejb + tomee-embedded + 1.7.5 + test + + + org.apache.openejb + openejb-junit + 4.7.5 + test + + + junit + junit + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + com.oracle + ojdbc16 + 11.2.0.3.0 + test + + + javax + javaee-api + 6.0 + provided + + + + + xml-apis + xml-apis + test + + + + + it.eng.parer + spagofat-paginator-gf + + + it.eng.parer + spagofat-timer-wrapper-ejb + ejb + + + org.hibernate + hibernate-entitymanager + ${hibernate-core-version} + + + org.hibernate + hibernate-validator + ${hibernate-validator-version} + + + xalan + xalan + 2.7.0 + test + + + + org.glassfish.main.persistence + eclipselink-wrapper + pom + provided + + + + diff --git a/spagolite-hibernate-test/src/main/java/it/eng/arquillian/Greeter.java b/spagolite-hibernate-test/src/main/java/it/eng/arquillian/Greeter.java new file mode 100644 index 0000000..3282709 --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/arquillian/Greeter.java @@ -0,0 +1,41 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.arquillian; + +import java.io.PrintStream; + +/** + * + * @author mbertuzzi + */ +public class Greeter { + + public void greet(PrintStream to, String name) { + to.println(createGreeting(name)); + } + + public String createGreeting(String name) { + return "Hello, " + name + "!"; + } + +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ChildEntity.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ChildEntity.java new file mode 100644 index 0000000..055c48a --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ChildEntity.java @@ -0,0 +1,52 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.hibernate.lazyLoad; + +import java.io.Serializable; +import javax.persistence.*; + +@Entity +@Table(name = "TEST_CHILD") +public class ChildEntity implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "ID_TEST_CHILD") + private long idTestChild; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_TEST_PARENT") + private ParentEntity parentEntity; + + public long getIdTestParent() { + return idTestChild; + } + + public void setIdTestParent(long idTestParent) { + this.idTestChild = idTestParent; + } + + public ParentEntity getParentEntity() { + return parentEntity; + } + + public void setParentEntity(ParentEntity parentEntity) { + this.parentEntity = parentEntity; + } +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ParentEntity.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ParentEntity.java new file mode 100644 index 0000000..e991619 --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/lazyLoad/ParentEntity.java @@ -0,0 +1,51 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.hibernate.lazyLoad; + +import java.io.Serializable; +import javax.persistence.*; + +@Entity +@Table(name = "TEST_PARENT") +public class ParentEntity implements Serializable { + + private static final long serialVersionUID = 1L; + private long idTestParent; + private ChildEntity childEntity; + + @Id + @Column(name = "ID_TEST_PARENT") + public long getIdTestParent() { + return idTestParent; + } + + public void setIdTestParent(long idTestParent) { + this.idTestParent = idTestParent; + } + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_TEST_PARENT") + public ChildEntity getChildEntity() { + return childEntity; + } + + public void setChildEntity(ChildEntity childEntity) { + this.childEntity = childEntity; + } + +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/paginator/StatementInterceptor.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/paginator/StatementInterceptor.java new file mode 100644 index 0000000..64315c7 --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/paginator/StatementInterceptor.java @@ -0,0 +1,65 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.paginator; + +import it.eng.paginator.ejb.PaginatorInterceptor; +import it.eng.spagoLite.db.base.table.LazyListBean; +import java.util.Iterator; +import javax.ejb.DependsOn; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.persistence.criteria.CriteriaBuilder; +import org.hibernate.EmptyInterceptor; +import org.hibernate.Session; + +/** + * + * @author mbertuzzi + */ +public class StatementInterceptor extends EmptyInterceptor { + + @Override + public String onPrepareStatement(String sql) { + if (isToPaginate() && isReadQuery(sql)) { + // gestisco la paginazione + return sql; + } + return sql; + } + + @Override + public void postFlush(Iterator entities) { + System.out.println("postFlush"); + } + + private boolean isReadQuery(String sql) { + return sql != null && sql.toUpperCase().matches("\\s*SELECT.*"); + } + + private boolean isToPaginate() { + LazyListBean llBean = PaginatorInterceptor.getLazyListBean(); + return llBean != null && !llBean.isQueryAlreadyExecuted(); + } + +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild2Entity.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild2Entity.java new file mode 100644 index 0000000..edd6715 --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild2Entity.java @@ -0,0 +1,101 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.sequence; + +import it.eng.sequences.hibernate.NonMonotonicSequenceGenerator; +import java.io.Serializable; +import java.util.List; +import javax.persistence.Cacheable; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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.SequenceGenerator; +import javax.persistence.Table; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE_CHILD2") +@NamedQuery(name = "SequenceChild2Entity.findAll", query = "SELECT a FROM SequenceChild2Entity a order by a.id") +public class SequenceChild2Entity implements Serializable { + + private long id; + private String campo; + private SequenceChildEntity sequenceChildEntity; + private List child3Entitys; + + @Id + // @NonMonotonicSequenceGenerator(sequenceName = "TSEQUENCE2") + @GeneratedValue(generator = "childGen", strategy = GenerationType.SEQUENCE) + @SequenceGenerator(name = "childGen", sequenceName = "TSEQUENCE2") + @Column(name = "ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "CAMPO", nullable = true) + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_CHILD") + public SequenceChildEntity getSequenceChildEntity() { + return sequenceChildEntity; + } + + public void setSequenceChildEntity(SequenceChildEntity sequenceChildEntity) { + this.sequenceChildEntity = sequenceChildEntity; + } + + @OneToMany(mappedBy = "sequenceChild2Entity" + // , cascade = { CascadeType.PERSIST, CascadeType.MERGE } + ) + public List getChild3Entitys() { + return child3Entitys; + } + + public void setChild3Entitys(List child3Entitys) { + this.child3Entitys = child3Entitys; + } + +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild3Entity.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild3Entity.java new file mode 100644 index 0000000..51d5100 --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChild3Entity.java @@ -0,0 +1,86 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.sequence; + +import it.eng.sequences.hibernate.NonMonotonicSequenceGenerator; +import java.io.Serializable; +import javax.persistence.Cacheable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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.SequenceGenerator; +import javax.persistence.Table; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE_CHILD3") +@NamedQuery(name = "SequenceChild3Entity.findAll", query = "SELECT a FROM SequenceChild3Entity a order by a.id") +public class SequenceChild3Entity implements Serializable { + + private Long id; + private String campo; + private SequenceChild2Entity sequenceChild2Entity; + + @Id + // @NonMonotonicSequenceGenerator(sequenceName = "TSEQUENCE2") + // @GeneratedValue(generator = "childGen", strategy = GenerationType.SEQUENCE) + // @SequenceGenerator(name = "childGen", sequenceName = "TSEQUENCE2") + @Column(name = "ID") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name = "CAMPO", nullable = true) + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_CHILD2") + public SequenceChild2Entity getSequenceChild2Entity() { + return sequenceChild2Entity; + } + + public void setSequenceChild2Entity(SequenceChild2Entity sequenceChild2Entity) { + this.sequenceChild2Entity = sequenceChild2Entity; + } + +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChildEntity.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChildEntity.java new file mode 100644 index 0000000..5581447 --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceChildEntity.java @@ -0,0 +1,99 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.sequence; + +import it.eng.sequences.hibernate.NonMonotonicSequenceGenerator; +import java.io.Serializable; +import java.util.List; +import javax.persistence.Cacheable; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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.SequenceGenerator; +import javax.persistence.Table; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE_CHILD") +@NamedQuery(name = "SequenceChildEntity.findAll", query = "SELECT a FROM SequenceChildEntity a order by a.id") +public class SequenceChildEntity implements Serializable { + + private long id; + private String campo; + private SequenceEntity testSequenceEntity; + private List child2Entitys; + + @Id + // @NonMonotonicSequenceGenerator(sequenceName = "TSEQUENCE2") + + @GeneratedValue(generator = "childGen", strategy = GenerationType.SEQUENCE) + @SequenceGenerator(name = "childGen", sequenceName = "TSEQUENCE2") + @Column(name = "ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "CAMPO", nullable = true) + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_PARENT") + public SequenceEntity getTestSequenceEntity() { + return testSequenceEntity; + } + + public void setTestSequenceEntity(SequenceEntity testSequenceEntity) { + this.testSequenceEntity = testSequenceEntity; + } + + @OneToMany(mappedBy = "sequenceChildEntity", cascade = { CascadeType.PERSIST, CascadeType.MERGE }) + public List getChild2Entitys() { + return child2Entitys; + } + + public void setChild2Entitys(List child2Entitys) { + this.child2Entitys = child2Entitys; + } +} diff --git a/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceEntity.java b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceEntity.java new file mode 100644 index 0000000..337dabc --- /dev/null +++ b/spagolite-hibernate-test/src/main/java/it/eng/hibernate/sequence/SequenceEntity.java @@ -0,0 +1,86 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.sequence; + +import it.eng.sequences.hibernate.NonMonotonicSequenceGenerator; +import java.io.Serializable; +import java.util.List; +import javax.persistence.Cacheable; +import javax.persistence.CascadeType; +import javax.persistence.Column; +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.SequenceGenerator; +import javax.persistence.Table; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE") +@NamedQuery(name = "SequenceEntity.findAll", query = "SELECT a FROM SequenceEntity a order by a.id") +public class SequenceEntity implements Serializable { + + private long id; + private String note; + private List testSequenceChildEntities; + + @Id + // @NonMonotonicSequenceGenerator(sequenceName = "TSEQUENCE") + @GeneratedValue(generator = "parentGen", strategy = GenerationType.SEQUENCE) + @SequenceGenerator(name = "parentGen", sequenceName = "TSEQUENCE") + @Column(name = "ID") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Column(name = "NOTE", nullable = true) + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + + @OneToMany(mappedBy = "testSequenceEntity", cascade = { CascadeType.PERSIST, CascadeType.DETACH, CascadeType.MERGE, + CascadeType.REFRESH }) + public List getTestSequenceChildEntities() { + return testSequenceChildEntities; + } + + public void setTestSequenceChildEntities(List testSequenceChildEntities) { + this.testSequenceChildEntities = testSequenceChildEntities; + } + +} diff --git a/spagolite-hibernate-test/src/main/resources/META-INF/MANIFEST.MF b/spagolite-hibernate-test/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/spagolite-hibernate-test/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/spagolite-hibernate-test/src/main/resources/META-INF/ejb-jar.xml b/spagolite-hibernate-test/src/main/resources/META-INF/ejb-jar.xml new file mode 100644 index 0000000..54fd397 --- /dev/null +++ b/spagolite-hibernate-test/src/main/resources/META-INF/ejb-jar.xml @@ -0,0 +1,46 @@ + + + + + spagofat-hibernate-test + + + + + diff --git a/spagolite-hibernate-test/src/main/resources/META-INF/persistence.xml b/spagolite-hibernate-test/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..542b00e --- /dev/null +++ b/spagolite-hibernate-test/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,40 @@ + + + + + + + + org.hibernate.ejb.HibernatePersistence + java:/saceriamDs + ../../../spagolite-sl-jpa/target/spagofat-sl-jpa-4.0.2-migrazioneHibernate-SNAPSHOT.jar + ENABLE_SELECTIVE + CALLBACK + + + + + + + + + + + diff --git a/spagolite-hibernate-test/src/test/java/it/eng/DummyTimerHelper.java b/spagolite-hibernate-test/src/test/java/it/eng/DummyTimerHelper.java new file mode 100644 index 0000000..719c9c6 --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/DummyTimerHelper.java @@ -0,0 +1,56 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng; + +import it.eng.parer.jboss.timer.common.JbossJobTimer; +import it.eng.parer.jboss.timer.common.JobTable; +import it.eng.parer.jboss.timer.exception.TimerNotFoundException; +import it.eng.parer.jboss.timer.helper.AbstractJbossTimerHelper; +import java.util.List; +import java.util.Set; +import javax.ejb.Stateless; + +@Stateless(name = "timerHelper") +public class DummyTimerHelper extends AbstractJbossTimerHelper { + + @Override + public String getApplicationName() { + return null; + } + + @Override + public JobTable getJob(String jobName) throws TimerNotFoundException { + return null; + } + + @Override + public List getJobs() { + return null; + } + + @Override + public JbossJobTimer getTimer(String jobName) throws TimerNotFoundException { + return null; + } + + @Override + public Set getApplicationTimerNames() { + return null; + } + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/FakeAuth.java b/spagolite-hibernate-test/src/test/java/it/eng/FakeAuth.java new file mode 100644 index 0000000..88f6968 --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/FakeAuth.java @@ -0,0 +1,52 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng; + +import it.eng.spagoLite.security.User; +import it.eng.spagoLite.security.auth.Authenticator; +import javax.ejb.LocalBean; +import javax.ejb.Stateless; +import javax.servlet.http.HttpSession; + +/** + * + * @author Iacolucci_M Classe finta creata soltanto per darla come risorsa iniettabile a openejb perché una classe di + * spagolite-middle richiede questa risorsa! + */ +@Stateless +@LocalBean +public class FakeAuth extends Authenticator { + + @Override + protected String getAppName() { + throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose + // Tools | Templates. + } + + @Override + public User recuperoAutorizzazioni(HttpSession hs) { + throw new UnsupportedOperationException("Not supported yet."); // To change body of generated methods, choose + // Tools | Templates. + } + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/PaginatorTests.java b/spagolite-hibernate-test/src/test/java/it/eng/PaginatorTests.java new file mode 100644 index 0000000..63b081e --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/PaginatorTests.java @@ -0,0 +1,113 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Properties; +import javax.ejb.EJB; +import javax.ejb.embeddable.EJBContainer; +import javax.naming.NamingException; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +/** + * + * @author Bertuzzi_M + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class PaginatorTests { + + private EJBContainer ejbContainer = null; + + @PersistenceContext + public EntityManager em; + + @EJB + private SimplyEjb ejb; + + @Test + public void dummyTest() { + + } + + // @Test + // public void selectQuery_richiamaInterceptor() { + // ejb.querySelect(em); + // } + + @Test + public void updateQuery_nonRichiamaInterceptor() { + ejb.queryUpdate(em); + } + + @Test + public void tipoDiRitornoNonCompatibile_exception() { + try { + ejb.queryUpdateVoid(em); + Assert.fail( + "Se il metoodo chiamato non ritorna un tipo compatibile con l'interceptor dev'essere sollevata un'eccezione"); + } catch (Exception e) { + Assert.assertTrue(true); + } + } + + @BeforeClass + public static void setUpClass() { + } + + @AfterClass + public static void tearDownClass() { + } + + @Before + public void setUp() throws NamingException, FileNotFoundException, IOException { + Properties props = new Properties(); + String locationPath = PaginatorTests.class.getProtectionDomain().getCodeSource().getLocation().getFile(); + String fileProperties = locationPath + "jndi.properties"; + + try (FileInputStream in = new FileInputStream(fileProperties)) { + props.load(in); + } + + ejbContainer = EJBContainer.createEJBContainer(props); + ejbContainer.getContext().bind("inject", this); + } + + @After + public void tearDown() { + if (ejbContainer != null) { + ejbContainer.close(); + } + } + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/SimplyEjb.java b/spagolite-hibernate-test/src/test/java/it/eng/SimplyEjb.java new file mode 100644 index 0000000..5eea2fe --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/SimplyEjb.java @@ -0,0 +1,64 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng; + +//import it.eng.parer.sacerlog.entity.LogEvento; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.base.table.BaseTable; +import java.util.List; +import javax.ejb.LocalBean; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.persistence.EntityManager; +import javax.persistence.Query; + +/** + * + * @author Iacolucci_M + */ +@Stateless +@LocalBean +@TransactionAttribute(TransactionAttributeType.REQUIRED) +public class SimplyEjb { + + // public AbstractBaseTable querySelect(EntityManager em) { + // Query query = em.createQuery("SELECT e FROM LogEvento e WHERE e.idEvento=:id"); + // query.setParameter("id", 1L); + // List eventiList = query.getResultList(); + // return new BaseTable(); + // } + + public AbstractBaseTable queryUpdate(EntityManager em) { + Query q = em.createQuery("UPDATE LogEvento e SET nmAzione=nmAzione WHERE e.idEvento= :id"); + q.setParameter("id", 1L); + q.executeUpdate(); + return new BaseTable(); + } + + public void queryUpdateVoid(EntityManager em) { + Query q = em.createQuery("UPDATE LogEvento e SET nmAzione=nmAzione WHERE e.idEvento= :id"); + q.setParameter("id", 1L); + } + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/arquillian/ArquillianTest.java b/spagolite-hibernate-test/src/test/java/it/eng/arquillian/ArquillianTest.java new file mode 100644 index 0000000..b004144 --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/arquillian/ArquillianTest.java @@ -0,0 +1,56 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.arquillian; + +/*import javax.inject.Inject; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +*/ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author mbertuzzi + */ + +// @RunWith(Arquillian.class) +public class ArquillianTest { + /* + * @Deployment public static JavaArchive createDeployment() { JavaArchive jar = + * ShrinkWrap.create(JavaArchive.class).addClass(Greeter.class); System.out.println(jar.toString(true)); return jar; + * } + * + * @Inject Greeter greeter; + * + * @Test public void should_create_greeting() { Assert.assertEquals("Hello, Earthling!", + * greeter.createGreeting("Earthling")); greeter.greet(System.out, "Earthling"); } + */ + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/hibernate/lazyLoad/HibernateLazyLoadTests.java b/spagolite-hibernate-test/src/test/java/it/eng/hibernate/lazyLoad/HibernateLazyLoadTests.java new file mode 100644 index 0000000..67a1404 --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/hibernate/lazyLoad/HibernateLazyLoadTests.java @@ -0,0 +1,87 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.lazyLoad; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Properties; +import javax.ejb.embeddable.EJBContainer; +import javax.naming.NamingException; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +/** + * + * @author Bertuzzi_M + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class HibernateLazyLoadTests { + + private EJBContainer ejbContainer = null; + + @PersistenceContext + public EntityManager em; + + @Test + public void retrieveIdFromHibernateLazyProxy() { + ChildEntity entity = em.find(ChildEntity.class, 10L); + Assert.assertNotNull(entity.getParentEntity()); + Assert.assertEquals(1L, entity.getParentEntity().getIdTestParent()); + } + + @Test + public void retrieveNullFromHibernateLazyProxy() { + ChildEntity entity = em.find(ChildEntity.class, 20L); + Assert.assertNull(entity.getParentEntity()); + } + + @Before + public void setUp() throws NamingException, FileNotFoundException, IOException { + Properties props = new Properties(); + String locationPath = HibernateLazyLoadTests.class.getProtectionDomain().getCodeSource().getLocation() + .getFile(); + String fileProperties = locationPath + "jndi.properties"; + + try (FileInputStream in = new FileInputStream(fileProperties)) { + props.load(in); + } + + ejbContainer = EJBContainer.createEJBContainer(props); + ejbContainer.getContext().bind("inject", this); + } + + @After + public void tearDown() { + if (ejbContainer != null) { + ejbContainer.close(); + } + } + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/CascadeMergeTests.java b/spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/CascadeMergeTests.java new file mode 100644 index 0000000..b21bca1 --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/CascadeMergeTests.java @@ -0,0 +1,116 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.sequence; + +import it.eng.hibernate.sequence.SequenceEntity; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Properties; +import javax.annotation.Resource; +import javax.ejb.embeddable.EJBContainer; +import javax.naming.NamingException; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.transaction.UserTransaction; +import org.junit.After; +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +/** + * + * @author Bertuzzi_M + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class CascadeMergeTests { + + private EJBContainer ejbContainer = null; + + @PersistenceContext + public EntityManager em; + @Resource + private UserTransaction tx; + + @Test + public void mergeParentWithTransientChild() throws Exception { + tx.begin(); + SequenceEntity toPersist = new SequenceEntity(); + // toPersist.setId(111L); + em.persist(toPersist); + em.flush(); + long id = toPersist.getId(); + // -------------------------------------------------------- + SequenceEntity parent = em.find(SequenceEntity.class, id); + + SequenceChildEntity child = new SequenceChildEntity(); + // child.setId(222L); + child.setTestSequenceEntity(parent); + + SequenceChild2Entity nephew = new SequenceChild2Entity(); + // nephew.setId(333L); + nephew.setSequenceChildEntity(child); + + SequenceChild3Entity grandnephew = new SequenceChild3Entity(); + // nephew.setId(333L); + grandnephew.setSequenceChild2Entity(nephew); + + nephew.setChild3Entitys(new ArrayList<>()); + nephew.getChild3Entitys().add(grandnephew); + + child.setChild2Entitys(new ArrayList<>()); + child.getChild2Entitys().add(nephew); + + parent.setTestSequenceChildEntities(new ArrayList<>()); + parent.getTestSequenceChildEntities().add(child); + + final SequenceEntity merge = em.merge(parent); + em.flush(); + + tx.commit(); + } + + @Before + public void setUp() throws NamingException, FileNotFoundException, IOException { + Properties props = new Properties(); + String locationPath = CascadeMergeTests.class.getProtectionDomain().getCodeSource().getLocation().getFile(); + String fileProperties = locationPath + "jndi.properties"; + + try (FileInputStream in = new FileInputStream(fileProperties)) { + props.load(in); + } + + ejbContainer = EJBContainer.createEJBContainer(props); + ejbContainer.getContext().bind("inject", this); + } + + @After + public void tearDown() { + if (ejbContainer != null) { + ejbContainer.close(); + } + } + +} diff --git a/spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/NonMonotonicSequenceGeneratorTests.java b/spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/NonMonotonicSequenceGeneratorTests.java new file mode 100644 index 0000000..6849eb3 --- /dev/null +++ b/spagolite-hibernate-test/src/test/java/it/eng/hibernate/sequence/NonMonotonicSequenceGeneratorTests.java @@ -0,0 +1,237 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.hibernate.sequence; + +import it.eng.hibernate.sequence.SequenceEntity; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import javax.annotation.Resource; +import javax.ejb.embeddable.EJBContainer; +import javax.naming.NamingException; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.transaction.UserTransaction; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.*; + +/** + * + * @author Bertuzzi_M + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class NonMonotonicSequenceGeneratorTests { + + private EJBContainer ejbContainer = null; + + @PersistenceContext + public EntityManager em; + @Resource + private UserTransaction tx; + + @Test + public void insertNuoviRecord() throws Exception { + tx.begin(); + SequenceEntity entity1 = new SequenceEntity(); + entity1.setNote("First JUnit insertRecordConSequence"); + em.persist(entity1); + + SequenceEntity entity2 = new SequenceEntity(); + entity2.setNote("Second JUnit insertRecordConSequence"); + em.persist(entity2); + + // se generata correttamente la seconda sequence non è il numero successivo rispetto alla prima + assertThat(entity2.getId(), is(not(entity1.getId() + 1L))); + assertThat(entity2.getId(), is(not(entity1.getId() - 1L))); + + Query query = em.createNamedQuery("SequenceEntity.findAll"); + List entities = query.getResultList(); + Assert.assertEquals(2, entities.size()); + tx.rollback(); + } + + @Test + public void aggiornaUnCampo() throws Exception { + tx.begin(); + SequenceEntity entity = new SequenceEntity(); + entity.setNote("First JUnit insertRecordConSequence"); + em.persist(entity); + em.flush(); + long id = entity.getId(); + + em.detach(entity); + + final String newNote = "Updated"; + SequenceEntity entityFromDb = em.find(SequenceEntity.class, id); + entityFromDb.setNote(newNote); + + SequenceEntity entityMerged = em.merge(entityFromDb); + em.flush(); + + Assert.assertEquals(id, entityMerged.getId()); + Assert.assertEquals(newNote, entityMerged.getNote()); + + tx.rollback(); + } + + @Test + public void aggiungiUnRecordFiglio() throws Exception { + tx.begin(); + SequenceEntity entity = new SequenceEntity(); + entity.setNote("First JUnit insertRecordConSequence"); + em.persist(entity); + em.flush(); + long id = entity.getId(); + em.detach(entity); + + SequenceEntity parent = em.find(SequenceEntity.class, id); + SequenceChildEntity child = new SequenceChildEntity(); + child.setTestSequenceEntity(parent); + child.setCampo("No matter"); + + parent.setTestSequenceChildEntities(new ArrayList<>()); + parent.getTestSequenceChildEntities().add(child); + + SequenceEntity merged = em.merge(parent); + em.flush(); + + Assert.assertEquals(id, merged.getId()); + Assert.assertEquals(1, merged.getTestSequenceChildEntities().size()); + + tx.rollback(); + } + + @Test + public void aggiungiPiuRecordFigli() throws Exception { + tx.begin(); + SequenceEntity entity = new SequenceEntity(); + entity.setNote("First JUnit insertRecordConSequence"); + em.persist(entity); + em.flush(); + long id = entity.getId(); + em.detach(entity); + + SequenceEntity parent = em.find(SequenceEntity.class, id); + SequenceChildEntity child = new SequenceChildEntity(); + child.setTestSequenceEntity(parent); + child.setCampo("No matter"); + SequenceChildEntity child2 = new SequenceChildEntity(); + child2.setTestSequenceEntity(parent); + child2.setCampo("No matter2"); + + parent.setTestSequenceChildEntities(new ArrayList<>()); + parent.getTestSequenceChildEntities().add(child); + parent.getTestSequenceChildEntities().add(child2); + + SequenceEntity merged = em.merge(parent); + em.flush(); + + Assert.assertEquals(id, merged.getId()); + Assert.assertEquals(2, merged.getTestSequenceChildEntities().size()); + + tx.rollback(); + } + + @Test + public void threeLevelsChildTest() throws Exception { + tx.begin(); + SequenceEntity entity = new SequenceEntity(); + entity.setId(99999999999L); + entity.setNote("parent"); + em.persist(entity); + em.flush(); + long id = entity.getId(); + em.detach(entity); + SequenceEntity parent = em.find(SequenceEntity.class, id); + + SequenceChildEntity firstChild = new SequenceChildEntity(); + firstChild.setTestSequenceEntity(parent); + firstChild.setCampo("child_1_1"); + SequenceChildEntity secondChild = new SequenceChildEntity(); + secondChild.setTestSequenceEntity(parent); + secondChild.setCampo("child_1_2"); + + SequenceChild2Entity firstChild2 = new SequenceChild2Entity(); + firstChild2.setSequenceChildEntity(firstChild); + firstChild2.setCampo("child_2_1"); + SequenceChild2Entity secondChild2 = new SequenceChild2Entity(); + secondChild2.setSequenceChildEntity(firstChild); + secondChild2.setCampo("child_2_2"); + + SequenceChild3Entity child3 = new SequenceChild3Entity(); + child3.setCampo("child_3_1"); + child3.setSequenceChild2Entity(firstChild2); + + firstChild2.setChild3Entitys(new ArrayList<>()); + firstChild2.getChild3Entitys().add(child3); + + firstChild.setChild2Entitys(new ArrayList<>()); + firstChild.getChild2Entitys().add(firstChild2); + firstChild.getChild2Entitys().add(secondChild2); + + parent.setTestSequenceChildEntities(new ArrayList<>()); + parent.getTestSequenceChildEntities().add(firstChild); + parent.getTestSequenceChildEntities().add(secondChild); + + SequenceEntity merged = em.merge(parent); + em.flush(); + + Assert.assertEquals(id, merged.getId()); + + tx.rollback(); + } + + @Before + public void setUp() throws NamingException, FileNotFoundException, IOException { + Properties props = new Properties(); + String locationPath = NonMonotonicSequenceGeneratorTests.class.getProtectionDomain().getCodeSource() + .getLocation().getFile(); + String fileProperties = locationPath + "jndi.properties"; + + try (FileInputStream in = new FileInputStream(fileProperties)) { + props.load(in); + } + + ejbContainer = EJBContainer.createEJBContainer(props); + ejbContainer.getContext().bind("inject", this); + } + + @After + public void tearDown() { + if (ejbContainer != null) { + ejbContainer.close(); + } + } + +} diff --git a/spagolite-hibernate-test/src/test/resources/countselectlist.properties b/spagolite-hibernate-test/src/test/resources/countselectlist.properties new file mode 100644 index 0000000..ca21828 --- /dev/null +++ b/spagolite-hibernate-test/src/test/resources/countselectlist.properties @@ -0,0 +1 @@ +# Serve solo per non far esplodere il paginator in fase di test \ No newline at end of file diff --git a/spagolite-hibernate-test/src/test/resources/create.sql b/spagolite-hibernate-test/src/test/resources/create.sql new file mode 100644 index 0000000..4c265ec --- /dev/null +++ b/spagolite-hibernate-test/src/test/resources/create.sql @@ -0,0 +1,15 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +/** + * Author: mbertuzzi + * Created: 30-Jan-2020 + */ + +CREATE TABLE `Book` ( + `id` int(11) NOT NULL, + `title` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) \ No newline at end of file diff --git a/spagolite-hibernate-test/src/test/resources/data.sql b/spagolite-hibernate-test/src/test/resources/data.sql new file mode 100644 index 0000000..0a449f3 --- /dev/null +++ b/spagolite-hibernate-test/src/test/resources/data.sql @@ -0,0 +1,11 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +/** + * Author: mbertuzzi + * Created: 30-Jan-2020 + */ +DELETE FROM Book; +INSERT INTO Book(id, title) VALUES (1, 'Unit Test Hibernate/JPA with in memory H2 Database'); \ No newline at end of file diff --git a/spagolite-hibernate-test/src/test/resources/jndi.properties b/spagolite-hibernate-test/src/test/resources/jndi.properties new file mode 100644 index 0000000..b152c72 --- /dev/null +++ b/spagolite-hibernate-test/src/test/resources/jndi.properties @@ -0,0 +1,29 @@ +#This is the minimun requirement to lauch OpenEJB +java.naming.factory.initial=org.apache.openejb.client.LocalInitialContextFactory +authenticator = new://Resource?class-name=it.eng.FakeAuth + +#We want OpenEJB to log everything in debug mode +log4j.category.OpenEJB.options = debug +log4j.category.OpenEJB.startup = debug +log4j.category.OpenEJB.startup.config = debug + +#Definition of the default datasource +saceriamDs=new://Resource?type=DataSource +saceriamDs.JdbcDriver=oracle.jdbc.OracleDriver +saceriamDs.JdbcUrl=jdbc:oracle:thin:@parer-vora-b03:1521/PARER19S.ente.regione.emr.it +saceriamDs.JtaManaged=true +saceriamDs.DefaultAutoCommit=false +#SACER_IAM +saceriamDs.UserName=SACER_IAM +saceriamDs.Password=EFi5S819Qv0Nl_mYZT1K + +#In memory DB +#inMemoryDS=new://Resource?type=DataSource +#inMemoryDS.JdbcDriver=org.h2.Driver +#inMemoryDS.JdbcUrl=jdbc:h2:mem:test;INIT=RUNSCRIPT FROM 'classpath:create.sql'\;RUNSCRIPT FROM 'classpath:data.sql' +#inMemoryDS.JtaManaged=true + +#openejb.deployments.classpath.filter.descriptors=true +#openejb.exclude-include.order=exclude-include +#openejb.deployments.classpath.include=".*" +#openejb.deployments.classpath.exclude="" diff --git a/spagolite-hibernate-test/transaction.log b/spagolite-hibernate-test/transaction.log new file mode 100644 index 0000000..e69de29 diff --git a/spagolite-middle/pom.xml b/spagolite-middle/pom.xml index 4d1f8f8..b519603 100644 --- a/spagolite-middle/pom.xml +++ b/spagolite-middle/pom.xml @@ -8,7 +8,7 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT @@ -43,12 +43,6 @@ org.dom4j dom4j - org.apache.commons commons-collections4 @@ -57,10 +51,6 @@ org.springframework.security.extensions spring-security-saml2-core - - commons-lang - commons-lang - commons-httpclient commons-httpclient @@ -93,7 +83,7 @@ org.jboss.spec - jboss-javaee-6.0 + jboss-jakartaee-8.0 pom provided @@ -105,13 +95,29 @@ org.apache.commons commons-text - - + + org.junit.jupiter + junit-jupiter-api + ${junit-jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-engine + ${junit-jupiter.version} + test + + + org.slf4j + slf4j-simple + ${slf4j.version} + test + diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/ExecutionHistory.java b/spagolite-middle/src/main/java/it/eng/spagoLite/ExecutionHistory.java index 4b2b891..98024f9 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/ExecutionHistory.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/ExecutionHistory.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite; import java.io.Serializable; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElement.java b/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElement.java index 501b1d2..a86c805 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElement.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElement.java @@ -1,6 +1,21 @@ -package it.eng.spagoLite; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoCore.error.EMFError; +package it.eng.spagoLite; import java.io.IOException; import java.io.StringWriter; @@ -11,6 +26,8 @@ import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; +import it.eng.spagoCore.error.EMFError; + public class FrameElement implements FrameElementInterface { protected static final long serialVersionUID = 1L; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElementInterface.java b/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElementInterface.java index 68e3846..a15ea31 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElementInterface.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/FrameElementInterface.java @@ -1,12 +1,29 @@ -package it.eng.spagoLite; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoCore.error.EMFError; +package it.eng.spagoLite; import java.io.Serializable; import org.codehaus.jettison.json.JSONObject; import org.dom4j.Element; +import it.eng.spagoCore.error.EMFError; + public interface FrameElementInterface extends Serializable { public Element asXml(); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/SessionManager.java b/spagolite-middle/src/main/java/it/eng/spagoLite/SessionManager.java index 9e2768d..f2b1a9a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/SessionManager.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/SessionManager.java @@ -1,10 +1,23 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite; import java.util.ArrayList; -import it.eng.spagoIFace.session.SessionCoreManager; -import it.eng.spagoLite.form.Form; -import it.eng.spagoLite.message.MessageBox; -import it.eng.spagoLite.security.IUser; import javax.servlet.http.HttpSession; @@ -12,6 +25,11 @@ import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; +import it.eng.spagoIFace.session.SessionCoreManager; +import it.eng.spagoLite.form.Form; +import it.eng.spagoLite.message.MessageBox; +import it.eng.spagoLite.security.IUser; + public class SessionManager extends SessionCoreManager { public static String getCurrentAction(HttpSession httpSession) { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/ActionBase.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/ActionBase.java index 88fc3f6..30e7204 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/ActionBase.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/ActionBase.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.actions; import it.eng.spagoCore.configuration.ConfigSingleton; @@ -15,14 +32,14 @@ import it.eng.spagoLite.security.SuppressLogging; import it.eng.spagoLite.security.profile.Pagina; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.DISABLE_SECURITY; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; +import javax.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -31,8 +48,7 @@ public abstract class ActionBase> extends BaseController { - private static final long serialVersionUID = 1L; - private static Logger logger = LoggerFactory.getLogger(ActionBase.class.getName()); + private static Logger log = LoggerFactory.getLogger(ActionBase.class.getName()); public static final String JSON_OBJECT = "###_JSON_OBJECT"; public static final String CLEAN_HISTORY = "cleanhistory"; @@ -90,7 +106,7 @@ public void service() throws Exception { init(); } catch (Throwable throwable) { - logger.error("Errore durante l'inizializzazione della action", throwable); + log.error("Errore durante l'inizializzazione della action", throwable); return; } @@ -101,7 +117,7 @@ public void service() throws Exception { try { new Process(this).execute(); } catch (Throwable throwable) { - logger.error("Errore interno del server", throwable); + log.error("Errore interno del server", throwable); getMessageBox().addFatal("Errore critico sulla funzionalita', contattare l'assistenza tecnica.", throwable); getMessageBox().setViewMode(ViewMode.plain); @@ -231,6 +247,15 @@ protected void forwardToPublisher(String publisherName) { super.forwardToPublisher(publisherName); } + @Override + protected void forwardToPublisherSkipSetLast(String publisherName) { + ExecutionHistory history = SessionManager.getLastExecutionHistory(getSession()); + if (!publisherName.equals(getLastPublisher()) && (history == null || history.isActionPublished())) { + SessionManager.addPrevExecutionToHistory(getSession(), false, true); + } + super.forwardToPublisherSkipSetLast(publisherName); + } + @Override protected void redirectToPublisher(String publisherName) { ExecutionHistory history = SessionManager.getLastExecutionHistory(getSession()); @@ -278,6 +303,18 @@ protected void redirectToAction(String action, String parameters, String fakeLas redirectToActionProfiled(action + parameters); } + /* + * Torna l'IP del client (se c'è quello del girato dal proxy. MEV#22913 - Logging accessi SPID non autorizzati + */ + protected String getIpClient() { + HttpServletRequest request = getRequest(); + String ipVers = request.getHeader("X-FORWARDED-FOR"); + if (ipVers == null || ipVers.isEmpty()) { + ipVers = request.getRemoteAddr(); + } + return ipVers; + } + public class Process extends FrameElement { private ActionBase actionBase; @@ -333,9 +370,9 @@ public void execute() throws SecurityException, NoSuchMethodException, IllegalAr private void logMethod(Method method) { if (method.isAnnotationPresent(SuppressLogging.class)) { - logger.debug("Eseguo il metodo: " + methodLog()); + log.debug("Eseguo il metodo: " + methodLog()); } else { - logger.info("Eseguo il metodo: " + methodLog()); + log.info("Eseguo il metodo: " + methodLog()); } } @@ -371,7 +408,7 @@ public Element asXml() { // Controllo delle autorizzazioni per le esecuzioni del metodo (azioni e menu) private boolean isAuthorized(Method method, boolean hasParams) throws SecurityException { - if (ConfigSingleton.getDisableSecurity()) { + if (ConfigSingleton.getInstance().getBooleanValue(DISABLE_SECURITY.name())) { return true; } Secure annotation = method.getAnnotation(Secure.class); @@ -404,7 +441,7 @@ private boolean isAuthorized(Method method, boolean hasParams) throws SecurityEx if (p != null && p.getChild(annotation.action()) != null) { return true; } else { - logger.debug("Utente " + getUser().getUsername() + " non autorizzato all'esecuzione del metodo " + log.debug("Utente " + getUser().getUsername() + " non autorizzato all'esecuzione del metodo " + annotation.action() + " in pagina " + getLastPublisher()); getMessageBox().addFatal( "Utente " + getUser().getUsername() + " non autorizzato all'esecuzione dell'azione " diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/RedirectAction.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/RedirectAction.java index 1e9472b..5350026 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/RedirectAction.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/RedirectAction.java @@ -1,8 +1,26 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.actions; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.DISABLE_SECURITY; + import it.eng.spagoCore.configuration.ConfigSingleton; import it.eng.spagoIFace.model.BaseController; -import it.eng.spagoIFace.model.PublisherInfo; import it.eng.spagoLite.SessionManager; import it.eng.spagoLite.security.IUser; @@ -15,8 +33,6 @@ */ public class RedirectAction extends BaseController { - private static final long serialVersionUID = 1L; - @Override public String getControllerName() { return "View.html"; @@ -30,7 +46,7 @@ public void service() throws Exception { // Controllo delle autorizzazioni per le pagine @Override protected final boolean isAuthorized(String pub) { - if (ConfigSingleton.getDisableSecurity()) { + if (ConfigSingleton.getInstance().getBooleanValue(DISABLE_SECURITY.name())) { return true; } IUser user = SessionManager.getUser(getSession()); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/ApplicationBaseProperties.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/ApplicationBaseProperties.java index 7141e26..9d13829 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/ApplicationBaseProperties.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/ApplicationBaseProperties.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/IApplicationBasePropertiesSevice.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/IApplicationBasePropertiesSevice.java index 1d7baf1..54f0106 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/IApplicationBasePropertiesSevice.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/application/IApplicationBasePropertiesSevice.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/FormAction.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/FormAction.java index 2540c7c..59c69e5 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/FormAction.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/FormAction.java @@ -1,5 +1,24 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.actions.form; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.DISABLE_SECURITY; + import it.eng.spagoCore.configuration.ConfigSingleton; import it.eng.spagoCore.error.EMFError; import it.eng.spagoLite.SessionManager; @@ -29,8 +48,7 @@ public abstract class FormAction> extends ActionBase { - private static Logger logger = LoggerFactory.getLogger(FormAction.class.getName()); - private static final long serialVersionUID = 1L; + private static Logger log = LoggerFactory.getLogger(FormAction.class.getName()); private boolean viewAction; private boolean editAction; private boolean deleteAction; @@ -143,10 +161,14 @@ public void setForm(T form) { * Gestisce gli eventi di navigazione sui wizard delle action * * @param wizard + * value * @param element + * value * @param wizardNavigation + * value * * @throws EMFError + * eccezione generica */ public abstract void wizard(Wizard wizard, WizardElement element, Wizard.WizardNavigation wizardNavigation) throws EMFError; @@ -173,7 +195,7 @@ protected void wizardNavigationOnClick(String wizardName, String navigationEvent WizardElement wizardElement = wizard.getComponent(stepName); if (wizardElement == null) { - logger.error("Passo non trovato"); + log.error("Passo non trovato"); getMessageBox().addError("Passo non trovato"); forwardToPublisher(getDefaultPublsherName()); } @@ -282,18 +304,19 @@ protected void check() { // Controllo delle autorizzazioni per le pagine @Override public boolean isAuthorized(String destination) { - if (ConfigSingleton.getDisableSecurity()) { + if (ConfigSingleton.getInstance().getBooleanValue(DISABLE_SECURITY.name())) { return true; } IUser user = SessionManager.getUser(getSession()); if (user != null && user.getProfile().getChild(destination) == null) { // getMessageBox().addFatal("Utente non autorizzato alla visualizzazione della risorsa richiesta"); - logger.debug("Utente " + user.getUsername() + " non autorizzato alla visualizzazione della pagina " + log.debug("Utente " + user.getUsername() + " non autorizzato alla visualizzazione della pagina " + destination); return false; } return true; } + /* * VECCHIO CODICE CHE NON GESTIVA LE FORM DINAMICHE CON UNA SOLA JSP * @@ -306,9 +329,8 @@ public boolean isAuthorized(String destination) { * * return false; } */ - public boolean isUserAuthorized(String action) { - if (ConfigSingleton.getDisableSecurity()) { + if (ConfigSingleton.getInstance().getBooleanValue(DISABLE_SECURITY.name())) { return true; } IUser user = getUser(); @@ -326,7 +348,7 @@ public boolean isUserAuthorized(String action) { if (p != null && p.getChild(action) != null) { return true; } else { - logger.debug("Utente " + user.getUsername() + " non autorizzato all'esecuzione dell'azione " + action + log.debug("Utente " + user.getUsername() + " non autorizzato all'esecuzione dell'azione " + action + " nella pagina " + getLastPublisher()); } } @@ -392,7 +414,7 @@ public void mostraInformativa() throws EMFError { /* * Metodo da ridefinire nel caso in cui si volesse gestire una chiamata all'help che include anche il codice del * menu della pagina per cui si intende chiedere il contenuto del menu. Si utilizza per l'applicazione dispenser che - * ha delle form generiche ma associate a più voci di menu (es.: pievesetstina e altre). + * ha delle form generiche ma associate a piu' voci di menu (es.: pievesetstina e altre). */ /* * protected String getCodiceMenu() { return null; } @@ -434,7 +456,7 @@ public void mostraHelpPagina() { redirectToAjax(jsonObject); } } catch (RuntimeException ex) { - logger.error("Errore durante l'invocazione del WS Rest per l'Help Online.", ex); + log.error("Errore durante l'invocazione del WS Rest per l'Help Online.", ex); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("risposta", diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/ListAction.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/ListAction.java index dc82932..1535a23 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/ListAction.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/form/ListAction.java @@ -1,5 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.actions.form; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.text.StringEscapeUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; + import it.eng.spagoCore.error.EMFError; import it.eng.spagoLite.db.base.BaseTableInterface; import it.eng.spagoLite.db.base.paging.IPaginator; @@ -9,11 +36,6 @@ import it.eng.spagoLite.form.list.List; import it.eng.spagoLite.message.MessageBox.ViewMode; import it.eng.spagoLite.security.IUser; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import org.apache.commons.lang3.StringEscapeUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; public abstract class ListAction> extends FormAction { @@ -24,6 +46,7 @@ public abstract class ListAction> extends For public static final String NE_DETTAGLIO_UPDATE = "update"; public static final String NE_DETTAGLIO_INSERT = "dettaglioInsert"; public static final String NE_DETTAGLIO_DELETE = "delete"; + public static final String NE_DETTAGLIO_CONFIRM_DELETE = "confirmdelete"; public static final String NE_DETTAGLIO_SELECT = "select"; public static final String NE_EXPORT_XLS = "esportaExcel"; public static final String NE_FIRST = "first"; @@ -39,25 +62,8 @@ public abstract class ListAction> extends For public static final String NE_UPDATED_ROW = "updatedRow"; public static final String NE_SHOW_INACTIVE_ROWS = "showInactiveRows"; public static final String NE_HIDE_INACTIVE_ROWS = "hideInactiveRows"; - /* - * private String tableName; private String navigationEvent; private String riga; private String forceReload; - * - * public String getTableName() { return tableName; } - * - * public void setTableName(String tableName) { this.tableName = tableName; } - * - * public String getNavigationEvent() { return navigationEvent; } - * - * public void setNavigationEvent(String navigationEvent) { this.navigationEvent = navigationEvent; } - * - * public String getRiga() { return riga; } - * - * public void setRiga(String riga) { this.riga = riga; } - * - * public String getForceReload() { return forceReload; } - * - * public void setForceReload(String forceReload) { this.forceReload = forceReload; } - */ + // + private static final String CONFIRM_DELETE_PAGE = "/confirmDeletePage"; private static final long serialVersionUID = 4683122278656206133L; public abstract void loadDettaglio() throws EMFError; @@ -82,8 +88,24 @@ public abstract class ListAction> extends For public abstract void filterInactiveRecords(List list) throws EMFError; + // + public void confirmDelete() throws EMFError { + setParameters(); + listNavigationOnClick(getTableName(), getNavigationEvent(), getRiga(), getForceReload()); + } + + public void cancelDelete() { + goBack(); + } + /** * Metodo di utility che viene eseguito dopo ogni query di paginazione lazy + * + * @param list + * value + * + * @throws EMFError + * eccezione generica */ public abstract void postLazyLoad(List list) throws EMFError; @@ -91,6 +113,7 @@ public abstract class ListAction> extends For * Gestisce l'ordinamento sull'ordinamento delle liste * * @throws EMFError + * eccezione generica */ public void listSortOnClick() throws EMFError { String tableName = getRequest().getParameter("table"); @@ -117,20 +140,12 @@ public void listSortOnClick() throws EMFError { forwardToPublisher(getLastPublisher()); } - /* - * private void setParameters() { setTableName(getRequest().getParameter("table")); - * setNavigationEvent(getRequest().getParameter("navigationEvent")); setRiga(getRequest().getParameter("riga")); - * setForceReload(getRequest().getParameter("forceReload")); } - * - * private void setParameters(String param[]) { setTableName(param[0]); setNavigationEvent(param[1]); - * setRiga(param[2]); setForceReload(param[3]); } - */ public void listDetailNavigationOnClick() throws EMFError { setParameters(); listDetailNavigationOnClick(getTableName(), getNavigationEvent(), getRiga(), getForceReload()); } - public void listDetailNavigationOnClick(String param[]) throws EMFError { + public void listDetailNavigationOnClick(String[] param) throws EMFError { setParameters(param); listDetailNavigationOnClick(getTableName(), getNavigationEvent(), getRiga(), getForceReload()); } @@ -140,8 +155,8 @@ public void listNavigationOnClick() throws EMFError { listNavigationOnClick(getTableName(), getNavigationEvent(), getRiga(), getForceReload()); } - // probabilmente questa è una submit - public void listNavigationOnClick(String param[]) throws EMFError { + // probabilmente questa � una submit + public void listNavigationOnClick(String[] param) throws EMFError { setParameters(param); listNavigationOnClick(getTableName(), getNavigationEvent(), getRiga(), getForceReload()); } @@ -150,29 +165,39 @@ public void listNavigationOnClick(String param[]) throws EMFError { * Gestisce gli eventi di navigazione sulle liste * * @param tableName + * nome tabella * @param navigationEvent + * evento * @param riga + * riga * @param forceReload + * reload * * @throws EMFError + * eccezione generica */ protected void listNavigationOnClick(String tableName, String navigationEvent, String riga, String forceReload) throws EMFError { List list = (List) getForm().getComponent(tableName); - // Forzo il goback se la tabella nella lista è null .. l'utente potrebbe aver cliccato il tasto back del browser + // Forzo il goback se la tabella nella lista � null .. l'utente potrebbe aver cliccato il tasto back del + // browser if (list.getTable() == null) { getMessageBox().addWarning( - "Si è verificato un errore (probabilmente) a seguito dell'utilizzo del tasto Indietro del browser.\n E' stata recuperata l'ultima pagina aperta correttamente."); + "Si � verificato un errore (probabilmente) a seguito dell'utilizzo del tasto Indietro del browser.\n E' stata recuperata l'ultima pagina aperta correttamente."); getMessageBox().setViewMode(ViewMode.plain); this.goBack(true); return; } calculateAuthorization(tableName); + /* aggiunto per garantire il tipo di http method utilizzato in base a navigationEvent */ + if (!authorizeHttpMethodOnNavigationEvent(navigationEvent)) { + return; + } forwardToPublisher(getLastPublisher()); if (navigationEvent.equalsIgnoreCase(NE_ELENCO)) { elencoOnClick(); } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_VIEW)) { - list.getTable().setCurrentRowIndex(new Integer(riga)); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); if ("true".equalsIgnoreCase(forceReload)) { initOnClick(); } @@ -181,7 +206,7 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S dettaglioOnClick(); } } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_UPDATE)) { - list.getTable().setCurrentRowIndex(new Integer(riga)); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); loadDettaglio(); dettaglioOnClick(); // Check security @@ -198,11 +223,16 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S if (list.getRowSmandrupper().isInsertable() && isInsertAction()) { insertDettaglio(); } + } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_CONFIRM_DELETE)) { + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); + // Check security + list.getRowSmandrupper().smandruppRow(list.getTable().getCurrentRow()); + if (list.getRowSmandrupper().isDeletable() && isDeleteAction()) { + forwardToDeletePage(); + } } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_DELETE)) { - list.getTable().setCurrentRowIndex(new Integer(riga)); - // loadDettaglio(); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); dettaglioOnClick(); - // Check security list.getRowSmandrupper().smandruppRow(list.getTable().getCurrentRow()); if (list.getRowSmandrupper().isDeletable() && isDeleteAction()) { @@ -220,8 +250,8 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S loadDettaglio(); } else if (navigationEvent.equalsIgnoreCase(NE_PREV)) { // evento invocato se sto paginando dal dettaglio - // invoco il lazyloading solo se è una tabella paginata e se sono alla prima riga - if (list.getTable().getLazyListBean() != null && list.getTable().getCurrentRowIndex() == 0) { + // invoco il lazyloading solo se � una tabella paginata e se sono alla prima riga + if (list.getTable().getLazyListInterface() != null && list.getTable().getCurrentRowIndex() == 0) { this.lazyLoadPrevPage(list); } else { list.getTable().prev(); @@ -229,10 +259,10 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S loadDettaglio(); } else if (navigationEvent.equalsIgnoreCase(NE_NEXT)) { // evento invocato se sto paginando dal dettaglio - // invoco il lazyloading solo se è una tabella paginata e se sono all'ultima riga (ie. l'ultima riga della - // pagina +1 è maggiore del numero di risultati relativi) - if (list.getTable().getLazyListBean() != null && list.getTable().getCurrentRowIndex() - + 1 > list.getTable().getLazyListBean().getMaxResult() - 1) { + // invoco il lazyloading solo se � una tabella paginata e se sono all'ultima riga (ie. l'ultima riga della + // pagina +1 � maggiore del numero di risultati relativi) + if (list.getTable().getLazyListInterface() != null && list.getTable().getCurrentRowIndex() + + 1 > list.getTable().getLazyListInterface().getMaxResult() - 1) { this.lazyLoadNextPage(list); } else { list.getTable().next(); @@ -245,7 +275,7 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S } loadDettaglio(); } else if (navigationEvent.equalsIgnoreCase(NE_GOTO_ROW)) { - list.getTable().setCurrentRowIndex(new Integer(riga)); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); loadDettaglio(); } else if (navigationEvent.equalsIgnoreCase(NE_LAST)) { if (!this.lazyLoadLastPage(list)) { @@ -264,10 +294,10 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_SAVE)) { saveDettaglio(); } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_CANCEL)) { - list.getTable().setCurrentRowIndex(new Integer(riga)); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); undoDettaglio(); } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_SELECT)) { - list.getTable().setCurrentRowIndex(new Integer(riga)); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); select(list); } else if (navigationEvent.equalsIgnoreCase(NE_SET_PAGE_SIZE)) { list.getTable().setPageSize(Integer.parseInt(getRiga())); @@ -281,10 +311,20 @@ protected void listNavigationOnClick(String tableName, String navigationEvent, S postLoad(); } + private void forwardToDeletePage() { + // + getRequest().setAttribute("table", getTableName()); + getRequest().setAttribute("riga", getRiga()); + getRequest().setAttribute("forceReload", getForceReload()); + + forwardToPublisherSkipSetLast(CONFIRM_DELETE_PAGE); + } + private boolean lazySortCurrentPage(List list) throws EMFError { BaseTableInterface table = list.getTable(); - // invoco l'ordinamento lazy se è una tabella paginata - if (table.getLazyListBean() != null && (table.size() < table.getLazyListBean().getCountResultSize())) { + // invoco l'ordinamento lazy se � una tabella paginata + if (table.getLazyListInterface() != null + && (table.size() < table.getLazyListInterface().getCountResultSize())) { table = getPaginator().sort(table); list.setTable(table); postLazyLoad(list); @@ -296,10 +336,11 @@ private boolean lazySortCurrentPage(List list) throws EMFError { private boolean lazyLoadNextPage(List list) throws EMFError { BaseTableInterface table = list.getTable(); - // invoco la paginazione lazy se è una tabella paginata e se la pagina successiva non è contenuta interamente + // invoco la paginazione lazy se � una tabella paginata e se la pagina successiva non � contenuta + // interamente // nella lista che ho in memoria - if (table.getLazyListBean() != null - && table.getLastRowPageIndex() + table.getPageSize() + 1 > table.getLazyListBean().getMaxResult()) { + if (table.getLazyListInterface() != null && table.getLastRowPageIndex() + table.getPageSize() + 1 > table + .getLazyListInterface().getMaxResult()) { table = getPaginator().nextPage(table); list.setTable(table); postLazyLoad(list); @@ -311,9 +352,10 @@ private boolean lazyLoadNextPage(List list) throws EMFError { private boolean lazyLoadPrevPage(List list) throws EMFError { BaseTableInterface table = list.getTable(); - // invoco la paginazione lazy se è una tabella paginata e se la pagina successiva non è contenuta interamente + // invoco la paginazione lazy se � una tabella paginata e se la pagina successiva non � contenuta + // interamente // nella lista che ho in memoria - if (table.getLazyListBean() != null && table.getFirstRowPageIndex() - table.getPageSize() < 0) { + if (table.getLazyListInterface() != null && table.getFirstRowPageIndex() - table.getPageSize() < 0) { table = getPaginator().prevPage(table); list.setTable(table); postLazyLoad(list); @@ -324,8 +366,8 @@ private boolean lazyLoadPrevPage(List list) throws EMFError { private boolean lazyLoadLastPage(List list) throws EMFError { BaseTableInterface table = list.getTable(); - if (table.getLazyListBean() != null && table.fullSize() > table.getLazyListBean().getFirstResult() - + table.getLazyListBean().getMaxResult()) { + if (table.getLazyListInterface() != null && table.fullSize() > table.getLazyListInterface().getFirstResult() + + table.getLazyListInterface().getMaxResult()) { table = getPaginator().lastPage(table); list.setTable(table); postLazyLoad(list); @@ -337,7 +379,7 @@ private boolean lazyLoadLastPage(List list) throws EMFError { private boolean lazyLoadFirstPage(List list) throws EMFError { BaseTableInterface table = list.getTable(); - if (table.getLazyListBean() != null && table.getLazyListBean().getFirstResult() > 0) { + if (table.getLazyListInterface() != null && table.getLazyListInterface().getFirstResult() > 0) { table = getPaginator().firstPage(table); list.setTable(table); postLazyLoad(list); @@ -349,17 +391,19 @@ private boolean lazyLoadFirstPage(List list) throws EMFError { protected boolean lazyLoadGoPage(List list, int page) throws EMFError { BaseTableInterface table = list.getTable(); - // invoco la paginazione lazy se è una tabella paginata - if (table.getLazyListBean() != null && // se il primo index della lista che ho in memoria è maggiore del primo - // index della pagina di destinazione - ((table.getLazyListBean().getFirstResult() > (page - 1) * table.getPageSize()) || // se l'ultimo index - // della lista che ho - // in memoria è minore - // dell'ultimo index - // della pagina di - // destinazione - (table.getLazyListBean().getFirstResult() - + table.getLazyListBean().getMaxResult() < page * table.getPageSize() - 1))) { + // invoco la paginazione lazy se � una tabella paginata + if (table.getLazyListInterface() != null && // se il primo index della lista che ho in memoria � maggiore del + // primo + // index della pagina di destinazione + ((table.getLazyListInterface().getFirstResult() > (page - 1) * table.getPageSize()) || // se l'ultimo + // index + // della lista che ho + // in memoria � minore + // dell'ultimo index + // della pagina di + // destinazione + (table.getLazyListInterface().getFirstResult() + + table.getLazyListInterface().getMaxResult() < page * table.getPageSize() - 1))) { table = getPaginator().goPage(table, page); list.setTable(table); postLazyLoad(list); @@ -373,25 +417,19 @@ protected void listDetailNavigationOnClick(String tableName, String navigationEv String forceReload) throws EMFError { List list = (List) getForm().getComponent(tableName); forwardToPublisher(getLastPublisher()); - int newRiga = new Integer(riga); if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_UPDATE)) { if (list.postAndValidate(getRequest(), getMessageBox())) { updateEditableRows(list); - list.getTable().setCurrentRowIndex(new Integer(riga)); // Cambio + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); // Cambio // riga update(list); } } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_DELETE)) { - // if (newRiga != list.getTable().getCurrentRowIndex()) { - // if (list.postAndValidate(getRequest(), getMessageBox())) { - // updateEditableRows(list); - // list.getTable().setCurrentRowIndex(new Integer(riga)); - // } - // - // } - list.getTable().setCurrentRowIndex(new Integer(riga)); + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); delete(list); - + } else if (navigationEvent.equalsIgnoreCase(NE_DETTAGLIO_CONFIRM_DELETE)) { + list.getTable().setCurrentRowIndex(Integer.parseInt(riga)); + forwardToDeletePage(); } } @@ -406,6 +444,24 @@ private void updateEditableRows(List list) throws EMFError { } } + // meccanismo di "sicurezza" per garantire che il singolo *navigationEvent* risponda + // ad un certo http method (e.g. evitare che la delete di un elemento in lista venga effettuata + // via GET anzich� POST) + private boolean authorizeHttpMethodOnNavigationEvent(String navigationEvent) throws EMFError { + boolean result = true; // default + if (NE_DETTAGLIO_DELETE.equals(navigationEvent)) { + result = HttpMethod.POST.name().equalsIgnoreCase(getRequest().getMethod()); + } + if (!result) { + try { + getResponse().sendError(HttpStatus.METHOD_NOT_ALLOWED.value()); + } catch (IOException e) { + throw new EMFError(EMFError.ERROR, e.getMessage()); + } + } + return result; + } + @Override public void process() throws EMFError { } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LoginAction.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LoginAction.java index eb6a45c..c9a8e2d 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LoginAction.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LoginAction.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.actions.security; import javax.annotation.Resource; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LogoutAction.java b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LogoutAction.java index 5e03bb7..cba5f89 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LogoutAction.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/actions/security/LogoutAction.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.actions.security; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/SqlTypesName.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/SqlTypesName.java index ea84fc4..ec6f715 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/SqlTypesName.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/SqlTypesName.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db; import java.math.BigDecimal; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseRowInterface.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseRowInterface.java index 5c02a6b..d646c4b 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseRowInterface.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseRowInterface.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base; import it.eng.spagoLite.FrameElementInterface; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseTableInterface.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseTableInterface.java index e05e1ff..1b6f0f5 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseTableInterface.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/BaseTableInterface.java @@ -1,7 +1,24 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base; import it.eng.spagoLite.db.base.sorting.SortingRule; -import it.eng.spagoLite.db.base.table.LazyListBean; +import it.eng.spagoLite.db.base.table.LazyListInterface; import java.io.Serializable; @@ -16,6 +33,7 @@ public interface BaseTableInterface extends Iterable * Imposta riga corrente sulla prima riga della pagina passata come parametro. * * @param page + * value */ public void goPage(int page); @@ -57,6 +75,7 @@ public interface BaseTableInterface extends Iterable * Imposta il numero della riga corrente (0 - n). * * @param rigaCorrente + * value */ public void setCurrentRowIndex(int rigaCorrente); @@ -108,7 +127,7 @@ public interface BaseTableInterface extends Iterable public int getPages(); /** - * @return se l'elenco è vuoto + * @return se l'elenco è vuoto */ public boolean isEmpty(); @@ -121,30 +140,10 @@ public interface BaseTableInterface extends Iterable * Carica il table bean a partire dalla tbella passata * * @param table + * value */ void load(BaseTableInterface table); - /** - * Carica il bean da DB - * - * @param query - * - * @throws EMFError - * @throws SQLException - */ - // public void load(ISelectQuery query) throws EMFError, EMFError, SQLException; - - /** - * Carica il bean da DB - * - * @param dataConnection - * @param query - * - * @throws SQLException - * @throws EMFError - */ - // public void load(DataConnection dataConnection, ISelectQuery query) throws EMFError, EMFError, SQLException; - /** * Aggiunge una riga all'elenco * @@ -156,6 +155,7 @@ public interface BaseTableInterface extends Iterable * Aggiunge una riga all'elenco * * @param row + * value * * @return oggetto generico T aggiunto */ @@ -170,7 +170,7 @@ public interface BaseTableInterface extends Iterable /** * Rimuove la riga con indice relativo rowIndex dalla lista e decrementa la "fullSize". Ritorna la riga rimossa - * aggiungendogli un attributo che indica l'indice assoluto della riga rispetto la lista se tale indice non era già + * aggiungendogli un attributo che indica l'indice assoluto della riga rispetto la lista se tale indice non era già * stato settato * * @param rowIndex @@ -195,9 +195,9 @@ public interface BaseTableInterface extends Iterable /** * Ritorna la riga passata. Se: *

    - *
  • la tabella è vuota
  • - *
  • o index è < 0
  • - *
  • o il numero delle righe è minore di index
  • + *
  • la tabella è vuota
  • + *
  • o index è minore di 0
  • + *
  • o il numero delle righe è minore di index
  • *
* * ritorna null. @@ -213,7 +213,9 @@ public interface BaseTableInterface extends Iterable * Aggiunge un criterio di ordinamento * * @param columnName + * value * @param sortType + * value */ public void addSortingRule(String columnName, int sortType); @@ -235,7 +237,7 @@ public interface BaseTableInterface extends Iterable * * @return bean per la paginazione. */ - public LazyListBean getLazyListBean(); + LazyListInterface getLazyListInterface(); /** * Rimuove la riga con indice assoluto RowIndex dalla lista e decrementa la "fullsize" @@ -252,6 +254,7 @@ public interface BaseTableInterface extends Iterable * all'interno della riga stessa. Provvede a ripulire l'indice. * * @param baseRowInterface + * value * * @return la riga aggiunta */ diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/JEEBaseRowInterface.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/JEEBaseRowInterface.java index dc682af..d040a05 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/JEEBaseRowInterface.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/JEEBaseRowInterface.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base; public interface JEEBaseRowInterface { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/AbstractPaginator.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/AbstractPaginator.java index d0f84bc..ad65243 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/AbstractPaginator.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/AbstractPaginator.java @@ -1,15 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.paging; import it.eng.spagoLite.db.base.BaseTableInterface; import it.eng.spagoLite.db.base.table.LazyListBean; +import it.eng.spagoLite.db.base.table.LazyListInterface; public abstract class AbstractPaginator implements IPaginator { @Override public BaseTableInterface nextPage(BaseTableInterface tableBean) { - LazyListBean llBean = tableBean.getLazyListBean(); + LazyListInterface llBean = tableBean.getLazyListInterface(); int oldFirst = llBean.getFirstResult(); - tableBean.getLazyListBean().setFirstResult(oldFirst + llBean.getMaxResult()); + llBean.setFirstResult(oldFirst + llBean.getMaxResult()); BaseTableInterface table = invoke(llBean); updateTableAfterInvoke(tableBean, table); table.first(); @@ -18,9 +36,9 @@ public BaseTableInterface nextPage(BaseTableInterface tableBean) { @Override public BaseTableInterface prevPage(BaseTableInterface tableBean) { - LazyListBean llBean = tableBean.getLazyListBean(); + LazyListInterface llBean = tableBean.getLazyListInterface(); int oldFirst = llBean.getFirstResult(); - tableBean.getLazyListBean().setFirstResult(oldFirst - llBean.getMaxResult()); + llBean.setFirstResult(oldFirst - llBean.getMaxResult()); BaseTableInterface table = invoke(llBean); updateTableAfterInvoke(tableBean, table); return table; @@ -28,8 +46,8 @@ public BaseTableInterface prevPage(BaseTableInterface tableBean) { @Override public BaseTableInterface firstPage(BaseTableInterface tableBean) { - LazyListBean llBean = tableBean.getLazyListBean(); - tableBean.getLazyListBean().setFirstResult(0); + LazyListInterface llBean = tableBean.getLazyListInterface(); + llBean.setFirstResult(0); BaseTableInterface table = invoke(llBean); updateTableAfterInvoke(tableBean, table); table.first(); @@ -38,11 +56,10 @@ public BaseTableInterface firstPage(BaseTableInterface tableBean) { @Override public BaseTableInterface lastPage(BaseTableInterface tableBean) { - LazyListBean llBean = tableBean.getLazyListBean(); - int floorCount = (int) Math - .floor((double) llBean.getCountResultSize() / tableBean.getLazyListBean().getMaxResult()) - * tableBean.getLazyListBean().getMaxResult(); - tableBean.getLazyListBean().setFirstResult(floorCount); + LazyListInterface llBean = tableBean.getLazyListInterface(); + int floorCount = (int) Math.floor((double) llBean.getCountResultSize() / llBean.getMaxResult()) + * tableBean.getLazyListInterface().getMaxResult(); + llBean.setFirstResult(floorCount); BaseTableInterface table = invoke(llBean); updateTableAfterInvoke(tableBean, table); return table; @@ -50,12 +67,11 @@ public BaseTableInterface lastPage(BaseTableInterface tableBean) { @Override public BaseTableInterface goPage(BaseTableInterface tableBean, int page) { - LazyListBean llBean = tableBean.getLazyListBean(); + LazyListInterface llBean = tableBean.getLazyListInterface(); int pageSize = tableBean.getPageSize(); - int firstResult = (int) Math - .floor((double) ((page - 1) * pageSize) / tableBean.getLazyListBean().getMaxResult()) - * tableBean.getLazyListBean().getMaxResult(); - tableBean.getLazyListBean().setFirstResult(firstResult > 0 ? firstResult : 0); + int firstResult = (int) Math.floor((double) ((page - 1) * pageSize) / llBean.getMaxResult()) + * llBean.getMaxResult(); + llBean.setFirstResult(firstResult > 0 ? firstResult : 0); BaseTableInterface table = invoke(llBean); updateTableAfterInvoke(tableBean, table); return table; @@ -63,7 +79,7 @@ public BaseTableInterface goPage(BaseTableInterface tableBean, int page) { @Override public BaseTableInterface sort(BaseTableInterface tableBean) { - LazyListBean llBean = tableBean.getLazyListBean(); + LazyListInterface llBean = tableBean.getLazyListInterface(); llBean.setSortQuery(true); llBean.setOrderBySortingRule(tableBean.getLastSortingRule().getSortType()); llBean.setOrderByColumnName(tableBean.getLastSortingRule().getColumnName()); @@ -88,5 +104,5 @@ private void updateTableAfterInvoke(BaseTableInterface oldTable, BaseTableInt } - protected abstract BaseTableInterface invoke(LazyListBean llBean); + protected abstract BaseTableInterface invoke(LazyListInterface llBean); } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/IPaginator.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/IPaginator.java index dcb0a36..4278a6f 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/IPaginator.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/paging/IPaginator.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.paging; import it.eng.spagoLite.db.base.BaseTableInterface; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/row/BaseRow.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/row/BaseRow.java index 297a8fc..cf3ba37 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/row/BaseRow.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/row/BaseRow.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.row; import it.eng.spagoLite.FrameElement; @@ -30,6 +47,7 @@ public BaseRow() { * Crea un nuovo RowBean e lo prepopola * * @param row + * value */ public BaseRow(BaseRowInterface row) { this.row = new LinkedHashMap(); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/RowComparator.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/RowComparator.java index 6bb6eaa..86e9b79 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/RowComparator.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/RowComparator.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.sorting; import it.eng.spagoLite.db.base.BaseRowInterface; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/SortingRule.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/SortingRule.java index 5a6cca2..a42d6fa 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/SortingRule.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/sorting/SortingRule.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.sorting; import java.io.Serializable; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/AbstractBaseTable.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/AbstractBaseTable.java index e1c944b..9046ace 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/AbstractBaseTable.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/AbstractBaseTable.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.table; import it.eng.spagoLite.FrameElement; @@ -25,6 +42,7 @@ public abstract class AbstractBaseTable extends Fram protected RowComparator rowComparator; protected SortingRule lastSortingRule; protected LazyListBean lazyListBean; + protected LazyListReflectionBean lazyListReflectionBean; public AbstractBaseTable() { clear(); @@ -61,7 +79,6 @@ public void next() { public void goPage(int page) { int capoNextPag = (int) (Math.floor(this.rigaCorrente / getPageSize()) + page) * getPageSize(); if (getPageSize() > 0) { - // this.rigaCorrente = capoNextPag < this.list.size() ? capoNextPag this.rigaCorrente = capoNextPag < this.size() ? capoNextPag : getFirstRowPageIndex(); } } @@ -69,7 +86,6 @@ public void goPage(int page) { public void nextPage() { int capoNextPag = (int) (Math.floor(this.rigaCorrente / getPageSize()) + 1) * getPageSize(); if (getPageSize() > 0) { - // this.rigaCorrente = capoNextPag < this.list.size() ? capoNextPag this.rigaCorrente = capoNextPag < this.size() ? capoNextPag : getFirstRowPageIndex(); } } @@ -83,8 +99,6 @@ public int getCurrentRowIndex() { } public void setCurrentRowIndex(int rigaCorrente) { - // if (rigaCorrente >= this.list.size()) { - // this.rigaCorrente = this.list.size() - 1; if (rigaCorrente >= this.size()) { this.rigaCorrente = this.size() - 1; return; @@ -96,18 +110,6 @@ public void setCurrentRowIndex(int rigaCorrente) { this.rigaCorrente = rigaCorrente; } - // FIXME: controllare bene!!!! - // public void setCurrentRow(T row){ - // if (this.list != null){ - // int i = 0; - // for (T riga : this.list) { - // if (riga.equals(row)){ - // this.rigaCorrente = ++i; - // } - // } - // } - // - // } public int getPageSize() { return this.pageSize; } @@ -120,13 +122,14 @@ public int getCurrentPageIndex() { if (lazyListBean != null) { return (int) Math.ceil((lazyListBean.getFirstResult() + getCurrentRowIndex()) / getPageSize()) + 1; } + if (lazyListReflectionBean != null) { + return (int) Math.ceil((lazyListReflectionBean.getFirstResult() + getCurrentRowIndex()) / getPageSize()) + + 1; + } return (int) Math.ceil(getCurrentRowIndex() / getPageSize()) + 1; } public int getFirstRowPageIndex() { - // if (lazyListBean != null) - // return ((int) Math.floor(getCurrentRowIndex() / getPageSize()) - // * getPageSize())-LazyListBean.maxResult(); return (int) Math.floor(getCurrentRowIndex() / getPageSize()) * getPageSize(); } @@ -135,8 +138,6 @@ public int getLastRowPageIndex() { } public int size() { - // if (lazyListBean != null) - // return this.lazyListBean.getCountResultSize(); return this.list.size(); } @@ -144,6 +145,9 @@ public int fullSize() { if (lazyListBean != null) { return this.lazyListBean.getCountResultSize(); } + if (lazyListReflectionBean != null) { + return this.lazyListReflectionBean.getCountResultSize(); + } return this.list.size(); } @@ -168,16 +172,6 @@ public void load(BaseTableInterface table) { } } - // public void load(ISelectQuery query) throws EMFError, EMFError { - // load(null, query); - // } - // - // public void load(DataConnection dataConnection, ISelectQuery query) - // throws EMFError, EMFError { - // clear(); - // query.select(dataConnection, this); - // } - public T add() { return add(null); } @@ -207,6 +201,7 @@ public T add(BaseRowInterface baseRowInterface) { * Aggiunge record di un tablebean a un tablebean preesistente * * @param table + * value */ public void addAll(BaseTableInterface table) { for (BaseRowInterface row : table) { @@ -280,7 +275,6 @@ public T removeFullIdx(int rowIndex) { && rowIndex < lazyListBean.getFirstResult() + lazyListBean.getMaxResult()) { T row = this.list.remove(rowIndex - lazyListBean.getFirstResult()); setCurrentRowIndex(getCurrentRowIndex()); - // row.setObject(ABSOLUTE_INDEX, rowIndex); return row; } } else if (size() > 0 && rowIndex < size()) { @@ -416,11 +410,19 @@ public List toList(String fieldName) { return toList(fieldName, new SortingRule[] { getLastSortingRule() }); } - public LazyListBean getLazyListBean() { - return lazyListBean; + public LazyListInterface getLazyListInterface() { + return lazyListBean != null ? lazyListBean : lazyListReflectionBean; } public void setLazyListBean(LazyListBean lazyListBean) { this.lazyListBean = lazyListBean; } + + public LazyListReflectionBean getLazyListReflectionBean() { + return lazyListReflectionBean; + } + + public void setLazyListReflectionBean(LazyListReflectionBean lazyListReflectionBean) { + this.lazyListReflectionBean = lazyListReflectionBean; + } } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/BaseTable.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/BaseTable.java index b2ac230..3dd704e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/BaseTable.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/BaseTable.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.table; import it.eng.spagoLite.db.base.row.BaseRow; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListBean.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListBean.java index 4f9b745..5bc1019 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListBean.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListBean.java @@ -1,16 +1,34 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.base.table; import java.io.Serializable; -import java.lang.reflect.Method; +import java.util.List; +import java.util.function.Function; /** - * + * * @author Quaranta_M */ -public class LazyListBean implements Serializable { +public class LazyListBean implements Serializable, LazyListInterface { /** - * + * */ private static final long serialVersionUID = 4568691707917060936L; private int countResultSize; @@ -18,15 +36,14 @@ public class LazyListBean implements Serializable { public static final int HYSTERESIS = 5; private int firstResult; private int maxResult; - private Class helperEJB; - private Method helperMethod; - private Object[] methodParameter; - private boolean queryAlreadyExecuted = false; - private String countSelectList; + private String countDistinctField; private String orderByColumnName; private int orderBySortingRule; private boolean isSortQuery; + private Function resultListToTableBeanFunc; + private LazyQuery lazyQuery; + @Override public int getCountResultSize() { return countResultSize; } @@ -43,53 +60,24 @@ public int decCountResultSize() { return this.countResultSize--; } + @Override public int getFirstResult() { return firstResult; } + @Override public void setFirstResult(int firstResult) { this.firstResult = firstResult; } - public Class getHelperEJB() { - return helperEJB; - } - - public void setHelperEJB(Class helperEJB) { - this.helperEJB = helperEJB; - } - - public Method getHelperMethod() { - return helperMethod; - } - - public void setHelperMethod(Method helperMethod) { - this.helperMethod = helperMethod; - } - - public Object[] getMethodParameter() { - return methodParameter; - } - - public void setMethodParameter(Object[] methodParameter) { - this.methodParameter = methodParameter; - } - - public boolean isQueryAlreadyExecuted() { - return queryAlreadyExecuted; - } - - public void setQueryAlreadyExecuted(boolean queryAlreadyExecuted) { - this.queryAlreadyExecuted = queryAlreadyExecuted; - } - + @Override public int getMaxResult() { return maxResult > 0 ? maxResult : MAX_RESULT; } /** * Setta il numero massimo di record da selezionare nella query - * + * * @param maxResult * deve essere un intero divisibile per 100, altrimenti la paginazione delle liste non funziona * correttamente @@ -101,18 +89,19 @@ public void setMaxResult(int maxResult) { this.maxResult = maxResult; } - public String getCountSelectList() { - return countSelectList; + public String getCountDistinctField() { + return countDistinctField; } - public void setCountSelectList(String countSelectList) { - this.countSelectList = countSelectList; + public void setCountDistinctField(String countDistinctField) { + this.countDistinctField = countDistinctField; } public String getOrderByColumnName() { return orderByColumnName; } + @Override public void setOrderByColumnName(String orderByColumnName) { this.orderByColumnName = orderByColumnName; } @@ -121,6 +110,7 @@ public int getOrderBySortingRule() { return orderBySortingRule; } + @Override public void setOrderBySortingRule(int orderBySortingRule) { this.orderBySortingRule = orderBySortingRule; } @@ -129,7 +119,24 @@ public boolean isSortQuery() { return isSortQuery; } + @Override public void setSortQuery(boolean isSortQuery) { this.isSortQuery = isSortQuery; } + + public Function getResultListToTableBeanFunc() { + return resultListToTableBeanFunc; + } + + public void setResultListToTableBeanFunc(Function resultListToTableBeanFunc) { + this.resultListToTableBeanFunc = resultListToTableBeanFunc; + } + + public LazyQuery getLazyQuery() { + return lazyQuery; + } + + public void setLazyQuery(LazyQuery lazyQuery) { + this.lazyQuery = lazyQuery; + } } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListInterface.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListInterface.java new file mode 100644 index 0000000..3fd7351 --- /dev/null +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListInterface.java @@ -0,0 +1,37 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagoLite.db.base.table; + +/** + * Fornisce le informazioni di minima necessarie a gestire la corretta paginazione delle liste + */ +public interface LazyListInterface { + int getMaxResult(); + + int getCountResultSize(); + + int getFirstResult(); + + void setFirstResult(int firstResult); + + void setSortQuery(boolean isSortQuery); + + void setOrderBySortingRule(int orderBySortingRule); + + void setOrderByColumnName(String orderByColumnName); +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListReflectionBean.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListReflectionBean.java new file mode 100644 index 0000000..0bb652b --- /dev/null +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyListReflectionBean.java @@ -0,0 +1,130 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagoLite.db.base.table; + +import java.io.Serializable; +import java.lang.reflect.Method; + +/** + * Usato solo dal DPI. Non ha logiche di DB e serve a tracciare più in generale il metodo che ha fornito i risultati per + * l'{@link AbstractBaseTable} + * + * @author mbertuzzi + */ +public class LazyListReflectionBean implements Serializable, LazyListInterface { + public static final int MAX_RESULT = 300; + + private Class clazz; + private Method method; + private Object[] parameters; + private int maxResult; + private int countResultSize; + private int firstResult; + private boolean isSortQuery; + private int orderBySortingRule; + private String orderByColumnName; + + @Override + public int getMaxResult() { + return maxResult > 0 ? maxResult : MAX_RESULT; + } + + /** + * Setta il numero massimo di record da selezionare nella query + * + * @param maxResult + * deve essere un intero divisibile per 100, altrimenti la paginazione delle liste non funziona + * correttamente + */ + public void setMaxResult(int maxResult) { + if (maxResult % 100 != 0) + throw new IllegalArgumentException( + "Il parametro maxResult " + maxResult + " deve essere un multiplo di 100"); + this.maxResult = maxResult; + } + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public Method getMethod() { + return method; + } + + public void setMethod(Method method) { + this.method = method; + } + + public Object[] getParameters() { + return parameters; + } + + public void setParameters(Object[] parameters) { + this.parameters = parameters; + } + + @Override + public int getCountResultSize() { + return countResultSize; + } + + public void setCountResultSize(int countResultSize) { + this.countResultSize = countResultSize; + } + + @Override + public int getFirstResult() { + return firstResult; + } + + @Override + public void setFirstResult(int firstResult) { + this.firstResult = firstResult; + } + + @Override + public void setSortQuery(boolean isSortQuery) { + this.isSortQuery = isSortQuery; + } + + @Override + public void setOrderBySortingRule(int orderBySortingRule) { + this.orderBySortingRule = orderBySortingRule; + } + + @Override + public void setOrderByColumnName(String orderByColumnName) { + this.orderByColumnName = orderByColumnName; + } + + public boolean isSortQuery() { + return isSortQuery; + } + + public int getOrderBySortingRule() { + return orderBySortingRule; + } + + public String getOrderByColumnName() { + return orderByColumnName; + } +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyQuery.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyQuery.java new file mode 100644 index 0000000..142610b --- /dev/null +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/LazyQuery.java @@ -0,0 +1,73 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagoLite.db.base.table; + +import javax.persistence.criteria.CriteriaQuery; +import java.io.Serializable; +import java.util.Map; + +public class LazyQuery implements Serializable { + private static final long serialVersionUID = 1L; + + private final String queryString; + private final Map queryParams; + private final String countQueryString; + + private final CriteriaQuery criteriaQuery; + private final CriteriaQuery countCriteriaQuery; + + public LazyQuery(String queryString, String countQueryString, Map queryParams) { + this.queryString = queryString; + this.countQueryString = countQueryString; + this.queryParams = queryParams; + this.criteriaQuery = null; + this.countCriteriaQuery = null; + } + + public LazyQuery(CriteriaQuery criteriaQuery, CriteriaQuery countCriteriaQuery) { + this.queryString = null; + this.countQueryString = null; + this.queryParams = null; + this.criteriaQuery = criteriaQuery; + this.countCriteriaQuery = countCriteriaQuery; + } + + public String getQueryString() { + return queryString; + } + + public Map getQueryParams() { + return queryParams; + } + + public String getCountQueryString() { + return countQueryString; + } + + public CriteriaQuery getCriteriaQuery() { + return criteriaQuery; + } + + public CriteriaQuery getCountCriteriaQuery() { + return countCriteriaQuery; + } + + public boolean isCriteriaQuery() { + return criteriaQuery != null; + } +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/Param.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/Param.java new file mode 100644 index 0000000..617224d --- /dev/null +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/base/table/Param.java @@ -0,0 +1,97 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagoLite.db.base.table; + +import org.springframework.util.Assert; + +import javax.persistence.Query; +import javax.persistence.TemporalType; +import java.util.Calendar; +import java.util.Date; +import java.util.Objects; + +public class Param { + private final String name; + private final Object value; + private final TemporalType temporalType; + + public Param(String name, Object value) { + this(name, value, null); + } + + public Param(String name, Object value, TemporalType temporalType) { + Assert.notNull(name); + this.name = name; + this.value = value; + this.temporalType = temporalType; + } + + private boolean isDate() { + return value instanceof Date; + } + + private Date getDate() { + if (isDate()) { + return Date.class.cast(value); + } + return null; + } + + private boolean isCalendar() { + return value instanceof Calendar; + } + + private Calendar getCalendar() { + if (isCalendar()) { + return Calendar.class.cast(value); + } + return null; + } + + private boolean hasTemporalType() { + return (isDate() || isCalendar()) && temporalType != null; + } + + public void setParameter(Query query) { + if (hasTemporalType()) { + if (isCalendar()) { + query.setParameter(name, getCalendar(), temporalType); + } + if (isDate()) { + query.setParameter(name, getDate(), temporalType); + } + } else { + query.setParameter(name, value); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Param param = (Param) o; + return name.equals(param.name) && Objects.equals(value, param.value) && temporalType == param.temporalType; + } + + @Override + public int hashCode() { + return Objects.hash(name, value, temporalType); + } +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/decodemap/DecodeMapIF.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/decodemap/DecodeMapIF.java index b0ccbc0..af635e2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/decodemap/DecodeMapIF.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/decodemap/DecodeMapIF.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.decodemap; import it.eng.spagoLite.FrameElementInterface; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/ColumnDescriptor.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/ColumnDescriptor.java index 514ae5f..42bf4b6 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/ColumnDescriptor.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/ColumnDescriptor.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.oracle.bean.column; import it.eng.spagoLite.db.SqlTypesName; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/TableDescriptor.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/TableDescriptor.java index 670c371..31c9a84 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/TableDescriptor.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/bean/column/TableDescriptor.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.oracle.bean.column; import java.util.HashMap; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMap.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMap.java index 31d19bf..e5ef1ec 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMap.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMap.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.oracle.decode; import it.eng.spagoLite.db.base.BaseRowInterface; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMapAbs.java b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMapAbs.java index 4d057f1..c9bdf35 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMapAbs.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/db/oracle/decode/DecodeMapAbs.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.db.oracle.decode; import it.eng.spagoLite.FrameElement; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Component.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Component.java index d2d3a1b..6cc7b2f 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Component.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Component.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Element.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Element.java index fbbdc6f..2e1e668 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Element.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Element.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form; public interface Element extends Component { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Elements.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Elements.java index 1c427ae..f9c5d22 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Elements.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Elements.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form; import java.util.List; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Form.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Form.java index 4b524d0..1dd16c2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/Form.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/Form.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseComponent.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseComponent.java index 15cc595..b82fc95 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseComponent.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseComponent.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.base; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElement.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElement.java index c3c7fe1..9fb3a45 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElement.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElement.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.base; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElements.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElements.java index 417bbf0..4304347 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElements.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseElements.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.base; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseForm.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseForm.java index ade5150..0e2d9d2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseForm.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/base/BaseForm.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.base; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/buttonList/ButtonList.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/buttonList/ButtonList.java index 48fc548..f305a76 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/buttonList/ButtonList.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/buttonList/ButtonList.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.buttonList; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Field.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Field.java index 950c8f4..46551f0 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Field.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Field.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Fields.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Fields.java index 69f555c..7af9e25 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Fields.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Fields.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields; import it.eng.spagoCore.error.EMFError; @@ -11,6 +28,7 @@ import it.eng.spagoLite.message.MessageBox; import java.io.File; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; @@ -32,6 +50,7 @@ public class Fields extends BaseElements { private static final long serialVersionUID = 1L; private static final int SIZE_THRESHOLD = 1000000; + public static final String ERRORE_JSON = "Errore durante il settaggio dell'errore json"; private Status status; @@ -64,7 +83,7 @@ public void post(HttpServletRequest servletRequest) { * se la dimensione massima del file è stata raggiunta o si è verificato un errore di I/O. * */ - public String[] postMultipart(HttpServletRequest servletRequest, int maxFileSize) throws FileUploadException { + public String[] postMultipart(HttpServletRequest servletRequest, long maxFileSize) throws FileUploadException { return this.postMultipart(servletRequest, new File(System.getProperty("java.io.tmpdir")), maxFileSize); } @@ -83,15 +102,15 @@ public String[] postMultipart(HttpServletRequest servletRequest, int maxFileSize * se la dimensione massima del file è stata raggiunta o si è verificato un errore di I/O. * */ - public String[] postMultipart(HttpServletRequest servletRequest, File tempDirRepository, int maxFileSize) + public String[] postMultipart(HttpServletRequest servletRequest, File tempDirRepository, long maxFileSize) throws FileUploadException { if (!ServletFileUpload.isMultipartContent(servletRequest)) { throw new IllegalArgumentException( "La request non è di tipo multipart/form-data utilizzare il metodo post(HttpServletRequest servletRequest)"); } String[] paramReturn = null; - Map paramMap = new HashMap(); - Map fileMap = new HashMap(); + Map paramMap = new HashMap<>(); + Map fileMap = new HashMap<>(); // Create a factory for disk-based file items DiskFileItemFactory factory = new DiskFileItemFactory(SIZE_THRESHOLD, tempDirRepository); // Create a new file upload handler @@ -101,7 +120,7 @@ public String[] postMultipart(HttpServletRequest servletRequest, File tempDirRep for (FileItem item : upload.parseRequest(servletRequest)) { if (item.isFormField()) { - String value = new String(item.get(), Charset.forName("UTF-8")); + String value = new String(item.get(), Charset.forName(StandardCharsets.UTF_8.name())); paramMap.put(item.getFieldName(), value); if (item.getFieldName().toLowerCase().startsWith("operation")) { String[] tmp = StringUtils.split(item.getFieldName(), "_"); @@ -146,6 +165,7 @@ public String[] postMultipart(HttpServletRequest servletRequest, File tempDirRep * oggetto bean * * @throws EMFError + * eccezione generica */ public void copyFromBean(BaseRowInterface row) throws EMFError { for (Field field : this) { @@ -163,6 +183,7 @@ public void copyFromBean(BaseRowInterface row) throws EMFError { * oggetto bean * * @throws EMFError + * eccezione generica */ public void copyToBean(BaseRowInterface row) throws EMFError { for (Field field : this) { @@ -235,6 +256,7 @@ public boolean postAndValidate(HttpServletRequest servletRequest, MessageBox mes * @return json object * * @throws EMFError + * eccezione generica */ public JSONObject asJSON(Message msg) throws EMFError { JSONObject json = asJSON(); @@ -255,7 +277,7 @@ public JSONObject asJSON(Message msg) throws EMFError { break; } } catch (JSONException ex) { - throw new EMFError(EMFError.ERROR, "Errore durante il settaggio dell'errore json", ex); + throw new EMFError(EMFError.ERROR, ERRORE_JSON, ex); } } return json; @@ -271,13 +293,14 @@ public JSONObject asJSON(Message msg) throws EMFError { * @return Json object * * @throws EMFError + * eccezione generica */ public JSONObject asJSON(String funcName) throws EMFError { JSONObject json = asJSON(); try { json.put("jsonFunctionName", funcName); } catch (JSONException ex) { - throw new EMFError(EMFError.ERROR, "Errore durante il settaggio dell'errore json", ex); + throw new EMFError(EMFError.ERROR, ERRORE_JSON, ex); } return json; } @@ -295,13 +318,14 @@ public JSONObject asJSON(String funcName) throws EMFError { * @return Json object * * @throws EMFError + * eccezione generica */ public JSONObject asJSON(Message msg, String funcName) throws EMFError { JSONObject json = asJSON(msg); try { json.put("jsonFunctionName", funcName); } catch (JSONException ex) { - throw new EMFError(EMFError.ERROR, "Errore durante il settaggio dell'errore json", ex); + throw new EMFError(EMFError.ERROR, ERRORE_JSON, ex); } return json; } @@ -337,7 +361,7 @@ public void clear() { } public int compare(BaseRowInterface row, Field[] excludeList) throws EMFError { - Set excludeSet = new HashSet(); + Set excludeSet = new HashSet<>(); for (Field field : excludeList) { excludeSet.add(field); } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/IMappableField.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/IMappableField.java index ed50547..78a8f22 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/IMappableField.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/IMappableField.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields; import it.eng.spagoLite.db.decodemap.DecodeMapIF; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/MultiValueField.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/MultiValueField.java index bc9fc16..268b3d9 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/MultiValueField.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/MultiValueField.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Section.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Section.java index 85266de..a8b8731 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Section.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/Section.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/SingleValueField.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/SingleValueField.java index 2244c2c..84e5b48 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/SingleValueField.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/SingleValueField.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Button.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Button.java index 8726222..8b074a9 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Button.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Button.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/CheckBox.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/CheckBox.java index 20f8fc8..d4ad567 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/CheckBox.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/CheckBox.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/ComboBox.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/ComboBox.java index 6e36da2..c66123e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/ComboBox.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/ComboBox.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Input.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Input.java index 263d7ab..38c3462 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Input.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Input.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Link.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Link.java index 07d45c4..534c449 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Link.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Link.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSelect.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSelect.java index f6d26af..d3fea94 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSelect.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSelect.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSemaphore.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSemaphore.java index 0e623d2..1b04133 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSemaphore.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/MultiSemaphore.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; @@ -22,15 +39,31 @@ public class MultiSemaphore extends MultiValueField implements IMappable * Costruttore. Per default i checkbox del semaforo sono inizialmente tutti ceccati. * * @param parent + * genitore * @param name + * nome * @param description + * descrizione * @param alias + * value * @param type + * tipo * @param format + * formato * @param required + * boolean true/false se obbligatorio * @param hidden + * value * @param readonly + * boolean true/false * @param trigger + * boolean true/false + * @param greenChecked + * boolean true/false + * @param yellowChecked + * boolean true/false + * @param redChecked + * boolean true/false */ public MultiSemaphore(Component parent, String name, String description, String alias, it.eng.spagoLite.xmlbean.form.Field.Type.Enum type, String format, boolean required, boolean hidden, @@ -168,8 +201,10 @@ public void post(HttpServletRequest servletRequest) { } /** - * * @return string del tipo "VRG" con le iniziali dei semafori checkati (Verde Rosso Giallo) + * + * @throws EMFError + * eccezione generica */ public String getConcatFlagSemaforo() throws EMFError { String flags = ""; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Radio.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Radio.java index cdb276f..f86945d 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Radio.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Radio.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Semaphore.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Semaphore.java index 53cf748..92ac4b9 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Semaphore.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/Semaphore.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/TextArea.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/TextArea.java index 62d59ad..35d7f8b 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/TextArea.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/fields/impl/TextArea.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.fields.impl; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/Grid.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/Grid.java index 55f366a..0421ec2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/Grid.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/Grid.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.grid; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridCell.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridCell.java index 56776cd..7d660a1 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridCell.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridCell.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.grid; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridRow.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridRow.java index 6e6580b..0a4fb2d 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridRow.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/grid/GridRow.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.grid; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/List.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/List.java index 3827b2c..80d2c59 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/List.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/List.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.list; import it.eng.spagoCore.error.EMFError; @@ -8,6 +25,7 @@ import it.eng.spagoLite.form.base.BaseElements; import it.eng.spagoLite.form.buttonList.ButtonList; import it.eng.spagoLite.form.fields.Field; +import it.eng.spagoLite.form.fields.Fields; import it.eng.spagoLite.form.fields.SingleValueField; import it.eng.spagoLite.form.fields.impl.CheckBox; import it.eng.spagoLite.message.Message; @@ -37,6 +55,7 @@ public class List> extends BaseElements { private String visibilityProperty; private Boolean filterValidRecords; private String excelFileName; + private Fields genericFields; private ButtonList buttonList; @@ -356,6 +375,7 @@ public boolean postAndValidate(HttpServletRequest servletRequest, MessageBox mes * Compila il row bean con il contenuto della riga corrente * * @throws EMFError + * eccezione generica */ public void copyToBean() throws EMFError { if (table != null && table.size() > 0) { @@ -371,6 +391,7 @@ public void copyToBean() throws EMFError { * oggetto bean * * @throws EMFError + * eccezione generica */ public void copyToBean(BaseRowInterface row) throws EMFError { for (Field field : this) { @@ -423,4 +444,12 @@ public void setExcelFileName(String excelFileName) { this.excelFileName = excelFileName; } + public Fields getGenericFields() { + return genericFields; + } + + public void setGenericFields(Fields genericFields) { + this.genericFields = genericFields; + } + } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/ListExcelWriter.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/ListExcelWriter.java index 83ba80e..723b812 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/ListExcelWriter.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/ListExcelWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* ==================================================================== Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -14,20 +31,25 @@ Licensed to the Apache Software Foundation (ASF) under one or more See the License for the specific language governing permissions and limitations under the License. ==================================================================== */ - package it.eng.spagoLite.form.list; import it.eng.spagoCore.error.EMFError; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.form.fields.Field; +import it.eng.spagoLite.form.fields.Fields; +import it.eng.spagoLite.form.fields.MultiValueField; import it.eng.spagoLite.form.fields.SingleValueField; import it.eng.spagoLite.form.fields.impl.ComboBox; +import it.eng.spagoLite.form.fields.impl.Button; import it.eng.spagoLite.util.Casting.Casting; import it.eng.spagoLite.xmlbean.form.Field.Type; +import it.eng.spagoLite.form.fields.impl.MultiSelect; +//import it.eng.spagoLite.xmlbean.form.Button; import java.io.OutputStream; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFDataFormat; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.Cell; @@ -44,19 +66,22 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.poi.ss.usermodel.Workbook; /** - * @author Enrico Grillini & Lorenzo Snidero + * @author Enrico Grillini / Lorenzo Snidero */ public class ListExcelWriter { + private List list; + private Fields fields; // private Workbook wb; - private Sheet sheet; - + // private Sheet sheet; private static CellStyle TITLE; private static CellStyle HEADER; private static CellStyle CELL; private static CellStyle CELL_DATE; private static CellStyle CELL_DATE_TIME; + private static CellStyle CELL_DECIMAL_DOTCOMMA; + private static CellStyle CELL_DECIMAL_DOT; public List getList() { return list; @@ -66,11 +91,20 @@ public void setList(List list) { this.list = list; } + public Fields getFields() { + return fields; + } + + public void setFields(Fields fields) { + this.fields = fields; + } + public ListExcelWriter(List list) { this.list = list; + this.fields = list.getGenericFields(); } - private void addTitle() { + private void addTitle(Sheet sheet) { Row titleRow = sheet.createRow(0); titleRow.setHeightInPoints(45); Cell titleCell = titleRow.createCell(0); @@ -83,7 +117,7 @@ private void addTitle() { // sheet.addMergedRegion(CellRangeAddress.valueOf("$A$1:$L$1")); } - private void addHeaders() { + private void addHeaders(Sheet sheet) { Row headerRow = sheet.createRow(1); int i = 0; @@ -99,7 +133,7 @@ private void addHeaders() { } } - private void addCells() throws EMFError { + private void addCells(Sheet sheet) throws EMFError { int size = 0; int j = 2; @@ -124,6 +158,12 @@ private void addCells() throws EMFError { cell.setCellStyle(CELL_DATE); } else if (field.getType().equals(Type.DATETIME)) { cell.setCellStyle(CELL_DATE_TIME); + } else if (field.getType().equals(Type.DECIMAL)) { + if (field.getFormat().equals("#,##0.00")) { + cell.setCellStyle(CELL_DECIMAL_DOTCOMMA); + } else { + cell.setCellStyle(CELL_DECIMAL_DOT); + } } else { cell.setCellStyle(CELL); } @@ -137,23 +177,106 @@ private void addCells() throws EMFError { } } + private void addHeadersForFields(Sheet sheet) { + + int i = 1; + for (Field field : getFields()) { + if (!(field instanceof Button)) { + Row headerRow = sheet.createRow(i); + if (!field.isHidden()) { + Cell headerCell = headerRow.createCell(0); + headerCell.setCellValue(field.getDescription()); + headerCell.setCellStyle(HEADER); + sheet.setColumnWidth(i, 10000); + + i++; + } + } + } + } + + private void addCellsForFields(Sheet sheet) throws EMFError { + int i = 1; + int size = 0; + + for (Field field : getFields()) { + if (!(field instanceof Button)) { + Row cellRow = sheet.getRow(i); + if (!field.isHidden()) { + size++; + Cell cell = cellRow.createCell(1); + + if (field instanceof ComboBox) { + Casting.setToExcel(cell, ((SingleValueField) field).getDecodedValue(), Type.STRING); + } else if (field instanceof MultiSelect) { + Casting.setToExcelMultiValue(cell, ((MultiValueField) field).getDecodedValues(), + Type.STRING); + } else { + Casting.setToExcel(cell, ((SingleValueField) field).getValue(), field.getType()); + } + + if (field.getType().equals(Type.DATE)) { + cell.setCellStyle(CELL_DATE); + } else if (field.getType().equals(Type.DATETIME)) { + cell.setCellStyle(CELL_DATE_TIME); + } else { + cell.setCellStyle(CELL); + } + + i++; + } + } + } + + for (int l = 0; l < size; l++) { + sheet.autoSizeColumn(l); + } + } + + private void addTitleForFields(Sheet sheet) { + Row titleRow = sheet.createRow(0); + titleRow.setHeightInPoints(45); + Cell titleCell = titleRow.createCell(0); + if (StringUtils.isNotBlank(fields.getName())) { + titleCell.setCellValue(fields.getName()); + } else { + titleCell.setCellValue(fields.getDescription()); + } + titleCell.setCellStyle(TITLE); + } + public void write(OutputStream outputStream) throws Exception { Workbook wb = new HSSFWorkbook(); createStyles(wb); // Creo il foglio - sheet = wb.createSheet("Elenco"); + Sheet sheet = wb.createSheet("Elenco"); PrintSetup printSetup = sheet.getPrintSetup(); printSetup.setLandscape(true); sheet.setFitToPage(true); sheet.setHorizontallyCenter(true); - addHeaders(); - addCells(); - addTitle(); + addHeaders(sheet); + addCells(sheet); + addTitle(sheet); - sheet.createFreezePane(0, 2); + Fields fields = list.getGenericFields(); + if (fields != null) { + // Creo il foglio dei "Fields" + Sheet sheet2 = wb.createSheet("Filtri"); + PrintSetup printSetup2 = sheet2.getPrintSetup(); + printSetup2.setLandscape(true); + sheet2.setFitToPage(true); + sheet2.setHorizontallyCenter(true); + addHeadersForFields(sheet2); + addCellsForFields(sheet2); + addTitleForFields(sheet2); + + sheet2.createFreezePane(0, 1); + } + + sheet.createFreezePane(0, 2); wb.write(outputStream); } @@ -232,5 +355,31 @@ private static void createStyles(Workbook wb) { CELL_DATE_TIME.setBorderBottom(BorderStyle.THIN); CELL_DATE_TIME.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOTCOMMA = wb.createCellStyle(); + // CELL.setAlignment(CellStyle.ALIGN_CENTER); + CELL_DECIMAL_DOTCOMMA.setWrapText(true); + CELL_DECIMAL_DOTCOMMA.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00")); + CELL_DECIMAL_DOTCOMMA.setBorderRight(BorderStyle.THIN); + CELL_DECIMAL_DOTCOMMA.setRightBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOTCOMMA.setBorderLeft(BorderStyle.THIN); + CELL_DECIMAL_DOTCOMMA.setLeftBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOTCOMMA.setBorderTop(BorderStyle.THIN); + CELL_DECIMAL_DOTCOMMA.setTopBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOTCOMMA.setBorderBottom(BorderStyle.THIN); + CELL_DECIMAL_DOTCOMMA.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + + CELL_DECIMAL_DOT = wb.createCellStyle(); + // CELL.setAlignment(CellStyle.ALIGN_CENTER); + CELL_DECIMAL_DOT.setWrapText(true); + CELL_DECIMAL_DOT.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0")); + CELL_DECIMAL_DOT.setBorderRight(BorderStyle.THIN); + CELL_DECIMAL_DOT.setRightBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOT.setBorderLeft(BorderStyle.THIN); + CELL_DECIMAL_DOT.setLeftBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOT.setBorderTop(BorderStyle.THIN); + CELL_DECIMAL_DOT.setTopBorderColor(IndexedColors.BLACK.getIndex()); + CELL_DECIMAL_DOT.setBorderBottom(BorderStyle.THIN); + CELL_DECIMAL_DOT.setBottomBorderColor(IndexedColors.BLACK.getIndex()); + } } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/NestedList.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/NestedList.java index e9283eb..5b62b5e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/NestedList.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/list/NestedList.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.list; import it.eng.spagoCore.error.EMFError; @@ -273,6 +290,7 @@ public boolean postAndValidate(HttpServletRequest servletRequest, MessageBox mes * Compila il row bean con il contenuto della riga corrente * * @throws EMFError + * eccezione generica */ public void copyToBean() throws EMFError { if (table != null && table.size() > 0) { @@ -288,6 +306,7 @@ public void copyToBean() throws EMFError { * riga oggetto BaseRowInterface * * @throws EMFError + * eccezione generica */ public void copyToBean(BaseRowInterface row) throws EMFError { for (Field field : this) { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/Tab.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/Tab.java index 2e3b7d8..7a1b032 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/Tab.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/Tab.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.tab; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/TabElement.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/TabElement.java index e018a4c..4e220b0 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/TabElement.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tab/TabElement.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.tab; import java.util.ArrayList; @@ -22,11 +39,17 @@ public TabElement(Component parent, String name, String description) { /** * * @param parent + * riferimento genitore * @param name + * value * @param description + * value * @param current + * boolean true/false * @param hidden + * boolean true/false * @param disabled + * boolean true/false * @param iconUrls * url separati da spazio */ diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/Tree.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/Tree.java index a10c5a1..10aad12 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/Tree.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/Tree.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.tree; import it.eng.spagoCore.error.EMFError; @@ -118,6 +135,7 @@ public Tree(Component parent, String name, String description, String title, Bas * Compila il row bean con il contenuto della riga corrente * * @throws EMFError + * eccezione generica */ public void copyToBean() throws EMFError { if (table != null && table.size() > 0) { @@ -130,8 +148,10 @@ public void copyToBean() throws EMFError { * Compila il row bean con il contenuto del form * * @param row + * dto row * * @throws EMFError + * eccezione generica */ public void copyToBean(BaseRowInterface row) throws EMFError { for (TreeField field : this) { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/TreeField.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/TreeField.java index ed01122..f2c5593 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/TreeField.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/tree/TreeField.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.tree; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/EndPage.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/EndPage.java index 46d89f9..ffe4585 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/EndPage.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/EndPage.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.wizard; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Step.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Step.java index aea363a..a2c33c0 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Step.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Step.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.wizard; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Wizard.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Wizard.java index 4959c6f..da21118 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Wizard.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/Wizard.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.wizard; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/WizardElement.java b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/WizardElement.java index c99a60c..1b85cb5 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/WizardElement.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/form/wizard/WizardElement.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.form.wizard; import it.eng.spagoLite.form.Component; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/message/Message.java b/spagolite-middle/src/main/java/it/eng/spagoLite/message/Message.java index d4dfae0..30c3a19 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/message/Message.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/message/Message.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.message; import it.eng.spagoLite.FrameElement; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageBox.java b/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageBox.java index 99ce10f..08caf43 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageBox.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageBox.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.message; import it.eng.spagoLite.FrameElement; @@ -51,6 +68,7 @@ public void clear() { * livelli del messaggio oracle. * * @param regexOracle + * value regular expression */ public void addMessagesFromOracle(String regexOracle) { if (regexOracle == null || "".equals(regexOracle)) { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageUtil.java b/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageUtil.java index dcd042e..bb268c2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageUtil.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/message/MessageUtil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/AbstractRowSmandrupper.java b/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/AbstractRowSmandrupper.java index 5cd5632..1564b1f 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/AbstractRowSmandrupper.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/AbstractRowSmandrupper.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.model.rowsmandrupper; public abstract class AbstractRowSmandrupper implements RowSmandrupperInterface { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/BaseRowSmandrupper.java b/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/BaseRowSmandrupper.java index 537efc9..c14b1cc 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/BaseRowSmandrupper.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/BaseRowSmandrupper.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.model.rowsmandrupper; import it.eng.spagoLite.db.base.BaseRowInterface; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/RowSmandrupperInterface.java b/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/RowSmandrupperInterface.java index 630fd3a..6d593d6 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/RowSmandrupperInterface.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/model/rowsmandrupper/RowSmandrupperInterface.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.model.rowsmandrupper; import it.eng.spagoLite.db.base.BaseRowInterface; @@ -16,4 +33,4 @@ public interface RowSmandrupperInterface extends Serializable { public void smandruppRow(BaseRowInterface row); -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/BaseUser.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/BaseUser.java index f1b13df..86b101a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/BaseUser.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/BaseUser.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security; import it.eng.spagoLite.security.menu.impl.Menu; @@ -26,6 +43,7 @@ public class BaseUser implements IUser { private UserType userType = null; // ID di un eventiale IDP esterno (Es.: SPID (SpidID) private String externalId = null; + private String email = null; public BaseUser(String codice, String descr) { this.menu = new Menu(codice, descr); @@ -152,4 +170,14 @@ public String getExternalId() { public void setExternalId(String externalId) { this.externalId = externalId; } + + @Override + public String getEmail() { + return email; + } + + @Override + public void setEmail(String email) { + this.email = email; + } } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/CsrfHelper.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/CsrfHelper.java index 6036be8..10d826e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/CsrfHelper.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/CsrfHelper.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/IUser.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/IUser.java index 42a9611..7a68ff8 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/IUser.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/IUser.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security; import it.eng.spagoLite.security.menu.impl.Menu; @@ -49,9 +66,9 @@ public interface IUser extends Serializable { public Map getOrganizzazioneMap(); // ***** Aggiunti per la gestione dei diversi tipi di IDP - public enum UserType { + public static enum UserType { SPID_FEDERA, SPID_PUGLIA - } + }; public UserType getUserType(); @@ -60,5 +77,8 @@ public enum UserType { public String getExternalId(); public void setExternalId(String externalId); - // ***** + + public String getEmail(); + + public void setEmail(String email); } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/Secure.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/Secure.java index d2cdbf9..8e0aa00 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/Secure.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/Secure.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security; import java.lang.annotation.ElementType; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/SuppressLogging.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/SuppressLogging.java index 4a3606e..20de1a3 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/SuppressLogging.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/SuppressLogging.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security; import java.lang.annotation.ElementType; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/User.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/User.java index 8fc9d9f..8a3c2f3 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/User.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/User.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security; import it.eng.spagoLite.security.profile.Profile; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/AuthenticationHandlerConstants.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/AuthenticationHandlerConstants.java index 50481c8..1a39a87 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/AuthenticationHandlerConstants.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/AuthenticationHandlerConstants.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import javax.xml.namespace.QName; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/Authenticator.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/Authenticator.java index c39647c..c1c0556 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/Authenticator.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/Authenticator.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import it.eng.spagoLite.SessionManager; @@ -26,6 +43,7 @@ public User doLogin(HttpSession httpSession) { * * * @param utente + * dto * * @return true/false se autenticato */ diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/PwdUtil.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/PwdUtil.java index d5316e8..b106800 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/PwdUtil.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/PwdUtil.java @@ -1,13 +1,31 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; +import java.util.Base64; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; -import org.apache.commons.codec.binary.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -18,8 +36,8 @@ public class PwdUtil { private static Logger log = LoggerFactory.getLogger(PwdUtil.class); - private final static int ITERATIONS = 2048; - private final static int KEY_LENGTH = 64 * 8; + private static final int ITERATIONS = 2048; + private static final int KEY_LENGTH = 64 * 8; @Deprecated public static String encodePassword(String password) { @@ -28,7 +46,7 @@ public static String encodePassword(String password) { md = MessageDigest.getInstance("SHA-1"); md.update(password.getBytes("UTF-8"), 0, password.length()); byte[] pwdHash = md.digest(); - return new String(Base64.encodeBase64(pwdHash), "UTF-8"); + return new String(Base64.getEncoder().encode(pwdHash), StandardCharsets.UTF_8); } catch (NoSuchAlgorithmException ex) { log.error("Algoritmo SHA-1 non supportato"); throw new RuntimeException(ex.getMessage()); @@ -39,54 +57,33 @@ public static String encodePassword(String password) { } - public static void main(String[] args) { - // String encodePBKDF2Password = encodePBKDF2Password(null, "password"); - // System.out.println(encodePBKDF2Password); - - String encodePassword = encodePassword("password"); - System.out.println(encodePassword); - } - public static String encodePBKDF2Password(byte[] binarySalt, String password) { PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), binarySalt, ITERATIONS, KEY_LENGTH); SecretKeyFactory skf; try { skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); byte[] pwdHash = skf.generateSecret(spec).getEncoded(); - return new String(Base64.encodeBase64(pwdHash), "UTF-8"); + return new String(Base64.getEncoder().encode(pwdHash), StandardCharsets.UTF_8); } catch (NoSuchAlgorithmException ex) { log.error("Algoritmo PBKDF2WithHmacSHA1 non supportato"); throw new RuntimeException(ex.getMessage()); } catch (InvalidKeySpecException ex) { log.error("Algoritmo PBKDF2WithHmacSHA1 non supportato"); throw new RuntimeException(ex.getMessage()); - } catch (UnsupportedEncodingException ex) { - log.error("Algoritmo UTF-8 non supportato"); - throw new RuntimeException(ex.getMessage()); } } public static String encodeUFT8Base64String(byte[] barray) { - try { - return new String(Base64.encodeBase64(barray), "UTF-8"); - } catch (UnsupportedEncodingException ex) { - log.error("Algoritmo UTF-8 non supportato"); - throw new RuntimeException(ex.getMessage()); - } + return new String(Base64.getEncoder().encode(barray), StandardCharsets.UTF_8); } public static byte[] decodeUFT8Base64String(String utf8str) { - try { - return Base64.decodeBase64(utf8str.getBytes("UTF-8")); - } catch (UnsupportedEncodingException ex) { - log.error("Algoritmo UTF-8 non supportato"); - throw new RuntimeException(ex.getMessage()); - } + return Base64.getDecoder().decode(utf8str.getBytes(StandardCharsets.UTF_8)); } public static byte[] generateSalt() { try { - SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); + SecureRandom sr = SecureRandom.getInstanceStrong(); byte[] salt = new byte[16]; sr.nextBytes(salt); return salt; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandler.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandler.java index dc97bb2..5f20f9c 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandler.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandler.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import java.util.HashSet; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandlerResolver.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandlerResolver.java index be6bab2..8bd06a2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandlerResolver.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPClientLoginHandlerResolver.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import java.util.ArrayList; @@ -15,4 +32,4 @@ public List getHandlerChain(PortInfo portInfo) { handlerChain.add(hh); return handlerChain; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPIamLoginHandler.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPIamLoginHandler.java index 8ac801f..7f8721a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPIamLoginHandler.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPIamLoginHandler.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import java.util.HashSet; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler.java index cac16d0..4b9c146 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import static it.eng.spagoLite.security.auth.AuthenticationHandlerConstants.QNAME_WSSE_HEADER; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler2.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler2.java index 4bc1d1b..1f73262 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler2.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/SOAPServerLoginHandler2.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; import java.util.HashSet; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/WSLoginHandler.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/WSLoginHandler.java index cb386f8..aac953d 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/WSLoginHandler.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/auth/WSLoginHandler.java @@ -1,7 +1,25 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.auth; //import java.sql.Date; import it.eng.spagoLite.security.exception.AuthWSException; +import java.math.BigDecimal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; @@ -54,17 +72,17 @@ public class WSLoginHandler { * nome del servizio web * @param em * EntityManager - * + * * @return true/false con verifica autorizzazione - * - * @throws UserWSNotAuthorizedException + * + * @throws AuthWSException * eccezione lanciata se l'utente non è autorizzato */ public static boolean checkAuthz(String username, Integer idOrganiz, String servizioWeb, EntityManager em) throws AuthWSException { Query q2 = em.createQuery(AUTH_QUERY); q2.setParameter("username", username); - q2.setParameter("idOrganiz", idOrganiz); + q2.setParameter("idOrganiz", new BigDecimal(idOrganiz)); q2.setParameter("servizioWeb", servizioWeb); return doCheckAuthz(username, idOrganiz, servizioWeb, q2); } @@ -77,10 +95,15 @@ public static boolean checkAuthz(String username, Integer idOrganiz, String serv * nome utente * @param password * password + * @param ipAddress + * indirizzo ip * @param em * EntityManager * + * @return true/false con verifica autorizzazione * + * @throws AuthWSException + * eccezione lanciata se l'utente non è autorizzato */ public static boolean login(String username, String password, String ipAddress, EntityManager em) throws AuthWSException { @@ -111,17 +134,21 @@ public static boolean login(String certCommonName, EntityManager em) throws Auth * Autenticazione e controllo di autorizzazioni ad eseguire un servizio per almeno un'organizzazione * * @param username + * nome utente * @param password + * password * @param servizioWeb + * nome servizio * @param em - * + * EntityManager + * @param ipAddress + * indirizzo ip + * * @return true se l'utente ha inserito le credenziali corrette ed è autorizzato ad eseguire il servizioWeb per * almeno un'organizzazione - * - * @throws UserWSNotAuthorizedException - * @throws FailedWSLoginException - * @throws AccountWSLockedException - * @throws AccountWSExpiredException + * + * @throws AuthWSException + * eccezione lanciata se l'utente non è autorizzato */ public static boolean loginAndCheckAuthzAtLeastOneOrganiz(String username, String password, String servizioWeb, String ipAddress, EntityManager em) throws AuthWSException { @@ -139,16 +166,20 @@ public static boolean loginAndCheckAuthzAtLeastOneOrganiz(String username, Strin * Autenticazione e controllo di autorizzazioni ad eseguire un servizio di Sacer IAM * * @param username + * nome utente * @param password + * password * @param servizioWeb + * nome servizio + * @param ipAddress + * indirizzo ip * @param em - * + * EntityManager + * * @return true/false con verifica login su iam - * - * @throws UserWSNotAuthorizedException - * @throws FailedWSLoginException - * @throws AccountWSLockedException - * @throws AccountWSExpiredException + * + * @throws AuthWSException + * eccezione lanciata se l'utente non è autorizzato */ public static boolean loginAndCheckAuthzIAM(String username, String password, String servizioWeb, String ipAddress, EntityManager em) throws AuthWSException { @@ -210,17 +241,21 @@ private static boolean doLogin(String username, String password, String ipAddres throw new AuthWSException(AuthWSException.CodiceErrore.UTENTE_SCADUTO, "Credenziali scadute in data " + formatter.format(expDate)); } - if (StringUtils.isEmpty(salt)) { - if (!PwdUtil.encodePassword(password).equals(dbPwd)) { - log.warn("Login failed for user: " + username); - throw new AuthWSException(AuthWSException.CodiceErrore.LOGIN_FALLITO, LOGIN_FALLITO_MSG); - } - } else { - if (!PwdUtil.encodePBKDF2Password(PwdUtil.decodeUFT8Base64String(salt), password).equals(dbPwd)) { - log.warn("Login failed for user: " + username); - throw new AuthWSException(AuthWSException.CodiceErrore.LOGIN_FALLITO, LOGIN_FALLITO_MSG); + if (StringUtils.isNotBlank(password)) { // in caso di autenticazione con Oauth2 + if (StringUtils.isEmpty(salt)) { + if (!PwdUtil.encodePassword(password).equals(dbPwd)) { + log.warn("Login failed for user: " + username); + throw new AuthWSException(AuthWSException.CodiceErrore.LOGIN_FALLITO, LOGIN_FALLITO_MSG); + } + } else { + if (!PwdUtil.encodePBKDF2Password(PwdUtil.decodeUFT8Base64String(salt), password) + .equals(dbPwd)) { + log.warn("Login failed for user: " + username); + throw new AuthWSException(AuthWSException.CodiceErrore.LOGIN_FALLITO, LOGIN_FALLITO_MSG); + } } } + if (ipCheck) { List list = ipListQuery.getResultList(); for (String ipAddr : list) { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/AuthWSException.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/AuthWSException.java index 3ccf378..d27acf6 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/AuthWSException.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/AuthWSException.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.exception; import javax.xml.bind.annotation.XmlElement; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/SOAPFaultInfo.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/SOAPFaultInfo.java index b04ae57..67cf6c7 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/SOAPFaultInfo.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/exception/SOAPFaultInfo.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/MenuEntry.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/MenuEntry.java index f1d6bda..7dbfd57 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/MenuEntry.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/MenuEntry.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.menu; import it.eng.spagoLite.FrameElement; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Link.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Link.java index 44c32b5..eb21d28 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Link.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Link.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.menu.impl; import it.eng.spagoLite.security.menu.MenuEntry; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Menu.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Menu.java index 2e4a489..e544e61 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Menu.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/menu/impl/Menu.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.menu.impl; import it.eng.spagoLite.security.menu.MenuEntry; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Attribute.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Attribute.java index 5a2e09a..c5362eb 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Attribute.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Attribute.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; public class Attribute extends ProfileElement> { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Azione.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Azione.java index 1a61928..334292a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Azione.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Azione.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; public class Azione extends ProfileElement> { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Component.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Component.java index 4f9c9fe..1ff685f 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Component.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Component.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; public class Component extends ProfileElement { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Function.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Function.java index accf70e..d06c349 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Function.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Function.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; public class Function extends ProfileElement { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/MenuDips.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/MenuDips.java index a8fe56d..15397ac 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/MenuDips.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/MenuDips.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; public class MenuDips extends ProfileElement> { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Pagina.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Pagina.java index 5d82e53..1e53fa4 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Pagina.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Pagina.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; import java.util.ArrayList; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Profile.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Profile.java index 8e6a535..c932296 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Profile.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/Profile.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; public class Profile extends ProfileElement> { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/ProfileElement.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/ProfileElement.java index 9ea356c..cc32166 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/ProfileElement.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/profile/ProfileElement.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.profile; import it.eng.spagoLite.FrameElement; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/ReloadableCachingMetadataManager.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/ReloadableCachingMetadataManager.java index 2f23673..67ca1b6 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/ReloadableCachingMetadataManager.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/ReloadableCachingMetadataManager.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.saml; import java.util.List; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteSAMLUserDetail.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteSAMLUserDetail.java index 0f1178e..452609b 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteSAMLUserDetail.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteSAMLUserDetail.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.saml; import it.eng.spagoLite.security.IUser; @@ -19,7 +36,7 @@ public class SliteSAMLUserDetail implements SAMLUserDetailsService { - private static Logger logger = LoggerFactory.getLogger(SliteSAMLUserDetail.class.getName()); + private static final Logger logger = LoggerFactory.getLogger(SliteSAMLUserDetail.class.getName()); // Costanti attributi SAML valide per PUGLIA E VECCHIO IDP INTERNO PARER protected static final String USERID = "urn:oid:0.9.2342.19200300.100.1.1"; protected static final String COGNOME = "urn:oid:2.5.4.4"; @@ -34,6 +51,7 @@ public class SliteSAMLUserDetail implements SAMLUserDetailsService { protected static final String SPID_NOME = "nome"; protected static final String SPID_COGNOME = "cognome"; protected static final String SPID_CODICE_FISCALE = "CodiceFiscale"; + protected static final String SPID_EMAIL = "emailAddressPersonale"; protected static final String SPID_AUTHENTICATION_METHOD_ENABLED_1 = "Primo Livello SPID"; protected static final String SPID_AUTHENTICATION_METHOD_ENABLED_2 = "Secondo Livello SPID"; protected static final String SPID_AUTHENTICATION_METHOD_ENABLED_3 = "Terzo Livello SPID"; @@ -41,6 +59,8 @@ public class SliteSAMLUserDetail implements SAMLUserDetailsService { protected static final String SPID_PUGLIA_NOME = "nome"; protected static final String SPID_PUGLIA_COGNOME = "familyName"; protected static final String SPID_PUGLIA_CODICE_FISCALE = "fiscalNumber"; + protected static final String SPID_PUGLIA_EMAIL = "email"; // DA VERIFICARE !!! INserito leggendo il documento di + // specifiche di integrazione SPID Puglia // Messaggi utilizzabili nelle classi derivate nella funziona verificaEsistenzaUtente() protected static final String MSG_TROPPE_OCCORRENZE_UTENTE = "Gentile %s %s, non è autorizzato ad accedere ai nostri sistemi tramite utente SPID con codice fiscale %s, sono state rilevate più occorrenze nel database"; @@ -48,7 +68,7 @@ public class SliteSAMLUserDetail implements SAMLUserDetailsService { protected static final String MSG_UTENTE_LIVELLO_AUTH_INADEGUATO = "Gentile %s %s, non è autorizzato ad accedere ai nostri sistemi con codice fiscale %s e livello di autorizzazione %s"; protected static final String MSG_UTENTE_SPID_NON_VALIDO = "Gentile %s %s, non è autorizzato ad accedere ai nostri sistemi con questo utente SPID senza codice fiscale"; protected static final String MSG_UTENTE_AGGIUNTIVO_RER = ", contatti helpdeskparer@regione.emilia-romagna.it per accedere."; - // Inizializza la proprietà di sistema abilita-livello-1-spid sull AppServer + // Inizializza la proprietà  di sistema abilita-livello-1-spid sull AppServer protected static boolean abilitaLivello1Spid = System.getProperty("abilita-livello-1-spid", "false").equals("true"); @Override @@ -58,7 +78,7 @@ public Object loadUserBySAML(SAMLCredential credential) throws UsernameNotFoundE // String codiceFiscaleSpid = getValue(credential, SPID_CODICE_FISCALE); if (verificaSeUtenteSpidValido(credential, u)) { /** - * * SI TRATTA DI UN UTENTE SPID VALIDO! Ed ho gi� determinato se RER o PUGLIA * + * * SI TRATTA DI UN UTENTE SPID VALIDO! Ed ho già determinato se RER o PUGLIA * */ List l = null; if (u.getUserType().equals(IUser.UserType.SPID_PUGLIA)) { @@ -76,11 +96,11 @@ public Object loadUserBySAML(SAMLCredential credential) throws UsernameNotFoundE String msg = String.format(getMessaggioUtente(MSG_UTENTE_NON_AUTORIZZATO, u), u.getNome(), u.getCognome(), u.getCodiceFiscale()); logger.warn(msg); - u.setUtenteDaAssociare(true); // nella prossima action si verr� rediretti su IAM ! + u.setUtenteDaAssociare(true); // nella prossima action si verrà rediretti su IAM ! } else { /* * L'utente esiste sul db locale PARER recupero l'id dell'utente e lo setto nell'oggetto utente e lo - * metto in sessione. Modifica fatta perch� idp generici non conoscono l'id dell'utente del db di iam. + * metto in sessione. Modifica fatta perchè idp generici non conoscono l'id dell'utente del db di iam. */ UtenteDb ut = l.iterator().next(); u.setUsername(ut.getUsername()); @@ -94,21 +114,24 @@ public Object loadUserBySAML(SAMLCredential credential) throws UsernameNotFoundE */ u.setCognome(getValue(credential, COGNOME)); u.setNome(getValue(credential, NOME)); - // Al PARER l'ID_UTENTE � quello vero del DB, in PUGLIA � un altro ID che non si sa (forse il codice + // Al PARER l'ID_UTENTE è quello vero del DB, in PUGLIA è un altro ID che non si sa (forse il codice // fiscale) String str = getValue(credential, USERID); if (NumberUtils.isCreatable(str)) { u.setIdUtente(Integer.parseInt(getValue(credential, USERID))); } else { - logger.info("Nell'attributo SAML [{}] non � presente un dato numerico", USERID); + logger.info("Nell'attributo SAML [{}] non è presente un dato numerico", USERID); u.setIdUtente(0); } u.setUsername(getValue(credential, USERNAME)); // Aggiunge all'utente arrivato da SAML i dati provenienti dal DB UtenteDb uDb = getUtentePerUsername(u.getUsername()); - u.setIdUtente(uDb.getId()); - u.setScadenzaPwd(uDb.getDataScadenzaPassword()); - u.setCodiceFiscale(uDb.getCodiceFiscale()); + /* nel caso di DPI il metodo non è ridefinito e la superclasse torna un null che va controllato! */ + if (uDb != null) { + u.setIdUtente(uDb.getId()); + u.setScadenzaPwd(uDb.getDataScadenzaPassword()); + u.setCodiceFiscale(uDb.getCodiceFiscale()); + } } String messaggioDiLog = "L'utente " + u.getUsername() + " ha effettuato un login"; if (getValue(credential, SPID_CODE) != null) { @@ -182,16 +205,18 @@ protected static boolean isAbilitaLivello1Spid() { } /* - * Determina se un utente � un utente SPID oppure un utente proveniente da un classico IDP normale Inoltre - * verifica che se si tratta di un utente RER o PUGLIA e controlla che esista il codice fiscale. Se esiste il codice - * fiscale in caso di RER verifica i livelli di autenticazione 1 o 2 e solleva un'eccezione opportuna nel caso in - * cui non sia autorizzata. Nel caso di Puglia... + * Determina se un utente è un utente SPID oppure un utente proveniente da un classico IDP normale Inoltre verifica + * che se si tratta di un utente RER o PUGLIA e controlla che esista il codice fiscale. Se esiste il codice fiscale + * in caso di RER verifica i livelli di autenticazione 1 o 2 e solleva un'eccezione opportuna nel caso in cui non + * sia autorizzata. Nel caso di Puglia... */ protected boolean verificaSeUtenteSpidValido(SAMLCredential credential, User u) throws UsernameNotFoundException { if (getValue(credential, SPID_CODE) != null) { // SE PROVIENE DA UN IDP SPID... String codiceFiscaleSpid = getValue(credential, SPID_CODICE_FISCALE); String codiceFiscaleSpidPuglia = getValue(credential, SPID_PUGLIA_CODICE_FISCALE); + String emailSpid = getValue(credential, SPID_EMAIL); + String emailSpidPuglia = getValue(credential, SPID_PUGLIA_EMAIL); if (codiceFiscaleSpid != null) { // RAMO RER // MAC#26002 - Correzione gestione proprieta di sistema relativa al livello di autenticazione spid @@ -199,10 +224,11 @@ protected boolean verificaSeUtenteSpidValido(SAMLCredential credential, User u) u.setCognome(getValue(credential, SPID_COGNOME)); u.setNome(getValue(credential, SPID_NOME)); u.setCodiceFiscale(codiceFiscaleSpid); + u.setEmail(emailSpid); u.setUserType(User.UserType.SPID_FEDERA); /* - * Se � stato abilitato il livello uno allora autorizza uno dei tre metodi di autenticazione 1-2-3 - * oppure se non � abilitato il livello uno permette solo i livelli 2-3 + * Se è stato abilitato il livello uno allora autorizza uno dei tre metodi di autenticazione 1-2-3 + * oppure se non è abilitato il livello uno permette solo i livelli 2-3 */ if (metodoAutenticazioneSpid != null && ((isAbilitaLivello1Spid() && (metodoAutenticazioneSpid.equalsIgnoreCase(SPID_AUTHENTICATION_METHOD_ENABLED_1) @@ -227,6 +253,7 @@ protected boolean verificaSeUtenteSpidValido(SAMLCredential credential, User u) u.setCodiceFiscale(codiceFiscaleSpidPuglia.substring(6)); u.setCognome(getValue(credential, SPID_PUGLIA_COGNOME)); u.setNome(getValue(credential, SPID_PUGLIA_NOME)); + u.setEmail(emailSpidPuglia); u.setUserType(User.UserType.SPID_PUGLIA); } else { // Interrompe il flusso con un'eccezione! String msg = String.format(getMessaggioUtente(MSG_UTENTE_SPID_NON_VALIDO, u), u.getNome(), diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteWebSSOProfileImpl.java b/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteWebSSOProfileImpl.java index 0d5464b..4a34b42 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteWebSSOProfileImpl.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/security/saml/SliteWebSSOProfileImpl.java @@ -1,6 +1,26 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.security.saml; import org.opensaml.saml2.core.AuthnRequest; +import org.opensaml.saml2.core.Issuer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.security.saml.websso.WebSSOProfileImpl; /** @@ -9,6 +29,9 @@ */ public class SliteWebSSOProfileImpl extends WebSSOProfileImpl { + @Autowired + private ApplicationContext ctx; + @Override protected void buildAuthnContext(AuthnRequest request, org.springframework.security.saml.websso.WebSSOProfileOptions options) { @@ -22,6 +45,19 @@ protected void buildAuthnContext(AuthnRequest request, if (des != null && des.contains(".lepida.it")) { super.buildAuthnContext(request, options); } + /* + * Risoluzione problema Puglia che voleva aggiungere al nome dell'Issuer (EntityId) un suffisso riguardante il + * tenant + */ + + String suffissoIssuer = null; + if (ctx.containsBean("suffissoIssuerSamlRequest")) { + suffissoIssuer = (String) ctx.getBean("suffissoIssuerSamlRequest"); + } + if (suffissoIssuer != null) { + Issuer iss = request.getIssuer(); + iss.setValue(iss.getValue() + suffissoIssuer); + } } } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BaseSpagoLiteTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BaseSpagoLiteTag.java index 7cc8e3f..7f8fd6a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BaseSpagoLiteTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BaseSpagoLiteTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import it.eng.spagoLite.SessionManager; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BodyTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BodyTag.java index e4947be..930c850 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BodyTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/BodyTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import javax.servlet.jsp.JspException; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/ContentTitleTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/ContentTitleTag.java index 7864799..e63b45c 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/ContentTitleTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/ContentTitleTag.java @@ -1,6 +1,22 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; -import it.eng.spagoCore.configuration.ConfigSingleton; import it.eng.spagoLite.SessionManager; import it.eng.spagoLite.security.IUser; @@ -20,26 +36,10 @@ public class ContentTitleTag extends BaseSpagoLiteTag { */ private String codiceMenu; private boolean showHelpBtn = true; - static final String helpServerURI; - - static { - helpServerURI = ConfigSingleton.getHelpServerURI(); - } @Override public int doStartTag() throws JspException { - /* - * VECCHIA GESTIONE - * - * writeln("

"); writeln("

"+ getCompleteTitle()+"

"); - * if(ConfigSingleton.getEnableHelpOnline() && showHelpBtn){ String href = ""; if(!helpServerURI.equals("")){ - * href = helpServerURI + SessionManager.getLastPublisher(pageContext.getSession()) + ".html"; }else{ href = - * getContextPath() + SessionManager.getLastPublisher(pageContext.getSession()) + ".html"; } - * writeln(""); - * writeln("\"Help"); - * writeln(""); } writeln("
"); return EVAL_PAGE; - */ /* * NUOVA GESTIONE */ @@ -87,15 +87,6 @@ public int doStartTag() throws JspException { writeln(""); } } - /* - * VECCHIA GESTIONE if (ConfigSingleton.getEnableHelpOnline() && showHelpBtn) { String href = ""; if - * (!helpServerURI.equals("")) { href = helpServerURI + - * SessionManager.getLastPublisher(pageContext.getSession()) + ".html"; } else { href = getContextPath() - * + SessionManager.getLastPublisher(pageContext.getSession()) + ".html"; } - * writeln(""); writeln("\"Help"); - * writeln(""); } - */ } } writeln(""); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/DoctypeTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/DoctypeTag.java index 25135c5..d9789ad 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/DoctypeTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/DoctypeTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import java.util.HashMap; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/FooterTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/FooterTag.java index 6752db9..ad783f4 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/FooterTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/FooterTag.java @@ -1,5 +1,31 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_2_ALT; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_2_TITLE; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_2_URL; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_3_ALT; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_3_TITLE; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_3_URL; +import static it.eng.spagoCore.configuration.ConfigProperties.URIProperty.LOGO_2_RELATIVE; +import static it.eng.spagoCore.configuration.ConfigProperties.URIProperty.LOGO_3_RELATIVE; + import it.eng.spagoCore.configuration.ConfigSingleton; import javax.servlet.jsp.JspException; import org.apache.commons.lang3.StringUtils; @@ -24,57 +50,48 @@ public int doEndTag() throws JspException { } private String renderFooterInfo(String contextPath) { + ConfigSingleton configSingleton = ConfigSingleton.getInstance(); + + StringBuilder img2 = new StringBuilder(); + img2.append("\"");"); + + StringBuilder img3 = new StringBuilder(); + img3.append("\"");"); + StringBuilder footer = new StringBuilder(); footer.append("

"); - if (StringUtils.isNotBlank(ConfigSingleton.getLogo2_url())) { - footer.append(""); + if (StringUtils.isNotBlank(configSingleton.getStringValue(LOGO_2_URL.name()))) { + footer.append(""); - footer.append("\"").append(ConfigSingleton.getLogo2_alt()).append("\"/"); + footer.append(img2.toString()); footer.append(""); } else { - footer.append("\"").append(ConfigSingleton.getLogo2_alt()).append("\"/"); + footer.append(img2.toString()); } footer.append("
\n"); - if (StringUtils.isNotBlank(ConfigSingleton.getLogo3_relativePath())) { - footer.append("
"); - if (StringUtils.isNotBlank(ConfigSingleton.getLogo3_url())) { - footer.append(""); - - footer.append("\"").append(ConfigSingleton.getLogo3_alt()).append("\"/"); + footer.append("
"); + if (StringUtils.isNotBlank(configSingleton.getStringValue(LOGO_3_URL.name()))) { + footer.append(""); - footer.append(""); - } else { - footer.append("\"").append(ConfigSingleton.getLogo3_alt()).append("\"/"); - } + footer.append(img3.toString()); - footer.append("
\n"); + footer.append(""); + } else { + footer.append(img3.toString()); } - /* - * footer. - * append("
I cookie ci aiutano a fornire i nostri servizi. Utilizzando tali servizi, accetti l'utilizzo dei cookie da parte nostra. Informazioni
"); - */ - - // footer.append("
"); - // if(getUser()!=null){ - // footer.append("
"); - // footer.append(" Cambio - // struttura"); - // footer.append(" Cambio - // password"); - // footer.append("
"); - // } return footer.toString(); } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HeadTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HeadTag.java index d720797..486489c 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HeadTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HeadTag.java @@ -1,34 +1,59 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; -import it.eng.spagoCore.configuration.ConfigSingleton; -import it.eng.spagoCore.util.JavaScript; -import it.eng.spagoLite.security.CsrfHelper; +import static it.eng.spagoCore.configuration.ConfigProperties.URIProperty.CSS_OVER_RELATIVE; +import static it.eng.spagoCore.configuration.ConfigProperties.URIProperty.FAV_ICON_RELATIVE; + +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.TITOLO_APPLICATIVO; + import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspException; + import org.apache.commons.lang3.StringUtils; -public class HeadTag extends BaseSpagoLiteTag { +import it.eng.spagoCore.configuration.ConfigSingleton; +import it.eng.spagoCore.util.JavaScript; +import it.eng.spagoLite.security.CsrfHelper; - private static final String IMG_FAVICON = "/img/regione/favicon.ico"; +public class HeadTag extends BaseSpagoLiteTag { private static final long serialVersionUID = 1L; - private String title; - public String getTitle() { - return title; - } + private final ConfigSingleton configSingleton = ConfigSingleton.getInstance(); - public void setTitle(String title) { - this.title = title; - } + private String title; + /* in caso di pagina inclusa in un'altra e non si vogliono ri-caricare le risorse js per evitare problemi */ + private boolean excludeStdJs = false;// default value + /* creato con stessa logica dei js */ + private boolean excludeStdCss = false;// default value @Override public int doStartTag() throws JspException { String contextPath = this.getContextPath(); writeln(" "); writeln(includeTitle(contextPath)); - writeln(includeCss(contextPath)); - writeln(includeJs(contextPath)); + if (!isExcludeStdCss()) { + writeln(includeCss(contextPath)); + } + if (!isExcludeStdJs()) { + writeln(includeJs(contextPath)); + } return EVAL_BODY_INCLUDE; @@ -50,8 +75,8 @@ protected String includeCss(String contextPath) { css.append(" \n"); - css.append( - " \n"); + css.append(" \n"); css.append(" \n"); @@ -80,22 +105,22 @@ protected String includeCss(String contextPath) { * */ css.append(" \n"); + + "/webjars/font-awesome/6.4.0/css/all.min.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n"); css.append(" \n"); + + "/webjars/highlightjs/11.5.0/styles/magula.min.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n"); /** * Custom */ css.append(" \n"); + + "/css/custom/jquery-ui-custom/1.13.2/jquery-ui.min.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n"); css.append(" \n"); css.append(" \n"); + + "/css/custom/highlightjs/11.5.0/highlightjs.custom.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />\n"); css.append(" \n"); @@ -106,24 +131,26 @@ protected String includeCss(String contextPath) { protected String includeTitle(String contextPath) { String titleHtml = JavaScript.stringToHTMLString(getTitle()); - StringBuilder title = new StringBuilder(); - if (StringUtils.isNotBlank(ConfigSingleton.getTitolo_applicativo())) { - // se è stato indicato un nome per l'applicazione nel file web.xml + StringBuilder localTitle = new StringBuilder(); + if (StringUtils.isNotBlank(configSingleton.getStringValue(TITOLO_APPLICATIVO.name()))) { + // se e' stato indicato un nome per l'applicazione nel file web.xml // lo racchiudo tra parentesi quadre e lo antepongo al titolo della // pagina definito nella JSP - title.append(" [" + ConfigSingleton.getTitolo_applicativo() + "] " + titleHtml + "\n"); + localTitle.append(" [").append(configSingleton.getStringValue(TITOLO_APPLICATIVO.name())) + .append("] ").append(titleHtml).append("\n"); } else { - title.append(" " + titleHtml + "\n"); + localTitle.append(" ").append(titleHtml).append("\n"); } - title.append(" \n"); - title.append(" \n"); + localTitle.append(" \n"); + localTitle.append(" \n"); + localTitle.append(" "); // csrf - title.append(includeCsrfToken()); + localTitle.append(includeCsrfToken()); - title.append( - " \n"); + localTitle.append(" \n"); - return title.toString(); + return localTitle.toString(); } protected String includeJs(String contextPath) { @@ -133,14 +160,14 @@ protected String includeJs(String contextPath) { * Webjars */ js.append(" \n"); + + "/webjars/jquery/3.6.4/jquery.min.js\">\n"); // Static (not updatable to webjar) js.append(" \n"); js.append(" \n"); + + "/webjars/jquery-ui/1.13.2/jquery-ui.min.js\">\n"); // Static (not updatable to webjar) js.append(" \n"); + + "/webjars/highlightjs/11.5.0/highlight.min.js\">\n"); js.append(" \n"); @@ -190,8 +217,32 @@ protected String includeJs(String contextPath) { return js.toString(); } + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + private String includeCsrfToken() { return CsrfHelper.getCsrfMetaDataToken((HttpServletRequest) this.pageContext.getRequest()); } + public boolean isExcludeStdJs() { + return excludeStdJs; + } + + public void setExcludeStdJs(boolean excludeStdJs) { + this.excludeStdJs = excludeStdJs; + } + + public boolean isExcludeStdCss() { + return excludeStdCss; + } + + public void setExcludeStdCss(boolean excludeStdCss) { + this.excludeStdCss = excludeStdCss; + } + } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HtmlTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HtmlTag.java index 8cfa892..49c9807 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HtmlTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/HtmlTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import java.util.HashMap; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MenuTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MenuTag.java index 487460d..5ddc291 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MenuTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MenuTag.java @@ -1,20 +1,36 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.AMBIENTE; + +import java.text.SimpleDateFormat; import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspException; + import it.eng.spagoCore.configuration.ConfigSingleton; import it.eng.spagoCore.util.JavaScript; -import it.eng.spagoLite.security.User; import it.eng.spagoLite.security.menu.MenuEntry; import it.eng.spagoLite.security.menu.impl.Link; import it.eng.spagoLite.security.menu.impl.Menu; -import it.eng.spagoLite.util.Casting.Casting; import it.eng.spagoLite.util.Format; -import java.text.DateFormat; -import java.text.SimpleDateFormat; - -import javax.servlet.http.HttpServletResponse; -import javax.servlet.jsp.JspException; public class MenuTag extends BaseSpagoLiteTag { @@ -30,12 +46,15 @@ public class MenuTag extends BaseSpagoLiteTag { public int doStartTag() throws JspException { if (getMessageBox() == null || !getMessageBox().hasFatal()) { + ConfigSingleton configSingleton = ConfigSingleton.getInstance(); + Menu menu = getUser().getMenu(); writeln("\n"); writeln("

"); - writeln("
" + ConfigSingleton.get_appName() + " v." - + ConfigSingleton.get_appVersion() + " | " + ConfigSingleton.get_appBuildDate() + "
"); + writeln("
" + configSingleton.getAppName() + " " + + configSingleton.getStringValue(AMBIENTE.name()) + " v." + configSingleton.getAppVersion() + " | " + + configSingleton.getAppBuildDate() + "
"); drawUserInfo(); drawCloseMenu(); closeUserInfo(); @@ -110,19 +129,6 @@ private void drawUserInfo() throws JspException { infoUtente.append("
"); } - // String[] nmStrutCompleto = getUser().getSceltaMap().split(","); - // infoUtente - // .append("
"); - // infoUtente.append(nmStrutCompleto[0]); - // infoUtente.append("
"); - // infoUtente - // .append("
"); - // infoUtente.append(nmStrutCompleto[1]); - // infoUtente.append("
"); - // infoUtente - // .append("
"); - // infoUtente.append(nmStrutCompleto[2]); - // infoUtente.append("
"); } writeln(infoUtente); } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MessageBoxTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MessageBoxTag.java index 7035ab9..981eccd 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MessageBoxTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/MessageBoxTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import it.eng.spagoLite.message.Message; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/NewLineTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/NewLineTag.java index fbe51e5..6f492e8 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/NewLineTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/NewLineTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import javax.servlet.jsp.JspException; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/PulsantieraTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/PulsantieraTag.java index a69d458..7df5051 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/PulsantieraTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/PulsantieraTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import javax.servlet.jsp.JspException; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/UserInfoTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/UserInfoTag.java index 9128267..6071d79 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/UserInfoTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/UserInfoTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag; import java.util.Date; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseFormTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseFormTag.java index 3da3d6a..dc7e27f 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseFormTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseFormTag.java @@ -1,15 +1,35 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form; -import javax.servlet.jsp.JspException; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.DEBUG_AUTHORIZATION; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.DISABLE_SECURITY; import it.eng.spagoCore.configuration.ConfigSingleton; +import javax.servlet.jsp.JspException; + import it.eng.spagoLite.form.Component; import it.eng.spagoLite.security.IUser; import it.eng.spagoLite.security.profile.Pagina; public abstract class BaseFormTag extends BaseTag { - protected static final String CONTEXTPATH = ConfigSingleton.get_contextRoot(); + protected static final String CONTEXTPATH = ConfigSingleton.getInstance().getContextPath(); private static final long serialVersionUID = 1L; private String name; @@ -42,19 +62,20 @@ public T getComponent(String componentName) { } public void debugAuthorization(StringBuilder body, String authorization) { - if (ConfigSingleton.getDebugAuthorization()) { - body.append(" \n"); + if (ConfigSingleton.getInstance().getBooleanValue(DEBUG_AUTHORIZATION.name())) { + body.append(" \n"); } } public void debugAuthorization(String authorization) throws JspException { - if (ConfigSingleton.getDebugAuthorization()) { + if (ConfigSingleton.getInstance().getBooleanValue(DEBUG_AUTHORIZATION.name())) { writeln(" "); } } public boolean isUserAuthorized(String action) { - if (ConfigSingleton.getDisableSecurity()) { + if (ConfigSingleton.getInstance().getBooleanValue(DISABLE_SECURITY.name())) { return true; } IUser user = getUser(); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseTag.java index 14e9fc5..9a8da9b 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/BaseTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form; import it.eng.spagoLite.SessionManager; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/CsrfInputTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/CsrfInputTag.java index 74ec081..8a86d88 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/CsrfInputTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/CsrfInputTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/DoubleLblFieldTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/DoubleLblFieldTag.java index 565a704..5816e3a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/DoubleLblFieldTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/DoubleLblFieldTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldBarDetailTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldBarDetailTag.java index e70221c..8212777 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldBarDetailTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldBarDetailTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoIFace.Values; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldTag.java index 4ddcb80..e7a4a3e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FieldTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.error.EMFError; @@ -133,7 +150,6 @@ private static final String htmlInput(Input field, String width, String posit if (field.getType().equals(Type.FILE)) { input = " "; - } else if (field.getType().equals(Type.PASSWORD)) { input = " "; @@ -246,7 +262,7 @@ private static final String htmlMultiCombo(MultiSelect field, String width, S if (combo != null) { for (Object key : combo.keySet()) { String descrizione = JavaScript.stringToHTMLString(combo.getDescrizione(key)); - descrizione = org.apache.commons.text.StringEscapeUtils.escapeHtml4(descrizione); + org.apache.commons.text.StringEscapeUtils.escapeHtml4(descrizione); out.append("

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FileFieldTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FileFieldTag.java index aa194c1..3158ee4 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FileFieldTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/FileFieldTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.error.EMFError; @@ -91,6 +108,7 @@ protected void writeStartContainer() throws JspException { * Stampa il container * * @throws JspException + * eccezione generica */ protected void writeEndContainer() throws JspException { writeln(ContainerTag.Factory.htmlEndContainer()); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LabelTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LabelTag.java index 5ee4206..5e189f6 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LabelTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LabelTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.util.JavaScript; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LblFieldTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LblFieldTag.java index 51fd6a8..691b0a9 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LblFieldTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/LblFieldTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.error.EMFError; @@ -97,6 +114,7 @@ protected void writeStartContainer() throws JspException { * Stampa il container * * @throws JspException + * eccezione generica */ protected void writeEndContainer() throws JspException { writeln(ContainerTag.Factory.htmlEndContainer()); @@ -166,26 +184,29 @@ public int doEndTag() throws JspException { StringBuilder select2 = new StringBuilder(); String name = getComponent().getName(); Field field = (ComboBox) getComponent(); - String editable = !field.isReadonly() && field.isEditMode() ? "" : "readonly:readonly,"; - select2.append(" "); + // } prevent opening after clear selection + writeln(select2.toString()); + // html5 placeholder + writeln(" "); } - // prevent opening after clear selection { - select2.append(".on('select2:unselecting', function () { $(this).data('unselecting', true); })"); - select2.append( - ".on('select2:opening', function (e) { if ($(this).data('unselecting')) { $(this).removeData('unselecting'); e.preventDefault(); } });"); - select2.append(""); - // } prevent opening after clear selection - writeln(select2.toString()); - // html5 placeholder - writeln(" "); } } writeEndContainer(); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/ValueTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/ValueTag.java index 2570738..8399ac9 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/ValueTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/fields/ValueTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.fields; import it.eng.spagoCore.util.JavaScript; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/ContainerTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/ContainerTag.java index d2f0fc7..fab96cb 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/ContainerTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/ContainerTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.formLayout; import it.eng.spagoLite.tag.BaseSpagoLiteTag; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FieldSetTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FieldSetTag.java index 68ffcbb..efbae63 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FieldSetTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FieldSetTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.formLayout; import it.eng.spagoLite.tag.BaseSpagoLiteTag; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FilterBoxTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FilterBoxTag.java index b18151d..6342bcf 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FilterBoxTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/FilterBoxTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.formLayout; import it.eng.spagoLite.tag.BaseSpagoLiteTag; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/RowTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/RowTag.java index 419ff47..166e975 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/RowTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/RowTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.formLayout; import it.eng.spagoLite.tag.BaseSpagoLiteTag; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/SectionTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/SectionTag.java index 19bc031..608865a 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/SectionTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/SectionTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.formLayout; import it.eng.spagoLite.form.fields.Section; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/TableSectionTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/TableSectionTag.java index 48cbe48..9079483 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/TableSectionTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/formLayout/TableSectionTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.formLayout; import it.eng.spagoLite.form.fields.Section; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListNavBarTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListNavBarTag.java index 81958db..ec9a1b4 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListNavBarTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListNavBarTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoLite.actions.form.ListAction; @@ -66,8 +83,8 @@ protected void writePrevPage() throws JspException { protected void writePrev() throws JspException { BaseTableInterface table = getComponent().getTable(); boolean enabled = table.getCurrentRowIndex() > 0; - enabled = (table.getLazyListBean() != null) ? (enabled || table.getLazyListBean().getFirstResult() > 0) - : enabled; + enabled = (table.getLazyListInterface() != null) + ? (enabled || table.getLazyListInterface().getFirstResult() > 0) : enabled; if (table != null) { if (!modificainCorso() && enabled) { // writeLink(ListAction.NE_PREV, PREV); @@ -113,8 +130,8 @@ protected void writeBack() throws JspException { protected void writeNext() throws JspException { BaseTableInterface table = getComponent().getTable(); - boolean enabled = (table.getLazyListBean() != null) - ? table.getCurrentRowIndex() + table.getLazyListBean().getFirstResult() < table.fullSize() - 1 + boolean enabled = (table.getLazyListInterface() != null) + ? table.getCurrentRowIndex() + table.getLazyListInterface().getFirstResult() < table.fullSize() - 1 : table.getCurrentRowIndex() < table.size() - 1; if (table != null) { if (!modificainCorso() && enabled) { @@ -160,9 +177,9 @@ protected void writeLast() throws JspException { protected void writeRecordCounter() throws JspException { BaseTableInterface table = getComponent().getTable(); if (table != null && table.size() > 0) { - if (table.getLazyListBean() != null) { + if (table.getLazyListInterface() != null) { writeln("Record " - + (table.getCurrentRowIndex() + table.getLazyListBean().getFirstResult() + 1) + " di " + + (table.getCurrentRowIndex() + table.getLazyListInterface().getFirstResult() + 1) + " di " + table.fullSize() + ""); } else { writeln("Record " + (table.getCurrentRowIndex() + 1) + " di " @@ -185,8 +202,8 @@ protected void writeIsListSortable() throws JspException { if (!isListInMemory() && !isLazySortEnabled()) { writeln("Lista non ordinabile (superati i " - + getComponent().getTable().getLazyListBean().getMaxResult() + " record)"); - } else if (getComponent().getTable().getLazyListBean() == null) { + + getComponent().getTable().getLazyListInterface().getMaxResult() + " record)"); + } else if (getComponent().getTable().getLazyListInterface() == null) { // writeln("Lista non ordinabile"); } } @@ -257,8 +274,8 @@ protected void writeUpdate() throws JspException { protected void writeDelete() throws JspException { BaseTableInterface table = getComponent().getTable(); if (table != null && table.getPageSize() > 0 && table.size() > 0 && isRowDeletable(table.getCurrentRow())) { - writeln("" + getLink("", ListAction.NE_DETTAGLIO_DELETE, DELETE_IMG, null, null, - table.getCurrentPageIndex(), false, true, getMainNavTable()) + ""); + writeln("" + getLink("", ListAction.NE_DETTAGLIO_CONFIRM_DELETE, DELETE_IMG, + null, null, table.getCurrentPageIndex(), false, true, getMainNavTable()) + ""); } } @@ -358,4 +375,4 @@ public int doStartTag() throws JspException { return SKIP_BODY; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListTag.java index 839a9ae..eff70b3 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/AbstractListTag.java @@ -1,5 +1,24 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.ENABLE_LAZY_SORT; + import it.eng.spagoCore.configuration.ConfigSingleton; import it.eng.spagoIFace.Values; import it.eng.spagoLite.db.base.BaseRowInterface; @@ -306,12 +325,12 @@ public boolean isSortable() { } public boolean isLazySortEnabled() { - return ConfigSingleton.getEnableLazySort(); + return ConfigSingleton.getInstance().getBooleanValue(ENABLE_LAZY_SORT.name()); } public boolean isListInMemory() { - return getComponent().getTable().getLazyListBean() == null - || getComponent().getTable().size() == getComponent().getTable().getLazyListBean().getCountResultSize(); + return getComponent().getTable().getLazyListInterface() == null || getComponent().getTable() + .size() == getComponent().getTable().getLazyListInterface().getCountResultSize(); } public boolean isMultiRowEdit() { @@ -366,4 +385,4 @@ protected boolean notIsNull(Object propertyValue) { return !result; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ButtonListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ButtonListTag.java index 2c42a50..69f491f 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ButtonListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ButtonListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -57,4 +74,4 @@ public void setDisableAll(boolean disableAll) { this.disableAll = disableAll; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/CheckBoxListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/CheckBoxListTag.java index 5410385..aa1d00c 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/CheckBoxListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/CheckBoxListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -152,8 +169,8 @@ public int doStartTag() throws JspException { writeln(" "); - writeln(" " - + getLink("", ListAction.NE_DETTAGLIO_DELETE, DELETE_IMG, "", "", i, false, true) + writeln(" " + getLink("", + ListAction.NE_DETTAGLIO_CONFIRM_DELETE, DELETE_IMG, "", "", i, false, true) + ""); // cancellazione dell'elemento } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/EditableListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/EditableListTag.java index 0821067..9ff239e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/EditableListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/EditableListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -204,8 +221,11 @@ UPDATE_IMG, null, null, i, false, getComponent().isMasterList()) } if (isDeleteAction() && !fields.isHideDeleteButton()) { if (isRowDeletable(row)) { - body.append(" " + getLink("", ListAction.NE_DETTAGLIO_DELETE, - DELETE_IMG, null, null, i, false, getComponent().isMasterList()) + ""); + body.append( + " " + getLink("", ListAction.NE_DETTAGLIO_CONFIRM_DELETE, + DELETE_IMG, null, null, i, false, getComponent().isMasterList()) + + ""); } else { body.append(" "); } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBackTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBackTag.java index 83f7697..1e00410 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBackTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBackTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoLite.db.base.BaseTableInterface; @@ -28,4 +45,4 @@ public int doStartTag() throws JspException { return SKIP_BODY; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarDetailTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarDetailTag.java index a9bb55b..398f9f2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarDetailTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarDetailTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoLite.actions.form.ListAction; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarTag.java index 8a60ad9..be0dd97 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListNavBarTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoLite.db.base.BaseTableInterface; @@ -124,4 +141,4 @@ public void setPageSizeRelated(boolean pageSizeRelated) { this.pageSizeRelated = pageSizeRelated; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListTag.java index a657fb3..bf0aca2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/ListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -302,9 +319,9 @@ private int drawBody(BaseTableInterface table, List fields, StringBuilder if (isDeleteAction() && !fields.isHideDeleteButton() && !isHideOperationButton()) { debugAuthorization(body, deleteAction); if (isRowDeletable(row)) { - body.append( - " " + getLink("", ListAction.NE_DETTAGLIO_DELETE, - DELETE_IMG, null, null, i, false, true) + "\n"); + body.append(" " + getLink("", + ListAction.NE_DETTAGLIO_CONFIRM_DELETE, DELETE_IMG, null, null, i, false, true) + + "\n"); } else { body.append(" \n"); } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/NestedListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/NestedListTag.java index e7ebca5..3406572 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/NestedListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/NestedListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -235,9 +252,9 @@ private void drawBody(BaseTableInterface table, List fields, List secon } if (!fields.isHideDeleteButton() && !isHideOperationButton()) { if (isRowDeletable(row)) { - body.append(" " + getLink("", - ListAction.NE_DETTAGLIO_DELETE, DELETE_IMG, null, null, i, false, true) + body.append(" " + getLink("", ListAction.NE_DETTAGLIO_CONFIRM_DELETE, DELETE_IMG, null, + null, i, false, true) + "\n"); } else { body.append(" table) { } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/RadioListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/RadioListTag.java index 028bb90..43500a0 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/RadioListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/RadioListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -134,8 +151,8 @@ public int doStartTag() throws JspException { String checked = (isChecked) ? " checked=\"checked\" " : ""; writeln(" "); - writeln(" " - + getLink("", ListAction.NE_DETTAGLIO_DELETE, DELETE_IMG, "", "", i, false, true) + writeln(" " + getLink("", + ListAction.NE_DETTAGLIO_CONFIRM_DELETE, DELETE_IMG, "", "", i, false, true) + ""); // cancellazione dell'elemento } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SelectListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SelectListTag.java index 136ed76..b740ccd 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SelectListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SelectListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -269,8 +286,9 @@ public int doStartTag() throws JspException { if (isDeleteAction() && !fields.isHideDeleteButton()) { debugAuthorization(deleteAction); if (isRowDeletable(row)) { - writeln(" " + getLink("", - ListAction.NE_DETTAGLIO_DELETE, DELETE_IMG, null, null, i, false, true) + writeln(" " + + getLink("", ListAction.NE_DETTAGLIO_CONFIRM_DELETE, DELETE_IMG, null, + null, i, false, true) + "\n"); } else { writeln(" \n"); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SimpleListTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SimpleListTag.java index 8099643..d92b4ca 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SimpleListTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/list/SimpleListTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.list; import it.eng.spagoCore.error.EMFError; @@ -98,4 +115,4 @@ public int doStartTag() throws JspException { return SKIP_BODY; } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/ContentTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/ContentTag.java index 26b5608..316780b 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/ContentTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/ContentTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.pageLayout; import it.eng.spagoLite.SessionManager; @@ -17,10 +34,16 @@ public class ContentTag extends BaseSpagoLiteTag { protected boolean multipartForm = false; + protected String action; + @Override public int doStartTag() throws JspException { String actionUrl = SessionManager.getCurrentActionUrl(pageContext.getSession()); + if (StringUtils.isNotBlank(action)) { + actionUrl = action; + } + writeln(""); writeln("

"); if (multipartForm) { @@ -67,4 +90,12 @@ protected String getCsrfQueryToken() { ? "?" + CsrfHelper.getCsrfQueryStringToken((HttpServletRequest) this.pageContext.getRequest()) : StringUtils.EMPTY; } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/HeaderTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/HeaderTag.java index 52442d0..839e0ad 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/HeaderTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/HeaderTag.java @@ -1,9 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.pageLayout; -import it.eng.spagoCore.configuration.ConfigSingleton; -import it.eng.spagoCore.util.JavaScript; -import it.eng.spagoLite.tag.NewLineTag; -import it.eng.spagoLite.tag.form.BaseTag; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_1_ALT; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_1_TITLE; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_1_URL; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_APP_ALT; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_APP_TITLE; +import static it.eng.spagoCore.configuration.ConfigProperties.StandardProperty.LOGO_APP_URL; +import static it.eng.spagoCore.configuration.ConfigProperties.URIProperty.LOGO_1_RELATIVE; +import static it.eng.spagoCore.configuration.ConfigProperties.URIProperty.LOGO_APP_RELATIVE; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -11,28 +32,27 @@ import org.apache.commons.lang3.StringUtils; +import it.eng.spagoCore.configuration.ConfigSingleton; +import it.eng.spagoCore.util.JavaScript; +import it.eng.spagoLite.tag.NewLineTag; +import it.eng.spagoLite.tag.form.BaseTag; + public class HeaderTag extends BaseTag { private static final String IMG_HOME = "/img/base/home.png"; private static final String IMG_LOGOUT = "/img/base/IconaLogout.png"; private static final String IMG_CAMBIO_STRUT = "/img/base/IconaCambioStruttura.png"; - private static final String IMG_SACER = "/img/logo_sacer_small.png"; private static final long serialVersionUID = 1L; - private static final String HREF_BASE = "/menu/AdapterHTTP?"; - private static final String HREF_ACTION = HREF_BASE + "action_name="; private static final String HOME_PAGE = "Home.html"; private boolean showHomeBtn = true; private boolean showChangeOrganizationBtn = true; private String changeOrganizationBtnDescription = "Cambio organizzazione"; private String description = ""; - // private static final String HOME_PAGE = - // "HOME_ACTION&CURRENT_TOP_MENU_ENTRY=SIPS_GESTIONE&VOID_SESSION=TRUE"; - @Override public int doStartTag() throws JspException { - String description = this.description; + ConfigSingleton configSingleton = ConfigSingleton.getInstance(); HttpServletRequest httpRequest = (HttpServletRequest) pageContext.getRequest(); if ("".equals(description) && getForm() != null) { description = JavaScript.stringToHTMLString(getForm().getDescription()); @@ -48,29 +68,19 @@ public int doStartTag() throws JspException { writeln("

"); writeln(""); writeln("
"); - writeln(" \"Logo\"/"); - - if (StringUtils.isNotBlank(ConfigSingleton.getLogo1_url())) { - writeln(""); - - writeln("\"");"); - - writeln(""); - } else { - writeln("\"");"); - } + + // Logo applicazione (in alto a sinistra) + final String logoApplicazione = prepareImage(configSingleton.getStringValue(LOGO_APP_RELATIVE.name()), + configSingleton.getStringValue(LOGO_APP_ALT.name()), + configSingleton.getStringValue(LOGO_APP_URL.name()), + configSingleton.getStringValue(LOGO_APP_TITLE.name()), contextPath, "floatLeft"); + writeln(logoApplicazione); + + // Logo 1 (in alto a destra) + final String logo1 = prepareImage(configSingleton.getStringValue(LOGO_1_RELATIVE.name()), + configSingleton.getStringValue(LOGO_1_ALT.name()), configSingleton.getStringValue(LOGO_1_URL.name()), + configSingleton.getStringValue(LOGO_1_TITLE.name()), contextPath, "floatRight"); + writeln(logo1); writeln("
"); @@ -86,11 +96,6 @@ public int doStartTag() throws JspException { + "\" alt=\"Torna alla pagina principale\" title=\"Torna alla pagina principale\" />"); writeln(" "); writeln("

"); - // for(ExecutionHistory his : SessionManager.getExecutionHistory(httpRequest.getSession())){ - // if(his.getForm()!=null) - // writeln( his.getForm().getDescription() +" >> "); - // } - writeln(description + "

"); writeln("
"); if (showChangeOrganizationBtn) { @@ -107,18 +112,41 @@ public int doStartTag() throws JspException { writeln("
"); writeln("
"); - - } else if (!"".equals(this.description)) { - writeln("

" + description + "

"); } return SKIP_BODY; } + private String prepareImage(String relativePath, String alt, String url, String title, String contextPath, + String cssClass) { + StringBuilder prepareImage = new StringBuilder(); + + StringBuilder img = new StringBuilder(); + img.append("\"");"); + + if (StringUtils.isNotBlank(url)) { + prepareImage.append(""); + + prepareImage.append(img.toString()); + + prepareImage.append(""); + } else { + prepareImage.append(img.toString()); + } + + return prepareImage.toString(); + } + private String getHomePage(String contextPath) { - return contextPath + "/" + - // HREF_ACTION + - JavaScript.stringToHTMLString(HOME_PAGE); + return contextPath + "/" + JavaScript.stringToHTMLString(HOME_PAGE); } public boolean isShowHomeBtn() { @@ -131,7 +159,6 @@ public void setShowHomeBtn(boolean showHomeBtn) { @Override public int doEndTag() throws JspException { - return EVAL_PAGE; } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/SimpleFormTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/SimpleFormTag.java index 4ff1249..83bf0ca 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/SimpleFormTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/pageLayout/SimpleFormTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.pageLayout; import javax.servlet.jsp.JspException; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/panel/AbstractPanelTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/panel/AbstractPanelTag.java index d9ede80..3a244c7 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/panel/AbstractPanelTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/panel/AbstractPanelTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.panel; import it.eng.spagoLite.form.fields.SingleValueField; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tab/TabTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tab/TabTag.java index ca5da76..02373c3 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tab/TabTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tab/TabTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.tab; import it.eng.spagoCore.util.JavaScript; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tree/TreeTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tree/TreeTag.java index b65b91b..072e0fd 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tree/TreeTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/tree/TreeTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.tree; import it.eng.spagoCore.error.EMFError; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/AbstractWizardTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/AbstractWizardTag.java index 80fa859..30013ad 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/AbstractWizardTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/AbstractWizardTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.wizard; import it.eng.spagoIFace.Values; @@ -91,14 +108,20 @@ protected void writeNext() throws JspException { * @deprecated * * @param navigationEvent + * evento di navigazione * @param linkClass + * rif. classe css * @param title + * titolo * @param step + * nome step * @param textInnerLink + * testo link * * @return link elaborato * * @throws JspException + * eccezione generica */ protected String getLink(String navigationEvent, String linkClass, String title, String step, String textInnerLink) throws JspException { diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/EndPageTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/EndPageTag.java index d30ae17..952373e 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/EndPageTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/EndPageTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.wizard; import it.eng.spagoLite.form.wizard.EndPage; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/StepTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/StepTag.java index 9ac84a7..68d6069 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/StepTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/StepTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.wizard; import it.eng.spagoLite.form.wizard.Step; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardNavBarTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardNavBarTag.java index 200978b..6fef74d 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardNavBarTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardNavBarTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.wizard; import javax.servlet.jsp.JspException; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardTag.java index 296c83d..8a2e73c 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/form/wizard/WizardTag.java @@ -1,7 +1,25 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.form.wizard; import it.eng.spagoLite.form.wizard.Wizard; import it.eng.spagoLite.tag.NewLineTag; + import it.eng.spagoLite.SessionManager; import it.eng.spagoLite.security.IUser; import it.eng.spagoLite.security.profile.Pagina; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblSelectTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblSelectTag.java index 544e33d..b86aad2 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblSelectTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblSelectTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.prototype; import it.eng.spagoCore.util.JavaScript; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblTag.java index 15e4dbf..27ad2fc 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/AbstractLblTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.prototype; import it.eng.spagoCore.util.JavaScript; @@ -106,6 +123,7 @@ public void setLabelPosition(String labelPosition) { * Scrive la label * * @throws JspException + * eccezione generica */ protected void writeLabel() throws JspException { String label = ContainerTag.LEFT.equalsIgnoreCase(getLabelPosition()) @@ -124,6 +142,7 @@ protected void writeLabel() throws JspException { * Scrive il controllo * * @throws JspException + * eccezione generica */ protected abstract void writeControl() throws JspException; @@ -131,6 +150,7 @@ protected void writeLabel() throws JspException { * Stampa il container * * @throws JspException + * eccezione generica */ protected void writeStartContainer() throws JspException { writeln(""); @@ -141,6 +161,7 @@ protected void writeStartContainer() throws JspException { * Stampa il container * * @throws JspException + * eccezione generica */ protected void writeEndContainer() throws JspException { writeln(ContainerTag.Factory.htmlEndContainer()); diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblCheckTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblCheckTag.java index e641b0a..9ce164d 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblCheckTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblCheckTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.prototype; import it.eng.spagoLite.tag.form.formLayout.ContainerTag; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblMultiSelectTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblMultiSelectTag.java index edf89b6..5b38a82 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblMultiSelectTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblMultiSelectTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.prototype; import it.eng.spagoLite.tag.form.formLayout.ContainerTag; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblSelectTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblSelectTag.java index aba73ac..c5ca411 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblSelectTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblSelectTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.prototype; import it.eng.spagoLite.tag.form.formLayout.ContainerTag; @@ -22,4 +39,4 @@ protected void writeControl() throws JspException { writeln("

"); } } -} \ No newline at end of file +} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblTextTag.java b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblTextTag.java index 029dd42..2b177a4 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblTextTag.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/tag/prototype/LblTextTag.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.tag.prototype; import it.eng.spagoCore.util.JavaScript; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/util/Casting/Casting.java b/spagolite-middle/src/main/java/it/eng/spagoLite/util/Casting/Casting.java index 3e1d52b..afd4d06 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/util/Casting/Casting.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/util/Casting/Casting.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.util.Casting; import it.eng.spagoCore.error.EMFError; @@ -89,7 +106,8 @@ public static boolean checkDate(String strDate) { * * @return Timestamp della data in ingresso * - * @throws ParseException + * @throws EMFError + * eccezione generica */ public static Timestamp parseDate(String strDate) throws EMFError { Timestamp result = null; @@ -112,7 +130,8 @@ public static Timestamp parseDate(String strDate) throws EMFError { * * @return BigDecimal della data in ingresso * - * @throws ParseException + * @throws EMFError + * eccezione generica */ public static BigDecimal parseInteger(String strInteger) throws EMFError { if (StringUtils.isBlank(strInteger)) { @@ -138,6 +157,7 @@ public static BigDecimal parseInteger(String strInteger) throws EMFError { * @return BigDecimal della data in ingresso * * @throws EMFError + * eccezione generica */ public static BigDecimal parseDecimal(String strDecimal) throws EMFError { if (StringUtils.isBlank(strDecimal)) { @@ -162,6 +182,7 @@ public static BigDecimal parseDecimal(String strDecimal) throws EMFError { * @return parsing del CAP fornito * * @throws EMFError + * eccezione generica */ public static String parseCAP(String cap) throws EMFError { if (StringUtils.isBlank(cap)) { @@ -183,6 +204,7 @@ public static String parseCAP(String cap) throws EMFError { * @return parsing della mail con espressione regolare * * @throws EMFError + * eccezione generica */ public static String parseEmail(String email) throws EMFError { if (StringUtils.isBlank(email)) { @@ -205,6 +227,7 @@ public static String parseEmail(String email) throws EMFError { * @return del codice fiscale con espressione regolare * * @throws EMFError + * eccezione generica */ public static String parseCodFiscale(String codFiscale) throws EMFError { if (StringUtils.isBlank(codFiscale)) { @@ -226,6 +249,7 @@ public static String parseCodFiscale(String codFiscale) throws EMFError { * @return della partiva iva con espressione regolare * * @throws EMFError + * eccezione generica */ public static String parsePartitaIva(String piva) throws EMFError { if (StringUtils.isBlank(piva)) { @@ -300,6 +324,7 @@ public static String parsePartitaIva(String piva) throws EMFError { * @return del codice fiscale con espressione regolare * * @throws EMFError + * eccezione generica */ public static String parseCodFiscalePartitaIva(String codice) throws EMFError { if (isCodiceFiscale(codice) || isPartitaIva(codice)) { @@ -338,6 +363,7 @@ public static boolean isPartitaIva(String codice) { * @return del telefono con espressione regolare * * @throws EMFError + * eccezione generica */ public static String parseTelefono(String telefono) throws EMFError { if (StringUtils.isBlank(telefono)) { @@ -393,7 +419,8 @@ public static final String format(Object value, Type.Enum type, String format) t * * @return risultato della formattazione * - * @throws ParseException + * @throws EMFError + * eccezione generica */ public static final String format(Object value, Type.Enum type) throws EMFError { if (value != null) { @@ -460,6 +487,7 @@ public static final boolean check(Set values, Type.Enum type) { * @return oggetto parsato * * @throws EMFError + * eccezione generica */ public static final Object parse(String value, Type.Enum type) throws EMFError { if (StringUtils.isNotBlank(value)) { @@ -526,4 +554,38 @@ public static final void setToExcel(Cell cell, String value, Type.Enum type) thr } } + public static final void setToExcelMultiValue(Cell cell, Set values, Type.Enum type) throws EMFError { + if (values != null && !values.isEmpty()) { + String value = ""; + for (String valueStr : values) { + value = value + valueStr + "; "; + } + if (type.equals(Type.STRING) || type.equals(Type.CAP) || type.equals(Type.EMAIL) + || type.equals(Type.CODFISCALE) || type.equals(Type.TELEFONO) || type.equals(Type.PARTITAIVA) + || type.equals(Type.CODFISCPIVA) || type.equals(Type.PREFISSOTEL)) { + cell.setCellValue(StringUtils.trim(value)); + } else if (type.equals(Type.DATE) || type.equals(Type.DATETIME)) { + cell.setCellValue(parseDate(value)); + } else if (type.equals(Type.INTEGER) || type.equals(Type.DECIMAL)) { + if (StringUtils.isNotBlank(value)) { + try { + Number num = new DecimalFormat("", new DecimalFormatSymbols(Locale.ITALIAN)).parse(value); + cell.setCellValue(num.doubleValue()); + } catch (ParseException ex) { + cell.setCellValue(""); + } + /* + * if (NumberUtils.isDigits(value)) { cell.setCellValue(Double.parseDouble(value)); } else { + * cell.setCellValue(""); } + */ + } else { + cell.setCellValue(value); + } + } else if (type.equals(Type.CURRENCY)) { + // FIXME + throw new EMFError(EMFError.ERROR, "Conversione di formato da implementare", null); + } + } + } + } diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/util/DataTypes.java b/spagolite-middle/src/main/java/it/eng/spagoLite/util/DataTypes.java index 9ed34a7..d2a3b18 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/util/DataTypes.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/util/DataTypes.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.util; import java.sql.Types; diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/util/Format.java b/spagolite-middle/src/main/java/it/eng/spagoLite/util/Format.java index 0a0239d..81af701 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/util/Format.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/util/Format.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.util; import java.math.BigDecimal; @@ -56,7 +73,7 @@ public enum DATE_FORMAT { DAY_FORMAT_MINUS_YY("dd-MM-yy"), DAY_FORMAT("dd/MM/yyyy"), WEEK_FORMAT("EEE dd MMM"), MONTH_FORMAT("MM/yyyy"), YEAR_FORMAT("yyyy"), TIME_FORMAT("HH:mm"); - private String format; + private final String format; DATE_FORMAT(String format) { this.format = format; @@ -332,6 +349,7 @@ public static String formatTime(Timestamp date) { * Formatta la data secondo il formato WEEK * * @param date + * timestamp in input * * @return la data formattata */ diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/util/MessageCodes.java b/spagolite-middle/src/main/java/it/eng/spagoLite/util/MessageCodes.java deleted file mode 100644 index 9a53a4e..0000000 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/util/MessageCodes.java +++ /dev/null @@ -1,51 +0,0 @@ -package it.eng.spagoLite.util; - -/** - * Classe contenitore dei codici di messaggi o errori che si trovano nel file ...WEB-INF\classes\messages_x_Y.properties - * dove x e Y indica language e country scelte. - * - * @author Corrado Vaccari - */ -public abstract class MessageCodes { - // Quando si aggiungono nuove sezioni, tipo "errori sul lavoratore", - // partire sempre dal 10000 superiore, - // Es. ultimo messaggio : 30103, cominciare la nuova sezione da 40000 - // per non rischiare di utilizzare id già usati - public static abstract class General { - public static final int NO_ROWS_IN_LIST = 10001; - public static final int DELETE_SUCCESS = 10002; - public static final int DELETE_FAIL = 10003; - public static final int UPDATE_SUCCESS = 10004; - public static final int UPDATE_FAIL = 10005; - public static final int GET_ROW_FAIL = 10006; - public static final int INSERT_SUCCESS = 10007; - public static final int INSERT_FAIL = 10008; - public static final int OPERATION_SUCCESS = 10009; - public static final int OPERATION_FAIL = 10010; - public static final int ELEMENT_DUPLICATED = 10011; - public static final int DELETE_FAILED_FK = 10012; - public static final int UNEXPECTED_INTERRUPT = 10014; - public static final int ERR_AGGIORNAMETO_AMDOCCOLL = 10015; - public static final int ERR_NO_DB_CONNECTION = 10016; - public static final int ERR_IN_WRITING_LOG = 10017; - public static final int DUPLICATE_ROW = 10018; - public static final int CONVERSION_TYPE = 10019; - public static final int DEPENDENT_FIELD_MIN_CHAR_ERROR = 10020; - public static final int DEPENDENT_FIELD_ERROR = 10021; - public static final int FORMATO_FILE_NON_AMMESSO = 10022; - public static final int FILE_TROOOOPPO_GRANDE = 10023; - public static final int FILE_CARATTERI_NON_AMMESSI = 10024; - public static final int IMPOSTARE_REGIONE_O_AZIENDA = 10025; - public static final int IMPOSTARE_REGIONE = 10026; - - } - - public static abstract class Validation { - public static final int ERRORE_VALIDAZIONE = 20000; - public static final int OBBLIGATORIO = 20001; - public static final int NUMERICO = 20002; - public static final int FORMATO_DATA_NON_CORRETTO = 20003; - public static final int POSITIVO = 20004; - } - -} diff --git a/spagolite-middle/src/main/java/it/eng/spagoLite/util/Parse.java b/spagolite-middle/src/main/java/it/eng/spagoLite/util/Parse.java index 5b61f92..ff9578b 100644 --- a/spagolite-middle/src/main/java/it/eng/spagoLite/util/Parse.java +++ b/spagolite-middle/src/main/java/it/eng/spagoLite/util/Parse.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.spagoLite.util; import java.math.BigDecimal; @@ -75,6 +92,7 @@ private static BigDecimal parseNumber(String value, String format, DecimalFormat * @return il numero parsato * * @throws ParseException + * eccezione generica */ public static BigDecimal parseDecimal(String value, String format) throws ParseException { return parseNumber(value, format, Format.SYMBOLS); @@ -84,10 +102,12 @@ public static BigDecimal parseDecimal(String value, String format) throws ParseE * Parsa un numero decimale secondo il formato standard * * @param value + * in ingresso * * @return il numero parsato * * @throws ParseException + * eccezione generica */ public static BigDecimal parseDecimal(String value) throws ParseException { return parseDecimal(value, Format.DECIMAL_FORMAT); @@ -102,6 +122,7 @@ public static BigDecimal parseDecimal(String value) throws ParseException { * @return il numero parsato * * @throws ParseException + * eccezione generica */ public static BigDecimal parseInteger(String value) throws ParseException { return parseDecimal(value, Format.INTEGER_FORMAT); @@ -111,12 +132,16 @@ public static BigDecimal parseInteger(String value) throws ParseException { * Parsa un numero secondo il formato e il simbolo di valuta forniti * * @param value + * in ingresso * @param format + * formato * @param currencySymbol + * currency * * @return il numero parsato * * @throws ParseException + * eccezione generica */ public static BigDecimal parseCurrency(String value, String format, String currencySymbol) throws ParseException { DecimalFormatSymbols decimalFormatSymbols = (DecimalFormatSymbols) Format.SYMBOLS.clone(); @@ -131,11 +156,14 @@ public static BigDecimal parseCurrency(String value, String format, String curre * Parsa un numero secondo il formato standard e il simbolo di valuta fornito * * @param value + * in ingresso * @param currencySymbol + * currency * * @return il numero parsato * * @throws ParseException + * eccezione generica */ public static BigDecimal parseCurrency(String value, String currencySymbol) throws ParseException { return parseCurrency(value, Format.CURRENCY_FORMAT, currencySymbol); @@ -150,6 +178,7 @@ public static BigDecimal parseCurrency(String value, String currencySymbol) thro * @return risultato parsing valuta * * @throws ParseException + * eccezione generica */ public static BigDecimal parseCurrency(String value) throws ParseException { try { @@ -163,11 +192,14 @@ public static BigDecimal parseCurrency(String value) throws ParseException { * Effettua il parsing della data in input * * @param date + * in ingresso * @param format + * formato * * @return la data parsata, null se la data è null o stringa vuota * * @throws ParseException + * eccezione generica */ public static Timestamp parseDate(String date, String format) throws ParseException { if (StringUtils.isBlank(date)) { @@ -189,10 +221,12 @@ public static Timestamp parseDate(String date, String format) throws ParseExcept * Parsa la data secondo il formato di default * * @param date + * in ingresso * * @return la data parsata, null se la data è null o stringa vuota * * @throws ParseException + * eccezione generica */ public static Timestamp parseDate(String date) throws ParseException { return parseDate(date, Format.DATE_FORMAT.DAY_FORMAT.format()); @@ -202,10 +236,12 @@ public static Timestamp parseDate(String date) throws ParseException { * Parsa la data secondo il formato DATE_TIME * * @param date + * in ingresso * * @return la data parsata, null se la data è null o stringa vuota * * @throws ParseException + * eccezione generica */ public static Timestamp parseDateTime(String date) throws ParseException { return parseDate(date, Format.DATE_FORMAT.SECOND_FORMAT.format()); @@ -215,10 +251,12 @@ public static Timestamp parseDateTime(String date) throws ParseException { * Parsa la data secondo il formato TIME * * @param date + * in ingresso * * @return la data parsata, null se la data è null o stringa vuota * * @throws ParseException + * eccezione generica */ public static Timestamp parseTime(String date) throws ParseException { return parseDate(date, Format.DATE_FORMAT.TIME_FORMAT.format()); @@ -228,10 +266,12 @@ public static Timestamp parseTime(String date) throws ParseException { * Parsa la data secondo il formato MONTH * * @param date + * in ingresso * * @return la data parsata, null se la data è null o stringa vuota * * @throws ParseException + * eccezione generica */ public static Timestamp parseMonth(String date) throws ParseException { return parseDate(date, Format.DATE_FORMAT.MONTH_FORMAT.format()); @@ -241,10 +281,12 @@ public static Timestamp parseMonth(String date) throws ParseException { * Parsa la data secondo il formato YEAR * * @param date + * in ingresso * * @return la data parsata, null se la data è null o stringa vuota * * @throws ParseException + * eccezione generica */ public static Timestamp parseYear(String date) throws ParseException { return parseDate(date, Format.DATE_FORMAT.YEAR_FORMAT.format()); diff --git a/spagolite-middle/src/main/java/it/eng/util/ClassUtil.java b/spagolite-middle/src/main/java/it/eng/util/ClassUtil.java index 5653da3..8ba3dfd 100644 --- a/spagolite-middle/src/main/java/it/eng/util/ClassUtil.java +++ b/spagolite-middle/src/main/java/it/eng/util/ClassUtil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util; import java.io.File; diff --git a/spagolite-middle/src/main/java/it/eng/util/EncryptionUtil.java b/spagolite-middle/src/main/java/it/eng/util/EncryptionUtil.java index ad5c5a6..fc0de49 100644 --- a/spagolite-middle/src/main/java/it/eng/util/EncryptionUtil.java +++ b/spagolite-middle/src/main/java/it/eng/util/EncryptionUtil.java @@ -1,6 +1,22 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util; -import it.eng.spagoCore.error.EMFError; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.security.InvalidAlgorithmParameterException; @@ -11,6 +27,7 @@ import java.util.Base64; import java.util.logging.Level; import java.util.logging.Logger; + import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; @@ -20,6 +37,8 @@ import javax.crypto.spec.GCMParameterSpec; import javax.crypto.spec.SecretKeySpec; +import it.eng.spagoCore.error.EMFError; + /** * * @author MIacolucci diff --git a/spagolite-middle/src/main/java/it/eng/util/FileSystemUtil.java b/spagolite-middle/src/main/java/it/eng/util/FileSystemUtil.java index 49deefa..a4d3326 100644 --- a/spagolite-middle/src/main/java/it/eng/util/FileSystemUtil.java +++ b/spagolite-middle/src/main/java/it/eng/util/FileSystemUtil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util; import java.io.File; @@ -6,7 +23,7 @@ public class FileSystemUtil { - public static final String[] EXLUDE_PATH = { ".svn" }; + public static final String[] EXLUDE_PATH = { ".svn", ".git" }; /** * Verifica se il file passato appartiene alla lista di esclusione passata diff --git a/spagolite-middle/src/main/java/it/eng/util/SpagoLiteTool.java b/spagolite-middle/src/main/java/it/eng/util/SpagoLiteTool.java index 65ea132..6daaf48 100644 --- a/spagolite-middle/src/main/java/it/eng/util/SpagoLiteTool.java +++ b/spagolite-middle/src/main/java/it/eng/util/SpagoLiteTool.java @@ -1,15 +1,32 @@ -package it.eng.util; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.xmlbean.form.FormDocument; -import it.eng.util.actionWriter.ActionWriter; -import it.eng.util.constantWriter.ConstantWriter; -import it.eng.util.formWriter.FormWriter; +package it.eng.util; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.List; +import it.eng.spagoLite.xmlbean.form.FormDocument; +import it.eng.util.actionWriter.ActionWriter; +import it.eng.util.constantWriter.ConstantWriter; +import it.eng.util.formWriter.FormWriter; + public class SpagoLiteTool { private static final String srcPath = "./src"; diff --git a/spagolite-middle/src/main/java/it/eng/util/SpringLiteTool.java b/spagolite-middle/src/main/java/it/eng/util/SpringLiteTool.java index 1b60e0c..f6119ce 100644 --- a/spagolite-middle/src/main/java/it/eng/util/SpringLiteTool.java +++ b/spagolite-middle/src/main/java/it/eng/util/SpringLiteTool.java @@ -1,19 +1,34 @@ -package it.eng.util; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.xmlbean.form.FormDocument; -import it.eng.util.actionWriter.ActionWriter; -import it.eng.util.constantWriter.ConstantWriter; -import it.eng.util.constantWriter.ScriptWriter; -import it.eng.util.formWriter.FormWriter; +package it.eng.util; import java.io.File; import java.io.FileWriter; -import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Locale; -import java.util.Vector; + +import it.eng.spagoLite.xmlbean.form.FormDocument; +import it.eng.util.actionWriter.ActionWriter; +import it.eng.util.constantWriter.ConstantWriter; +import it.eng.util.constantWriter.ScriptWriter; +import it.eng.util.formWriter.FormWriter; public class SpringLiteTool { diff --git a/spagolite-middle/src/main/java/it/eng/util/actionWriter/ActionWriter.java b/spagolite-middle/src/main/java/it/eng/util/actionWriter/ActionWriter.java index d4312c0..aca6f76 100644 --- a/spagolite-middle/src/main/java/it/eng/util/actionWriter/ActionWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/actionWriter/ActionWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.actionWriter; import it.eng.spagoLite.xmlbean.form.Button; diff --git a/spagolite-middle/src/main/java/it/eng/util/constantWriter/ConstantWriter.java b/spagolite-middle/src/main/java/it/eng/util/constantWriter/ConstantWriter.java index fb17373..e733c2a 100644 --- a/spagolite-middle/src/main/java/it/eng/util/constantWriter/ConstantWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/constantWriter/ConstantWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.constantWriter; import it.eng.util.ClassUtil; diff --git a/spagolite-middle/src/main/java/it/eng/util/constantWriter/ScriptWriter.java b/spagolite-middle/src/main/java/it/eng/util/constantWriter/ScriptWriter.java index dac0091..1b5d776 100644 --- a/spagolite-middle/src/main/java/it/eng/util/constantWriter/ScriptWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/constantWriter/ScriptWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.constantWriter; import it.eng.spagoLite.xmlbean.form.Button; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/ButtonListWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/ButtonListWriter.java index 255c9dd..6c24fbb 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/ButtonListWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/ButtonListWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.ButtonList; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/EndPageWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/EndPageWriter.java index 059463f..a9639ca 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/EndPageWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/EndPageWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.EndPage; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldWriter.java index 0d25703..65c00ee 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Button; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldsWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldsWriter.java index eb84ac7..9ad1739 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldsWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/FieldsWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Field; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/FormWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/FormWriter.java index e0ec0ec..d929ec4 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/FormWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/FormWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Button; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/ListWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/ListWriter.java index efe50ee..65ff606 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/ListWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/ListWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Field; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/NestedListWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/NestedListWriter.java index 82b9dbb..b8085c6 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/NestedListWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/NestedListWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Field; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/SectionWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/SectionWriter.java index f2c20d1..3904f39 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/SectionWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/SectionWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Section; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/StepWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/StepWriter.java index 11638d6..1211fbf 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/StepWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/StepWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Step; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/TabElementWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/TabElementWriter.java index ec1dac5..bbf17d2 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/TabElementWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/TabElementWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.TabElement; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/TabWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/TabWriter.java index 09e2660..155565c 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/TabWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/TabWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Tab; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeElementWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeElementWriter.java index 765cd04..dedac2d 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeElementWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeElementWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.TreeElement; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeWriter.java index 47f2c64..3ce5332 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/TreeWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.Tree; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardElementWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardElementWriter.java index d41cd49..50a7be3 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardElementWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardElementWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import java.io.IOException; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardWriter.java index ce4a0dc..72f9d78 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/WizardWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter; import it.eng.spagoLite.xmlbean.form.EndPage; diff --git a/spagolite-middle/src/main/java/it/eng/util/formWriter/base/ElementWriter.java b/spagolite-middle/src/main/java/it/eng/util/formWriter/base/ElementWriter.java index fc8c11c..23e1c45 100644 --- a/spagolite-middle/src/main/java/it/eng/util/formWriter/base/ElementWriter.java +++ b/spagolite-middle/src/main/java/it/eng/util/formWriter/base/ElementWriter.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.util.formWriter.base; import it.eng.spagoLite.form.fields.impl.Button; diff --git a/spagolite-middle/src/main/resources/META-INF/sl.tld b/spagolite-middle/src/main/resources/META-INF/sl.tld index 669b0ec..c95eebb 100644 --- a/spagolite-middle/src/main/resources/META-INF/sl.tld +++ b/spagolite-middle/src/main/resources/META-INF/sl.tld @@ -44,6 +44,11 @@ false true + + action + false + true + form @@ -103,6 +108,18 @@ true true + + excludeStdJs + false + true + boolean + + + excludeStdCss + false + true + boolean + body diff --git a/spagolite-middle/src/main/resources/messages.properties b/spagolite-middle/src/main/resources/messages.properties deleted file mode 100644 index bd615e2..0000000 --- a/spagolite-middle/src/main/resources/messages.properties +++ /dev/null @@ -1,67 +0,0 @@ -# ATTENZIONE -# Siccome questi testi vengono visualizzati in HTML, non bisogna mettere -# lettere accentate o altri caratteri strani, ma in questi casi occorre -# inserire la codifica HTML relativa. -# Ad esempio è à ecc. - -10001 = La lista non contiene righe -10002 = Cancellazione eseguita correttamente -10003 = Errore durante la cancellazione -10004 = Aggiornamento eseguito correttamente -10005 = Errore durante l'aggiornamento -10006 = Errore durante il recupero della riga -10007 = Inserimento eseguito correttamente -10008 = Errore durante l'inserimento -10009 = Operazione completata con successo -10010 = Operazione fallita -10011 = Elemento già esistente -10012 = La codifica non può essere cancellata perchè già utilizzata. -10014 = Servizio interattivo interrotto in maniera non prevista, operazione abortita. -10015 = Non è stato inserito un documento di identificazione valido. -10016 = Recupero della connessione al database non riuscita. -10017 = Errore di scrittura nella tabella di log. -10018 = Riga gia' presente nella lista. -10019 = %0 -10020 = Inserire almeno %0 caratteri nel campo %1 -10021 = Al valore %0 del campo %1 non corrisponde un valore valido per il campo %2 -10022 = Estensione o formato di file non ammessi - inserire solo file con estensione .txt -10023 = Il file allegato eccede la dimensione massima di %0MB. -10024 = Nome file non valido. I seguenti caratteri non sono ammessi: %0 -10025 = Impostare almeno la Regione o l'Azienda -10026 = Impostare la Regione - - -#Validazione -20000 = Si è verificato un errore di validazione: -20001 = il campo %0 è obbligatorio. -20002 = il campo %0 non è in formato numerico. -20003 = La data %0 non è nel formato corretto: deve essere gg/mm/aaaa oppure ggmmaaaa. -20004 = il campo %0 deve essere maggiore di zero. -20005 = la data %0 non è corretta -20006 = la posizione contabile %0 non è valida per questa fase -20007 = il numero di giorni non è valido -20008 = l'importo %0 inserito non è valido -20009 = Nella scheda sono presenti i seguenti errori di validazione: -20010 = La data inserita è superiore alla data attuale -20011 = L'importo %0 inserito è superiore al consentito -20012 = Impostare almeno la Regione o l'Azienda -20013 = Impostare la Regione -20014 = La data di %0 non può essere superiore della data di %1 -20015 = Il flag oltre soglia impostato non è corretto -20016 = Il flag ricovero ripetuto impostato non è corretto -20017 = Con posizione contabile = 'B', almeno uno dei flag di verifica va impostato a 'V' -20018 = Con posizione contabile = 'A', tutti i flag di verifica vanno impostati a 'C' -20019 = Con posizione contabile = '%0' il flag di verifica dell'importo deve essere impostato a 'V' -20020 = Errore durante il recupero dell'importo ticket da banca dati -20021 = Almeno un flag di verifica è impostato a 'V'. E' necessario che la posizione contabile sia a 'B' -20022 = I campi non sono modificabili poiché il flag 'Verifica anagrafica' è impostato ad 'I' -20023 = I campi non sono modificabili poiché né il flag 'Oltre soglia' né il flag 'Ricovero ripetuto' sono impostati a 'I' -20024 = I campi non sono modificabili poiché il flag 'Verifica importo' non è impostato a 'I' -20025 = I campi non sono modificabili poiché non è stato valorizzato alcun flag di verifica -20026 = Se viene impostato un flag a 'V' i dati della scheda devono essere variati rispetto alla fase precedente -20027 = Il flag '%0' è impostato ad 'I'. Per poter salvare la scheda è necessario impostarlo a 'V' oppure a 'C' -20028 = Con posizione contabile = '%0' il flag di verifica dell'importo deve essere impostato a 'V'. Modificare la riga 99 della scheda con identificativo = '%1' -20029 = Con posizione contabile = 'C' i dati non devono essere variati rispetto alla fase precedente e tutti i flag di verifica devono essere impostati a 'C' -20030 = Il flag '%0' è impostato ad 'I'. Per poter salvare è necessario impostarlo a 'V' oppure a 'C' sulla riga 99 della scheda con identificativo = '%1' -20031 = I dati di almeno un record di questa scheda sono stati modificati. Il flag di verifica importo deve essere impostato a 'V' - diff --git a/spagolite-middle/src/test/java/it/eng/spagolite/security/auth/TestPasswordUtil.java b/spagolite-middle/src/test/java/it/eng/spagolite/security/auth/TestPasswordUtil.java new file mode 100644 index 0000000..ec060f0 --- /dev/null +++ b/spagolite-middle/src/test/java/it/eng/spagolite/security/auth/TestPasswordUtil.java @@ -0,0 +1,71 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.spagolite.security.auth; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import it.eng.spagoLite.security.auth.PwdUtil; + +/** + * Test sulla classe che genera le password. + * + * @author Snidero_L + */ +public class TestPasswordUtil { + + public TestPasswordUtil() { + } + + @BeforeAll + public static void setUpClass() { + } + + @AfterAll + public static void tearDownClass() { + } + + @BeforeEach + public void setUp() { + } + + @AfterEach + public void tearDown() { + } + + @Test + public void testPasswordWitoutSalt() { + String actualPassword = PwdUtil.encodePassword("password"); + final String expectedPassword = "W6ph5Mm5Pz8GgiULbPgzG37mj9g="; + Assertions.assertEquals(expectedPassword, actualPassword); + } + + @Test + public void testPasswordWithSalt() { + byte[] salt = PwdUtil.decodeUFT8Base64String("7TtONHgKep1bl7wmDGQ5jA=="); + String actualPassword = PwdUtil.encodePBKDF2Password(salt, "password"); + final String expectedPassword = "BQ9fmLrh2aNFQGRmtD+jjGiv6UaDKBcKvSzKaVWQ1NcHj8ZELAH1ZZXphSFzHlNJXlMjSIYl0Fd597B1kntbRw=="; + Assertions.assertEquals(expectedPassword, actualPassword); + + } + +} diff --git a/spagolite-paginator-ejb/arquillian.xml b/spagolite-paginator-ejb/arquillian.xml new file mode 100644 index 0000000..e34b3f7 --- /dev/null +++ b/spagolite-paginator-ejb/arquillian.xml @@ -0,0 +1,24 @@ + + + + + 127.0.0.1 + + + + + + + + /home/mbertuzzi/workspace/jboss-eap-7.3 + /usr/lib/jvm/jre-1.8.0 + true + + + + \ No newline at end of file diff --git a/spagolite-paginator-ejb/pom.xml b/spagolite-paginator-ejb/pom.xml new file mode 100644 index 0000000..1e95338 --- /dev/null +++ b/spagolite-paginator-ejb/pom.xml @@ -0,0 +1,82 @@ + + 4.0.0 + spagofat-paginator-ejb + Spagolite paginator - ejb + ejb + + it.eng.parer + spagofat + 4.11.1-SNAPSHOT + + + + + + org.jboss.arquillian + arquillian-bom + 1.6.0.Final + import + pom + + + + + + org.jboss.spec + jboss-jakartaee-8.0 + pom + provided + + + org.hibernate + hibernate-core + provided + + + it.eng.parer + spagofat-paginator-gf + + + junit + junit + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + + + org.wildfly.arquillian + wildfly-arquillian-container-managed + 2.2.0.Final + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.apache.maven.plugins + maven-ejb-plugin + + + + diff --git a/spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java new file mode 100644 index 0000000..71c6cd3 --- /dev/null +++ b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java @@ -0,0 +1,42 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.ejb; + +import it.eng.paginator.helper.LazyListHelper; +import it.eng.spagoLite.db.base.BaseTableInterface; +import it.eng.spagoLite.db.base.paging.AbstractPaginator; +import it.eng.spagoLite.db.base.table.LazyListBean; +import it.eng.spagoLite.db.base.table.LazyListInterface; + +import javax.ejb.EJB; + +/** + * + * @author Quaranta_M + */ +public class PaginatorImpl extends AbstractPaginator { + + @EJB(mappedName = "java:app/paginator/LazyListHelper") + private LazyListHelper lazyListHelper; + + @Override + protected BaseTableInterface invoke(LazyListInterface llBean) { + return lazyListHelper.getTableBean((LazyListBean) llBean); + } + +} diff --git a/spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java new file mode 100644 index 0000000..1abd65f --- /dev/null +++ b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java @@ -0,0 +1,44 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.ejb; + +import it.eng.spagoLite.db.base.table.LazyListBean; +import javax.interceptor.AroundInvoke; +import javax.interceptor.InvocationContext; + +public class PaginatorInterceptor { + + private static ThreadLocal tLocalLazyList = new ThreadLocal<>(); + + @AroundInvoke + public Object storeInvocation(InvocationContext inv) throws Exception { + return invoke(inv); + } + + private Object invoke(InvocationContext inv) throws Exception { + return inv.proceed(); + } + + public static LazyListBean getLazyListBean() { + return tLocalLazyList.get(); + } + + public static void setLazyListBean(LazyListBean llBean) { + tLocalLazyList.set(llBean); + } +} diff --git a/spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyListHelper.java b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyListHelper.java new file mode 100644 index 0000000..9e37294 --- /dev/null +++ b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyListHelper.java @@ -0,0 +1,163 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.helper; + +import it.eng.paginator.util.CriteriaQueryUtils; +import it.eng.paginator.util.QueryUtils; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.base.table.LazyListBean; +import it.eng.spagoLite.db.base.table.LazyQuery; +import org.springframework.util.Assert; + +import java.util.*; +import java.util.function.Function; +import javax.ejb.LocalBean; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaQuery; + +@Stateless(mappedName = "java:app/paginator/LazyListHelper") +@LocalBean +@TransactionAttribute(TransactionAttributeType.REQUIRED) +public class LazyListHelper { + @PersistenceContext + private EntityManager entityManager; + + public AbstractBaseTable getTableBean(LazyListBean llBean) { + Assert.notNull(llBean.getLazyQuery(), + "è stata richiamato il caricamento lazy ma non ci sono dati per eseguire la query"); + return getTableBean(llBean, llBean.getResultListToTableBeanFunc()); + } + + private T getTableBean(LazyListBean lazyListBean, Function tansformFunc) { + final LazyQuery lazyQuery = lazyListBean.getLazyQuery(); + List resultList; + if (lazyQuery.isCriteriaQuery()) { + if (lazyListBean.getCountResultSize() <= 0) { + final TypedQuery query = entityManager.createQuery(lazyQuery.getCountCriteriaQuery()); + lazyListBean.setCountResultSize(query.getSingleResult().intValue()); + } + resultList = execQuery(lazyQuery.getCriteriaQuery(), lazyListBean.getMaxResult(), + lazyListBean.getFirstResult(), lazyListBean.getOrderByColumnName(), + lazyListBean.getOrderBySortingRule()); + } else { + if (lazyListBean.getCountResultSize() <= 0) { + Query count = createQuery(lazyQuery.getCountQueryString(), lazyQuery.getQueryParams()); + lazyListBean.setCountResultSize(Long.class.cast(count.getSingleResult()).intValue()); + } + resultList = execQuery(lazyQuery.getQueryString(), lazyQuery.getQueryParams(), lazyListBean.getMaxResult(), + lazyListBean.getFirstResult(), lazyListBean.getOrderByColumnName(), + lazyListBean.getOrderBySortingRule()); + } + + final T tableBean = tansformFunc.apply(resultList); + if (tableBean != null) { + tableBean.setLazyListBean(lazyListBean); + } + return tableBean; + } + + public T getTableBean(Query query, Function tansformFunc) { + return getTableBean(query, tansformFunc, "", new LazyListBean()); + } + + /** + * @param cq + * CriteriaQuery per recuperare i record dal DB + * @param transformFunc + * Function che prende come parametro d'ingresso una List (i risultati dal DB) e restituisce il + * *TableBean + * + * @return *TableBean calcolato dalla lambda sulla base dei dati ottenuti dalla query + */ + public T getTableBean(CriteriaQuery cq, Integer maxResults, + Function transformFunc) { + final LazyListBean lazyListBean = new LazyListBean(); + setRecordLimits(lazyListBean, maxResults); + return getTableBean(cq, transformFunc, lazyListBean); + } + + public T getTableBean(CriteriaQuery cq, Function transformFunc) { + return getTableBean(cq, 0, transformFunc); + + } + + public T getTableBean(Query query, Function tansformFunc, + String countDistinctField) { + + final LazyListBean lazyListBean = new LazyListBean(); + lazyListBean.setCountDistinctField(countDistinctField); + setRecordLimits(lazyListBean, query); + return getTableBean(query, tansformFunc, countDistinctField, lazyListBean); + } + + private T getTableBean(Query query, Function tansformFunc, + String countDistinctField, LazyListBean lazyListBean) { + setRecordLimits(lazyListBean, query); + lazyListBean.setLazyQuery(new LazyQuery(QueryUtils.queryStringFrom(query), + QueryUtils.selectToCount(query, countDistinctField), QueryUtils.extractParameters(query))); + lazyListBean.setResultListToTableBeanFunc(tansformFunc); + return getTableBean(lazyListBean, tansformFunc); + } + + private void setRecordLimits(LazyListBean lazyListBean, Integer maxResults) { + if (maxResults != null && maxResults > 0 && maxResults != Integer.MAX_VALUE) { + lazyListBean.setMaxResult(maxResults); + } + } + + private void setRecordLimits(LazyListBean lazyListBean, Query query) { + setRecordLimits(lazyListBean, query.getMaxResults()); + } + + private T getTableBean(CriteriaQuery cq, Function tansformFunc, + LazyListBean lazyListBean) { + lazyListBean.setResultListToTableBeanFunc(tansformFunc); + lazyListBean.setLazyQuery(new LazyQuery(cq, CriteriaQueryUtils.countCriteria(entityManager, cq))); + return getTableBean(lazyListBean, tansformFunc); + } + + private Query createQuery(String queryString, Map params) { + Query query = entityManager.createQuery(queryString); + params.keySet().forEach(k -> query.setParameter(k, params.get(k))); + return query; + } + + private List execQuery(final String queryString, Map params, int maxResults, int firstResult, + String sortColumnName, int sortingRule) { + String sortedQueryString = QueryUtils.handleOrderBy(queryString, sortColumnName, sortingRule); + Query sortedQuerty = createQuery(sortedQueryString, params); + sortedQuerty.setFirstResult(firstResult); + sortedQuerty.setMaxResults(maxResults); + return sortedQuerty.getResultList(); + } + + private List execQuery(final CriteriaQuery cq, int maxResults, int firstResult, String sortColumnName, + int sortingRule) { + CriteriaQueryUtils.handleOrderBy(cq, sortColumnName, sortingRule, entityManager.getCriteriaBuilder()); + TypedQuery query = entityManager.createQuery(cq); + query.setFirstResult(firstResult); + query.setMaxResults(maxResults); + return query.getResultList(); + } +} diff --git a/spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyQuery.java b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyQuery.java new file mode 100644 index 0000000..01305b2 --- /dev/null +++ b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/helper/LazyQuery.java @@ -0,0 +1,116 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.helper; + +import it.eng.spagoLite.db.base.table.Param; +import java.util.HashSet; +import java.util.Set; +import javax.persistence.Query; +import javax.persistence.criteria.CriteriaQuery; + +/** + * + * @author manuel.bertuzzi@eng.it + */ +public class LazyQuery { + + private final Query query; + private final String countDistinctField; + + private final Set criteriaQueryParams; + private final CriteriaQuery criteriaQuery; + private final Integer maxResults; + + public LazyQuery(Query query, String countDistinctField) { + this.query = query; + this.countDistinctField = countDistinctField; + this.criteriaQuery = null; + this.criteriaQueryParams = null; + this.maxResults = null; + } + + public LazyQuery(Query query) { + this.query = query; + this.countDistinctField = null; + this.criteriaQuery = null; + this.criteriaQueryParams = null; + this.maxResults = null; + } + + public LazyQuery(CriteriaQuery criteriaQuery, Set criteriaQueryParams) { + this.criteriaQueryParams = criteriaQueryParams; + this.criteriaQuery = criteriaQuery; + this.query = null; + this.countDistinctField = null; + this.maxResults = null; + } + + public LazyQuery(CriteriaQuery criteriaQuery) { + this.criteriaQueryParams = new HashSet<>(); + this.criteriaQuery = criteriaQuery; + this.query = null; + this.countDistinctField = null; + this.maxResults = null; + } + + public LazyQuery(CriteriaQuery criteriaQuery, Set criteriaQueryParams, int maxResults) { + this.criteriaQueryParams = criteriaQueryParams; + this.criteriaQuery = criteriaQuery; + this.maxResults = maxResults; + this.query = null; + this.countDistinctField = null; + + } + + public LazyQuery(CriteriaQuery criteriaQuery, int maxResults) { + this.criteriaQueryParams = new HashSet<>(); + this.criteriaQuery = criteriaQuery; + this.maxResults = maxResults; + this.query = null; + this.countDistinctField = null; + } + + public Query getQuery() { + return query; + } + + public Set getCriteriaQueryParams() { + return criteriaQueryParams; + } + + public CriteriaQuery getCriteriaQuery() { + return criteriaQuery; + } + + public String getCountDistinctField() { + return countDistinctField; + } + + public boolean isCriteriaQuery() { + return criteriaQuery != null; + } + + public boolean isQuery() { + return query != null; + } + + public Integer getMaxResults() { + return maxResults; + } + +} diff --git a/spagolite-paginator-ejb/src/main/java/it/eng/paginator/hibernate/OracleSqlInterceptor.java b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/hibernate/OracleSqlInterceptor.java new file mode 100644 index 0000000..1c5db1b --- /dev/null +++ b/spagolite-paginator-ejb/src/main/java/it/eng/paginator/hibernate/OracleSqlInterceptor.java @@ -0,0 +1,29 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.hibernate; + +import it.eng.paginator.util.QueryUtils; +import org.hibernate.EmptyInterceptor; + +public class OracleSqlInterceptor extends EmptyInterceptor { + + @Override + public String onPrepareStatement(String sql) { + return QueryUtils.fixOracleMultiColumnDistinct(sql); + } +} diff --git a/spagolite-paginator-ejb/src/main/java/it/eng/sequences/hibernate/NonMonotonicSequenceGenerator.java b/spagolite-paginator-ejb/src/main/java/it/eng/sequences/hibernate/NonMonotonicSequenceGenerator.java new file mode 100644 index 0000000..e942de8 --- /dev/null +++ b/spagolite-paginator-ejb/src/main/java/it/eng/sequences/hibernate/NonMonotonicSequenceGenerator.java @@ -0,0 +1,56 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.sequences.hibernate; + +import java.io.Serializable; +import java.security.SecureRandom; +import java.util.Properties; + +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.engine.spi.SharedSessionContractImplementor; +import org.hibernate.id.enhanced.SequenceStyleGenerator; +import org.hibernate.service.ServiceRegistry; +import org.hibernate.type.LongType; +import org.hibernate.type.Type; + +/** + * + * @author mbertuzzi + */ +public class NonMonotonicSequenceGenerator extends SequenceStyleGenerator { + + private static final String FORMAT = "%d%d"; + private static final SecureRandom RAND = new SecureRandom(); + private static final int MAX = 9999; + private static final int MIN = 1000; + + private int random() { + return (RAND.nextInt((MAX - MIN) + 1) + MIN); + } + + @Override + public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException { + return Long.parseLong(String.format(FORMAT, random(), super.generate(session, object))); + } + + @Override + public void configure(Type type, Properties params, ServiceRegistry serviceRegistry) throws MappingException { + super.configure(LongType.INSTANCE, params, serviceRegistry); + } +} diff --git a/spagolite-paginator-ejb/src/main/resources/META-INF/MANIFEST.MF b/spagolite-paginator-ejb/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..58630c0 --- /dev/null +++ b/spagolite-paginator-ejb/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/spagolite-paginator-gf/src/main/resources/ejb-jar-TEMPLATE.xml b/spagolite-paginator-ejb/src/main/resources/META-INF/ejb-jar.xml similarity index 65% rename from spagolite-paginator-gf/src/main/resources/ejb-jar-TEMPLATE.xml rename to spagolite-paginator-ejb/src/main/resources/META-INF/ejb-jar.xml index 9bb76f7..542b97e 100644 --- a/spagolite-paginator-gf/src/main/resources/ejb-jar-TEMPLATE.xml +++ b/spagolite-paginator-ejb/src/main/resources/META-INF/ejb-jar.xml @@ -1,20 +1,19 @@ - - - - - - Invoker + paginator + + diff --git a/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/NonMonotonicSequenceGeneratorTest.java b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/NonMonotonicSequenceGeneratorTest.java new file mode 100644 index 0000000..bf519b0 --- /dev/null +++ b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/NonMonotonicSequenceGeneratorTest.java @@ -0,0 +1,107 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.sequences.hibernate; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; + +import java.util.List; + +import javax.annotation.Resource; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.transaction.UserTransaction; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * + * @author manuel.bertuzzi@eng.it + */ +@RunWith(Arquillian.class) +public class NonMonotonicSequenceGeneratorTest { + @PersistenceContext + private EntityManager em; + + @Resource + private UserTransaction tx; + + @Deployment + public static Archive createTestArchive() { + return ShrinkWrap + .create(WebArchive.class, NonMonotonicSequenceGeneratorTest.class.getSimpleName() + "Tests.war") + .addAsResource(NonMonotonicSequenceGeneratorTest.class.getClassLoader().getResource("persistence.xml"), + "META-INF/persistence.xml") + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") + .addClasses(org.apache.commons.lang3.StringUtils.class) + .addPackages(false, "org.springframework.beans", "org.springframework.util") + .addPackages(true, "it.eng.sequences.hibernate"); + + } + + @Test + public void userTransactionIsHere() { + Assert.assertNotNull(tx); + } + + @Test + public void entityManagerIsHere() { + Assert.assertNotNull(em); + } + + @Test + public void insertNuoviRecord() throws Exception { + tx.begin(); + try { + SequenceEntity entity1 = new SequenceEntity(); + entity1.setNote("First JUnit insertRecordConSequence"); + em.persist(entity1); + + SequenceEntity entity2 = new SequenceEntity(); + entity2.setNote("Second JUnit insertRecordConSequence"); + em.persist(entity2); + + // se generata correttamente la seconda sequence non è il numero successivo rispetto alla prima + assertThat(entity2.getId(), is(not(entity1.getId() + 1L))); + assertThat(entity2.getId(), is(not(entity1.getId() - 1L))); + + Query query = em.createNamedQuery("SequenceEntity.findAll"); + List entities = query.getResultList(); + Assert.assertEquals(2, entities.size()); + } finally { + tx.rollback(); + } + + } + +} diff --git a/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild2Entity.java b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild2Entity.java new file mode 100644 index 0000000..d35556a --- /dev/null +++ b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild2Entity.java @@ -0,0 +1,104 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.sequences.hibernate; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Cacheable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; +import org.hibernate.id.enhanced.SequenceStyleGenerator; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE_CHILD2") +@NamedQuery(name = "SequenceChild2Entity.findAll", query = "SELECT a FROM SequenceChild2Entity a order by a.id") +public class SequenceChild2Entity implements Serializable { + + private Long id; + private String campo; + private SequenceChildEntity sequenceChildEntity; + private List child3Entitys; + + @Id + @GenericGenerator(name = "TSEQUENCE_GENERATOR", strategy = "it.eng.sequences.hibernate.NonMonotonicSequenceGenerator", parameters = { + @Parameter(name = SequenceStyleGenerator.SEQUENCE_PARAM, value = "TSEQUENCE2"), + @Parameter(name = SequenceStyleGenerator.INCREMENT_PARAM, value = "1") }) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TSEQUENCE_GENERATOR") + @Column(name = "ID") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name = "CAMPO", nullable = true) + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_CHILD") + public SequenceChildEntity getSequenceChildEntity() { + return sequenceChildEntity; + } + + public void setSequenceChildEntity(SequenceChildEntity sequenceChildEntity) { + this.sequenceChildEntity = sequenceChildEntity; + } + + @OneToMany(mappedBy = "sequenceChild2Entity" + // , cascade = { CascadeType.PERSIST, CascadeType.MERGE } + ) + public List getChild3Entitys() { + return child3Entitys; + } + + public void setChild3Entitys(List child3Entitys) { + this.child3Entitys = child3Entitys; + } + +} diff --git a/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild3Entity.java b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild3Entity.java new file mode 100644 index 0000000..e5c4f0a --- /dev/null +++ b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChild3Entity.java @@ -0,0 +1,90 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.sequences.hibernate; + +import java.io.Serializable; + +import javax.persistence.Cacheable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; +import org.hibernate.id.enhanced.SequenceStyleGenerator; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE_CHILD3") +@NamedQuery(name = "SequenceChild3Entity.findAll", query = "SELECT a FROM SequenceChild3Entity a order by a.id") +public class SequenceChild3Entity implements Serializable { + + private Long id; + private String campo; + private SequenceChild2Entity sequenceChild2Entity; + + @Id + @GenericGenerator(name = "TSEQUENCE_GENERATOR", strategy = "it.eng.sequences.hibernate.NonMonotonicSequenceGenerator", parameters = { + @Parameter(name = SequenceStyleGenerator.SEQUENCE_PARAM, value = "TSEQUENCE2"), + @Parameter(name = SequenceStyleGenerator.INCREMENT_PARAM, value = "1") }) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TSEQUENCE_GENERATOR") + @Column(name = "ID") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name = "CAMPO", nullable = true) + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_CHILD2") + public SequenceChild2Entity getSequenceChild2Entity() { + return sequenceChild2Entity; + } + + public void setSequenceChild2Entity(SequenceChild2Entity sequenceChild2Entity) { + this.sequenceChild2Entity = sequenceChild2Entity; + } + +} diff --git a/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChildEntity.java b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChildEntity.java new file mode 100644 index 0000000..998235f --- /dev/null +++ b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceChildEntity.java @@ -0,0 +1,102 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.sequences.hibernate; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Cacheable; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; +import org.hibernate.id.enhanced.SequenceStyleGenerator; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE_CHILD") +@NamedQuery(name = "SequenceChildEntity.findAll", query = "SELECT a FROM SequenceChildEntity a order by a.id") +public class SequenceChildEntity implements Serializable { + + private Long id; + private String campo; + private SequenceEntity testSequenceEntity; + private List child2Entitys; + + @Id + @GenericGenerator(name = "TSEQUENCE_GENERATOR", strategy = "it.eng.sequences.hibernate.NonMonotonicSequenceGenerator", parameters = { + @Parameter(name = SequenceStyleGenerator.SEQUENCE_PARAM, value = "TSEQUENCE2"), + @Parameter(name = SequenceStyleGenerator.INCREMENT_PARAM, value = "1") }) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TSEQUENCE_GENERATOR") + @Column(name = "ID") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name = "CAMPO", nullable = true) + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ID_PARENT") + public SequenceEntity getTestSequenceEntity() { + return testSequenceEntity; + } + + public void setTestSequenceEntity(SequenceEntity testSequenceEntity) { + this.testSequenceEntity = testSequenceEntity; + } + + @OneToMany(mappedBy = "sequenceChildEntity", cascade = { CascadeType.PERSIST, CascadeType.MERGE }) + public List getChild2Entitys() { + return child2Entitys; + } + + public void setChild2Entitys(List child2Entitys) { + this.child2Entitys = child2Entitys; + } +} diff --git a/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceEntity.java b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceEntity.java new file mode 100644 index 0000000..a0ae8ca --- /dev/null +++ b/spagolite-paginator-ejb/src/test/java/it/eng/sequences/hibernate/SequenceEntity.java @@ -0,0 +1,90 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.sequences.hibernate; + +import java.io.Serializable; +import java.util.List; + +import javax.persistence.Cacheable; +import javax.persistence.CascadeType; +import javax.persistence.Column; +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; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; +import org.hibernate.id.enhanced.SequenceStyleGenerator; + +/** + * + * @author mbertuzzi + */ +@Entity +@Cacheable(true) +@Table(name = "TEST_SEQUENCE") +@NamedQuery(name = "SequenceEntity.findAll", query = "SELECT a FROM SequenceEntity a order by a.id") +public class SequenceEntity implements Serializable { + + private Long id; + private String note; + private List testSequenceChildEntities; + + @Id + @GenericGenerator(name = "TSEQUENCE_GENERATOR", strategy = "it.eng.sequences.hibernate.NonMonotonicSequenceGenerator", parameters = { + @Parameter(name = SequenceStyleGenerator.SEQUENCE_PARAM, value = "TSEQUENCE"), + @Parameter(name = SequenceStyleGenerator.INCREMENT_PARAM, value = "1") }) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TSEQUENCE_GENERATOR") + @Column(name = "ID") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Column(name = "NOTE", nullable = true) + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + + @OneToMany(mappedBy = "testSequenceEntity", cascade = { CascadeType.PERSIST, CascadeType.DETACH, CascadeType.MERGE, + CascadeType.REFRESH }) + public List getTestSequenceChildEntities() { + return testSequenceChildEntities; + } + + public void setTestSequenceChildEntities(List testSequenceChildEntities) { + this.testSequenceChildEntities = testSequenceChildEntities; + } + +} diff --git a/spagolite-paginator-ejb/src/test/resources/org.hibernate.integrator.spi.Integrator b/spagolite-paginator-ejb/src/test/resources/org.hibernate.integrator.spi.Integrator new file mode 100644 index 0000000..b013a59 --- /dev/null +++ b/spagolite-paginator-ejb/src/test/resources/org.hibernate.integrator.spi.Integrator @@ -0,0 +1 @@ +it.eng.sequences.hibernate.NonMonotonicSequenceIntegrator \ No newline at end of file diff --git a/spagolite-paginator-ejb/src/test/resources/persistence.xml b/spagolite-paginator-ejb/src/test/resources/persistence.xml new file mode 100644 index 0000000..6cebc08 --- /dev/null +++ b/spagolite-paginator-ejb/src/test/resources/persistence.xml @@ -0,0 +1,17 @@ + + + + org.hibernate.ejb.HibernatePersistence + jdbc/SiamDs + false + NONE + + + + + + + + + + diff --git a/spagolite-paginator-gf/arquillian.xml b/spagolite-paginator-gf/arquillian.xml new file mode 100644 index 0000000..b005887 --- /dev/null +++ b/spagolite-paginator-gf/arquillian.xml @@ -0,0 +1,24 @@ + + + + + 127.0.0.1 + + + + + + + + /home/mbertuzzi/workspace/jbosseap + /usr/lib/jvm/jre-1.8.0 + true + + + + \ No newline at end of file diff --git a/spagolite-paginator-gf/pom.xml b/spagolite-paginator-gf/pom.xml index cf55810..02e4508 100644 --- a/spagolite-paginator-gf/pom.xml +++ b/spagolite-paginator-gf/pom.xml @@ -1,16 +1,29 @@ 4.0.0 spagofat-paginator-gf - Spagolite paginator (eclipselink) + Spagolite paginator - gf it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT + + + + + org.jboss.arquillian + arquillian-bom + 1.4.0.Final + import + pom + + + + org.jboss.spec - jboss-javaee-6.0 + jboss-jakartaee-8.0 pom provided @@ -26,32 +39,50 @@ it.eng.parer spagofat-middle - org.apache.commons commons-collections4 - org.glassfish.main.persistence - eclipselink-wrapper - pom + org.hibernate + hibernate-core provided + + + org.apache.commons + commons-lang3 + + + + junit + junit + test + + + org.jboss.arquillian.junit + arquillian-junit-container + test + + + org.jboss.as + jboss-as-arquillian-container-managed + 7.1.1.Final + test + + + org.jboss.arquillian.protocol + arquillian-protocol-servlet + test + - - - src/main/resources - - **/ejb-jar-TEMPLATE.xml - - - + + + org.apache.maven.plugins + maven-compiler-plugin + + diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/CountQueryRedirector.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/CountQueryRedirector.java deleted file mode 100644 index 4563ee7..0000000 --- a/spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/CountQueryRedirector.java +++ /dev/null @@ -1,113 +0,0 @@ -package it.eng.paginator.eclipselink; - -import it.eng.paginator.ejb.PaginatorInterceptor; -import it.eng.spagoLite.db.base.sorting.SortingRule; -import it.eng.spagoLite.db.base.table.LazyListBean; -import java.math.BigDecimal; -import java.util.Vector; - -import org.apache.commons.lang3.StringUtils; -import org.eclipse.persistence.expressions.Expression; -import org.eclipse.persistence.expressions.ExpressionBuilder; -import org.eclipse.persistence.internal.sessions.AbstractRecord; -import org.eclipse.persistence.internal.sessions.AbstractSession; -import org.eclipse.persistence.internal.sessions.ArrayRecord; -import org.eclipse.persistence.queries.*; -import org.eclipse.persistence.sessions.*; - -/** - * - * @author Quaranta_M - */ -public class CountQueryRedirector implements QueryRedirector { - - // private static final String FL_COUNT_QUERY = "fl_count_query"; - @Override - public Object invokeQuery(DatabaseQuery query, Record arguments, Session session) { - query.setRedirector(null); - if (query instanceof ObjectLevelReadQuery) { - // setto il risultato della count nel bean threadlocal - LazyListBean llBean = PaginatorInterceptor.getLazyListBean(); - ObjectLevelReadQuery countQuery = (ObjectLevelReadQuery) query.clone(); - // Rimuovo l'order by - countQuery.setOrderByExpressions(null); - - // Rimuovo la select list - if (countQuery.isReportQuery()) { - ((ReportQuery) countQuery).clearItems(); - if (llBean.getCountSelectList() != null) { - String[] selectList = llBean.getCountSelectList().split(","); - for (String s : selectList) { - ((ReportQuery) countQuery).addAttribute(s); - } - } else { - ((ReportQuery) countQuery).selectValue1(); - } - } else if (countQuery.isReadAllQuery()) { - ReportQuery rq = new ReportQuery(countQuery.getReferenceClass(), countQuery.getExpressionBuilder()); - rq.setSelectionCriteria(countQuery.getSelectionCriteria()); - rq.setDistinctState(countQuery.getDistinctState()); - countQuery = rq; - // Se è necessario invocare la SELECT con la primarykey - if (llBean.getCountSelectList() != null) { - String[] selectList = llBean.getCountSelectList().split(","); - for (String s : selectList) { - ((ReportQuery) countQuery).addAttribute(s); - } - } else { - ((ReportQuery) countQuery).selectValue1(); - } - } - - // Pulisco eventuali paginazioni - countQuery.setFirstResult(0); - countQuery.setMaxRows(0); - - // costruisco la select count() intorno la query - StringBuilder countSQL = new StringBuilder("SELECT COUNT(*) FROM ("); - countSQL.append(countQuery.getTranslatedSQLString(session, arguments)); - countSQL.append(")"); - // StringBuilder countSQL = new StringBuilder("SELECT COUNT(*) FROM ("); - // countSQL.append(countQuery.getSQLString()); - // countSQL.append(")"); - DataReadQuery dataQuery = new DataReadQuery(countSQL.toString()); - ArrayRecord count = (ArrayRecord) ((Vector) dataQuery.execute((AbstractSession) session, - (AbstractRecord) arguments)).get(0); - - int countResult = ((BigDecimal) count.get("COUNT(*)")).intValueExact(); - llBean.setCountResultSize(countResult); - - ObjectLevelReadQuery origQuery = ((ObjectLevelReadQuery) query); - - // Pagino la query originale - DA - origQuery.setFirstResult(llBean.getFirstResult()); - // Pagino la query originale - A - llBean.setMaxResult(origQuery.getMaxRows()); - origQuery.setMaxRows(llBean.getFirstResult() + llBean.getMaxResult()); - // Ordino se necessario - if (llBean.isSortQuery()) { - ExpressionBuilder builder = new ExpressionBuilder(); - Expression ex = builder.get(toCamelCase(llBean.getOrderByColumnName(), true)); - origQuery.setOrderByExpressions(null); - origQuery.addOrdering( - llBean.getOrderBySortingRule() == SortingRule.ASC ? ex.ascending() : ex.descending()); - } - // eseguo la query originale paginata - return query.execute((AbstractSession) session, (AbstractRecord) arguments); - - } else { - // eseguo la query originale non paginata - return query.execute((AbstractSession) session, (AbstractRecord) arguments); - - } - - } - - private String toCamelCase(String value, boolean startWithLowerCase) { - String[] strings = StringUtils.split(value.toLowerCase(), "_"); - for (int i = startWithLowerCase ? 1 : 0; i < strings.length; i++) { - strings[i] = StringUtils.capitalize(strings[i]); - } - return StringUtils.join(strings); - } -} \ No newline at end of file diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/ListSessionListener.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/ListSessionListener.java deleted file mode 100644 index d7b63d4..0000000 --- a/spagolite-paginator-gf/src/main/java/it/eng/paginator/eclipselink/ListSessionListener.java +++ /dev/null @@ -1,40 +0,0 @@ -package it.eng.paginator.eclipselink; - -import it.eng.paginator.ejb.PaginatorInterceptor; -import it.eng.spagoLite.db.base.table.LazyListBean; -import org.eclipse.persistence.sessions.SessionEvent; -import org.eclipse.persistence.sessions.SessionEventAdapter; - -/** - * - * @author Quaranta_M - */ -public class ListSessionListener extends SessionEventAdapter { - - // @Resource - // private TransactionSynchronizationRegistry transactionCtx; - - // private static final String FL_COUNT_QUERY = "fl_count_query"; - - @Override - public void preExecuteQuery(SessionEvent event) { - LazyListBean llBean = PaginatorInterceptor.getLazyListBean(); - if (llBean != null && !llBean.isQueryAlreadyExecuted()) { - event.getQuery().setRedirector(new CountQueryRedirector()); - } - } - - /** - * Setta la query come già eseguita per evitare che query successive alla prima, presenti all'interno di uno stesso - * metodo, siano paginate a loro volta. Solo la prima query infatti deve essere paginata. - * - * @param event - */ - @Override - public void postExecuteQuery(SessionEvent event) { - LazyListBean llBean = PaginatorInterceptor.getLazyListBean(); - if (llBean != null && !llBean.isQueryAlreadyExecuted()) { - llBean.setQueryAlreadyExecuted(true); - } - } -} \ No newline at end of file diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/InvokerLocal.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/InvokerLocal.java deleted file mode 100644 index 4b3cc12..0000000 --- a/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/InvokerLocal.java +++ /dev/null @@ -1,14 +0,0 @@ -package it.eng.paginator.ejb; - -import it.eng.spagoLite.db.base.table.LazyListBean; - -import java.lang.reflect.Method; - -import javax.ejb.Local; - -@Local -public interface InvokerLocal { - - public Object invokeLazyPagination(Class helperEJB, Method method, Object[] parameterValue, - LazyListBean llBean); -} diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java deleted file mode 100644 index 5e36880..0000000 --- a/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package it.eng.paginator.ejb; - -import it.eng.spagoLite.db.base.BaseTableInterface; -import it.eng.spagoLite.db.base.paging.AbstractPaginator; -import it.eng.spagoLite.db.base.table.LazyListBean; -import javax.ejb.EJB; - -/** - * - * @author Quaranta_M - */ -public class PaginatorImpl extends AbstractPaginator { - - @EJB(mappedName = "java:app/paginator/Invoker") - private InvokerLocal invoker; - - @SuppressWarnings("unchecked") - @Override - protected BaseTableInterface invoke(LazyListBean llBean) { - return (BaseTableInterface) invoker.invokeLazyPagination(llBean.getHelperEJB(), llBean.getHelperMethod(), - llBean.getMethodParameter(), llBean); - } - -} diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java deleted file mode 100644 index 442a68d..0000000 --- a/spagolite-paginator-gf/src/main/java/it/eng/paginator/ejb/PaginatorInterceptor.java +++ /dev/null @@ -1,100 +0,0 @@ -package it.eng.paginator.ejb; - -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.base.table.LazyListBean; - -import java.lang.reflect.Method; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.ResourceBundle; - -import javax.interceptor.AroundInvoke; -import javax.interceptor.InvocationContext; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PaginatorInterceptor { - - static Logger log = LoggerFactory.getLogger(PaginatorInterceptor.class); - private final static Map countQuerySelectList = new HashMap(); - private static final String BUNDLE_NAME = "countselectlist"; - private static final ResourceBundle rb = ResourceBundle.getBundle(BUNDLE_NAME, Locale.getDefault(), - Thread.currentThread().getContextClassLoader()); - - static { - // null equivale a SELECT 1 FROM ... - if (rb != null) { - Enumeration keys = rb.getKeys(); - while (keys.hasMoreElements()) { - String key = keys.nextElement(); - String value = rb.getString(key); - countQuerySelectList.put(key, ("".equals(value)) ? null : value); - } - } - } - - private static ThreadLocal tLocalLazyList = new ThreadLocal(); - - @AroundInvoke - public Object storeInvocation(InvocationContext inv) throws Exception { - try { - pre(inv); - Object obj = invoke(inv); - post(obj); - return obj; - } catch (Exception e) { - // Logger log = Logger.getLogger(inv.getTarget().getClass()); - log.error("Exception in LoggingInterceptor: " + e.getMessage()); - throw e; - } finally { - tLocalLazyList.remove(); - } - } - - private void pre(InvocationContext inv) { - // Recupero il bean settatomi dall'invoker(e ancor prima dal Paginator) - // (la prima chiamata al metodo dell'helper non avrà il bean nella - // variabile threadLocal) - if (tLocalLazyList.get() == null) { - LazyListBean paginator = new LazyListBean(); - Class helperEJB = inv.getTarget().getClass(); - Method method = inv.getMethod(); - // L'interceptor deve entrare in funzione solo con metodi che - // ritornano un'istanza di AbstractLazyBaseTable; asSubclass() - // lancia un'eccezione - method.getReturnType().asSubclass(AbstractBaseTable.class); - Object[] parameterValue = inv.getParameters(); - paginator.setHelperEJB(helperEJB); - paginator.setHelperMethod(method); - paginator.setMethodParameter(parameterValue); - paginator.setCountSelectList( - countQuerySelectList != null ? countQuerySelectList.get(method.getName()) : null); - tLocalLazyList.set(paginator); - } - } - - private Object invoke(InvocationContext inv) throws Exception { - return inv.proceed(); - } - - private void post(Object obj) { - if (obj instanceof AbstractBaseTable) { - // Setto il lazybean nel tablebean per le successive invocazioni - AbstractBaseTable tableBean = (AbstractBaseTable) obj; - if (tableBean.getLazyListBean() == null) { - tableBean.setLazyListBean(tLocalLazyList.get()); - } - } - } - - public static LazyListBean getLazyListBean() { - return tLocalLazyList.get(); - } - - public static void setLazyListBean(LazyListBean llBean) { - tLocalLazyList.set(llBean); - } -} diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/CriteriaQueryUtils.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/CriteriaQueryUtils.java new file mode 100644 index 0000000..8b2bcf0 --- /dev/null +++ b/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/CriteriaQueryUtils.java @@ -0,0 +1,356 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.util; + +import java.util.Collection; +import java.util.Collections; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceUnitUtil; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Expression; +import javax.persistence.criteria.Fetch; +import javax.persistence.criteria.From; +import javax.persistence.criteria.Join; +import javax.persistence.criteria.Order; +import javax.persistence.criteria.Path; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import javax.persistence.criteria.Selection; +import javax.persistence.metamodel.Attribute; +import javax.persistence.metamodel.EntityType; + +import org.springframework.beans.PropertyAccessor; +import org.springframework.beans.PropertyAccessorFactory; + +import it.eng.spagoLite.db.base.sorting.SortingRule; +import it.eng.spagoLite.db.base.table.Param; + +public abstract class CriteriaQueryUtils { + + private static volatile int aliasCount = 0; + + /** + * + * @param em + * @param criteria + * + * @return + */ + public static int count(EntityManager em, CriteriaQuery criteria) { + return count(em, criteria, Collections.emptySet()); + } + + /** + * Result count from a CriteriaQuery + * + * @param em + * Entity Manager + * @param criteria + * Criteria Query to count results + * + * @param params + * + * @return row count + */ + public static int count(EntityManager em, CriteriaQuery criteria, Set params) { + + final TypedQuery query = em.createQuery(countCriteria(em, criteria)); + params.stream().forEach(p -> p.setParameter(query)); + return query.getSingleResult().intValue(); + } + + /** + * Create a row count CriteriaQuery from a CriteriaQuery + * + * @param em + * entity manager + * @param criteria + * source criteria + * + * @return row count CriteriaQuery + */ + public static CriteriaQuery countCriteria(EntityManager em, CriteriaQuery criteria) { + CriteriaBuilder builder = em.getCriteriaBuilder(); + CriteriaQuery countCriteria = builder.createQuery(Long.class); + copyCriteriaWithoutSelectionAndOrder(criteria, countCriteria, false); + + Expression countExpression; + + if (criteria.isDistinct()) { + countExpression = builder.countDistinct(findRoot(countCriteria, criteria.getResultType())); + } else { + countExpression = builder.count(findRoot(countCriteria, criteria.getResultType())); + } + + return countCriteria.select(countExpression); + } + + /** + * Gets The result alias, if none set a default one and return it + * + * @param selection + * + * @return root alias or generated one + */ + private static synchronized String getOrCreateAlias(Selection selection) { + // reset alias count + if (aliasCount > 1000) + aliasCount = 0; + + String alias = selection.getAlias(); + if (alias == null) { + alias = "PARER_generatedAlias" + aliasCount++; + selection.alias(alias); + } + return alias; + } + + /** + * Find the Root with type class on CriteriaQuery Root Set + * + * @param + * root type + * @param query + * criteria query + * @param clazz + * root type + * + * @return Root of null if none + */ + @SuppressWarnings("unchecked") + private static Root findRoot(CriteriaQuery query, Class clazz) { + + for (Root r : query.getRoots()) { + if (clazz.equals(r.getJavaType())) { + return (Root) r.as(clazz); + } + } + return null; + } + + /** + * Copy criteria without selection and order. + * + * @param from + * source Criteria. + * @param to + * destination Criteria. + */ + private static void copyCriteriaWithoutSelectionAndOrder(CriteriaQuery from, CriteriaQuery to, + boolean copyFetches) { + if (isEclipseLink(from) && from.getRestriction() != null) { + // EclipseLink adds roots from predicate paths to critera. Skip copying + // roots as workaround. + } else { + // Copy Roots + for (Root root : from.getRoots()) { + Root dest = to.from(root.getJavaType()); + dest.alias(getOrCreateAlias(root)); + copyJoins(root, dest); + if (copyFetches) + copyFetches(root, dest); + } + } + + to.groupBy(from.getGroupList()); + to.distinct(from.isDistinct()); + + if (from.getGroupRestriction() != null) + to.having(from.getGroupRestriction()); + + Predicate predicate = from.getRestriction(); + if (predicate != null) + to.where(predicate); + } + + private static boolean isEclipseLink(CriteriaQuery from) { + return from.getClass().getName().contains("org.eclipse.persistence"); + } + + /** + * Copy Joins + * + * @param from + * source Join + * @param to + * destination Join + */ + private static void copyJoins(From from, From to) { + for (Join j : from.getJoins()) { + Join toJoin = to.join(j.getAttribute().getName(), j.getJoinType()); + toJoin.alias(getOrCreateAlias(j)); + + copyJoins(j, toJoin); + } + } + + /** + * Copy Fetches + * + * @param from + * source From + * @param to + * destination From + */ + private static void copyFetches(From from, From to) { + for (Fetch f : from.getFetches()) { + Fetch toFetch = to.fetch(f.getAttribute().getName()); + copyFetches(f, toFetch); + } + } + + /** + * Copy Fetches + * + * @param from + * source Fetch + * @param to + * dest Fetch + */ + private static void copyFetches(Fetch from, Fetch to) { + for (Fetch f : from.getFetches()) { + Fetch toFetch = to.fetch(f.getAttribute().getName()); + // recursively copy fetches + copyFetches(f, toFetch); + } + } + + /** + * Initialize a entity. + * + * @param em + * entity manager to use + * @param entity + * entity to initialize + * @param depth + * max depth on recursion + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static void initialize(EntityManager em, Object entity, int depth) { + // return on nulls, depth = 0 or already initialized objects + if (entity == null || depth == 0) { + return; + } + + PersistenceUnitUtil unitUtil = em.getEntityManagerFactory().getPersistenceUnitUtil(); + EntityType entityType = em.getMetamodel().entity(entity.getClass()); + Set attributes = entityType.getDeclaredAttributes(); + + Object id = unitUtil.getIdentifier(entity); + + if (id != null) { + Object attached = em.find(entity.getClass(), unitUtil.getIdentifier(entity)); + + for (Attribute a : attributes) { + if (!unitUtil.isLoaded(entity, a.getName())) { + if (a.isCollection()) { + intializeCollection(em, entity, attached, a, depth); + } else if (a.isAssociation()) { + intialize(em, entity, attached, a, depth); + } + } + } + } + } + + /** + * Initialize entity attribute + * + * @param em + * @param entity + * @param a + * @param depth + */ + @SuppressWarnings("rawtypes") + private static void intialize(EntityManager em, Object entity, Object attached, Attribute a, int depth) { + Object value = PropertyAccessorFactory.forDirectFieldAccess(attached).getPropertyValue(a.getName()); + if (!em.getEntityManagerFactory().getPersistenceUnitUtil().isLoaded(value)) { + em.refresh(value); + } + + PropertyAccessorFactory.forDirectFieldAccess(entity).setPropertyValue(a.getName(), value); + + initialize(em, value, depth - 1); + } + + /** + * Initialize collection + * + * @param em + * @param entity + * @param a + * @param depth + */ + @SuppressWarnings("rawtypes") + private static void intializeCollection(EntityManager em, Object entity, Object attached, Attribute a, int depth) { + PropertyAccessor accessor = PropertyAccessorFactory.forDirectFieldAccess(attached); + Collection c = (Collection) accessor.getPropertyValue(a.getName()); + + for (Object o : c) + initialize(em, o, depth - 1); + + PropertyAccessorFactory.forDirectFieldAccess(entity).setPropertyValue(a.getName(), c); + } + + // ************************************* + private static Path getOrderByPath(CriteriaQuery cq, String sortColumnName) { + final String columnFieldName = QueryUtils.toCamelCase(sortColumnName); + final Optional optionalPath = cq.getRoots().stream().map(root -> { + final Root r = (Root) root; + try { + return r.get(columnFieldName); + } catch (IllegalStateException | IllegalArgumentException e) { + return null; + } + }).filter(Objects::nonNull).findFirst(); + + if (optionalPath.isPresent()) { + return optionalPath.get(); + } + throw new IllegalArgumentException("Impossibile ordinare per " + columnFieldName + ": campo inesistente"); + } + + /** + * + * @param cq + * @param sortColumnName + * @param sortingRule + * @param cb + */ + public static void handleOrderBy(CriteriaQuery cq, String sortColumnName, int sortingRule, CriteriaBuilder cb) { + if (org.apache.commons.lang3.StringUtils.isNotEmpty(sortColumnName)) { + final Path path = getOrderByPath(cq, sortColumnName); + if (path != null) { + final Order orderBy; + if (SortingRule.DESC == sortingRule) { + orderBy = cb.desc(path); + } else { + orderBy = cb.asc(path); + } + cq.orderBy(orderBy); + } + } + } + +} diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/HibernateUtils.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/HibernateUtils.java new file mode 100644 index 0000000..7d8e132 --- /dev/null +++ b/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/HibernateUtils.java @@ -0,0 +1,130 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.paginator.util; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.hibernate.proxy.HibernateProxy; +import org.hibernate.proxy.LazyInitializer; + +/** + * + * @author Manuel Bertuzzi + */ +public abstract class HibernateUtils { + /** + * Converte una collection di BigDecimal in una List Utilizzato per una migrazione ad Hibernate che non + * modifichi minimamente la logica attuale La soluzione pulita è chiaramente farsi arrivare direttamente il tipo di + * dato corretto. + * + * @param longCollection + * + * @return + */ + public static List bigDecimalListFrom(Collection longCollection) { + if (longCollection == null) { + return null; + } + + if (longCollection.isEmpty()) { + return new ArrayList<>(); + } + return longCollection.stream().filter(Objects::nonNull).map(l -> BigDecimal.valueOf(l)) + .collect(Collectors.toList()); + } + + /** + * Converte un Number in Long gestendo il caso di valore null. Utilizzato per una migrazione ad Hibernate che non + * modifichi minimamente la logica attuale La soluzione pulita è chiaramente farsi arrivare direttamente il tipo di + * dato corretto. Si utilizza questo metodo piuttosto che farlo inline col metodo longValue() perché in caso di + * valori null darebbe un NullPointerException che prima non sarebbe stato sollevato. + * + * @param number + * + * @return + */ + public static Long longFrom(Number number) { + return number == null ? null : number.longValue(); + } + + public static boolean isCollectionOf(final Class c, Collection collection) { + return collection.stream().allMatch(o -> c.isInstance(o)); + } + + /** + * Converte una collection di BigDecimal in una List Utilizzato per una migrazione ad Hibernate che non + * modifichi minimamente la logica attuale La soluzione pulita è chiaramente farsi arrivare direttamente il tipo di + * dato corretto. + * + * @param collection + * + * @return + */ + public static List longListFrom(Collection collection) { + if (collection == null) { + return null; + } + if (collection.isEmpty()) { + return new ArrayList<>(); + } + return collection.stream().filter(Objects::nonNull).map(BigDecimal::longValue).collect(Collectors.toList()); + } + + /** + * Converte un Number in BigDecimal gestendo il caso di valore null. Utilizzato per una migrazione ad Hibernate che + * non modifichi minimamente la logica attuale La soluzione pulita è chiaramente farsi arrivare direttamente il tipo + * di dato corretto. Si utilizza questo metodo piuttosto che farlo inline col metodo BigDecimal.valueOf() perché in + * caso di valori null darebbe un NullPointerException che prima non sarebbe stato sollevato. + * + * @param numero + * + * @return + */ + public static BigDecimal bigDecimalFrom(Number numero) { + if (numero == null) { + return null; + } + if (numero instanceof Long) { + return BigDecimal.valueOf(numero.longValue()); + } + if (numero instanceof Integer) { + return BigDecimal.valueOf(numero.intValue()); + } + throw new IllegalArgumentException("Conversione da " + numero.getClass() + " a BigDecimal non gestita"); + } + + public static T unproxyEntity(T entity) { + if (entity instanceof HibernateProxy) { + HibernateProxy hibernateProxy = (HibernateProxy) entity; + LazyInitializer initializer = hibernateProxy.getHibernateLazyInitializer(); + return (T) initializer.getImplementation(); + } else { + return entity; + } + } +} diff --git a/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/QueryUtils.java b/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/QueryUtils.java new file mode 100644 index 0000000..32d8f7a --- /dev/null +++ b/spagolite-paginator-gf/src/main/java/it/eng/paginator/util/QueryUtils.java @@ -0,0 +1,137 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.util; + +import java.util.HashMap; +import java.util.Map; + +import javax.persistence.Parameter; +import javax.persistence.Query; + +import org.apache.commons.lang3.StringUtils; + +import it.eng.spagoLite.db.base.sorting.SortingRule; + +public abstract class QueryUtils { + + private QueryUtils() { + throw new IllegalStateException("Da utilizzare tramite i metodi statici"); + } + + private static final String MULTI_COL_DISTINCT_REGEXP = "(?i)\\s*SELECT COUNT\\s*\\(\\s*(DISTINCT [A-Za-z0-9_.]+\\s*,[A-Za-z0-9_,.\\s]+)\\)(.*)"; + private static final String MULTI_COL_DISTINCT_ALIAS_REGEXP = "(?i)\\s*SELECT COUNT\\s*\\(\\s*(DISTINCT [A-Za-z0-9_.]+\\s*,[A-Za-z0-9_,.\\s]+)\\)\\s*(AS\\s+[A-Za-z0-9_]+)\\s*(.*)"; + + public static String fixOracleMultiColumnDistinct(final String sql) { + final String queryString = normalizeQueryString(sql); + String subQuery = null; + String countAlias = ""; + if (queryString.matches(MULTI_COL_DISTINCT_ALIAS_REGEXP)) { + countAlias = queryString.replaceFirst(MULTI_COL_DISTINCT_ALIAS_REGEXP, " $2 "); + subQuery = queryString.replaceFirst(MULTI_COL_DISTINCT_ALIAS_REGEXP, "SELECT $1 $3"); + + } else if (queryString.matches(MULTI_COL_DISTINCT_REGEXP)) { + subQuery = queryString.replaceFirst(MULTI_COL_DISTINCT_REGEXP, "SELECT $1 $2"); + } + if (subQuery != null) { + return normalizeQueryString("SELECT COUNT(*)" + countAlias + " FROM (" + subQuery + ")"); + } else { + return queryString; + } + } + + public static String selectToCount(final String selectQuery) { + return selectToCount(selectQuery, null); + } + + public static String removeOrderBy(final String selectQuery) { + String sql = normalizeQueryString(selectQuery); + final int orderByIndex = sql.toUpperCase().indexOf(" ORDER BY "); + if (orderByIndex > 0) { + return sql.substring(0, orderByIndex); + } + return sql; + } + + public static String normalizeQueryString(String queryString) { + String multipleSpace = "\\s{2,}"; + return queryString.replaceAll(multipleSpace, " "); + } + + public static String selectToCount(Query query, String distinctField) { + return selectToCount(queryStringFrom(query), distinctField); + } + + public static String selectToCount(String selectQuery, String distinctField) { + StringBuilder stringBuilder = new StringBuilder("SELECT COUNT("); + if (StringUtils.isBlank(distinctField)) { + stringBuilder.append("*"); + } else { + stringBuilder.append("DISTINCT ").append(distinctField); + } + stringBuilder.append(")"); + String countQuery = normalizeQueryString(selectQuery); + countQuery = removeOrderBy(countQuery); + stringBuilder.append(countQuery.substring(countQuery.toUpperCase().indexOf(" FROM "))); + return stringBuilder.toString(); + } + + public static String queryStringFrom(Query query) { + final org.hibernate.query.Query hibernateQuery = query.unwrap(org.hibernate.query.Query.class); + return hibernateQuery.getQueryString(); + } + + public static String handleOrderBy(Query query, String sortColumnName, int sortingRule) { + return handleOrderBy(queryStringFrom(query), sortColumnName, sortingRule); + } + + public static String handleOrderBy(String queryStr, String sortColumnName, int sortingRule) { + if (StringUtils.isNotBlank(sortColumnName)) { + String sql = removeOrderBy(queryStr); + StringBuilder sqlSB = new StringBuilder(sql); + sqlSB.append(" ORDER BY ").append(toCamelCase(sortColumnName)); + if (SortingRule.ASC == sortingRule) { + sqlSB.append(" ASC "); + } else { + sqlSB.append(" DESC "); + } + return sqlSB.toString(); + } + return queryStr; + } + + public static String toCamelCase(String value) { + String[] strings = StringUtils.split(value.toLowerCase(), "_"); + for (int i = 1; i < strings.length; i++) { + strings[i] = StringUtils.capitalize(strings[i]); + } + return StringUtils.join(strings); + } + + public static void copyParameters(final Query from, final Query to) { + from.getParameters().stream().map(Parameter::getName) + .forEach(paramName -> to.setParameter(paramName, from.getParameterValue(paramName))); + } + + public static Map extractParameters(final Query from) { + Map params = new HashMap<>(); + from.getParameters().stream().map(Parameter::getName) + .forEach(paramName -> params.put(paramName, from.getParameterValue(paramName))); + return params; + } + +} diff --git a/spagolite-paginator-gf/src/main/java/it/eng/sequences/eclipselink/NonMonotonicSequenceGenerator.java b/spagolite-paginator-gf/src/main/java/it/eng/sequences/eclipselink/NonMonotonicSequenceGenerator.java deleted file mode 100644 index 8b43e9b..0000000 --- a/spagolite-paginator-gf/src/main/java/it/eng/sequences/eclipselink/NonMonotonicSequenceGenerator.java +++ /dev/null @@ -1,112 +0,0 @@ -package it.eng.sequences.eclipselink; - -import java.security.SecureRandom; -import java.util.Map; -import java.util.Vector; - -import org.eclipse.persistence.config.SessionCustomizer; -import org.eclipse.persistence.descriptors.ClassDescriptor; -import org.eclipse.persistence.exceptions.DatabaseException; -import org.eclipse.persistence.internal.databaseaccess.Accessor; -import org.eclipse.persistence.internal.sessions.AbstractSession; -import org.eclipse.persistence.sequencing.NativeSequence; -import org.eclipse.persistence.sessions.Session; - -/** - * - * @author Quaranta_M - */ -public class NonMonotonicSequenceGenerator extends NativeSequence implements SessionCustomizer { - - private static SecureRandom rand = new SecureRandom(); - - private static final int MAX = 9999; - private static final int MIN = 1000; - - public NonMonotonicSequenceGenerator() { - } - - public NonMonotonicSequenceGenerator(boolean shouldUseIdentityIfPlatformSupports) { - super(shouldUseIdentityIfPlatformSupports); - } - - public NonMonotonicSequenceGenerator(String name) { - super(name); - } - - public NonMonotonicSequenceGenerator(String name, boolean shouldUseIdentityIfPlatformSupports) { - super(name, shouldUseIdentityIfPlatformSupports); - } - - public NonMonotonicSequenceGenerator(String name, int size) { - super(name, size); - } - - public NonMonotonicSequenceGenerator(String name, int size, boolean shouldUseIdentityIfPlatformSupports) { - super(name, size, shouldUseIdentityIfPlatformSupports); - } - - public NonMonotonicSequenceGenerator(String name, int size, int initialValue) { - super(name, size, initialValue); - } - - public NonMonotonicSequenceGenerator(String name, int size, int initialValue, - boolean shouldUseIdentityIfPlatformSupports) { - super(name, size, initialValue, shouldUseIdentityIfPlatformSupports); - } - - @Override - public Object getGeneratedValue(Accessor accessor, AbstractSession writeSession, String seqName) { - if (shouldUsePreallocation()) { - return null; - } else { - Number value = updateAndSelectSequence(accessor, writeSession, seqName, 1); - if (value == null) { - throw DatabaseException.errorPreallocatingSequenceNumbers(); - } - long newval = Long.parseLong(randInt() + "" + value); - return newval; - } - } - - @Override - public Vector getGeneratedVector(Accessor accessor, AbstractSession writeSession, String seqName, int size) { - if (shouldUsePreallocation()) { - Number value = updateAndSelectSequence(accessor, writeSession, seqName, size); - if (value == null) { - throw DatabaseException.errorPreallocatingSequenceNumbers(); - } - long newval = Long.parseLong(randInt() + "" + value); - return createVector(newval, seqName, size); - } else { - return null; - } - } - - @Override - public void customize(Session session) { - - Map entities = session.getDescriptors(); - for (Map.Entry entry : entities.entrySet()) { - NonMonotonicSequenceGenerator sequence = new NonMonotonicSequenceGenerator( - entry.getValue().getSequenceNumberName(), 1); - session.getLogin().addSequence(sequence); - } - } - - /** - * Returns a pseudo-random number between MIN and MAX, inclusive. The difference between min and max can be at most - * Integer.MAX_VALUE - 1. - * - * @return Integer between min and max, inclusive. - * - * @see java.util.Random#nextInt(int) - */ - private static int randInt() { - // nextInt is normally exclusive of the top value, - // so add 1 to make it inclusive - return rand.nextInt((MAX - MIN) + 1) + MIN; - - } - -} diff --git a/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/CriteriaQueryUtilsTest.java b/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/CriteriaQueryUtilsTest.java new file mode 100644 index 0000000..31d9fb5 --- /dev/null +++ b/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/CriteriaQueryUtilsTest.java @@ -0,0 +1,112 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package it.eng.paginator.util; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import it.eng.spagoLite.db.base.sorting.SortingRule; +import it.eng.spagoLite.db.base.table.Param; + +/** + * + * @author manuel.bertuzzi@eng.it + */ +@RunWith(Arquillian.class) +public class CriteriaQueryUtilsTest { + @PersistenceContext + private EntityManager em; + + @Deployment + public static Archive createTestArchive() { + return ShrinkWrap.create(WebArchive.class, CriteriaQueryUtilsTest.class.getSimpleName() + "Tests.war") + .addAsResource(CriteriaQueryUtilsTest.class.getClassLoader().getResource("persistence.xml"), + "META-INF/persistence.xml") + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") + .addClass(org.apache.commons.lang3.StringUtils.class) + .addPackages(false, "org.springframework.beans", "org.springframework.util") + .addPackages(true, "it.eng.spagoLite.db.base", "it.eng.paginator.util"); + } + + @Test + public void entityManagerIsHere() { + Assert.assertNotNull(em); + } + + @Test + public void countFromCriteriaQuery_noParams() { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(PigAmbienteVers.class); + Root pav = query.from(PigAmbienteVers.class); + query.select(pav); + List resultList = em.createQuery(query).getResultList(); + int result = CriteriaQueryUtils.count(em, query); + Assert.assertEquals(resultList.size(), result); + } + + @Test + public void countFromCriteriaQuery_withParams() { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(PigAmbienteVers.class); + Root pav = query.from(PigAmbienteVers.class); + List condition = new ArrayList<>(); + condition.add(cb.equal(pav.get("idAmbienteVers"), cb.parameter(Long.class, "id"))); + query.select(pav); + query.where(condition.toArray(new Predicate[] {})); + Set params = new HashSet<>(); + params.add(new Param("id", 3l)); + int result = CriteriaQueryUtils.count(em, query, params); + Assert.assertEquals(1, result); + } + + @Test + public void testHandleOrderBy() { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(PigAmbienteVers.class); + Root pav = query.from(PigAmbienteVers.class); + query.select(pav); + CriteriaQueryUtils.handleOrderBy(query, "NM_AMBIENTE_VERS", SortingRule.DESC, cb); + List resultList = em.createQuery(query).getResultList(); + Assert.assertEquals("prova", resultList.get(0).getNmAmbienteVers()); + } + +} diff --git a/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/PigAmbienteVers.java b/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/PigAmbienteVers.java new file mode 100644 index 0000000..f4f3fc0 --- /dev/null +++ b/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/PigAmbienteVers.java @@ -0,0 +1,55 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.util; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +import org.hibernate.annotations.Immutable; + +/** + * @author manuel.bertuzzi@eng.it + */ +@Entity +@Table(name = "PIG_AMBIENTE_VERS") +@Immutable +@NamedQueries({ + @NamedQuery(name = "PigAmbienteVers.findAll", query = "SELECT v FROM PigAmbienteVers v ORDER BY v.nmAmbienteVers ASC"), + + @NamedQuery(name = "PigAmbienteVers.findGreaterThanId", query = "SELECT v FROM PigAmbienteVers v WHERE v.idAmbienteVers > :idAmbienteVers ORDER BY v.nmAmbienteVers ASC") }) +public class PigAmbienteVers { + + @Id + @Column(name = "ID_AMBIENTE_VERS") + private Long idAmbienteVers; + + @Column(name = "NM_AMBIENTE_VERS") + private String nmAmbienteVers; + + public Long getIdAmbienteVers() { + return idAmbienteVers; + } + + public String getNmAmbienteVers() { + return nmAmbienteVers; + } +} diff --git a/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/QueryUtilsTest.java b/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/QueryUtilsTest.java new file mode 100644 index 0000000..548e905 --- /dev/null +++ b/spagolite-paginator-gf/src/test/java/it/eng/paginator/util/QueryUtilsTest.java @@ -0,0 +1,246 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.paginator.util; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(Arquillian.class) +public class QueryUtilsTest { + + @PersistenceContext + private EntityManager em; + + @Deployment + public static Archive createTestArchive() { + return ShrinkWrap.create(WebArchive.class, CriteriaQueryUtilsTest.class.getSimpleName() + ".war") + .addAsResource(CriteriaQueryUtilsTest.class.getClassLoader().getResource("persistence.xml"), + "META-INF/persistence.xml") + .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") + .addClass(org.apache.commons.lang3.StringUtils.class) + .addPackages(false, "org.springframework.beans", "org.springframework.util") + .addPackages(true, "it.eng.spagoLite.db.base", "it.eng.paginator.util"); + } + + @Test + public void entityManagerIsHere() { + Assert.assertNotNull(em); + } + + @Test + public void getQueryStringFromNamedQuery() { + Query query = em.createNamedQuery("PigAmbienteVers.findAll", PigAmbienteVers.class); + assertEquals("SELECT v FROM PigAmbienteVers v ORDER BY v.nmAmbienteVers ASC", + QueryUtils.queryStringFrom(query)); + } + + @Test + public void getQueryStringFromNamedQueryWithParameter() { + Query query = em.createNamedQuery("PigAmbienteVers.findGreaterThanId", PigAmbienteVers.class); + query.setParameter("idAmbienteVers", 1L); + assertEquals( + "SELECT v FROM PigAmbienteVers v WHERE v.idAmbienteVers > :idAmbienteVers ORDER BY v.nmAmbienteVers ASC", + QueryUtils.queryStringFrom(query)); + } + + @Test + public void getQueryStringFromNativeQuery() { + final String expected = "SELECT v FROM PIG_AMBIENTE_VERS v " + " WHERE ID_AMBIENTE_VERS = 3"; + Query query = em.createNativeQuery(expected, PigAmbienteVers.class); + Assert.assertEquals(expected, QueryUtils.queryStringFrom(query)); + } + + @Test + public void getQueryStringFromNativeQueryWithParameters() { + final String expected = "SELECT v FROM PIG_AMBIENTE_VERS v " + " WHERE ID_AMBIENTE_VERS = :id"; + Query query = em.createNativeQuery(expected, PigAmbienteVers.class); + query.setParameter("id", 1L); + Assert.assertEquals(expected, QueryUtils.queryStringFrom(query)); + } + + @Test + public void getQueryStringFromTypedQuery() { + TypedQuery query = getTypedQuery(); + Assert.assertEquals( + "select distinct generatedAlias0 from PigAmbienteVers as generatedAlias0 where generatedAlias0.idAmbienteVers=3L order by generatedAlias0.nmAmbienteVers desc", + QueryUtils.queryStringFrom(query)); + } + + @Test + public void getCountQueryStringFromTypedQuery() { + Assert.assertEquals( + "SELECT COUNT(*) from PigAmbienteVers as generatedAlias0 where generatedAlias0.idAmbienteVers=3L", + QueryUtils.selectToCount(QueryUtils.queryStringFrom(getTypedQuery()))); + + } + + @Test + public void getQueryStringFromQuery() { + final String queryStr = "SELECT v FROM PigAmbienteVers v WHERE v.idAmbienteVers = 3 ORDER BY v.nmAmbienteVers DESC "; + Query query = em.createQuery(queryStr, PigAmbienteVers.class); + Assert.assertEquals(queryStr, QueryUtils.queryStringFrom(query)); + + } + + @Test + public void getQueryStringFromQueryWithParameter() { + final String queryStr = "SELECT v FROM PigAmbienteVers v WHERE v.idAmbienteVers = :id"; + Query query = em.createQuery(queryStr, PigAmbienteVers.class); + query.setParameter("id", 1L); + Assert.assertEquals(queryStr, QueryUtils.queryStringFrom(query)); + + } + + @Test + public void getCountQueryStringFromQuery() { + final String queryStr = "SELECT v FROM PigAmbienteVers v WHERE v.idAmbienteVers = 1 ORDER BY v.nmAmbienteVers DESC "; + Query query = em.createQuery(queryStr, PigAmbienteVers.class); + Assert.assertEquals("SELECT COUNT(*) FROM PigAmbienteVers v WHERE v.idAmbienteVers = 1", + QueryUtils.selectToCount(QueryUtils.queryStringFrom(query))); + + } + + @Test + public void getCountQueryStringFromQueryWithParameter() { + final String queryStr = "SELECT v FROM PigAmbienteVers v WHERE v.idAmbienteVers = :id ORDER BY v.nmAmbienteVers DESC "; + + Query query = em.createQuery(queryStr, PigAmbienteVers.class); + query.setParameter("id", 1L); + Assert.assertEquals("SELECT COUNT(*) FROM PigAmbienteVers v WHERE v.idAmbienteVers = :id", + QueryUtils.selectToCount(QueryUtils.queryStringFrom(query))); + + } + + @Test + public void getCountQueryStringFromQueryAndDistinctField() { + String queryStr = "SELECT DISTINCT p FROM PigAmbienteVers p"; + System.out.println(QueryUtils.selectToCount(queryStr, "idAmbienteVers")); + Assert.assertEquals("SELECT COUNT(DISTINCT idAmbienteVers) FROM PigAmbienteVers p", + QueryUtils.selectToCount(queryStr, "idAmbienteVers")); + + } + + private TypedQuery getTypedQuery() { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery cq = cb.createQuery(PigAmbienteVers.class); + Root entity = cq.from(PigAmbienteVers.class); + cq.select(entity); + cq.distinct(true); + cq.orderBy(cb.desc(entity.get("nmAmbienteVers"))); + List condizioni = new ArrayList<>(); + condizioni.add(cb.equal(entity.get("idAmbienteVers"), 3L)); + cq.where(condizioni.toArray(new Predicate[] {})); + return em.createQuery(cq); + } + + @Test + public void removeMultipleSpaceFromQueryString() { + final String expectedQueryString = "SELECT u FROM AroVLisArchivUnitaDoc u WHERE u.idUnitaDoc = :idud ORDER BY u.dsClassif, u.cdFascic"; + final String toNormalize = "SELECT u FROM AroVLisArchivUnitaDoc u WHERE u.idUnitaDoc = :idud ORDER BY u.dsClassif, u.cdFascic"; + assertEquals(expectedQueryString, QueryUtils.normalizeQueryString(toNormalize)); + } + + @Test + public void queryRemoveOrderBy() { + final String selectQuery = "SELECT u FROM AroVLisArchivUnitaDoc u WHERE u.idUnitaDoc = :idud ORDER BY u.dsClassif, u.cdFascic"; + final String expected = "SELECT u FROM AroVLisArchivUnitaDoc u WHERE u.idUnitaDoc = :idud"; + assertEquals(expected, QueryUtils.removeOrderBy(selectQuery)); + } + + @Test + public void queryRemoveOrderByWhenTheresNoOrderBy() { + final String selectQuery = "SELECT u FROM AroVLisArchivUnitaDoc u WHERE u.idUnitaDoc = :idud"; + final String expected = "SELECT u FROM AroVLisArchivUnitaDoc u WHERE u.idUnitaDoc = :idud"; + assertEquals(expected, QueryUtils.removeOrderBy(selectQuery)); + } + + @Test + public void selectQueryToCountQuery() { + final String selectQuery = "SELECT u FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud ORDER BY u.dsClassif,u.cdFascic"; + final String expected = "SELECT COUNT(*) FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud"; + assertEquals(expected, QueryUtils.selectToCount(selectQuery)); + } + + @Test + public void countQueryWithOneFieldForDistinct() { + final String selectQuery = "SELECT u FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud ORDER BY u.dsClassif,u.cdFascic"; + final String expected = "SELECT COUNT(DISTINCT idUnitaDoc) FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud"; + assertEquals(expected, QueryUtils.selectToCount(selectQuery, "idUnitaDoc")); + } + + @Test + public void countQueryWithEmptyStringForDistinctIsTheSameOfNoDistinctFields() { + final String selectQuery = "SELECT u FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud ORDER BY u.dsClassif,u.cdFascic"; + final String expected = "SELECT COUNT(*) FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud"; + assertEquals(expected, QueryUtils.selectToCount(selectQuery, "")); + } + + @Test + public void countQueryWithNullDistinctIsTheSameOfNoDistinctFields() { + final String selectQuery = "SELECT u FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud ORDER BY u.dsClassif,u.cdFascic"; + final String expected = "SELECT COUNT(*) FROM AroVLisArchivUnitaDoc u where u.idUnitaDoc = :idud"; + assertEquals(expected, QueryUtils.selectToCount(selectQuery, null)); + } + + @Test + public void fixCountDistinctMultipleColumns() { + final String selectDistinct = "SELECT COUNT(DISTINCT column1,column2,column3,column4 ) FROM table WHERE col1 = '2'"; + final String expected = "SELECT COUNT(*) FROM (SELECT DISTINCT column1,column2,column3,column4 FROM table WHERE col1 = '2')"; + assertEquals(expected, QueryUtils.fixOracleMultiColumnDistinct(selectDistinct)); + } + + @Test + public void fixCountDistinctMultipleColumnsWithAlias() { + final String selectDistinct = "select count(distinct monvlisudn0_.AA_KEY_UNITA_DOC, monvlisudn0_.CD_KEY_UNITA_DOC, monvlisudn0_.CD_REGISTRO_KEY_UNITA_DOC, monvlisudn0_.ID_STRUT) as col_0_0_ from MON_V_LIS_UD_NON_VERS_IAM monvlisudn0_ where monvlisudn0_.ID_AMBIENTE=? and monvlisudn0_.ID_ENTE=? and monvlisudn0_.ID_STRUT=? and monvlisudn0_.ID_USER_IAM=?"; + final String expected = "SELECT COUNT(*) as col_0_0_ FROM (SELECT distinct monvlisudn0_.AA_KEY_UNITA_DOC, monvlisudn0_.CD_KEY_UNITA_DOC, monvlisudn0_.CD_REGISTRO_KEY_UNITA_DOC, monvlisudn0_.ID_STRUT from MON_V_LIS_UD_NON_VERS_IAM monvlisudn0_ where monvlisudn0_.ID_AMBIENTE=? and monvlisudn0_.ID_ENTE=? and monvlisudn0_.ID_STRUT=? and monvlisudn0_.ID_USER_IAM=?)"; + assertEquals(expected, QueryUtils.fixOracleMultiColumnDistinct(selectDistinct)); + } + + @Test + public void fixCountDistinctSingleColumnDoNothing() { + final String selectDistinct = "SELECT COUNT(DISTINCT column1) FROM table WHERE col1 = '2'"; + assertEquals(selectDistinct, QueryUtils.fixOracleMultiColumnDistinct(selectDistinct)); + } + + @Test + public void fixCountStarDoNothing() { + final String selectDistinct = "SELECT COUNT(DISTINCT column1) FROM table WHERE col1 = '2'"; + assertEquals(selectDistinct, QueryUtils.fixOracleMultiColumnDistinct(selectDistinct)); + } +} diff --git a/spagolite-paginator-gf/src/test/resources/persistence.xml b/spagolite-paginator-gf/src/test/resources/persistence.xml new file mode 100644 index 0000000..ec30e0a --- /dev/null +++ b/spagolite-paginator-gf/src/test/resources/persistence.xml @@ -0,0 +1,17 @@ + + + + org.hibernate.ejb.HibernatePersistence + jdbc/PingDs + false + NONE + + + + + + + + + + diff --git a/spagolite-si-client/pom.xml b/spagolite-si-client/pom.xml index cb13c5c..e8cd2bd 100644 --- a/spagolite-si-client/pom.xml +++ b/spagolite-si-client/pom.xml @@ -7,7 +7,7 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT diff --git a/spagolite-si-server/pom.xml b/spagolite-si-server/pom.xml index 6ecb14e..f301bb5 100644 --- a/spagolite-si-server/pom.xml +++ b/spagolite-si-server/pom.xml @@ -6,7 +6,7 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT war @@ -23,7 +23,7 @@ --> org.jboss.spec - jboss-javaee-6.0 + jboss-jakartaee-8.0 pom provided diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/Costanti.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/Costanti.java index 6dc05db..78d9b83 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/Costanti.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/Costanti.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this template, choose Tools | Templates * and open the template in the editor. diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/ReplicaUtente.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/ReplicaUtente.java index 3d64cfa..33ac1a3 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/ReplicaUtente.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/ReplicaUtente.java @@ -1,22 +1,40 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws; +import javax.ejb.EJB; +import javax.jws.HandlerChain; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; + import it.eng.integriam.server.ws.reputente.CancellaUtenteRisposta; import it.eng.integriam.server.ws.reputente.InserimentoUtenteRisposta; import it.eng.integriam.server.ws.reputente.ModificaUtenteRisposta; import it.eng.integriam.server.ws.reputente.ReplicaUtenteInterface; import it.eng.integriam.server.ws.reputente.Utente; -import javax.inject.Inject; -import javax.jws.HandlerChain; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; - @WebService(serviceName = "ReplicaUtente") @HandlerChain(file = "/ws_handler.xml") public class ReplicaUtente { - @Inject + // @Inject + @EJB(beanName = "replicaUtenteEjb") private ReplicaUtenteInterface repUsr; @WebMethod(operationName = "inserimentoUtente") diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/CancellaUtenteRisposta.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/CancellaUtenteRisposta.java index 920a90e..2b14700 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/CancellaUtenteRisposta.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/CancellaUtenteRisposta.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; public class CancellaUtenteRisposta extends ReplicaUtenteRispostaAbstract { diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/InserimentoUtenteRisposta.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/InserimentoUtenteRisposta.java index e4c5e14..d20e7bd 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/InserimentoUtenteRisposta.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/InserimentoUtenteRisposta.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; /** diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaIndIp.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaIndIp.java index f53d76a..c516343 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaIndIp.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaIndIp.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaOrganizAbil.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaOrganizAbil.java index ba4c228..cf61457 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaOrganizAbil.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaOrganizAbil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; import java.util.ArrayList; @@ -27,4 +44,4 @@ public void setOrganizAbilList(List organizAbilList) { public Iterator iterator() { return organizAbilList.iterator(); } -} \ No newline at end of file +} diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaServiziAutor.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaServiziAutor.java index 6d98573..510deac 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaServiziAutor.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaServiziAutor.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; import java.util.ArrayList; diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaTipiDatoAbil.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaTipiDatoAbil.java index a47ca3b..9d2432d 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaTipiDatoAbil.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ListaTipiDatoAbil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; import java.util.ArrayList; @@ -27,4 +44,4 @@ public void setTipoDatoAbilList(List tipoDatoAbilList) { public Iterator iterator() { return tipoDatoAbilList.iterator(); } -} \ No newline at end of file +} diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ModificaUtenteRisposta.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ModificaUtenteRisposta.java index 8df3a7f..138a328 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ModificaUtenteRisposta.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ModificaUtenteRisposta.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; /** @@ -15,4 +32,4 @@ public Utente getUtente() { public void setUtente(Utente utente) { this.utente = utente; } -} \ No newline at end of file +} diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/OrganizAbil.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/OrganizAbil.java index 29a805c..f3e5b23 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/OrganizAbil.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/OrganizAbil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; /** @@ -48,4 +65,4 @@ public boolean isFlOrganizDefault() { public void setFlOrganizDefault(boolean flOrganizDefault) { this.flOrganizDefault = flOrganizDefault; } -} \ No newline at end of file +} diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteInterface.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteInterface.java index f6ecead..73cb1a2 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteInterface.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteInterface.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; public interface ReplicaUtenteInterface { diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteRispostaAbstract.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteRispostaAbstract.java index 17002cf..4fe40b7 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteRispostaAbstract.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/ReplicaUtenteRispostaAbstract.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; import it.eng.integriam.server.ws.Costanti.EsitoServizio; diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/TipoDatoAbil.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/TipoDatoAbil.java index 6801c59..b6797e2 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/TipoDatoAbil.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/TipoDatoAbil.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; /** diff --git a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/Utente.java b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/Utente.java index 1b81604..3b3cfff 100644 --- a/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/Utente.java +++ b/spagolite-si-server/src/main/java/it/eng/integriam/server/ws/reputente/Utente.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.server.ws.reputente; import java.util.Date; diff --git a/spagolite-si-server/src/main/webapp/WEB-INF/beans.xml b/spagolite-si-server/src/main/webapp/WEB-INF/beans.xml index 62d7907..b106d39 100644 --- a/spagolite-si-server/src/main/webapp/WEB-INF/beans.xml +++ b/spagolite-si-server/src/main/webapp/WEB-INF/beans.xml @@ -1,3 +1,7 @@ - + diff --git a/spagolite-si-util/pom.xml b/spagolite-si-util/pom.xml index 80ddc11..aee8692 100644 --- a/spagolite-si-util/pom.xml +++ b/spagolite-si-util/pom.xml @@ -14,9 +14,16 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT - + + + + org.apache.maven.plugins + maven-surefire-plugin + + + UTF-8 @@ -34,16 +41,37 @@ it.eng.parer spagofat-si-client - org.apache.commons commons-collections4 - + + org.dom4j + dom4j + + + org.junit.jupiter + junit-jupiter-api + 5.6.0 + test + + + org.junit.jupiter + junit-jupiter-params + ${junit-jupiter.version} + test + + + org.junit.jupiter + junit-jupiter-engine + 5.6.0 + test + + + org.slf4j + slf4j-simple + ${slf4j.version} + test + diff --git a/spagolite-si-util/src/main/java/it/eng/integriam/client/util/UserUtil.java b/spagolite-si-util/src/main/java/it/eng/integriam/client/util/UserUtil.java index 40c7836..de2bcef 100644 --- a/spagolite-si-util/src/main/java/it/eng/integriam/client/util/UserUtil.java +++ b/spagolite-si-util/src/main/java/it/eng/integriam/client/util/UserUtil.java @@ -1,12 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.client.util; -import it.eng.integriam.client.ws.recauth.HelpDips; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.dom4j.Element; +import it.eng.integriam.client.ws.recauth.HelpDips; import it.eng.integriam.client.ws.recauth.RecuperoAutorizzazioniRisposta; import it.eng.spagoLite.FrameElement; import it.eng.spagoLite.security.User; @@ -16,10 +34,13 @@ import it.eng.spagoLite.security.profile.MenuDips; import it.eng.spagoLite.security.profile.Pagina; import it.eng.spagoLite.security.profile.Profile; -import java.util.HashMap; public class UserUtil { + private UserUtil() { + throw new IllegalStateException("Impossibile istanziare la classe. Contiene solo metodi statici."); + } + public static void fillComponenti(User utente, RecuperoAutorizzazioniRisposta auth) { utente.setMenu(populateMenu(auth.getMenuList())); Profile profilo = new Profile(utente.getUsername(), "Profilo"); @@ -88,10 +109,9 @@ public static void fillComponenti(User utente, RecuperoAutorizzazioniRisposta au public static Menu populateMenu(List userMenu) { Menu menu = new Menu("", ""); - List list = new ArrayList(); - // Map map = new LinkedHashMap(); + List list = new ArrayList<>(); for (it.eng.integriam.client.ws.recauth.Menu entryMenu : userMenu) { - int level = entryMenu.getNiLivelloEntryMenu().intValue(); + int level = entryMenu.getNiLivelloEntryMenu(); Node node = new Node(entryMenu); if (list.size() < level) { @@ -104,7 +124,7 @@ public static Menu populateMenu(List us list.set(level - 1, node); } - if (list.size() > 0) { + if (!list.isEmpty()) { for (Node childNode : list.get(0)) { populateMenu(menu, childNode); } @@ -117,13 +137,9 @@ private static void populateMenu(Menu menu, Node node) { if (!node.hasChild()) { Link childLink = new Link(node.getEntryMenu().getNmEntryMenu(), node.getEntryMenu().getDsEntryMenu(), node.getEntryMenu().getDsLinkEntryMenu()); - // boolean esisteMenu=node.getEntryMenu().isFlHelpPresente(); - // childLink.setHelpAvailable(esisteMenu); menu.add(childLink); } else { Menu childMenu = new Menu(node.getEntryMenu().getNmEntryMenu(), node.getEntryMenu().getDsEntryMenu()); - // boolean esisteMenu=node.getEntryMenu().isFlHelpPresente(); - // childMenu.setHelpAvailable(esisteMenu); menu.add(childMenu); for (Node childNode : node) { @@ -134,11 +150,11 @@ private static void populateMenu(Menu menu, Node node) { private static class Node extends FrameElement implements Iterable { - private List child; - private it.eng.integriam.client.ws.recauth.Menu entryMenu; + private final List child; + private final it.eng.integriam.client.ws.recauth.Menu entryMenu; public Node(it.eng.integriam.client.ws.recauth.Menu entryMenu) { - this.child = new ArrayList(); + this.child = new ArrayList<>(); this.entryMenu = entryMenu; } @@ -147,13 +163,14 @@ public it.eng.integriam.client.ws.recauth.Menu getEntryMenu() { } public boolean hasChild() { - return child.size() > 0; + return !child.isEmpty(); } public void add(Node node) { child.add(node); } + @Override public Iterator iterator() { return child.iterator(); } @@ -163,8 +180,8 @@ public Element asXml() { Element element = super.asXml(); element.addAttribute("codice", entryMenu.getNmEntryMenu()); - for (Node child : this) { - element.add(child.asXml()); + for (Node c : this) { + element.add(c.asXml()); } return element; diff --git a/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMRestClients.java b/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMRestClients.java index 4bf3f05..7f87437 100644 --- a/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMRestClients.java +++ b/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMRestClients.java @@ -1,9 +1,26 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.client.ws; +import java.net.URI; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import java.net.URI; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponentsBuilder; @@ -16,14 +33,28 @@ public class IAMRestClients { restTemplate = new RestTemplate(); } - public static String recuperoHelpClient(String username, String password, String serviceURL, long idApplic, - String tiHelpOnLine, String nmPaginaWeb) { - // RestTemplate restTemplate=new RestTemplate(); - String oggettoJson = null; - URI targetUrl = UriComponentsBuilder.fromHttpUrl(serviceURL) - // .path("/saceriam/rest/recuperoHelp.html") - .queryParam("idApplic", idApplic).queryParam("tiHelpOnLine", tiHelpOnLine) - .queryParam("nmPaginaWeb", nmPaginaWeb).build().toUri(); + private IAMRestClients() { + throw new IllegalArgumentException("Impossibile istanziare la classe. Contiene solamente metodi statici."); + } + + /** + * Recupera il l'help on line per l'applicazione. + * + * @param serviceURL, + * url del servizio di helpe online + * @param idApplic, + * id applicazione per cui fornire l'help online + * @param tiHelpOnLine, + * tipologia help online + * @param nmPaginaWeb. + * pagina web per cui cui richiedere l'help online + * + * @return stringa contenente la serializzazione dell'help online. + */ + public static String recuperoHelpClient(String serviceURL, long idApplic, String tiHelpOnLine, String nmPaginaWeb) { + final String oggettoJson; + URI targetUrl = UriComponentsBuilder.fromHttpUrl(serviceURL).queryParam("idApplic", idApplic) + .queryParam("tiHelpOnLine", tiHelpOnLine).queryParam("nmPaginaWeb", nmPaginaWeb).build().toUri(); try { oggettoJson = restTemplate.getForObject(targetUrl, String.class); return oggettoJson; diff --git a/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMSoapClients.java b/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMSoapClients.java index 1513ee5..b9632fc 100644 --- a/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMSoapClients.java +++ b/spagolite-si-util/src/main/java/it/eng/integriam/client/ws/IAMSoapClients.java @@ -1,9 +1,23 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.integriam.client.ws; -import it.eng.integriam.client.ws.allenteconv.AllineamentoEnteConvenzionato; -import it.eng.integriam.client.ws.allenteconv.AllineamentoEnteConvenzionato_Service; -import it.eng.integriam.client.ws.calcoloservizierogati.CalcoloServiziErogati; -import it.eng.integriam.client.ws.calcoloservizierogati.CalcoloServiziErogati_Service; +import java.net.MalformedURLException; import java.net.URL; import java.util.Map; @@ -12,54 +26,157 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import it.eng.integriam.client.ws.allenteconv.AllineamentoEnteConvenzionato; +import it.eng.integriam.client.ws.allenteconv.AllineamentoEnteConvenzionato_Service; +import it.eng.integriam.client.ws.calcoloservizierogati.CalcoloServiziErogati; +import it.eng.integriam.client.ws.calcoloservizierogati.CalcoloServiziErogati_Service; import it.eng.integriam.client.ws.recauth.RecuperoAutorizzazioni; import it.eng.integriam.client.ws.recauth.RecuperoAutorizzazioni_Service; +import it.eng.integriam.client.ws.renews.RestituzioneNewsApplicazione; +import it.eng.integriam.client.ws.renews.RestituzioneNewsApplicazione_Service; import it.eng.integriam.client.ws.reporg.ReplicaOrganizzazione; import it.eng.integriam.client.ws.reporg.ReplicaOrganizzazione_Service; import it.eng.integriam.client.ws.reputente.ReplicaUtente; import it.eng.integriam.client.ws.reputente.ReplicaUtente_Service; -import it.eng.integriam.client.ws.renews.RestituzioneNewsApplicazione; -import it.eng.integriam.client.ws.renews.RestituzioneNewsApplicazione_Service; import it.eng.spagoLite.security.auth.AuthenticationHandlerConstants; import it.eng.spagoLite.security.auth.SOAPClientLoginHandlerResolver; +/** + * Contenitore dei client SOAP. Per garantire la thread safety nonostante il lazy loading vieniva utilizzato il pattern + * di double-checked locking. Questo pattern è sbagliato per questo motivo: + * https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html + * + * (i suggerimenti sono di SONAR). + */ public class IAMSoapClients { private static final Logger LOG = LoggerFactory.getLogger(IAMSoapClients.class); - private static RecuperoAutorizzazioni_Service recAuthService; - private static ReplicaOrganizzazione_Service repAuthService; - private static ReplicaUtente_Service repUtenteService; - private static RestituzioneNewsApplicazione_Service resNewsApplicService; - private static AllineamentoEnteConvenzionato_Service aecService; - private static CalcoloServiziErogati_Service cseService; + private static final String LOG_CONNESSIONE = "Connessione al WS: {}"; + private static final String LOG_ERRORE = "Errore durante l'inizializzazione del bean. WS Sever offline?"; + private static final String WSDL = "?wsdl"; + private static final int DEFAULT_TIMEOUT = 10_000; + + private IAMSoapClients() { + throw new IllegalStateException("Impossibile istanziare la classe. Espone solamente metodi statici."); + } + + /** + * Contenitore delle istanze del servizio. L'ottenimento dell'istanza del service è thread safe. + * + */ + public static class ServiceHolder { + + private static RecuperoAutorizzazioni_Service recAuthService; + private static ReplicaOrganizzazione_Service repAuthService; + private static ReplicaUtente_Service repUtenteService; + private static RestituzioneNewsApplicazione_Service resNewsApplicService; + private static AllineamentoEnteConvenzionato_Service aecService; + private static CalcoloServiziErogati_Service cseService; + + private static final String LOG_CREATO = "Creato il client service identitificato dal WSDL: {}"; + private static final String ISTANZA_ERRATA = "Impossibile riutilizzare la stessa istanza, l'URL del wsdl fornita {} è diversa da quella attualmente configurata {} !"; + + private ServiceHolder() { + throw new IllegalStateException("Questa classe è pensata per esporre solamente metodi statici"); + } + + public static synchronized RecuperoAutorizzazioni_Service getRecuperoAutorizzazioniService(URL wsdlUrl) { + if (recAuthService != null && !recAuthService.getWSDLDocumentLocation().equals(wsdlUrl)) { + LOG.warn(ISTANZA_ERRATA, wsdlUrl, recAuthService.getWSDLDocumentLocation()); + recAuthService = null; + } + if (recAuthService == null) { + recAuthService = new RecuperoAutorizzazioni_Service(wsdlUrl); + LOG.info(LOG_CREATO, wsdlUrl); + + } + + return recAuthService; + } + + public static synchronized ReplicaOrganizzazione_Service getReplicaOrganizzazioneService(URL wsdlUrl) { + if (repAuthService != null && !repAuthService.getWSDLDocumentLocation().equals(wsdlUrl)) { + LOG.warn(ISTANZA_ERRATA, wsdlUrl, repAuthService.getWSDLDocumentLocation()); + repAuthService = null; + } + if (repAuthService == null) { + repAuthService = new ReplicaOrganizzazione_Service(wsdlUrl); + LOG.info(LOG_CREATO, wsdlUrl); + } + return repAuthService; + } + + public static synchronized ReplicaUtente_Service getReplicaUtenteService(URL wsdlUrl) { + if (repUtenteService != null && !repUtenteService.getWSDLDocumentLocation().equals(wsdlUrl)) { + LOG.warn(ISTANZA_ERRATA, wsdlUrl, repUtenteService.getWSDLDocumentLocation()); + repUtenteService = null; + } + if (repUtenteService == null) { + repUtenteService = new ReplicaUtente_Service(wsdlUrl); + LOG.info(LOG_CREATO, wsdlUrl); + } + return repUtenteService; + } + + public static synchronized RestituzioneNewsApplicazione_Service getRestituzioneNewsApplicazioneService( + URL wsdlUrl) { + if (resNewsApplicService != null && !resNewsApplicService.getWSDLDocumentLocation().equals(wsdlUrl)) { + LOG.warn(ISTANZA_ERRATA, wsdlUrl, resNewsApplicService.getWSDLDocumentLocation()); + resNewsApplicService = null; + } + + if (resNewsApplicService == null) { + resNewsApplicService = new RestituzioneNewsApplicazione_Service(wsdlUrl); + LOG.info(LOG_CREATO, wsdlUrl); + } + return resNewsApplicService; + } + + public static synchronized AllineamentoEnteConvenzionato_Service getAllineamentoEnteConvenzionatoService( + URL wsdlUrl) { + + if (aecService != null && !aecService.getWSDLDocumentLocation().equals(wsdlUrl)) { + LOG.warn(ISTANZA_ERRATA, wsdlUrl, aecService.getWSDLDocumentLocation()); + aecService = null; + } + if (aecService == null) { + aecService = new AllineamentoEnteConvenzionato_Service(wsdlUrl); + LOG.info(LOG_CREATO, wsdlUrl); + } + return aecService; + } + + public static synchronized CalcoloServiziErogati_Service getCalcoloServiziErogatiService(URL wsdlUrl) { + + if (cseService != null && !cseService.getWSDLDocumentLocation().equals(wsdlUrl)) { + LOG.warn(ISTANZA_ERRATA, wsdlUrl, cseService.getWSDLDocumentLocation()); + cseService = null; + } + if (cseService == null) { + cseService = new CalcoloServiziErogati_Service(wsdlUrl); + LOG.info(LOG_CREATO, wsdlUrl); + } + return cseService; + } + } public static RecuperoAutorizzazioni recuperoAutorizzazioniClient(String username, String password, String serviceURL) { try { - LOG.info("Connessione al WS: " + serviceURL); - if (recAuthService == null) { - synchronized (IAMSoapClients.class) { - if (recAuthService == null) { - URL wsdlURL = new URL(serviceURL + "?wsdl"); - recAuthService = new RecuperoAutorizzazioni_Service(wsdlURL); - recAuthService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); - LOG.info("Creato il client service per il WS: " + serviceURL); - } - } - } + LOG.info(LOG_CONNESSIONE, serviceURL); + + RecuperoAutorizzazioni_Service recAuthService = ServiceHolder + .getRecuperoAutorizzazioniService(new URL(serviceURL + WSDL)); + recAuthService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); RecuperoAutorizzazioni client = recAuthService.getRecuperoAutorizzazioniPort(); - Map requestContext = ((BindingProvider) client).getRequestContext(); - // Timeout in millis - setTimeout(requestContext, 10000); - // Endpoint URL - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL); - requestContext.put(AuthenticationHandlerConstants.USER, username); - requestContext.put(AuthenticationHandlerConstants.PWD, password); + + // configura il client + configureWsClient(client, serviceURL, username, password, DEFAULT_TIMEOUT); return client; - } catch (Exception e) { - LOG.error("Errore durante l'inizializzazione del bean. WS Sever offline?", e); + } catch (MalformedURLException e) { + LOG.error(LOG_ERRORE, e); return null; } } @@ -67,58 +184,35 @@ public static RecuperoAutorizzazioni recuperoAutorizzazioniClient(String usernam public static ReplicaOrganizzazione replicaOrganizzazioneClient(String username, String password, String serviceURL) { try { - LOG.info("Connessione al WS: " + serviceURL); - if (repAuthService == null) { - synchronized (IAMSoapClients.class) { - if (repAuthService == null) { - URL wsdlURL = new URL(serviceURL + "?wsdl"); - repAuthService = new ReplicaOrganizzazione_Service(wsdlURL); - repAuthService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); - LOG.info("Creato il client service per il WS: " + serviceURL); - } - } - } + LOG.info(LOG_CONNESSIONE, serviceURL); + ReplicaOrganizzazione_Service replicaOrganizzazioneService = ServiceHolder + .getReplicaOrganizzazioneService(new URL(serviceURL + WSDL)); + replicaOrganizzazioneService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); + ReplicaOrganizzazione client = replicaOrganizzazioneService.getReplicaOrganizzazionePort(); + + // configura il client + configureWsClient(client, serviceURL, username, password, DEFAULT_TIMEOUT); - ReplicaOrganizzazione client = repAuthService.getReplicaOrganizzazionePort(); - Map requestContext = ((BindingProvider) client).getRequestContext(); - // Timeout in millis - setTimeout(requestContext, 10000); - // Endpoint URL - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL); - requestContext.put(AuthenticationHandlerConstants.USER, username); - requestContext.put(AuthenticationHandlerConstants.PWD, password); return client; - } catch (Exception e) { - LOG.error("Errore durante l'inizializzazione del bean. WS Sever offline?", e); + } catch (MalformedURLException e) { + LOG.error(LOG_ERRORE, e); return null; } } public static ReplicaUtente replicaUtenteClient(String username, String password, String serviceURL) { try { - LOG.info("Connessione al WS: " + serviceURL); - if (repUtenteService == null) { - synchronized (IAMSoapClients.class) { - if (repUtenteService == null) { - URL wsdlURL = new URL(serviceURL + "?wsdl"); - repUtenteService = new ReplicaUtente_Service(wsdlURL); - repUtenteService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); - LOG.info("Creato il client service per il WS: " + serviceURL); - } - } - } - + LOG.info(LOG_CONNESSIONE, serviceURL); + ReplicaUtente_Service repUtenteService = ServiceHolder.getReplicaUtenteService(new URL(serviceURL + WSDL)); + repUtenteService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); ReplicaUtente client = repUtenteService.getReplicaUtentePort(); - Map requestContext = ((BindingProvider) client).getRequestContext(); - // Timeout in millis - setTimeout(requestContext, 100000); - // Endpoint URL - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL); - requestContext.put(AuthenticationHandlerConstants.USER, username); - requestContext.put(AuthenticationHandlerConstants.PWD, password); + + // configura il client + configureWsClient(client, serviceURL, username, password, DEFAULT_TIMEOUT); + return client; - } catch (Exception e) { - LOG.error("Errore durante l'inizializzazione del bean. WS Sever offline?", e); + } catch (MalformedURLException e) { + LOG.error(LOG_ERRORE, e); return null; } } @@ -126,91 +220,63 @@ public static ReplicaUtente replicaUtenteClient(String username, String password public static RestituzioneNewsApplicazione restituzioneNewsApplicazioneClient(String username, String password, String serviceURL) { try { - LOG.info("Connessione al WS: " + serviceURL); - if (resNewsApplicService == null) { - synchronized (IAMSoapClients.class) { - if (resNewsApplicService == null) { - URL wsdlURL = new URL(serviceURL + "?wsdl"); - resNewsApplicService = new RestituzioneNewsApplicazione_Service(wsdlURL); - resNewsApplicService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); - LOG.info("Creato il client service per il WS: " + serviceURL); - } - } - } - + LOG.info(LOG_CONNESSIONE, serviceURL); + RestituzioneNewsApplicazione_Service resNewsApplicService = ServiceHolder + .getRestituzioneNewsApplicazioneService(new URL(serviceURL + WSDL)); + resNewsApplicService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); RestituzioneNewsApplicazione client = resNewsApplicService.getRestituzioneNewsApplicazionePort(); - Map requestContext = ((BindingProvider) client).getRequestContext(); - // Timeout in millis - setTimeout(requestContext, 10000); - // Endpoint URL - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL); - requestContext.put(AuthenticationHandlerConstants.USER, username); - requestContext.put(AuthenticationHandlerConstants.PWD, password); + + // configura il client + configureWsClient(client, serviceURL, username, password, DEFAULT_TIMEOUT); + return client; - } catch (Exception e) { - LOG.error("Errore durante l'inizializzazione del bean. WS Sever offline?", e); + } catch (MalformedURLException e) { + LOG.error(LOG_ERRORE, e); return null; } + } public static AllineamentoEnteConvenzionato allineamentoEnteConvenzionatoClient(String username, String password, String serviceURL) { - try { - LOG.info("Connessione al WS: " + serviceURL); - if (aecService == null) { - synchronized (IAMSoapClients.class) { - if (aecService == null) { - URL wsdlURL = new URL(serviceURL + "?wsdl"); - aecService = new AllineamentoEnteConvenzionato_Service(wsdlURL); - aecService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); - LOG.info("Creato il client service per il WS: " + serviceURL); - } - } - } + try { + LOG.info(LOG_CONNESSIONE, serviceURL); + AllineamentoEnteConvenzionato_Service aecService = ServiceHolder + .getAllineamentoEnteConvenzionatoService(new URL(serviceURL + WSDL)); + aecService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); AllineamentoEnteConvenzionato client = aecService.getAllineamentoEnteConvenzionatoPort(); - Map requestContext = ((BindingProvider) client).getRequestContext(); - // Timeout in millis - setTimeout(requestContext, 10000); - // Endpoint URL - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL); - requestContext.put(AuthenticationHandlerConstants.USER, username); - requestContext.put(AuthenticationHandlerConstants.PWD, password); + + // configura il client + configureWsClient(client, serviceURL, username, password, DEFAULT_TIMEOUT); + return client; - } catch (Exception e) { - LOG.error("Errore durante l'inizializzazione del bean. WS Sever offline?", e); + } catch (MalformedURLException e) { + LOG.error(LOG_ERRORE, e); return null; } + } public static CalcoloServiziErogati calcoloServiziErogatiClient(String username, String password, String serviceURL) { - try { - LOG.info("Connessione al WS: " + serviceURL); - if (cseService == null) { - synchronized (IAMSoapClients.class) { - if (cseService == null) { - URL wsdlURL = new URL(serviceURL + "?wsdl"); - cseService = new CalcoloServiziErogati_Service(wsdlURL); - cseService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); - LOG.info("Creato il client service per il WS: " + serviceURL); - } - } - } + try { + LOG.info(LOG_CONNESSIONE, serviceURL); + CalcoloServiziErogati_Service cseService = ServiceHolder + .getCalcoloServiziErogatiService(new URL(serviceURL + WSDL)); + cseService.setHandlerResolver(new SOAPClientLoginHandlerResolver()); CalcoloServiziErogati client = cseService.getCalcoloServiziErogatiPort(); - Map requestContext = ((BindingProvider) client).getRequestContext(); - // Timeout in millis - setTimeout(requestContext, 10000); - // Endpoint URL - requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL); - requestContext.put(AuthenticationHandlerConstants.USER, username); - requestContext.put(AuthenticationHandlerConstants.PWD, password); + + // configura il client + configureWsClient(client, serviceURL, username, password, DEFAULT_TIMEOUT); + return client; - } catch (Exception e) { - LOG.error("Errore durante l'inizializzazione del bean. WS Sever offline?", e); + } catch (MalformedURLException e) { + LOG.error(LOG_ERRORE, e); return null; } + } /** @@ -219,7 +285,7 @@ public static CalcoloServiziErogati calcoloServiziErogatiClient(String username, * {@link IAMSoapClients#replicaUtenteClient(java.lang.String, java.lang.String, java.lang.String) } * * Esempio di utilizzo: - * + * *

      * {
      *     @code
@@ -242,6 +308,35 @@ public static void changeRequestTimeout(BindingProvider wsClient, int newTimeout
         }
     }
 
+    /**
+     * Configura il client del web service SOAP
+     *
+     * @param 
+     *            Web service client type
+     * @param wsClient
+     *            Istanza client web service
+     * @param serviceURL
+     *            url da configurare
+     * @param username
+     *            username da configurare
+     * @param password
+     *            password da configurare
+     * @param newTimeout
+     *            timeout da sovrascrivere
+     */
+    private static  void configureWsClient(T wsClient, String serviceURL, String username, String password,
+            int newTimeout) {
+        Map requestContext = ((BindingProvider) wsClient).getRequestContext();
+
+        // Timeout in millis
+        setTimeout(requestContext, newTimeout);
+        // Endpoint URL
+        requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
+        requestContext.put(AuthenticationHandlerConstants.USER, username);
+        requestContext.put(AuthenticationHandlerConstants.PWD, password);
+
+    }
+
     /**
      * Imposta o sovrascrive il timeout.
      *
diff --git a/spagolite-si-util/src/test/java/it/eng/integriam/client/ws/TestSoapClients.java b/spagolite-si-util/src/test/java/it/eng/integriam/client/ws/TestSoapClients.java
new file mode 100644
index 0000000..a16d540
--- /dev/null
+++ b/spagolite-si-util/src/test/java/it/eng/integriam/client/ws/TestSoapClients.java
@@ -0,0 +1,252 @@
+/*
+ * Engineering Ingegneria Informatica S.p.A.
+ *
+ * Copyright (C) 2023 Regione Emilia-Romagna
+ * 

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.integriam.client.ws; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import it.eng.integriam.client.ws.IAMSoapClients.ServiceHolder; +import it.eng.integriam.client.ws.allenteconv.AllineamentoEnteConvenzionato_Service; +import it.eng.integriam.client.ws.calcoloservizierogati.CalcoloServiziErogati_Service; +import it.eng.integriam.client.ws.recauth.RecuperoAutorizzazioni_Service; +import it.eng.integriam.client.ws.renews.RestituzioneNewsApplicazione_Service; +import it.eng.integriam.client.ws.reporg.ReplicaOrganizzazione_Service; +import it.eng.integriam.client.ws.reputente.ReplicaUtente_Service; + +/** + * Test per i client SOAP + */ +public class TestSoapClients { + + private static URL REC_AUTORIZZ_WSDL_SVIL; + private static URL REC_AUTORIZZ_WSDL_TEST; + private static URL REP_ORGANIZZ_WSDL_SVIL; + private static URL REP_ORGANIZZ_WSDL_TEST; + private static URL REP_UTENTE_WSDL_SVIL; + private static URL REP_UTENTE_WSDL_TEST; + private static URL REST_NEWS_WSDL_SVIL; + private static URL REST_NEWS_WSDL_TEST; + private static URL ALL_ENTE_CONVENZ_WSDL_SVIL; + private static URL ALL_ENTE_CONVENZ_WSDL_TEST; + private static URL CALCOLO_SERVIZI_WSDL_SVIL; + private static URL CALCOLO_SERVIZI_WSDL_TEST; + + public TestSoapClients() { + } + + @BeforeAll + public static void setUpClass() throws MalformedURLException { + REC_AUTORIZZ_WSDL_SVIL = new URL("https://parer-svil.ente.regione.emr.it/saceriam/RecuperoAutorizzazioni?wsdl"); + REC_AUTORIZZ_WSDL_TEST = new URL( + "https://parer-test.regione.emilia-romagna.it/saceriam/RecuperoAutorizzazioni?wsdl"); + + REP_ORGANIZZ_WSDL_SVIL = new URL("https://parer-svil.ente.regione.emr.it/saceriam/ReplicaOrganizzazione?wsdl"); + REP_ORGANIZZ_WSDL_TEST = new URL( + "https://parer-test.regione.emilia-romagna.it/saceriam/ReplicaOrganizzazione?wsdl"); + + REP_UTENTE_WSDL_SVIL = new URL("https://parer-svil.ente.regione.emr.it/sacer/ReplicaUtente?wsdl"); + REP_UTENTE_WSDL_TEST = new URL("https://parer-test.regione.emilia-romagna.it/sacer/ReplicaUtente?wsdl"); + + REST_NEWS_WSDL_SVIL = new URL( + "https://parer-svil.ente.regione.emr.it/saceriam/RestituzioneNewsApplicazione?wsdl"); + REST_NEWS_WSDL_TEST = new URL( + "https://parer-test.regione.emilia-romagna.it/saceriam/RestituzioneNewsApplicazione?wsdl"); + + ALL_ENTE_CONVENZ_WSDL_SVIL = new URL( + "https://parer-svil.ente.regione.emr.it/saceriam/AllineamentoEnteConvenzionato?wsdl"); + ALL_ENTE_CONVENZ_WSDL_TEST = new URL( + "https://parer-test.regione.emilia-romagna.it/saceriam/AllineamentoEnteConvenzionato?wsdl"); + + CALCOLO_SERVIZI_WSDL_SVIL = new URL( + "https://parer-svil.ente.regione.emr.it/saceriam/CalcoloServiziErogati?wsdl"); + CALCOLO_SERVIZI_WSDL_TEST = new URL( + "https://parer-test.regione.emilia-romagna.it/saceriam/CalcoloServiziErogati?wsdl"); + + } + + @AfterAll + public static void tearDownClass() { + } + + @BeforeEach + public void setUp() { + + } + + @AfterEach + public void tearDown() { + } + + @Test + public void testIstanzeDiverseRecuperoAutorizzazioni() { + RecuperoAutorizzazioni_Service service = ServiceHolder.getRecuperoAutorizzazioniService(REC_AUTORIZZ_WSDL_SVIL); + RecuperoAutorizzazioni_Service service2 = ServiceHolder + .getRecuperoAutorizzazioniService(REC_AUTORIZZ_WSDL_TEST); + assertFalse(service == service2); + + } + + @Test + public void testIstanzeDiverseReplicaOrganizzazione() { + ReplicaOrganizzazione_Service service = ServiceHolder.getReplicaOrganizzazioneService(REP_ORGANIZZ_WSDL_SVIL); + ReplicaOrganizzazione_Service service2 = ServiceHolder.getReplicaOrganizzazioneService(REP_ORGANIZZ_WSDL_TEST); + assertFalse(service == service2); + } + + @Test + public void testIstanzeDiverseReplicaUtente() { + ReplicaUtente_Service service = ServiceHolder.getReplicaUtenteService(REP_UTENTE_WSDL_SVIL); + ReplicaUtente_Service service2 = ServiceHolder.getReplicaUtenteService(REP_UTENTE_WSDL_TEST); + assertFalse(service == service2); + } + + @Test + public void testIstanzeDiverseRestituzioneNews() { + RestituzioneNewsApplicazione_Service service = ServiceHolder + .getRestituzioneNewsApplicazioneService(REST_NEWS_WSDL_SVIL); + RestituzioneNewsApplicazione_Service service2 = ServiceHolder + .getRestituzioneNewsApplicazioneService(REST_NEWS_WSDL_TEST); + assertFalse(service == service2); + } + + @Test + public void testIstanzeDiverseAllineaEntiConvenzionati() { + AllineamentoEnteConvenzionato_Service service = ServiceHolder + .getAllineamentoEnteConvenzionatoService(ALL_ENTE_CONVENZ_WSDL_SVIL); + AllineamentoEnteConvenzionato_Service service2 = ServiceHolder + .getAllineamentoEnteConvenzionatoService(ALL_ENTE_CONVENZ_WSDL_TEST); + assertFalse(service == service2); + } + + @Test + public void testIstanzeDiverseCalcoloServiziiErogati() { + CalcoloServiziErogati_Service service = ServiceHolder + .getCalcoloServiziErogatiService(CALCOLO_SERVIZI_WSDL_SVIL); + CalcoloServiziErogati_Service service2 = ServiceHolder + .getCalcoloServiziErogatiService(CALCOLO_SERVIZI_WSDL_TEST); + assertFalse(service == service2); + } + + @Test + public void testThreadSafetyRecuperoAutorizzazioniService() { + + RecuperoAutorizzazioni_Service service = ServiceHolder.getRecuperoAutorizzazioniService(REC_AUTORIZZ_WSDL_SVIL); + + for (int i = 0; i < 10; i++) { + new Thread(() -> { + RecuperoAutorizzazioni_Service service2 = ServiceHolder + .getRecuperoAutorizzazioniService(REC_AUTORIZZ_WSDL_SVIL); + // Sono la stessa istanza (creata una volta sola) + assertTrue(service == service2); + }).start(); + + } + } + + @Test + public void testThreadSafetyReplicaOrganizzazioneService() { + + ReplicaOrganizzazione_Service service = ServiceHolder.getReplicaOrganizzazioneService(REP_ORGANIZZ_WSDL_SVIL); + + for (int i = 0; i < 10; i++) { + new Thread(() -> { + ReplicaOrganizzazione_Service service2 = ServiceHolder + .getReplicaOrganizzazioneService(REP_ORGANIZZ_WSDL_SVIL); + // Sono la stessa istanza (creata una volta sola) + assertTrue(service == service2); + }).start(); + + } + } + + @Test + public void testThreadSafetyReplicaUtenteService() { + + ReplicaUtente_Service service = ServiceHolder.getReplicaUtenteService(REP_UTENTE_WSDL_SVIL); + + for (int i = 0; i < 10; i++) { + new Thread(() -> { + ReplicaUtente_Service service2 = ServiceHolder.getReplicaUtenteService(REP_UTENTE_WSDL_SVIL); + // Sono la stessa istanza (creata una volta sola) + assertTrue(service == service2); + }).start(); + + } + } + + @Test + public void testThreadSafetyRestituzioneNewsService() { + + RestituzioneNewsApplicazione_Service service = ServiceHolder + .getRestituzioneNewsApplicazioneService(REST_NEWS_WSDL_SVIL); + + for (int i = 0; i < 10; i++) { + new Thread(() -> { + RestituzioneNewsApplicazione_Service service2 = ServiceHolder + .getRestituzioneNewsApplicazioneService(REST_NEWS_WSDL_SVIL); + // Sono la stessa istanza (creata una volta sola) + assertTrue(service == service2); + }).start(); + + } + } + + @Test + public void testThreadSafetyAllineaEntiConvenzionatiService() { + + AllineamentoEnteConvenzionato_Service service = ServiceHolder + .getAllineamentoEnteConvenzionatoService(ALL_ENTE_CONVENZ_WSDL_SVIL); + + for (int i = 0; i < 10; i++) { + new Thread(() -> { + AllineamentoEnteConvenzionato_Service service2 = ServiceHolder + .getAllineamentoEnteConvenzionatoService(ALL_ENTE_CONVENZ_WSDL_SVIL); + // Sono la stessa istanza (creata una volta sola) + assertTrue(service == service2); + }).start(); + + } + } + + @Test + public void testThreadSafetyCalcoloServiziErogatiService() { + + CalcoloServiziErogati_Service service = ServiceHolder + .getCalcoloServiziErogatiService(CALCOLO_SERVIZI_WSDL_SVIL); + + for (int i = 0; i < 10; i++) { + new Thread(() -> { + CalcoloServiziErogati_Service service2 = ServiceHolder + .getCalcoloServiziErogatiService(CALCOLO_SERVIZI_WSDL_SVIL); + // Sono la stessa istanza (creata una volta sola) + assertTrue(service == service2); + }).start(); + + } + } + +} diff --git a/spagolite-sl-ejb/pom.xml b/spagolite-sl-ejb/pom.xml index 6cae043..0bffea1 100644 --- a/spagolite-sl-ejb/pom.xml +++ b/spagolite-sl-ejb/pom.xml @@ -7,12 +7,13 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT + org.jboss.spec - jboss-javaee-6.0 + jboss-jakartaee-8.0 pom provided @@ -28,21 +29,20 @@ it.eng.parer spagofat-timer-wrapper-common - org.apache.commons commons-collections4 - org.apache.commons commons-lang3 + @@ -54,9 +54,6 @@ org.apache.maven.plugins maven-ejb-plugin - - 3.1 - diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/Constants.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/Constants.java index 350f2da..1dd5dbd 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/Constants.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/Constants.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/SacerLogEjbType.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/SacerLogEjbType.java index ea4f1e0..07d2653 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/SacerLogEjbType.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/common/SacerLogEjbType.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.common; import java.lang.annotation.ElementType; diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogEjb.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogEjb.java index 9f16791..5647779 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogEjb.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogEjb.java @@ -1,23 +1,22 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.ejb; -import it.eng.parer.sacerlog.common.SacerLogEjbType; -import it.eng.parer.sacerlog.ejb.helper.SacerLogHelper; -import it.eng.parer.sacerlog.ejb.util.ObjectsToLogBefore; -import it.eng.parer.sacerlog.ejb.util.PremisEnums; -import it.eng.parer.sacerlog.entity.LogAgenteEvento; -import it.eng.parer.sacerlog.entity.LogEvento; -import it.eng.parer.sacerlog.entity.LogOggettoEvento; -import it.eng.parer.sacerlog.viewEntity.AplVLogFotoTiEvnOgg; -import it.eng.parer.sacerlog.viewEntity.AplVLogTiEvn; -import it.eng.parer.sacerlog.viewEntity.AplVLogTiEvnConOrigine; -import it.eng.parer.sacerlog.viewEntity.AplVLogTiOgg; -import it.eng.parer.sacerlog.viewEntity.LogVLogAgente; -import it.eng.parer.sacerlog.entity.EntityConstraints; -import it.eng.parer.sacerlog.entity.LogChiaveAccessoEvento; -import it.eng.parer.sacerlog.entity.LogEventoByScript; -import it.eng.parer.sacerlog.util.TransactionLogContext; -import it.eng.parer.sacerlog.viewEntity.AplVLogChiaveTiOgg; -import it.eng.parer.sacerlog.viewEntity.AplVLogTrigTiEvnOgg; import java.io.StringReader; import java.math.BigDecimal; import java.util.ArrayList; @@ -26,11 +25,12 @@ import java.util.Iterator; import java.util.List; import java.util.Set; + import javax.annotation.Resource; import javax.ejb.EJB; -import javax.ejb.Stateless; import javax.ejb.LocalBean; import javax.ejb.SessionContext; +import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; @@ -38,12 +38,32 @@ import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; +import it.eng.parer.sacerlog.common.SacerLogEjbType; +import it.eng.parer.sacerlog.ejb.helper.SacerLogHelper; +import it.eng.parer.sacerlog.ejb.util.ObjectsToLogBefore; +import it.eng.parer.sacerlog.ejb.util.PremisEnums; +import it.eng.parer.sacerlog.entity.EntityConstraints; +import it.eng.parer.sacerlog.entity.LogAgenteEvento; +import it.eng.parer.sacerlog.entity.LogChiaveAccessoEvento; +import it.eng.parer.sacerlog.entity.LogEvento; +import it.eng.parer.sacerlog.entity.LogEventoByScript; +import it.eng.parer.sacerlog.entity.LogOggettoEvento; +import it.eng.parer.sacerlog.util.TransactionLogContext; +import it.eng.parer.sacerlog.viewEntity.AplVLogChiaveTiOgg; +import it.eng.parer.sacerlog.viewEntity.AplVLogFotoTiEvnOgg; +import it.eng.parer.sacerlog.viewEntity.AplVLogTiEvn; +import it.eng.parer.sacerlog.viewEntity.AplVLogTiEvnConOrigine; +import it.eng.parer.sacerlog.viewEntity.AplVLogTiOgg; +import it.eng.parer.sacerlog.viewEntity.AplVLogTrigTiEvnOgg; +import it.eng.parer.sacerlog.viewEntity.LogVLogAgente; + /** * * @author Iacolucci_M @@ -155,8 +175,8 @@ protected LogEvento log(TransactionLogContext ctx, boolean isTrigger, String nmT idApplic = tipo.getIdApplic(); } else { tipoConOrigine = sacerLogHelper.getTipoEventoByApplicFinestraAzione(nmApplic, nmComponente, nmAzione); - idTipoEvento = tipoConOrigine.getIdTipoEvento(); - idApplic = tipoConOrigine.getIdApplic(); + idTipoEvento = tipoConOrigine.getAplVLogTiEvnConOrigineId().getIdTipoEvento(); + idApplic = tipoConOrigine.getAplVLogTiEvnConOrigineId().getIdApplic(); } AplVLogTiOgg tiOgg = sacerLogHelper.getTipoOggettoByNome(nmApplic, nmTipoOggetto); @@ -449,7 +469,7 @@ public List logBefore(TransactionLogContext ctx, String nmAp AplVLogTiEvnConOrigine tipoConOrigine = sacerLogHelper.getTipoEventoByApplicFinestraAzione(nmApplic, nmComponente, nmAzione); - BigDecimal idTipoEvento = tipoConOrigine.getIdTipoEvento(); + BigDecimal idTipoEvento = tipoConOrigine.getAplVLogTiEvnConOrigineId().getIdTipoEvento(); AplVLogTiOgg tiOgg = sacerLogHelper.getTipoOggettoByNome(nmApplic, nmTipoOggetto); AplVLogFotoTiEvnOgg evnOgg = sacerLogHelper.getFotoByEventoOggetto(idTipoEvento, tiOgg.getIdTipoOggetto()); diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogWebEjb.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogWebEjb.java index d051b03..7402f06 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogWebEjb.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/SacerLogWebEjb.java @@ -1,38 +1,57 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.ejb; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.ejb.EJB; +import javax.ejb.LocalBean; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; +import javax.persistence.criteria.CriteriaQuery; + +import it.eng.paginator.helper.LazyListHelper; +import it.eng.parer.sacerlog.common.SacerLogEjbType; import it.eng.parer.sacerlog.ejb.common.helper.ParamApplicHelper; import it.eng.parer.sacerlog.ejb.helper.SacerLogHelper; +import it.eng.parer.sacerlog.slite.gen.viewbean.AplVLogTiOggRowBean; import it.eng.parer.sacerlog.slite.gen.viewbean.AplVLogTiOggTableBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVLisAsserzioniDatiRowBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVLisAsserzioniDatiTableBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVLisEventoOggettoRowBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVLisEventoOggettoTableBean; -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVRicEventiTableBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVRicEventiRowBean; +import it.eng.parer.sacerlog.slite.gen.viewbean.LogVRicEventiTableBean; +import it.eng.parer.sacerlog.slite.gen.viewbean.LogVUsrAbilOrganizRowBean; +import it.eng.parer.sacerlog.slite.gen.viewbean.LogVUsrAbilOrganizTableBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVVisEventoPrincTxRowBean; import it.eng.parer.sacerlog.slite.gen.viewbean.LogVVisOggettoRowBean; +import it.eng.parer.sacerlog.viewEntity.AplVLogTiOgg; +import it.eng.parer.sacerlog.viewEntity.ILogVRicEventi; import it.eng.parer.sacerlog.viewEntity.LogVLisAsserzioniDati; import it.eng.parer.sacerlog.viewEntity.LogVLisEventoOggetto; import it.eng.parer.sacerlog.viewEntity.LogVRicEventi; +import it.eng.parer.sacerlog.viewEntity.LogVUsrAbilOrganiz; import it.eng.parer.sacerlog.viewEntity.LogVVisEventoPrincTx; import it.eng.parer.sacerlog.viewEntity.LogVVisOggetto; -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; -import javax.ejb.EJB; -import javax.ejb.Stateless; -import javax.ejb.LocalBean; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import it.eng.parer.sacerlog.common.SacerLogEjbType; -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVUsrAbilOrganizTableBean; -import it.eng.parer.sacerlog.slite.gen.viewbean.AplVLogTiOggRowBean; -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVUsrAbilOrganizRowBean; -import it.eng.parer.sacerlog.viewEntity.AplVLogTiOgg; -import it.eng.parer.sacerlog.viewEntity.ILogVRicEventi; -import it.eng.parer.sacerlog.viewEntity.LogVUsrAbilOrganiz; /** * @@ -48,8 +67,8 @@ public class SacerLogWebEjb { private SacerLogHelper sacerLogHelper; @EJB ParamApplicHelper paramApplicHelper; - - private static Logger log = LoggerFactory.getLogger(SacerLogWebEjb.class); + @EJB(mappedName = "java:app/paginator/LazyListHelper") + protected LazyListHelper lazyListHelper; /* * Estrae il dettaglio da visualizzare nella form di visualizzazione log per oggetto @@ -97,17 +116,8 @@ public LogVLisEventoOggettoTableBean getEventsByAppTipoOggettoId(String nomeAppl riga.setTipoClasseEvento(ogg.getTipoClasseEvento()); riga.setTipoOrigineAgente(ogg.getTipoOrigineAgente()); riga.setTipoOrigineEvento(ogg.getTipoOrigineEvento()); - - /* - * String dsMotivazione = ogg.getDsMotivoScript(); if (ogg.getDsGeneratoreAzione() == null || - * ogg.getDsAzione() == null) { riga.setString("calc_azione", "Azione scaturita da " + ogg.getNmApplic()); } - * else { riga.setString("calc_azione", ogg.getDsGeneratoreAzione() + "/" + ogg.getDsAzione() + - * (dsMotivazione != null ? " (" + dsMotivazione + ")" : "")); } - */ riga.setString("calc_azione", getStringAzioneCalcolata(ogg.getDsGeneratoreAzione(), ogg.getDsAzione(), ogg.getDsMotivoScript())); - // riga.setString("calc_azione", ogg.getDsGeneratoreAzione() + "/" + ogg.getDsAzione() - // + (dsMotivazione != null ? " (" + dsMotivazione + ")" : "")); riga.setIdTransazione(ogg.getIdTransazione()); tabella.add(riga); } @@ -143,7 +153,8 @@ public LogVLisAsserzioniDatiTableBean getAsserzioniDatiByIdOggettoEvento(BigDeci riga.setPathKey(ogg.getPathKey()); riga.setTipoModifica(ogg.getTipoModifica()); riga.setTipoValore(ogg.getTipoValore()); - String flg1 = "0", flg2 = "0"; + String flg1 = "0"; + String flg2 = "0"; /* * La logica di apparizione dei link per i valori troppo grandi è la seguente: * @@ -220,9 +231,6 @@ public LogVVisEventoPrincTxRowBean getLogVVisEventoPrincTxById(BigDecimal idTran } else { LogVVisEventoPrincTxRowBean row = new LogVVisEventoPrincTxRowBean(); row.entityToRowBean(rec); - // String dsMotivazione = rec.getDsMotivoScript(); - // row.setString("azione_composita", rec.getDsGeneratoreAzione() + "/" + rec.getDsAzione() - // + (dsMotivazione != null ? " (" + dsMotivazione + ")" : "")); row.setString("azione_composita", getStringAzioneCalcolata(rec.getDsGeneratoreAzione(), rec.getDsAzione(), rec.getDsMotivoScript())); return row; @@ -254,8 +262,12 @@ public LogVUsrAbilOrganizTableBean getOrganizzazioniByApplicAndUsrId(String nome public LogVRicEventiTableBean getEventiByOrgTipoClasseDates(String nmApplicazione, String nmOggetto, BigDecimal idOrganizzazione, BigDecimal idTipoOggetto, String classeEvento, Date DataDa, Date DataA, Integer maxResults) { - List lista = sacerLogHelper.findEventiByOrgTipoClasseDates(nmApplicazione, nmOggetto, - idOrganizzazione, idTipoOggetto, classeEvento, DataDa, DataA, maxResults); + CriteriaQuery cq = sacerLogHelper.findEventiByOrgTipoClasseDates(nmApplicazione, nmOggetto, idOrganizzazione, + idTipoOggetto, classeEvento, DataDa, DataA); + return lazyListHelper.getTableBean(cq, maxResults, this::getTableBeanFrom); + } + + public LogVRicEventiTableBean getTableBeanFrom(List lista) { if (lista == null || lista.isEmpty()) { return null; } else { @@ -276,9 +288,6 @@ public LogVRicEventiTableBean getEventiByOrgTipoClasseDates(String nmApplicazion riga.setString("nm_organizzazione", rec.getNmAmbiente() + "/" + rec.getNmVersatore()); } } - // String dsMotivazione = rec.getDsMotivoScript(); - // riga.setString("azione_composita", rec.getNmGeneratoreAzione() + "/" + rec.getNmAzione() - // + (dsMotivazione != null ? " (" + dsMotivazione + ")" : "")); riga.setString("azione_composita", getStringAzioneCalcolata(rec.getNmGeneratoreAzione(), rec.getNmAzione(), rec.getDsMotivoScript())); tabella.add(riga); @@ -310,10 +319,6 @@ public LogVRicEventiTableBean getOggettiByIdEvento(BigDecimal idEvento) { riga.setString("nm_organizzazione", rec.getNmAmbiente() + "/" + rec.getNmVersatore()); } } - // String dsMotivazione = rec.getDsMotivoScript(); - // riga.setString("azione_composita", rec.getNmGeneratoreAzione() + "/" + rec.getNmAzione() - // + (dsMotivazione != null ? " (" + dsMotivazione + ")" : "")); - // riga.setString("azione_composita",rec.getNmGeneratoreAzione()+"/"+rec.getNmAzione()); riga.setString("azione_composita", getStringAzioneCalcolata(rec.getNmGeneratoreAzione(), rec.getNmAzione(), rec.getDsMotivoScript())); tabella.add(riga); @@ -331,9 +336,6 @@ public LogVRicEventiTableBean getEventiByIdtransazioneExcludingEvento(BigDecimal LogVRicEventiTableBean tabella = new LogVRicEventiTableBean(); for (LogVRicEventi rec : lista) { LogVRicEventiRowBean riga = new LogVRicEventiRowBean(); - // String dsMotivazione = rec.getDsMotivoScript(); - // riga.setString("azione_composita", rec.getNmGeneratoreAzione() + "/" + rec.getNmAzione() - // + (dsMotivazione != null ? " (" + dsMotivazione + ")" : "")); riga.setString("azione_composita", getStringAzioneCalcolata(rec.getNmGeneratoreAzione(), rec.getNmAzione(), rec.getDsMotivoScript())); riga.entityToRowBean(rec); diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/AppServerInstance.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/AppServerInstance.java index ed51925..485a905 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/AppServerInstance.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/AppServerInstance.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/helper/ParamApplicHelper.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/helper/ParamApplicHelper.java index c1c38ad..1ea31e1 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/helper/ParamApplicHelper.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/common/helper/ParamApplicHelper.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/ExportImportFotoHelper.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/ExportImportFotoHelper.java index b4fcb8c..c16e0e2 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/ExportImportFotoHelper.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/ExportImportFotoHelper.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates @@ -5,6 +22,10 @@ */ package it.eng.parer.sacerlog.ejb.helper; +import it.eng.parer.sacerlog.common.SacerLogEjbType; +import it.eng.spagoCore.util.JpaUtils; +import java.io.IOException; +import java.io.Reader; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.Clob; @@ -12,21 +33,18 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import javax.ejb.Stateless; +import java.util.HashMap; +import java.util.Map.Entry; import javax.ejb.LocalBean; +import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import it.eng.parer.sacerlog.common.SacerLogEjbType; -import java.io.IOException; -import java.io.Reader; -import java.util.HashMap; -import java.util.Map.Entry; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.text.StrSubstitutor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @@ -52,8 +70,9 @@ public String exportFoto(BigDecimal idOggetto, String functionName) { String risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement("SELECT " + functionName + "(?) AS FOTO FROM DUAL"); ps.setBigDecimal(1, idOggetto); rs = ps.executeQuery(); @@ -73,6 +92,9 @@ public String exportFoto(BigDecimal idOggetto, String functionName) { ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { throw new RuntimeException("Errore esportazione foto dalla funzione oracle " + functionName + "()", ex); } @@ -89,8 +111,9 @@ public long importFoto(String fotoXml, String procedureName) { long risultato = -1; CallableStatement cs = null; String istruzione = "{call " + procedureName + "(?,?)}"; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); cs = con.prepareCall(istruzione); cs.registerOutParameter(2, java.sql.Types.NUMERIC); cs.setString(1, fotoXml); @@ -108,6 +131,14 @@ public long importFoto(String fotoXml, String procedureName) { throw new RuntimeException("Errore importazione Foto", ex); } } + if (con != null) { + try { + con.close(); + } catch (SQLException ex) { + log.debug("Errore importazione Foto", ex); + throw new RuntimeException("Errore importazione Foto", ex); + } + } } return risultato; } diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/SacerLogHelper.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/SacerLogHelper.java index f33ab91..3e29d2e 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/SacerLogHelper.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/helper/SacerLogHelper.java @@ -1,6 +1,26 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.ejb.helper; +import it.eng.parer.sacerlog.common.SacerLogEjbType; +import it.eng.parer.sacerlog.ejb.common.AppServerInstance; import it.eng.parer.sacerlog.entity.LogEventoByScript; +import it.eng.parer.sacerlog.entity.LogEventoLoginUser; import it.eng.parer.sacerlog.viewEntity.AplVLogChiaveTiOgg; import it.eng.parer.sacerlog.viewEntity.AplVLogFotoTiEvnOgg; import it.eng.parer.sacerlog.viewEntity.AplVLogInit; @@ -17,6 +37,7 @@ import it.eng.parer.sacerlog.viewEntity.LogVUsrAbilOrganiz; import it.eng.parer.sacerlog.viewEntity.LogVVisEventoPrincTx; import it.eng.parer.sacerlog.viewEntity.LogVVisOggetto; +import it.eng.spagoCore.util.JpaUtils; import java.io.IOException; import java.io.Reader; import java.math.BigDecimal; @@ -31,10 +52,7 @@ import java.util.Calendar; import java.util.Date; import java.util.List; -import javax.ejb.Stateless; -import javax.ejb.LocalBean; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; +import javax.ejb.*; import javax.persistence.*; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; @@ -43,10 +61,6 @@ import javax.persistence.criteria.Root; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import it.eng.parer.sacerlog.common.SacerLogEjbType; -import it.eng.parer.sacerlog.viewEntity.ILogVRicEventi; -import it.eng.parer.sacerlog.viewEntity.LogVRicEventiOrganiz; -import it.eng.parer.sacerlog.viewEntity.LogVUsrAbilOrganiz; /** * @@ -60,6 +74,8 @@ public class SacerLogHelper { @PersistenceContext private EntityManager entityManager; + @EJB + private AppServerInstance appServerInstance; private static final String TRUE = "1"; private static final String FALSE = "0"; @@ -108,11 +124,7 @@ public boolean isLoggingEnabled() { Query query = entityManager.createNamedQuery("AplVParamApplic.findByNmParamApplic", AplVParamApplic.class); query.setParameter("nmParamApplic", "LOG_ATTIVO"); AplVParamApplic p = (AplVParamApplic) query.getSingleResult(); - if (p.getDsValoreParamApplic().equalsIgnoreCase("true")) { - return true; - } else { - return false; - } + return p.getDsValoreParamApplic().equalsIgnoreCase("true"); } catch (RuntimeException ex) { log.error("Errore nell'estrazione del parametro applicativo [{}]", "LOG_ATTIVO", ex); throw ex; @@ -125,11 +137,7 @@ public boolean isLoggingEnabledForThisNomeAzione(String nomeAzione) { query.setParameter("nmParamApplic", "AZIONE_INIZIALIZZAZIONE_LOG"); AplVParamApplic p = (AplVParamApplic) query.getSingleResult(); - if (p.getDsValoreParamApplic().equalsIgnoreCase(nomeAzione)) { - return true; - } else { - return false; - } + return p.getDsValoreParamApplic().equalsIgnoreCase(nomeAzione); } catch (RuntimeException ex) { log.error("Errore nell'estrazione del parametro applicativo [{}]", "AZIONE_INIZIALIZZAZIONE_LOG", ex); throw ex; @@ -262,8 +270,10 @@ public String getFotoXml(String query, BigDecimal idOggetto, String nmQueryTipoO String risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; + try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement("SELECT GET_XML_FOTO_AS_CLOB(?,?) AS FOTO FROM DUAL"); ps.setClob(1, getStringAsClob(con, query)); ps.setBigDecimal(2, idOggetto); @@ -283,9 +293,13 @@ public String getFotoXml(String query, BigDecimal idOggetto, String nmQueryTipoO ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { throw new RuntimeException("Errore lettura foto dalla funzione oracle", ex); } + } return risultato; } @@ -295,8 +309,9 @@ public String getDeltaFotoAsClob(String xml1, String xml2) { String risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement("SELECT SACER_LOG.GET_DELTA_FOTO_AS_CLOB(?,?) AS DELTA FROM DUAL"); Clob par1 = con.createClob(); Clob par2 = con.createClob(); @@ -310,7 +325,6 @@ public String getDeltaFotoAsClob(String xml1, String xml2) { risultato = clob == null ? null : getClobAsString(clob); } } catch (Exception ex) { - // ex.printStackTrace(); log.error("Errore lettura foto dalla funzione oracle GET_DELTA_FOTO_AS_CLOB()", ex); } finally { try { @@ -320,6 +334,9 @@ public String getDeltaFotoAsClob(String xml1, String xml2) { ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { } } @@ -331,8 +348,9 @@ public String getDeltaFotoAssertAsClob(String xml1, String xml2) { String risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement("SELECT SACER_LOG.GET_DELTA_ASSERT_FOR_TEST(?,?) AS DELTA FROM DUAL"); Clob par1 = con.createClob(); Clob par2 = con.createClob(); @@ -346,7 +364,6 @@ public String getDeltaFotoAssertAsClob(String xml1, String xml2) { risultato = clob == null ? null : getClobAsString(clob); } } catch (Exception ex) { - // ex.printStackTrace(); final String testoErrore = "Errore lettura foto dalla funzione oracle GET_DELTA_ASSERT_FOR_TEST()"; log.error(testoErrore, ex); throw new RuntimeException(testoErrore, ex); @@ -358,6 +375,9 @@ public String getDeltaFotoAssertAsClob(String xml1, String xml2) { ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { } @@ -370,14 +390,15 @@ public boolean isThereATrigger(String sqlTrigger, BigDecimal idFoto) { String campo = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement(sqlTrigger); ps.setBigDecimal(1, idFoto); rs = ps.executeQuery(); if (rs != null && rs.next()) { campo = rs.getString("FLAG"); - risultato = campo != null && campo.equals(TRUE) ? true : false; + risultato = campo != null && campo.equals(TRUE); } } catch (Exception ex) { log.error(null, ex); @@ -390,6 +411,9 @@ public boolean isThereATrigger(String sqlTrigger, BigDecimal idFoto) { ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { throw new RuntimeException("Errore verifica esistenza trigger", ex); } @@ -406,13 +430,14 @@ public List findAllObjectIdFromTrigger(String sqlTriggerAllObjectId, List risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement(sqlTriggerAllObjectId); ps.setBigDecimal(1, idEntity); rs = ps.executeQuery(); if (rs != null) { - risultato = new ArrayList(); + risultato = new ArrayList<>(); while (rs.next()) { risultato.add(rs.getBigDecimal("ID")); } @@ -428,6 +453,9 @@ public List findAllObjectIdFromTrigger(String sqlTriggerAllObjectId, ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { throw new RuntimeException("Errore estrazione ID scatenati dal trigger", ex); } @@ -443,8 +471,9 @@ public List findAllObjectIdToInitialize(String sqlFindAllObjectId) { List risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement(sqlFindAllObjectId); rs = ps.executeQuery(); if (rs != null) { @@ -464,6 +493,9 @@ public List findAllObjectIdToInitialize(String sqlFindAllObjectId) { ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { throw new RuntimeException("Errore estrazione ID scatenati dalla funzione init log", ex); } @@ -479,8 +511,9 @@ public List findAllChiaviAccessoByIdOggetto(String sqlAllChiaviAcces List risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement(sqlAllChiaviAccesso); ps.setBigDecimal(1, idOggettoFiglio); rs = ps.executeQuery(); @@ -501,6 +534,9 @@ public List findAllChiaviAccessoByIdOggetto(String sqlAllChiaviAcces ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { throw new RuntimeException("Errore Lettura degli oggetti padre", ex); } @@ -519,7 +555,7 @@ public LogVVisOggetto getDettOggettoByAppTipoOggettoId(String nomeApplicazione, query.setParameter("nmTipoOggetto", nomeTipoOggetto); query.setParameter("idOggetto", idOggetto); List l = query.getResultList(); - if (l.size() > 0) { + if (!l.isEmpty()) { return l.get(0); } else { return null; @@ -542,7 +578,7 @@ public List getEventsByAppTipoOggettoId(String nomeApplica query.setParameter("nmApplic", nomeApplicazione); query.setParameter("nmTipoOggetto", nomeTipoOggetto); query.setParameter("idOggetto", idOggetto); - return (List) query.getResultList(); + return query.getResultList(); } catch (RuntimeException ex) { log.error( "Errore nell'estrazione di LogVLisEventoOggetto con nmApplic [{}] nmTipoOggetto [{}] idOggetto [{}]", @@ -559,7 +595,7 @@ public List getAsserzioniDatiByIdOggettoEvento(BigDecimal Query query = entityManager.createNamedQuery("LogVLisAsserzioniDati.findByIdOggettoEvento", LogVLisAsserzioniDati.class); query.setParameter("idOggettoEvento", idOggettoEvento); - return (List) query.getResultList(); + return query.getResultList(); } catch (RuntimeException ex) { log.error("Errore nell'estrazione di LogVLisAsserzioniDati con idOggettoEvento [{}]", idOggettoEvento, ex); throw ex; @@ -642,9 +678,8 @@ public List findUsrVAbilOrganizByApplicAndUser(String nmAppl } } - public List findEventiByOrgTipoClasseDates(String nomeApplicazione, String nmOggetto, - BigDecimal idOrganizzazione, BigDecimal idTipoOggetto, String classeEvento, Date dataDa, Date dataA, - Integer maxResult) { + public CriteriaQuery findEventiByOrgTipoClasseDates(String nomeApplicazione, String nmOggetto, + BigDecimal idOrganizzazione, BigDecimal idTipoOggetto, String classeEvento, Date dataDa, Date dataA) { try { CriteriaBuilder cb = entityManager.getCriteriaBuilder(); @@ -681,11 +716,7 @@ public List findEventiByOrgTipoClasseDates(String nomeApplicazio predicate = cb.and(predicate, cb.like(cb.lower(nmOgg), "%" + nmOggetto.toLowerCase() + "%")); } cq.where(predicate); - TypedQuery q = entityManager.createQuery(cq); - if (maxResult != null) { - q.setMaxResults(maxResult); - } - return q.getResultList(); + return cq; } catch (RuntimeException ex) { log.error( @@ -726,7 +757,7 @@ public LogVVisEventoPrincTx findTransazioneById(BigDecimal idTransazione) { Query query = entityManager.createNamedQuery("LogVVisEventoPrincTx.findTxById", LogVVisEventoPrincTx.class); query.setParameter("idTransazione", idTransazione); query.setMaxResults(1); - List lista = (List) query.getResultList(); + List lista = query.getResultList(); if (lista != null && !lista.isEmpty()) { return lista.get(0); } @@ -753,7 +784,7 @@ public List getDistinctLogVLisEventoScriptByNmApplic(String nmApplic) public void insertEntity(T entity, boolean forceFlush) { if (entity != null) { - log.debug("Persisting instance of class " + entity.getClass().getSimpleName()); + log.debug("Persisting instance of class {}", entity.getClass().getSimpleName()); entityManager.persist(entity); if (forceFlush) { entityManager.flush(); @@ -761,9 +792,26 @@ public void insertEntity(T entity, boolean forceFlush) { } } + public void insertEventoLoginUser(String nmUserid, String cdIndIpClient, Date dtEvento, String tipoEvento, + String dsEvento, String cognomeUser, String nomeUser, String cfUser, String cdIdEsterno, String emailUser) { + LogEventoLoginUser logEventoLoginUser = new LogEventoLoginUser(); + logEventoLoginUser.setNmUserid(nmUserid); + logEventoLoginUser.setCdIndIpClient(cdIndIpClient); + logEventoLoginUser.setCdIndServer(appServerInstance.getName()); + logEventoLoginUser.setDtEvento(dtEvento); + logEventoLoginUser.setTipoEvento(tipoEvento); + logEventoLoginUser.setDsEvento(dsEvento); + logEventoLoginUser.setNmCognomeUser(cognomeUser); + logEventoLoginUser.setNmNomeUser(nomeUser); + logEventoLoginUser.setCdFiscUser(cfUser); + logEventoLoginUser.setCdIDEsterno(cdIdEsterno); + logEventoLoginUser.setDsEmailUser(emailUser); + insertEntity(logEventoLoginUser, true); + } + public void removeEntity(T entity, boolean forceFlush) { if (entity != null) { - log.debug("Removing instance of class " + entity.getClass().getSimpleName()); + log.debug("Removing instance of class {}", entity.getClass().getSimpleName()); entityManager.remove(entity); if (forceFlush) { entityManager.flush(); @@ -772,7 +820,7 @@ public void removeEntity(T entity, boolean forceFlush) { } public T findById(Class entityClass, BigDecimal id) { - log.debug("Getting instance of class " + entityClass.getSimpleName() + " with id: " + id); + log.debug("Getting instance of class {} with id {}", entityClass.getSimpleName(), id); try { T instance = entityManager.find(entityClass, id); log.debug("Get successful"); @@ -791,8 +839,9 @@ public long inserisciFoto(long idOggettoEvento, String fotoXml, Calendar momento long risultato = -1; CallableStatement cs = null; String istruzione = "{call SACER_LOG.INSERT_FOTO(?,?,?,?)}"; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); cs = con.prepareCall(istruzione); cs.registerOutParameter(4, java.sql.Types.NUMERIC); cs.setLong(1, idOggettoEvento); @@ -804,6 +853,7 @@ public long inserisciFoto(long idOggettoEvento, String fotoXml, Calendar momento log.error("Errore Scrittura Foto", ex); throw new RuntimeException("Errore Scrittura Foto", ex); } finally { + if (cs != null) { try { cs.close(); @@ -812,6 +862,15 @@ public long inserisciFoto(long idOggettoEvento, String fotoXml, Calendar momento throw new RuntimeException("Errore Scrittura Foto", ex); } } + if (con != null) { + try { + con.close(); + } catch (SQLException ex) { + log.debug("Errore Scrittura Foto", ex); + throw new RuntimeException("Errore Scrittura Foto", ex); + } + } + } return risultato; } @@ -823,15 +882,15 @@ public BigDecimal getNewTransactionId() { BigDecimal risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement("SELECT SACER_LOG.slog_evento_transazione.NEXTVAL AS TRANSACTION_ID FROM DUAL"); rs = ps.executeQuery(); if (rs != null && rs.next()) { risultato = rs.getBigDecimal("TRANSACTION_ID"); } } catch (Exception ex) { - // ex.printStackTrace(); log.error(null, ex); } finally { try { @@ -841,6 +900,9 @@ public BigDecimal getNewTransactionId() { ps.close(); } } + if (con != null) { + con.close(); + } } catch (Exception ex) { } } @@ -854,8 +916,9 @@ public long scriviDelta(long idOggettoEvento, Calendar momentoAttuale) { long risultato = -1; CallableStatement cs = null; String istruzione = "{call SACER_LOG.SCRIVI_DELTA(?,?,?)}"; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); cs = con.prepareCall(istruzione); cs.registerOutParameter(3, java.sql.Types.NUMERIC); cs.setLong(1, idOggettoEvento); @@ -866,6 +929,7 @@ public long scriviDelta(long idOggettoEvento, Calendar momentoAttuale) { log.error("Errore Scrittura DELTA", ex); throw new RuntimeException("Errore nella chiamata alla procedura SCRIVI_DELTA", ex); } finally { + if (cs != null) { try { cs.close(); @@ -874,6 +938,15 @@ public long scriviDelta(long idOggettoEvento, Calendar momentoAttuale) { throw new RuntimeException("Errore nella chiamata alla procedura SCRIVI_DELTA", ex); } } + + if (con != null) { + try { + con.close(); + } catch (SQLException ex) { + log.error("Errore Scrittura DELTA", ex); + throw new RuntimeException("Errore nella chiamata alla procedura SCRIVI_DELTA", ex); + } + } } return risultato; } @@ -900,8 +973,9 @@ public String getXmlFotoByIdEventoOggettoAsString(BigDecimal idOggettoEvento) { String risultato = null; ResultSet rs = null; PreparedStatement ps = null; + Connection con = null; try { - Connection con = entityManager.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(entityManager); ps = con.prepareStatement("SELECT SACER_LOG.GET_XML_FOTO_BY_ID_AS_CLOB(?) AS FOTO FROM DUAL"); ps.setLong(1, idOggettoEvento.longValueExact()); rs = ps.executeQuery(); @@ -910,7 +984,6 @@ public String getXmlFotoByIdEventoOggettoAsString(BigDecimal idOggettoEvento) { risultato = clob == null ? null : getClobAsString(clob); } } catch (Exception ex) { - // ex.printStackTrace(); log.error(null, ex); } finally { try { @@ -918,17 +991,21 @@ public String getXmlFotoByIdEventoOggettoAsString(BigDecimal idOggettoEvento) { rs.close(); if (ps != null) { ps.close(); + } } + if (con != null) { + con.close(); + } } catch (Exception ex) { } } return risultato; } - /********************************************************* + /* * Query applicative NATIVE sullo storico delle FOTO XML * - *********************************************************/ + */ /* * Torna i ruoli che l'utente aveva in una determinata data diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/LogOggettoRuolo.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/LogOggettoRuolo.java index 66ebef9..d0a2359 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/LogOggettoRuolo.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/LogOggettoRuolo.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.ejb.util; import java.math.BigDecimal; diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/ObjectsToLogBefore.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/ObjectsToLogBefore.java index f47d7d5..b8cd978 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/ObjectsToLogBefore.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/ObjectsToLogBefore.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/PremisEnums.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/PremisEnums.java index 26db5c7..084d496 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/PremisEnums.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/ejb/util/PremisEnums.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.ejb.util; /** diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/Constants.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/Constants.java index 7acad30..df9e9ad 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/Constants.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/Constants.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.job; import java.util.Calendar; diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/JobData.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/JobData.java index c4dd803..f19ca16 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/JobData.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/JobData.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogAllineamentoTimer.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogAllineamentoTimer.java index 36f56b2..5d571c5 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogAllineamentoTimer.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogAllineamentoTimer.java @@ -1,9 +1,26 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.job; -import it.eng.parer.jboss.timer.common.CronSchedule; -import it.eng.parer.jboss.timer.common.JbossJobTimer; import static it.eng.parer.sacerlog.job.SacerLogTimer.TIME_DURATION; + import java.util.Date; + import javax.annotation.Resource; import javax.ejb.EJB; import javax.ejb.LocalBean; @@ -15,9 +32,13 @@ import javax.ejb.Timer; import javax.ejb.TimerConfig; import javax.ejb.TimerService; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import it.eng.parer.jboss.timer.common.CronSchedule; +import it.eng.parer.jboss.timer.common.JbossJobTimer; + /** * * @author Iacolucci_M diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJob.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJob.java index 1b50c50..b2533fe 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJob.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJob.java @@ -1,13 +1,27 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.job; -import it.eng.parer.sacerlog.ejb.SacerLogEjb; -import it.eng.parer.sacerlog.ejb.helper.SacerLogHelper; -import it.eng.parer.sacerlog.ejb.util.PremisEnums; -import it.eng.parer.sacerlog.viewEntity.AplVLogInit; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.List; + import javax.annotation.Resource; import javax.ejb.EJB; import javax.ejb.LocalBean; @@ -15,10 +29,16 @@ import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; + import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import it.eng.parer.sacerlog.ejb.SacerLogEjb; +import it.eng.parer.sacerlog.ejb.helper.SacerLogHelper; +import it.eng.parer.sacerlog.ejb.util.PremisEnums; +import it.eng.parer.sacerlog.viewEntity.AplVLogInit; + /** * * diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJobHelper.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJobHelper.java index b38a776..5db416d 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJobHelper.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogJobHelper.java @@ -1,25 +1,46 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package it.eng.parer.sacerlog.job; -import it.eng.parer.sacerlog.ejb.common.AppServerInstance; import java.io.Serializable; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Timestamp; import java.util.Date; + import javax.ejb.EJB; -import javax.ejb.Stateless; import javax.ejb.LocalBean; +import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import it.eng.parer.sacerlog.ejb.common.AppServerInstance; +import it.eng.spagoCore.util.JpaUtils; + /** * * @author Iacolucci_M @@ -49,8 +70,9 @@ public void writeLogJob(String jobName, String opType, String descr) { Date now = new Date(); Timestamp date = new Timestamp(now.getTime()); PreparedStatement ps = null; + Connection con = null; try { - Connection con = em.unwrap(Connection.class); + con = JpaUtils.provideConnectionFrom(em); ps = con.prepareStatement( "INSERT INTO APL_V_LOG_JOB (ID_LOG_JOB, NM_JOB, TI_REG_LOG_JOB, DT_REG_LOG_JOB, DL_MSG_ERR, CD_IND_SERVER)" + "VALUES (SSLOG_JOB.nextVal, ?, ?, ?, ?, ?)"); @@ -68,6 +90,11 @@ public void writeLogJob(String jobName, String opType, String descr) { if (ps != null) { ps.close(); } + + if (con != null) { + con.close(); + } + } catch (Exception ex) { } diff --git a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogTimer.java b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogTimer.java index 1a33122..36bb1a6 100644 --- a/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogTimer.java +++ b/spagolite-sl-ejb/src/main/java/it/eng/parer/sacerlog/job/SacerLogTimer.java @@ -1,8 +1,24 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.job; -import it.eng.parer.jboss.timer.common.CronSchedule; -import it.eng.parer.jboss.timer.common.JbossJobTimer; import java.util.Date; + import javax.annotation.Resource; import javax.ejb.EJB; import javax.ejb.LocalBean; @@ -12,9 +28,13 @@ import javax.ejb.Timeout; import javax.ejb.Timer; import javax.ejb.TimerService; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import it.eng.parer.jboss.timer.common.CronSchedule; +import it.eng.parer.jboss.timer.common.JbossJobTimer; + /** * * @author Iacolucci_M diff --git a/spagolite-sl-ejb/src/main/resources/META-INF/ejb-jar.xml b/spagolite-sl-ejb/src/main/resources/META-INF/ejb-jar.xml index 0172304..9886e39 100644 --- a/spagolite-sl-ejb/src/main/resources/META-INF/ejb-jar.xml +++ b/spagolite-sl-ejb/src/main/resources/META-INF/ejb-jar.xml @@ -9,13 +9,14 @@ + it.eng.parer.jboss.timer.interceptor.JbossTimerNodeInterceptor @@ -46,6 +47,7 @@ + diff --git a/spagolite-sl-jpa/pom.xml b/spagolite-sl-jpa/pom.xml index 14eacea..9d0a250 100644 --- a/spagolite-sl-jpa/pom.xml +++ b/spagolite-sl-jpa/pom.xml @@ -7,30 +7,34 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT org.jboss.spec - jboss-javaee-6.0 + jboss-jakartaee-8.0 pom provided - org.eclipse.persistence - eclipselink + org.hibernate + hibernate-core provided - + + org.hibernate.validator + hibernate-validator + provided + org.apache.commons commons-collections4 + + it.eng.parer + spagofat-paginator-ejb + ejb + diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/EntityConstraints.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/EntityConstraints.java index 97d7b82..9eaa037 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/EntityConstraints.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/EntityConstraints.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogAgenteEvento.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogAgenteEvento.java index 9faf981..bb09dae 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogAgenteEvento.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogAgenteEvento.java @@ -1,15 +1,44 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + /** * The persistent class for the LOG_AGENTE_EVENTO database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_AGENTE_EVENTO") +@Table(schema = "SACER_LOG", name = "LOG_AGENTE_EVENTO") @NamedQueries({ @NamedQuery(name = "LogAgenteEvento.findAll", query = "SELECT l FROM LogAgenteEvento l"), @NamedQuery(name = "LogAgenteEvento.deleteAll", query = "DELETE FROM LogAgenteEvento") }) public class LogAgenteEvento implements Serializable { @@ -24,7 +53,7 @@ public LogAgenteEvento() { } @Id - @SequenceGenerator(name = "LOG_AGENTE_EVENTO_IDAGENTEEVENTO_GENERATOR", sequenceName = "SACER_LOG.SLOG_AGENTE_EVENTO", allocationSize = 1) + @SequenceGenerator(name = "LOG_AGENTE_EVENTO_IDAGENTEEVENTO_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_AGENTE_EVENTO", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_AGENTE_EVENTO_IDAGENTEEVENTO_GENERATOR") @Column(name = "ID_AGENTE_EVENTO") public long getIdAgenteEvento() { diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogChiaveAccessoEvento.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogChiaveAccessoEvento.java index 5bd512d..ee18877 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogChiaveAccessoEvento.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogChiaveAccessoEvento.java @@ -1,16 +1,47 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.util.Calendar; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + /** * The persistent class for the LOG_CHIAVE_ACCESSO_EVENTO database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_CHIAVE_ACCESSO_EVENTO") +@Table(schema = "SACER_LOG", name = "LOG_CHIAVE_ACCESSO_EVENTO") @NamedQueries({ @NamedQuery(name = "LogChiaveAccessoEvento.findAll", query = "SELECT l FROM LogChiaveAccessoEvento l"), @NamedQuery(name = "LogChiaveAccessoEvento.deleteAll", query = "DELETE FROM LogChiaveAccessoEvento") }) public class LogChiaveAccessoEvento implements Serializable { @@ -27,7 +58,7 @@ public LogChiaveAccessoEvento() { } @Id - @SequenceGenerator(name = "LOG_CHIAVE_ACCESSO_EVENTO_IDCHIAVEACCESSOEVENTO_GENERATOR", sequenceName = "SACER_LOG.SLOG_CHIAVE_ACCESSO_EVENTO", allocationSize = 1) + @SequenceGenerator(name = "LOG_CHIAVE_ACCESSO_EVENTO_IDCHIAVEACCESSOEVENTO_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_CHIAVE_ACCESSO_EVENTO", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_CHIAVE_ACCESSO_EVENTO_IDCHIAVEACCESSOEVENTO_GENERATOR") @Column(name = "ID_CHIAVE_ACCESSO_EVENTO") public long getIdChiaveAccessoEvento() { diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogDeltaFoto.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogDeltaFoto.java index 663c5a2..56e0b23 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogDeltaFoto.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogDeltaFoto.java @@ -1,23 +1,55 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; -import java.sql.Clob; import java.util.Calendar; -import javax.persistence.*; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.ColumnTransformer; /** * The persistent class for the LOG_DELTA_FOTO database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_DELTA_FOTO") +@Table(schema = "SACER_LOG", name = "LOG_DELTA_FOTO") @NamedQueries({ @NamedQuery(name = "LogDeltaFoto.findAll", query = "SELECT l FROM LogDeltaFoto l"), @NamedQuery(name = "LogDeltaFoto.deleteAll", query = "DELETE FROM LogDeltaFoto") }) public class LogDeltaFoto implements Serializable { private static final long serialVersionUID = 1L; private long idDeltaFoto; - private Clob blDeltaFoto; + private String blDeltaFoto; private Calendar dtRegEvento; private LogOggettoEvento logOggettoEvento1; private LogOggettoEvento logOggettoEvento2; @@ -26,7 +58,7 @@ public LogDeltaFoto() { } @Id - @SequenceGenerator(name = "LOG_DELTA_FOTO_IDDELTAFOTO_GENERATOR", sequenceName = "SACER_LOG.SLOG_DELTA_FOTO", allocationSize = 1) + @SequenceGenerator(name = "LOG_DELTA_FOTO_IDDELTAFOTO_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_DELTA_FOTO", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_DELTA_FOTO_IDDELTAFOTO_GENERATOR") @Column(name = "ID_DELTA_FOTO") public long getIdDeltaFoto() { @@ -37,12 +69,13 @@ public void setIdDeltaFoto(long idDeltaFoto) { this.idDeltaFoto = idDeltaFoto; } - @Column(name = "BL_DELTA_FOTO") - public Clob getBlDeltaFoto() { + @ColumnTransformer(read = "to_clob(columnName)", write = "?") + @Column(name = "BL_DELTA_FOTO", columnDefinition = "XMLType") + public String getBlDeltaFoto() { return this.blDeltaFoto; } - public void setBlDeltaFoto(Clob blDeltaFoto) { + public void setBlDeltaFoto(String blDeltaFoto) { this.blDeltaFoto = blDeltaFoto; } diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEvento.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEvento.java index e668e96..038806e 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEvento.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEvento.java @@ -1,16 +1,46 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; import java.util.Calendar; -import javax.persistence.*; import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + /** * The persistent class for the LOG_EVENTO database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_EVENTO") +@Table(schema = "SACER_LOG", name = "LOG_EVENTO") @NamedQueries({ @NamedQuery(name = "LogEvento.findAll", query = "SELECT l FROM LogEvento l"), @NamedQuery(name = "LogEvento.deleteAll", query = "DELETE FROM LogEvento") }) public class LogEvento implements Serializable { @@ -33,7 +63,7 @@ public LogEvento() { } @Id - @SequenceGenerator(name = "LOG_EVENTO_IDEVENTO_GENERATOR", sequenceName = "SACER_LOG.SLOG_EVENTO", allocationSize = 1) + @SequenceGenerator(name = "LOG_EVENTO_IDEVENTO_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_EVENTO", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_EVENTO_IDEVENTO_GENERATOR") @Column(name = "ID_EVENTO") public long getIdEvento() { diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoByScript.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoByScript.java index 05a01b8..44fc60d 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoByScript.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoByScript.java @@ -1,16 +1,42 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + /** * The persistent class for the LOG_EVENTO_BY_SCRIPT database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_EVENTO_BY_SCRIPT") +@Table(schema = "SACER_LOG", name = "LOG_EVENTO_BY_SCRIPT") @NamedQueries({ @NamedQuery(name = "LogEventoByScript.findByTipoOggettoId", query = "SELECT l FROM LogEventoByScript l WHERE l.idTipoOggetto = :idTipoOggetto AND l.idOggetto = :idOggetto"), @NamedQuery(name = "LogEventoByScript.deleteAll", query = "DELETE FROM LogEventoByScript") @@ -39,7 +65,7 @@ public LogEventoByScript() { } @Id - @SequenceGenerator(name = "LOG_EVENTO_BY_SCRIPT_IDEVENTOBYSCRIPT_GENERATOR", sequenceName = "SACER_LOG.SLOG_EVENTO_BY_SCRIPT", allocationSize = 1) + @SequenceGenerator(name = "LOG_EVENTO_BY_SCRIPT_IDEVENTOBYSCRIPT_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_EVENTO_BY_SCRIPT", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_EVENTO_BY_SCRIPT_IDEVENTOBYSCRIPT_GENERATOR") @Column(name = "ID_EVENTO_BY_SCRIPT") public long getIdEventoByScript() { diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoLoginUser.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoLoginUser.java new file mode 100644 index 0000000..d8f8ece --- /dev/null +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogEventoLoginUser.java @@ -0,0 +1,172 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.parer.sacerlog.entity; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * The persistent class for the LOG_EVENTO_LOGIN_USER database table. + * + */ +@Entity +@Table(schema = "SACER_LOG", name = "LOG_EVENTO_LOGIN_USER") +@NamedQuery(name = "LogEventoLoginUser.findAll", query = "SELECT l FROM LogEventoLoginUser l") +public class LogEventoLoginUser implements Serializable { + + private static final long serialVersionUID = 1L; + private Long idEventoLoginUser; + private String cdIndIpClient; + private String cdIndServer; + private String dsEvento; + private Date dtEvento; + private String nmUserid; + private String tipoEvento; + private String nmNomeUser; + private String nmCognomeUser; + private String cdFiscUser; + private String dsEmailUser; + private String cdIDEsterno; + + public LogEventoLoginUser() { + } + + @Id + @SequenceGenerator(name = "LOG_EVENTO_LOGIN_USER_IDEVENTOLOGINUSER_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_EVENTO_LOGIN_USER", allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_EVENTO_LOGIN_USER_IDEVENTOLOGINUSER_GENERATOR") + @Column(name = "ID_EVENTO_LOGIN_USER") + public Long getIdEventoLoginUser() { + return this.idEventoLoginUser; + } + + public void setIdEventoLoginUser(Long idEventoLoginUser) { + this.idEventoLoginUser = idEventoLoginUser; + } + + @Column(name = "CD_IND_IP_CLIENT") + public String getCdIndIpClient() { + return this.cdIndIpClient; + } + + public void setCdIndIpClient(String cdIndIpClient) { + this.cdIndIpClient = cdIndIpClient; + } + + @Column(name = "CD_IND_SERVER") + public String getCdIndServer() { + return this.cdIndServer; + } + + public void setCdIndServer(String cdIndServer) { + this.cdIndServer = cdIndServer; + } + + @Column(name = "DS_EVENTO") + public String getDsEvento() { + return this.dsEvento; + } + + public void setDsEvento(String dsEvento) { + this.dsEvento = dsEvento; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "DT_EVENTO") + public Date getDtEvento() { + return this.dtEvento; + } + + public void setDtEvento(Date dtEvento) { + this.dtEvento = dtEvento; + } + + @Column(name = "NM_USERID") + public String getNmUserid() { + return this.nmUserid; + } + + public void setNmUserid(String nmUserid) { + this.nmUserid = nmUserid; + } + + @Column(name = "TIPO_EVENTO") + public String getTipoEvento() { + return this.tipoEvento; + } + + public void setTipoEvento(String tipoEvento) { + this.tipoEvento = tipoEvento; + } + + @Column(name = "NM_NOME_USER") + public String getNmNomeUser() { + return nmNomeUser; + } + + public void setNmNomeUser(String nmNomeUser) { + this.nmNomeUser = nmNomeUser; + } + + @Column(name = "NM_COGNOME_USER") + public String getNmCognomeUser() { + return nmCognomeUser; + } + + public void setNmCognomeUser(String nmCognomeUser) { + this.nmCognomeUser = nmCognomeUser; + } + + @Column(name = "CD_FISC_USER") + public String getCdFiscUser() { + return cdFiscUser; + } + + public void setCdFiscUser(String cdFiscUser) { + this.cdFiscUser = cdFiscUser; + } + + @Column(name = "DS_EMAIL_USER") + public String getDsEmailUser() { + return dsEmailUser; + } + + public void setDsEmailUser(String dsEmailUser) { + this.dsEmailUser = dsEmailUser; + } + + @Column(name = "CD_ID_ESTERNO") + public String getCdIDEsterno() { + return cdIDEsterno; + } + + public void setCdIDEsterno(String cdIDEsterno) { + this.cdIDEsterno = cdIDEsterno; + } + +} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEvento.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEvento.java index 28fa354..666e57d 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEvento.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEvento.java @@ -1,32 +1,61 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; -import java.sql.Clob; import java.util.Calendar; -import javax.persistence.*; -import org.eclipse.persistence.annotations.Customizer; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +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.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.ColumnTransformer; /** * The persistent class for the LOG_FOTO_OGGETTO_EVENTO database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_FOTO_OGGETTO_EVENTO") -@Customizer(LogFotoOggettoEventoXMLDataCustomizer.class) +@Table(schema = "SACER_LOG", name = "LOG_FOTO_OGGETTO_EVENTO") @NamedQuery(name = "LogFotoOggettoEvento.deleteAll", query = "DELETE FROM LogFotoOggettoEvento") public class LogFotoOggettoEvento implements Serializable { private static final long serialVersionUID = 1L; private long idFotoOggettoEvento; private Calendar dtRegEvento; - private Clob blFotoOggetto; + private String blFotoOggetto; private LogOggettoEvento logOggettoEvento; public LogFotoOggettoEvento() { } @Id - @SequenceGenerator(name = "LOG_FOTO_OGGETTO_EVENTO_IDFOTOOGGETTOEVENTO_GENERATOR", sequenceName = "SACER_LOG.SLOG_FOTO_OGGETTO_EVENTO", allocationSize = 1) + @SequenceGenerator(name = "LOG_FOTO_OGGETTO_EVENTO_IDFOTOOGGETTOEVENTO_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_FOTO_OGGETTO_EVENTO", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_FOTO_OGGETTO_EVENTO_IDFOTOOGGETTOEVENTO_GENERATOR") @Column(name = "ID_FOTO_OGGETTO_EVENTO") public long getIdFotoOggettoEvento() { @@ -47,11 +76,13 @@ public void setDtRegEvento(Calendar dtRegEvento) { this.dtRegEvento = dtRegEvento; } - public Clob getBlFotoOggetto() { + @ColumnTransformer(read = "to_clob(columnName)", write = "?") + @Column(name = "BL_FOTO_OGGETTO", columnDefinition = "XMLType") + public String getBlFotoOggetto() { return this.blFotoOggetto; } - public void setBlFotoOggetto(Clob blFotoOggetto) { + public void setBlFotoOggetto(String blFotoOggetto) { this.blFotoOggetto = blFotoOggetto; } diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEventoXMLDataCustomizer.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEventoXMLDataCustomizer.java deleted file mode 100644 index 4c32986..0000000 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogFotoOggettoEventoXMLDataCustomizer.java +++ /dev/null @@ -1,22 +0,0 @@ -package it.eng.parer.sacerlog.entity; - -import org.eclipse.persistence.config.DescriptorCustomizer; -import org.eclipse.persistence.descriptors.ClassDescriptor; -import org.eclipse.persistence.mappings.xdb.DirectToXMLTypeMapping; - -/** - * - * @author Iacolucci_M - */ -public class LogFotoOggettoEventoXMLDataCustomizer implements DescriptorCustomizer { - - public void customize(final ClassDescriptor descriptor) throws Exception { - descriptor.removeMappingForAttributeName("blFotoOggetto"); - DirectToXMLTypeMapping mapping = new DirectToXMLTypeMapping(); - mapping.setAttributeName("blFotoOggetto"); // nome dell'attributo dell'entita' - mapping.setFieldName("BL_FOTO_OGGETTO"); // nome della colonna del DBname of the data base column - mapping.setFieldType(java.sql.Types.NVARCHAR); - descriptor.addMapping(mapping); - } - -} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogOggettoEvento.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogOggettoEvento.java index b4c97bc..eba4107 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogOggettoEvento.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/LogOggettoEvento.java @@ -1,19 +1,49 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.entity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + /** * The persistent class for the LOG_OGGETTO_EVENTO database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_OGGETTO_EVENTO") +@Table(schema = "SACER_LOG", name = "LOG_OGGETTO_EVENTO") @NamedQueries({ @NamedQuery(name = "LogOggettoEvento.findAll", query = "SELECT l FROM LogOggettoEvento l"), @NamedQuery(name = "LogOggettoEvento.deleteAll", query = "DELETE FROM LogOggettoEvento") }) -@NamedQuery(name = "LogOggettoEvento.findAll", query = "SELECT l FROM LogOggettoEvento l") public class LogOggettoEvento implements Serializable { private static final long serialVersionUID = 1L; @@ -31,7 +61,7 @@ public LogOggettoEvento() { } @Id - @SequenceGenerator(name = "LOG_OGGETTO_EVENTO_IDOGGETTOEVENTO_GENERATOR", sequenceName = "SACER_LOG.SLOG_OGGETTO_EVENTO", allocationSize = 1) + @SequenceGenerator(name = "LOG_OGGETTO_EVENTO_IDOGGETTOEVENTO_GENERATOR", schema = "SACER_LOG", sequenceName = "SLOG_OGGETTO_EVENTO", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "LOG_OGGETTO_EVENTO_IDOGGETTOEVENTO_GENERATOR") @Column(name = "ID_OGGETTO_EVENTO") public long getIdOggettoEvento() { diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/constraint/ConstLogEventoLoginUser.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/constraint/ConstLogEventoLoginUser.java new file mode 100644 index 0000000..2ba18aa --- /dev/null +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/entity/constraint/ConstLogEventoLoginUser.java @@ -0,0 +1,50 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.parer.sacerlog.entity.constraint; + +/** + * + * @author Bonora_L + */ +public class ConstLogEventoLoginUser { + + public enum TipoEvento { + BAD_PASS, BAD_USER, EXPIRED, LOCKED, LOGIN_OK, SET_PSW, BAD_USER_ASSOCIATION, BAD_CF + } + + public static final String NM_ATTORE_ONLINE = "SacerIam OnLine"; + public static final String NM_ATTORE_WS = "SacerIam WS"; + + public static final String DS_EVENTO_UNKNOWN_USER = "Unknown user"; + public static final String DS_EVENTO_ACCOUNT_DISABLED = "Account disabled"; + public static final String DS_EVENTO_ACCOUNT_EXPIRED_ON = "Account expired on {0}"; + public static final String DS_EVENTO_BAD_PSW = "Bad password"; + public static final String DS_EVENTO_RESET_PSW = "Reset password utente"; + public static final String DS_EVENTO_EDIT_PSW = "Modifica password da parte dell'utente"; + public static final String DS_EVENTO_BAD_PSW_EDIT_PSW = "Comunicazione della vecchia password errata nell'ambito della funzione di \"Modifica password\""; + public static final String DS_EVENTO_USR_LOCKED_EDIT_PSW = "Comunicazione di utente disabilitato nell'ambito della funzione di \"Modifica password\""; + public static final String DS_EVENTO_UNKNOWN_USR_EDIT_PSW = "Comunicazione di utente inesistente nell'ambito della funzione di \"Modifica password\""; + public static final String DS_EVENTO_UNKNOWN_USR_ASSOCIA_CF = "Comunicazione di utente inesistente nell'ambito della funzione di \"Associazione codice fiscale\""; + public static final String DS_EVENTO_BAD_PSW_ASSOCIA_CF = "Comunicazione di password errata nell'ambito della funzione di \"Associazione codice fiscale\""; + public static final String DS_EVENTO_BAD_CF_SPID = "SPID - Codice fiscale non trovato nella base dati"; + // public static final String DS_EVENTO_BAD_PSW_DISABLE_EDIT_PSW = "Comunicazione della vecchia password errata + // nell'ambito della funzione di \"Modifica password\"; l'utente viene disabilitato"; + public static final String DS_EVENTO_INSERT_PSW = "Inserimento nuova password utente"; + public static final String DS_EVENTO_RIATTIVA_USER = "Riattivazione utente"; + public static final String DS_EVENTO_INSERT_USER = "Inserimento utente"; +} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/LogParam.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/LogParam.java index ddc809d..c74ee91 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/LogParam.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/LogParam.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/TransactionLogContext.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/TransactionLogContext.java index e7e9220..ec9972f 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/TransactionLogContext.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/util/TransactionLogContext.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogChiaveTiOgg.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogChiaveTiOgg.java index 40614b0..79d90bd 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogChiaveTiOgg.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogChiaveTiOgg.java @@ -1,9 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the APL_V_LOG_CHIAVE_TI_OGG database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogFotoTiEvnOgg.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogFotoTiEvnOgg.java index bc81276..05970bd 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogFotoTiEvnOgg.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogFotoTiEvnOgg.java @@ -1,9 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the APL_V_LOG_FOTO_TI_EVN_OGG database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogInit.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogInit.java index 9f63b7f..8b5637b 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogInit.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogInit.java @@ -1,9 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the APL_V_LOG_INIT database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvn.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvn.java index a8b2037..93315ef 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvn.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvn.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the APL_V_LOG_TI_EVN database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigine.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigine.java index c9b70b3..e1f1321 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigine.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigine.java @@ -1,8 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; -import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; /** * The persistent class for the APL_V_LOG_TI_EVN_CON_ORIGINE database table. @@ -11,15 +33,12 @@ @Entity @Table(name = "APL_V_LOG_TI_EVN_CON_ORIGINE", schema = "SACER_IAM") @NamedQueries({ @NamedQuery(name = "AplVLogTiEvnConOrigine.findAll", query = "SELECT a FROM AplVLogTiEvnConOrigine a"), - @NamedQuery(name = "AplVLogTiEvnConOrigine.findByApplicIdAzioneCompSw", query = "SELECT a FROM AplVLogTiEvnConOrigine a WHERE a.nmApplic = :nmApplic AND a.idAzionePaginaCompSw = :idAzionePaginaCompSw"), + @NamedQuery(name = "AplVLogTiEvnConOrigine.findByApplicIdAzioneCompSw", query = "SELECT a FROM AplVLogTiEvnConOrigine a WHERE a.nmApplic = :nmApplic AND a.id.idAzionePaginaCompSw = :idAzionePaginaCompSw"), @NamedQuery(name = "AplVLogTiEvnConOrigine.findByApplicFinestraAzione", query = "SELECT a FROM AplVLogTiEvnConOrigine a WHERE a.nmApplic = :nmApplic AND a.nmPaginaCompSw = :nmPaginaCompSw AND a.nmAzionePaginaCompSw = :nmAzionePaginaCompSw") }) public class AplVLogTiEvnConOrigine implements Serializable { private static final long serialVersionUID = 1L; - private BigDecimal idApplic; - private BigDecimal idAzionePaginaCompSw; - private BigDecimal idPaginaCompSw; - private BigDecimal idTipoEvento; + private AplVLogTiEvnConOrigineId aplVLogTiEvnConOrigineId; private String nmApplic; private String nmAzionePaginaCompSw; private String nmPaginaCompSw; @@ -31,44 +50,13 @@ public class AplVLogTiEvnConOrigine implements Serializable { public AplVLogTiEvnConOrigine() { } - @Id - @Column(name = "ID_APPLIC") - public BigDecimal getIdApplic() { - return this.idApplic; - } - - public void setIdApplic(BigDecimal idApplic) { - this.idApplic = idApplic; - } - - @Id - @Column(name = "ID_AZIONE_PAGINA_COMP_SW") - public BigDecimal getIdAzionePaginaCompSw() { - return this.idAzionePaginaCompSw; - } - - public void setIdAzionePaginaCompSw(BigDecimal idAzionePaginaCompSw) { - this.idAzionePaginaCompSw = idAzionePaginaCompSw; - } - - @Id - @Column(name = "ID_PAGINA_COMP_SW") - public BigDecimal getIdPaginaCompSw() { - return this.idPaginaCompSw; - } - - public void setIdPaginaCompSw(BigDecimal idPaginaCompSw) { - this.idPaginaCompSw = idPaginaCompSw; - } - - @Id - @Column(name = "ID_TIPO_EVENTO") - public BigDecimal getIdTipoEvento() { - return this.idTipoEvento; + @EmbeddedId + public AplVLogTiEvnConOrigineId getAplVLogTiEvnConOrigineId() { + return aplVLogTiEvnConOrigineId; } - public void setIdTipoEvento(BigDecimal idTipoEvento) { - this.idTipoEvento = idTipoEvento; + public void setAplVLogTiEvnConOrigineId(AplVLogTiEvnConOrigineId aplVLogTiEvnConOrigineId) { + this.aplVLogTiEvnConOrigineId = aplVLogTiEvnConOrigineId; } @Column(name = "NM_APPLIC") diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigineId.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigineId.java new file mode 100644 index 0000000..e8428ff --- /dev/null +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiEvnConOrigineId.java @@ -0,0 +1,112 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.parer.sacerlog.viewEntity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class AplVLogTiEvnConOrigineId implements Serializable { + + private static final long serialVersionUID = 1L; + private BigDecimal idApplic; + private BigDecimal idAzionePaginaCompSw; + private BigDecimal idPaginaCompSw; + private BigDecimal idTipoEvento; + + public AplVLogTiEvnConOrigineId() { + } + + @Column(name = "ID_APPLIC") + public BigDecimal getIdApplic() { + return this.idApplic; + } + + public void setIdApplic(BigDecimal idApplic) { + this.idApplic = idApplic; + } + + @Column(name = "ID_AZIONE_PAGINA_COMP_SW") + public BigDecimal getIdAzionePaginaCompSw() { + return this.idAzionePaginaCompSw; + } + + public void setIdAzionePaginaCompSw(BigDecimal idAzionePaginaCompSw) { + this.idAzionePaginaCompSw = idAzionePaginaCompSw; + } + + @Column(name = "ID_PAGINA_COMP_SW") + public BigDecimal getIdPaginaCompSw() { + return this.idPaginaCompSw; + } + + public void setIdPaginaCompSw(BigDecimal idPaginaCompSw) { + this.idPaginaCompSw = idPaginaCompSw; + } + + @Column(name = "ID_TIPO_EVENTO") + public BigDecimal getIdTipoEvento() { + return this.idTipoEvento; + } + + public void setIdTipoEvento(BigDecimal idTipoEvento) { + this.idTipoEvento = idTipoEvento; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 59 * hash + Objects.hashCode(this.idApplic); + hash = 59 * hash + Objects.hashCode(this.idAzionePaginaCompSw); + hash = 59 * hash + Objects.hashCode(this.idPaginaCompSw); + hash = 59 * hash + Objects.hashCode(this.idTipoEvento); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final AplVLogTiEvnConOrigineId other = (AplVLogTiEvnConOrigineId) obj; + if (!Objects.equals(this.idApplic, other.idApplic)) { + return false; + } + if (!Objects.equals(this.idAzionePaginaCompSw, other.idAzionePaginaCompSw)) { + return false; + } + if (!Objects.equals(this.idPaginaCompSw, other.idPaginaCompSw)) { + return false; + } + if (!Objects.equals(this.idTipoEvento, other.idTipoEvento)) { + return false; + } + return true; + } + +} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiOgg.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiOgg.java index d380cc0..0614cf4 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiOgg.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTiOgg.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the APL_V_LOG_TI_OGG database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTrigTiEvnOgg.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTrigTiEvnOgg.java index c17e674..dd488f0 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTrigTiEvnOgg.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVLogTrigTiEvnOgg.java @@ -1,9 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the APL_V_LOG_TRIG_TI_EVN_OGG database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVParamApplic.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVParamApplic.java index 3c9929b..31deb81 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVParamApplic.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/AplVParamApplic.java @@ -1,6 +1,24 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/ILogVRicEventi.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/ILogVRicEventi.java index a50e74a..d3e78fa 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/ILogVRicEventi.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/ILogVRicEventi.java @@ -1,3 +1,20 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVDeltaAsserzioni.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVDeltaAsserzioni.java index 3edbb87..7eb7d1d 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVDeltaAsserzioni.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVDeltaAsserzioni.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the LOG_V_DELTA_ASSERZIONI database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisAsserzioniDati.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisAsserzioniDati.java index 6d52dc5..191fe9f 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisAsserzioniDati.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisAsserzioniDati.java @@ -1,9 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the LOG_V_LIS_ASSERZIONI_DATI database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoByScript.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoByScript.java index 7ce8349..ab17652 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoByScript.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoByScript.java @@ -1,17 +1,39 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; import java.math.BigDecimal; import java.sql.Timestamp; -import javax.persistence.*; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; /** * The persistent class for the LOG_V_LIS_EVENTO_BY_SCRIPT database table. * */ @Entity -@Table(name = "SACER_LOG.LOG_V_LIS_EVENTO_BY_SCRIPT") +@Table(schema = "SACER_LOG", name = "LOG_V_LIS_EVENTO_BY_SCRIPT") @NamedQueries({ @NamedQuery(name = "LogVLisEventoByScript.findByTipoOggettoId", query = "SELECT l FROM LogVLisEventoByScript l WHERE l.idTipoOggetto = :idTipoOggetto AND l.idOggetto = :idOggetto"), @NamedQuery(name = "LogVLisEventoByScript.findDistinctByNmApplic", query = "SELECT DISTINCT l.idTipoOggetto, l.idOggetto, l.nmTipoOggetto FROM LogVLisEventoByScript l WHERE l.nmApplic = :nmApplic") }) diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoOggetto.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoOggetto.java index 5f68b71..a494632 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoOggetto.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLisEventoOggetto.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; -import java.sql.Timestamp; import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; /** * The persistent class for the LOG_V_LIS_EVENTO_OGGETTO database table. diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLogAgente.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLogAgente.java index 52a779b..3027b0b 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLogAgente.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVLogAgente.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the LOG_V_LOG_AGENTE database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventi.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventi.java index 3a918b8..130c13a 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventi.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventi.java @@ -1,10 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; -import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; + /** * The persistent class for the LOG_V_RIC_EVENTI database table. * @@ -20,11 +43,10 @@ public class LogVRicEventi implements ILogVRicEventi { private String dsKeyOggetto; private Timestamp dtRegEvento; private BigDecimal idAgente; - private BigDecimal idAgenteEvento; + private LogVRicEventiId logVRicEventiId; private BigDecimal idApplic; private BigDecimal idEvento; private BigDecimal idOggetto; - private BigDecimal idOggettoEvento; private BigDecimal idOrganizApplic; private BigDecimal idTipoEvento; private BigDecimal idTipoOggetto; @@ -51,6 +73,15 @@ public class LogVRicEventi implements ILogVRicEventi { public LogVRicEventi() { } + @EmbeddedId + public LogVRicEventiId getLogVRicEventiId() { + return logVRicEventiId; + } + + public void setLogVRicEventiId(LogVRicEventiId logVRicEventiId) { + this.logVRicEventiId = logVRicEventiId; + } + @Column(name = "DS_KEY_OGGETTO") @Override public String getDsKeyOggetto() { @@ -84,16 +115,18 @@ public void setIdAgente(BigDecimal idAgente) { this.idAgente = idAgente; } - @Id - @Column(name = "ID_AGENTE_EVENTO") @Override + @Transient public BigDecimal getIdAgenteEvento() { - return this.idAgenteEvento; + return this.logVRicEventiId.getIdAgenteEvento(); } @Override public void setIdAgenteEvento(BigDecimal idAgenteEvento) { - this.idAgenteEvento = idAgenteEvento; + if (this.logVRicEventiId == null) { + this.logVRicEventiId = new LogVRicEventiId(); + } + logVRicEventiId.setIdAgenteEvento(idAgenteEvento); } @Column(name = "ID_APPLIC") @@ -129,16 +162,18 @@ public void setIdOggetto(BigDecimal idOggetto) { this.idOggetto = idOggetto; } - @Id - @Column(name = "ID_OGGETTO_EVENTO") @Override + @Transient public BigDecimal getIdOggettoEvento() { - return this.idOggettoEvento; + return this.logVRicEventiId.getIdOggettoEvento(); } @Override public void setIdOggettoEvento(BigDecimal idOggettoEvento) { - this.idOggettoEvento = idOggettoEvento; + if (this.logVRicEventiId == null) { + this.logVRicEventiId = new LogVRicEventiId(); + } + this.logVRicEventiId.setIdOggettoEvento(idOggettoEvento); } @Column(name = "ID_TIPO_EVENTO") diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiId.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiId.java new file mode 100644 index 0000000..f09f566 --- /dev/null +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiId.java @@ -0,0 +1,84 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.parer.sacerlog.viewEntity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +/** + * The persistent class for the LOG_V_RIC_EVENTI database table. + * + */ +@Embeddable +public class LogVRicEventiId implements Serializable { + + private BigDecimal idOggettoEvento; + private BigDecimal idAgenteEvento; + + @Column(name = "ID_OGGETTO_EVENTO") + public BigDecimal getIdOggettoEvento() { + return idOggettoEvento; + } + + public void setIdOggettoEvento(BigDecimal idOggettoEvento) { + this.idOggettoEvento = idOggettoEvento; + } + + @Column(name = "ID_AGENTE_EVENTO") + public BigDecimal getIdAgenteEvento() { + return idAgenteEvento; + } + + public void setIdAgenteEvento(BigDecimal idAgenteEvento) { + this.idAgenteEvento = idAgenteEvento; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 89 * hash + Objects.hashCode(this.idOggettoEvento); + hash = 89 * hash + Objects.hashCode(this.idAgenteEvento); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final LogVRicEventiId other = (LogVRicEventiId) obj; + if (!Objects.equals(this.idOggettoEvento, other.idOggettoEvento)) { + return false; + } + if (!Objects.equals(this.idAgenteEvento, other.idAgenteEvento)) { + return false; + } + return true; + } + +} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganiz.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganiz.java index 6abf0fc..adfcea1 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganiz.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganiz.java @@ -1,10 +1,33 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; -import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Transient; + /** * The persistent class for the LOG_V_RIC_EVENTI_ORGANIZ database table. * @@ -20,11 +43,9 @@ public class LogVRicEventiOrganiz implements ILogVRicEventi { private String dsKeyOggetto; private Timestamp dtRegEvento; private BigDecimal idAgente; - private BigDecimal idAgenteEvento; private BigDecimal idApplic; private BigDecimal idEvento; private BigDecimal idOggetto; - private BigDecimal idOggettoEvento; private BigDecimal idOrganizApplic; private BigDecimal idTipoEvento; private BigDecimal idTipoOggetto; @@ -47,10 +68,20 @@ public class LogVRicEventiOrganiz implements ILogVRicEventi { private String tipoClasseEvento; private String tipoOrigineAgente; private String dsMotivoScript; + private LogVRicEventiOrganizId logVRicEventiOrganizId; public LogVRicEventiOrganiz() { } + @EmbeddedId + public LogVRicEventiOrganizId getLogVRicEventiOrganizId() { + return logVRicEventiOrganizId; + } + + public void setLogVRicEventiOrganizId(LogVRicEventiOrganizId logVRicEventiOrganizId) { + this.logVRicEventiOrganizId = logVRicEventiOrganizId; + } + @Column(name = "DS_KEY_OGGETTO") @Override public String getDsKeyOggetto() { @@ -84,16 +115,22 @@ public void setIdAgente(BigDecimal idAgente) { this.idAgente = idAgente; } - @Id - @Column(name = "ID_AGENTE_EVENTO") @Override + @Transient public BigDecimal getIdAgenteEvento() { - return this.idAgenteEvento; + return this.logVRicEventiOrganizId.getIdAgenteEvento(); } @Override public void setIdAgenteEvento(BigDecimal idAgenteEvento) { - this.idAgenteEvento = idAgenteEvento; + initId(); + this.logVRicEventiOrganizId.setIdAgenteEvento(idAgenteEvento); + } + + private void initId() { + if (logVRicEventiOrganizId == null) { + this.logVRicEventiOrganizId = new LogVRicEventiOrganizId(); + } } @Column(name = "ID_APPLIC") @@ -129,16 +166,16 @@ public void setIdOggetto(BigDecimal idOggetto) { this.idOggetto = idOggetto; } - @Id - @Column(name = "ID_OGGETTO_EVENTO") @Override + @Transient public BigDecimal getIdOggettoEvento() { - return this.idOggettoEvento; + return this.logVRicEventiOrganizId.getIdOggettoEvento(); } @Override public void setIdOggettoEvento(BigDecimal idOggettoEvento) { - this.idOggettoEvento = idOggettoEvento; + initId(); + this.logVRicEventiOrganizId.setIdOggettoEvento(idOggettoEvento); } @Column(name = "ID_TIPO_EVENTO") diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganizId.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganizId.java new file mode 100644 index 0000000..6116739 --- /dev/null +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVRicEventiOrganizId.java @@ -0,0 +1,84 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.parer.sacerlog.viewEntity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class LogVRicEventiOrganizId implements Serializable { + + private static final long serialVersionUID = 1L; + private BigDecimal idAgenteEvento; + private BigDecimal idOggettoEvento; + + public LogVRicEventiOrganizId() { + } + + @Column(name = "ID_AGENTE_EVENTO") + public BigDecimal getIdAgenteEvento() { + return this.idAgenteEvento; + } + + public void setIdAgenteEvento(BigDecimal idAgenteEvento) { + this.idAgenteEvento = idAgenteEvento; + } + + @Column(name = "ID_OGGETTO_EVENTO") + public BigDecimal getIdOggettoEvento() { + return this.idOggettoEvento; + } + + public void setIdOggettoEvento(BigDecimal idOggettoEvento) { + this.idOggettoEvento = idOggettoEvento; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + Objects.hashCode(this.idAgenteEvento); + hash = 59 * hash + Objects.hashCode(this.idOggettoEvento); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final LogVRicEventiOrganizId other = (LogVRicEventiOrganizId) obj; + if (!Objects.equals(this.idAgenteEvento, other.idAgenteEvento)) { + return false; + } + if (!Objects.equals(this.idOggettoEvento, other.idOggettoEvento)) { + return false; + } + return true; + } + +} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganiz.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganiz.java index dfef2fb..99a9fdf 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganiz.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganiz.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the LOG_V_USR_ABIL_ORGANIZ database table. * @@ -11,7 +34,7 @@ @Entity @Table(name = "LOG_V_USR_ABIL_ORGANIZ", schema = "SACER_LOG") @NamedQueries({ @NamedQuery(name = "LogVUsrAbilOrganiz.findAll", query = "SELECT u FROM LogVUsrAbilOrganiz u"), - @NamedQuery(name = "LogVUsrAbilOrganiz.findByApplicAndUser", query = "SELECT u FROM LogVUsrAbilOrganiz u WHERE u.nmApplic = :nmApplic AND u.idUserIam = :idUserIam ORDER BY u.dlCompositoOrganiz"), }) + @NamedQuery(name = "LogVUsrAbilOrganiz.findByApplicAndUser", query = "SELECT u FROM LogVUsrAbilOrganiz u WHERE u.nmApplic = :nmApplic AND u.logVUsrAbilOrganizId.idUserIam = :idUserIam ORDER BY u.dlCompositoOrganiz"), }) public class LogVUsrAbilOrganiz implements Serializable { private static final long serialVersionUID = 1L; @@ -22,23 +45,32 @@ public class LogVUsrAbilOrganiz implements Serializable { private BigDecimal idApplic; private BigDecimal idDichAbilOrganiz; private BigDecimal idOrganizApplic; - private BigDecimal idOrganizIam; private BigDecimal idOrganizIamPadre; private BigDecimal idTipoOrganiz; - private BigDecimal idUserIam; private BigDecimal idUsoUserApplic; private String nmApplic; private String nmOrganiz; private String nmTipoOrganiz; + private LogVUsrAbilOrganizId logVUsrAbilOrganizId; public LogVUsrAbilOrganiz() { } public LogVUsrAbilOrganiz(BigDecimal idOrganizIam, BigDecimal idOrganizApplic) { - this.idOrganizIam = idOrganizIam; + this.logVUsrAbilOrganizId = new LogVUsrAbilOrganizId(); + logVUsrAbilOrganizId.setIdOrganizIam(idOrganizIam); this.idOrganizApplic = idOrganizApplic; } + @EmbeddedId + public LogVUsrAbilOrganizId getLogVUsrAbilOrganizId() { + return logVUsrAbilOrganizId; + } + + public void setLogVUsrAbilOrganizId(LogVUsrAbilOrganizId logVUsrAbilOrganizId) { + this.logVUsrAbilOrganizId = logVUsrAbilOrganizId; + } + @Column(name = "DL_COMPOSITO_ORGANIZ") public String getDlCompositoOrganiz() { return this.dlCompositoOrganiz; @@ -66,7 +98,7 @@ public void setDsOrganiz(String dsOrganiz) { this.dsOrganiz = dsOrganiz; } - @Column(name = "FL_ATTIVO") + @Column(name = "FL_ATTIVO", columnDefinition = "char") public String getFlAttivo() { return this.flAttivo; } @@ -102,16 +134,6 @@ public void setIdOrganizApplic(BigDecimal idOrganizApplic) { this.idOrganizApplic = idOrganizApplic; } - @Id - @Column(name = "ID_ORGANIZ_IAM") - public BigDecimal getIdOrganizIam() { - return this.idOrganizIam; - } - - public void setIdOrganizIam(BigDecimal idOrganizIam) { - this.idOrganizIam = idOrganizIam; - } - @Column(name = "ID_ORGANIZ_IAM_PADRE") public BigDecimal getIdOrganizIamPadre() { return this.idOrganizIamPadre; @@ -130,16 +152,6 @@ public void setIdTipoOrganiz(BigDecimal idTipoOrganiz) { this.idTipoOrganiz = idTipoOrganiz; } - @Id - @Column(name = "ID_USER_IAM") - public BigDecimal getIdUserIam() { - return this.idUserIam; - } - - public void setIdUserIam(BigDecimal idUserIam) { - this.idUserIam = idUserIam; - } - @Column(name = "ID_USO_USER_APPLIC") public BigDecimal getIdUsoUserApplic() { return this.idUsoUserApplic; diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganizId.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganizId.java new file mode 100644 index 0000000..a8e6d55 --- /dev/null +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVUsrAbilOrganizId.java @@ -0,0 +1,84 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package it.eng.parer.sacerlog.viewEntity; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Objects; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class LogVUsrAbilOrganizId implements Serializable { + + private static final long serialVersionUID = 1L; + private BigDecimal idOrganizIam; + private BigDecimal idUserIam; + + public LogVUsrAbilOrganizId() { + } + + @Column(name = "ID_ORGANIZ_IAM") + public BigDecimal getIdOrganizIam() { + return this.idOrganizIam; + } + + public void setIdOrganizIam(BigDecimal idOrganizIam) { + this.idOrganizIam = idOrganizIam; + } + + @Column(name = "ID_USER_IAM") + public BigDecimal getIdUserIam() { + return this.idUserIam; + } + + public void setIdUserIam(BigDecimal idUserIam) { + this.idUserIam = idUserIam; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 67 * hash + Objects.hashCode(this.idOrganizIam); + hash = 67 * hash + Objects.hashCode(this.idUserIam); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final LogVUsrAbilOrganizId other = (LogVUsrAbilOrganizId) obj; + if (!Objects.equals(this.idOrganizIam, other.idOrganizIam)) { + return false; + } + if (!Objects.equals(this.idUserIam, other.idUserIam)) { + return false; + } + return true; + } + +} diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoOggetto.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoOggetto.java index ac27344..c14491a 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoOggetto.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoOggetto.java @@ -1,9 +1,31 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; -import java.sql.Timestamp; import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; /** * The persistent class for the LOG_V_VIS_EVENTO_OGGETTO database table. diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoPrincTx.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoPrincTx.java index 87aad67..5584471 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoPrincTx.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisEventoPrincTx.java @@ -1,10 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; import java.math.BigDecimal; import java.sql.Timestamp; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + /** * The persistent class for the LOG_V_VIS_EVENTO_PRINC_TX database table. * diff --git a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisOggetto.java b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisOggetto.java index d3521a9..bd14dcd 100644 --- a/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisOggetto.java +++ b/spagolite-sl-jpa/src/main/java/it/eng/parer/sacerlog/viewEntity/LogVVisOggetto.java @@ -1,9 +1,32 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.viewEntity; import java.io.Serializable; -import javax.persistence.*; -import java.sql.Timestamp; import java.math.BigDecimal; +import java.sql.Timestamp; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; /** * The persistent class for the LOG_V_VIS_OGGETTO database table. diff --git a/spagolite-sl-slg/pom.xml b/spagolite-sl-slg/pom.xml index 2ad3683..5031f22 100644 --- a/spagolite-sl-slg/pom.xml +++ b/spagolite-sl-slg/pom.xml @@ -7,7 +7,7 @@ it.eng.parer spagofat - 4.1.28-SNAPSHOT + 4.11.1-SNAPSHOT @@ -23,23 +23,14 @@ it.eng.parer spagofat-sl-jpa - org.apache.commons commons-collections4 - - - - org.glassfish.main.persistence - eclipselink-wrapper - pom - provided + + org.dom4j + dom4j + @@ -51,9 +42,9 @@ parer-tool-compilation generate-sources - 1.7 - 1.7 - 1.7 + 1.8 + 1.8 + 1.8 it/eng/parer/sacerlog/slite/gen/util/*.java @@ -72,9 +63,9 @@ createSliteDir generate-sources - + - + run @@ -106,6 +97,4 @@ - - diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/util/ParerTool.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/util/ParerTool.java index 72093c6..1a4d2b5 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/util/ParerTool.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/util/ParerTool.java @@ -1,9 +1,27 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.util; -import it.eng.util.SpringLiteTool; import java.io.File; import java.nio.charset.Charset; +import it.eng.util.SpringLiteTool; + public class ParerTool extends SpringLiteTool { private static final String GEN_PACKAGE = "it.eng.parer.sacerlog.slite.gen"; @@ -27,9 +45,9 @@ public static void main(String[] args) } System.out.println("Percorso corrente : " + new File(".").getAbsolutePath()); System.setProperty("file.encoding", "UTF-8"); - java.lang.reflect.Field charset = Charset.class.getDeclaredField("defaultCharset"); - charset.setAccessible(true); - charset.set(null, null); + // java.lang.reflect.Field charset = Charset.class.getDeclaredField("defaultCharset"); + // charset.setAccessible(true); + // charset.set(null, null); String actionPath = basedir.replaceAll("\\\\", "/") + "/../spagolite-sl-web/src/main/java/it/eng/parer/sacerlog/web/action"; ParerTool myParerTool = new ParerTool(actionPath, null, GEN_PACKAGE, ACTION_PACKAGE, FORM_PACKAGE); diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggRowBean.java index 0c84dcf..dac04ae 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggRowBean.java @@ -1,12 +1,29 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; + +import it.eng.parer.sacerlog.viewEntity.AplVLogTiOgg; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.db.base.JEEBaseRowInterface; import it.eng.spagoLite.db.base.row.BaseRow; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import it.eng.parer.sacerlog.viewEntity.AplVLogTiOgg; - -import java.math.BigDecimal; /** * RowBean per la tabella Apl_V_LOG_TI_OGG diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableBean.java index e920521..7f18491 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableBean.java @@ -1,15 +1,27 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Apl_V_Tipo_Oggetto +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.AplVLogTiOggRowBean; -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.util.Iterator; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * TableBean per la tabella Apl_V_Tipo_Oggetto * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableDescriptor.java index 17d4750..60af250 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/AplVLogTiOggTableDescriptor.java @@ -1,12 +1,28 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; -import javax.annotation.Generated; + +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; /** * @author Sloth diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiRowBean.java index 60f8449..78a39b0 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiRowBean.java @@ -1,13 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; + import it.eng.parer.sacerlog.viewEntity.LogVLisAsserzioniDati; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.db.base.JEEBaseRowInterface; import it.eng.spagoLite.db.base.row.BaseRow; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import java.math.BigDecimal; - /** * RowBean per la tabella Log_V_Lis_Asserzioni_Dati * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableBean.java index 5ffc065..1a75d98 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableBean.java @@ -1,15 +1,27 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Log_V_Lis_Asserzioni_Dati +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVLisAsserzioniDatiRowBean; -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.util.Iterator; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * TableBean per la tabella Log_V_Lis_Asserzioni_Dati * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableDescriptor.java index b07ad25..abe2a26 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisAsserzioniDatiTableDescriptor.java @@ -1,12 +1,28 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; -import javax.annotation.Generated; + +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; /** * @author Sloth diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoRowBean.java index 0904cd2..bc4300f 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoRowBean.java @@ -1,13 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import it.eng.parer.sacerlog.viewEntity.LogVLisEventoOggetto; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.db.base.JEEBaseRowInterface; import it.eng.spagoLite.db.base.row.BaseRow; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import it.eng.parer.sacerlog.viewEntity.LogVLisEventoOggetto; - -import java.math.BigDecimal; -import java.sql.Timestamp; /** * RowBean per la tabella Log_V_Lis_Evento_Oggetto diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableBean.java index 23f97c8..8268f8b 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableBean.java @@ -1,15 +1,27 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Log_V_Lis_Evento_Oggetto +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVLisEventoOggettoRowBean; -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.util.Iterator; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * TableBean per la tabella Log_V_Lis_Evento_Oggetto * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableDescriptor.java index 1da815e..aa24708 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVLisEventoOggettoTableDescriptor.java @@ -1,12 +1,29 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * @author Sloth * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiRowBean.java index 43139be..ef29fc4 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiRowBean.java @@ -1,5 +1,25 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; +import java.sql.Timestamp; + import it.eng.parer.sacerlog.viewEntity.ILogVRicEventi; import it.eng.spagoLite.db.base.BaseRowInterface; //import it.eng.spagoLite.db.base.JEEBaseRowInterface; @@ -7,9 +27,6 @@ import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; //import it.eng.parer.sacerlog.viewEntity.LogVRicEventi; -import java.math.BigDecimal; -import java.sql.Timestamp; - /** * RowBean per la tabella Log_V_Ric_Eventi * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableBean.java index f8cbacf..aa24ae1 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableBean.java @@ -1,18 +1,30 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Log_V_Ric_Eventi +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVRicEventiRowBean; + +package it.eng.parer.sacerlog.slite.gen.viewbean; + +import java.util.Iterator; + import it.eng.parer.sacerlog.viewEntity.ILogVRicEventi; import it.eng.spagoLite.db.base.table.AbstractBaseTable; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import java.util.Iterator; - /** - * TableBean per la tabella Log_V_Ric_Eventi & C. + * TableBean per la tabella Log_V_Ric_Eventi and C. * */ public class LogVRicEventiTableBean extends AbstractBaseTable { diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableDescriptor.java index 58cf2cf..93ee049 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVRicEventiTableDescriptor.java @@ -1,12 +1,29 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * @author Sloth * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizRowBean.java index 64907f5..799c01f 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizRowBean.java @@ -1,13 +1,31 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; + import it.eng.parer.sacerlog.viewEntity.LogVUsrAbilOrganiz; +import it.eng.parer.sacerlog.viewEntity.LogVUsrAbilOrganizId; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.db.base.JEEBaseRowInterface; import it.eng.spagoLite.db.base.row.BaseRow; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import java.math.BigDecimal; - /** * RowBean per la tabella Usr_V_Abil_Organiz * @@ -152,13 +170,13 @@ public void setDlPathIdOrganizIam(String dl_path_id_organiz_iam) { @Override public void entityToRowBean(Object obj) { LogVUsrAbilOrganiz entity = (LogVUsrAbilOrganiz) obj; - this.setIdUserIam(entity.getIdUserIam()); + this.setIdUserIam(entity.getLogVUsrAbilOrganizId().getIdUserIam()); this.setFlAttivo(entity.getFlAttivo()); this.setIdUsoUserApplic(entity.getIdUsoUserApplic()); this.setIdApplic(entity.getIdApplic()); this.setNmApplic(entity.getNmApplic()); this.setIdDichAbilOrganiz(entity.getIdDichAbilOrganiz()); - this.setIdOrganizIam(entity.getIdOrganizIam()); + this.setIdOrganizIam(entity.getLogVUsrAbilOrganizId().getIdOrganizIam()); this.setIdOrganizApplic(entity.getIdOrganizApplic()); this.setIdTipoOrganiz(entity.getIdTipoOrganiz()); this.setNmTipoOrganiz(entity.getNmTipoOrganiz()); @@ -172,13 +190,14 @@ public void entityToRowBean(Object obj) { @Override public LogVUsrAbilOrganiz rowBeanToEntity() { LogVUsrAbilOrganiz entity = new LogVUsrAbilOrganiz(); - entity.setIdUserIam(this.getIdUserIam()); + entity.setLogVUsrAbilOrganizId(new LogVUsrAbilOrganizId()); + entity.getLogVUsrAbilOrganizId().setIdUserIam(this.getIdUserIam()); entity.setFlAttivo(this.getFlAttivo()); entity.setIdUsoUserApplic(this.getIdUsoUserApplic()); entity.setIdApplic(this.getIdApplic()); entity.setNmApplic(this.getNmApplic()); entity.setIdDichAbilOrganiz(this.getIdDichAbilOrganiz()); - entity.setIdOrganizIam(this.getIdOrganizIam()); + entity.getLogVUsrAbilOrganizId().setIdOrganizIam(this.getIdOrganizIam()); entity.setIdOrganizApplic(this.getIdOrganizApplic()); entity.setIdTipoOrganiz(this.getIdTipoOrganiz()); entity.setNmTipoOrganiz(this.getNmTipoOrganiz()); diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableBean.java index 1e37a7a..4da1994 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableBean.java @@ -1,15 +1,27 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Usr_V_Abil_Organiz +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVUsrAbilOrganizRowBean; -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.util.Iterator; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * TableBean per la tabella Log_V_Usr_Abil_Organiz * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableDescriptor.java index 12d399b..cbc52b5 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVUsrAbilOrganizTableDescriptor.java @@ -1,12 +1,29 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * @author Sloth * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxRowBean.java index a97736e..42904f3 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxRowBean.java @@ -1,13 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import it.eng.parer.sacerlog.viewEntity.LogVVisEventoPrincTx; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.db.base.JEEBaseRowInterface; import it.eng.spagoLite.db.base.row.BaseRow; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import it.eng.parer.sacerlog.viewEntity.LogVVisEventoPrincTx; - -import java.math.BigDecimal; -import java.sql.Timestamp; /** * RowBean per la tabella Log_V_Vis_Evento_Princ_Tx diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableBean.java index abb9d5f..f460500 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableBean.java @@ -1,15 +1,27 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Log_V_Vis_Evento_Princ_Tx +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVVisEventoPrincTxRowBean; -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.util.Iterator; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * TableBean per la tabella Log_V_Vis_Evento_Princ_Tx * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableDescriptor.java index cb17138..9575c8d 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisEventoPrincTxTableDescriptor.java @@ -1,12 +1,28 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; -import javax.annotation.Generated; + +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; /** * @author Sloth diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoRowBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoRowBean.java index 7493d1c..2895c35 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoRowBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoRowBean.java @@ -1,13 +1,30 @@ +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + package it.eng.parer.sacerlog.slite.gen.viewbean; +import java.math.BigDecimal; +import java.sql.Timestamp; + +import it.eng.parer.sacerlog.viewEntity.LogVVisOggetto; import it.eng.spagoLite.db.base.BaseRowInterface; import it.eng.spagoLite.db.base.JEEBaseRowInterface; import it.eng.spagoLite.db.base.row.BaseRow; import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; -import it.eng.parer.sacerlog.viewEntity.LogVVisOggetto; - -import java.math.BigDecimal; -import java.sql.Timestamp; /** * RowBean per la tabella Log_V_Vis_Oggetto diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableBean.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableBean.java index d26e122..045e7bf 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableBean.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableBean.java @@ -1,15 +1,27 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; - -/** - * ViewBean per la vista Log_V_Vis_Oggetto +/* + * Engineering Ingegneria Informatica S.p.A. * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . */ -import it.eng.parer.sacerlog.slite.gen.viewbean.LogVVisOggettoRowBean; -import it.eng.spagoLite.db.base.table.AbstractBaseTable; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.util.Iterator; +import it.eng.spagoLite.db.base.table.AbstractBaseTable; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * TableBean per la tabella Log_V_Vis_Oggetto * diff --git a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableDescriptor.java b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableDescriptor.java index 7b7f115..893d744 100644 --- a/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableDescriptor.java +++ b/spagolite-sl-slg/src/main/java/it/eng/parer/sacerlog/slite/gen/viewbean/LogVVisOggettoTableDescriptor.java @@ -1,12 +1,29 @@ -package it.eng.parer.sacerlog.slite.gen.viewbean; +/* + * Engineering Ingegneria Informatica S.p.A. + * + * Copyright (C) 2023 Regione Emilia-Romagna + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Affero General Public License for more details. + *

+ * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ -import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; -import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; +package it.eng.parer.sacerlog.slite.gen.viewbean; import java.sql.Types; import java.util.LinkedHashMap; import java.util.Map; +import it.eng.spagoLite.db.oracle.bean.column.ColumnDescriptor; +import it.eng.spagoLite.db.oracle.bean.column.TableDescriptor; + /** * @author Sloth * diff --git a/spagolite-sl-slg/src/main/resources/forms/GestioneLogEventi.xml b/spagolite-sl-slg/src/main/resources/forms/GestioneLogEventi.xml index 89fc517..cff7efe 100644 --- a/spagolite-sl-slg/src/main/resources/forms/GestioneLogEventi.xml +++ b/spagolite-sl-slg/src/main/resources/forms/GestioneLogEventi.xml @@ -56,6 +56,7 @@